From 16e094b5e50e4b61e5d1f6519282a12672fc71a3 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 17 Oct 2024 16:52:53 +0000 Subject: [PATCH 001/509] feat(api): add gpt-4o-audio-preview model for chat completions (#1135) This enables audio inputs and outputs. https://platform.openai.com/docs/guides/audio --- .stats.yml | 2 +- api.md | 4 + src/index.ts | 4 + src/lib/AbstractChatCompletionRunner.ts | 4 +- src/resources/beta/assistants.ts | 10 ++ src/resources/chat/chat.ts | 7 + src/resources/chat/completions.ts | 153 ++++++++++++++++++- src/resources/chat/index.ts | 4 + tests/api-resources/chat/completions.test.ts | 2 + 9 files changed, 183 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 68789976b..984e8a8d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-71e58a77027c67e003fdd1b1ac8ac11557d8bfabc7666d1a827c6b1ca8ab98b5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8729aaa35436531ab453224af10e67f89677db8f350f0346bb3537489edea649.yml diff --git a/api.md b/api.md index 71027acfd..da60f65bd 100644 --- a/api.md +++ b/api.md @@ -33,9 +33,12 @@ Types: - ChatCompletion - ChatCompletionAssistantMessageParam +- ChatCompletionAudio +- ChatCompletionAudioParam - ChatCompletionChunk - ChatCompletionContentPart - ChatCompletionContentPartImage +- ChatCompletionContentPartInputAudio - ChatCompletionContentPartRefusal - ChatCompletionContentPartText - ChatCompletionFunctionCallOption @@ -43,6 +46,7 @@ Types: - ChatCompletionMessage - ChatCompletionMessageParam - ChatCompletionMessageToolCall +- ChatCompletionModality - ChatCompletionNamedToolChoice - ChatCompletionRole - ChatCompletionStreamOptions diff --git a/src/index.ts b/src/index.ts index d3e1d2a78..56108223a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -250,9 +250,12 @@ export namespace OpenAI { export import ChatModel = API.ChatModel; export import ChatCompletion = API.ChatCompletion; export import ChatCompletionAssistantMessageParam = API.ChatCompletionAssistantMessageParam; + export import ChatCompletionAudio = API.ChatCompletionAudio; + export import ChatCompletionAudioParam = API.ChatCompletionAudioParam; export import ChatCompletionChunk = API.ChatCompletionChunk; export import ChatCompletionContentPart = API.ChatCompletionContentPart; export import ChatCompletionContentPartImage = API.ChatCompletionContentPartImage; + export import ChatCompletionContentPartInputAudio = API.ChatCompletionContentPartInputAudio; export import ChatCompletionContentPartRefusal = API.ChatCompletionContentPartRefusal; export import ChatCompletionContentPartText = API.ChatCompletionContentPartText; export import ChatCompletionFunctionCallOption = API.ChatCompletionFunctionCallOption; @@ -260,6 +263,7 @@ export namespace OpenAI { export import ChatCompletionMessage = API.ChatCompletionMessage; export import ChatCompletionMessageParam = API.ChatCompletionMessageParam; export import ChatCompletionMessageToolCall = API.ChatCompletionMessageToolCall; + export import ChatCompletionModality = API.ChatCompletionModality; export import ChatCompletionNamedToolChoice = API.ChatCompletionNamedToolChoice; export import ChatCompletionRole = API.ChatCompletionRole; export import ChatCompletionStreamOptions = API.ChatCompletionStreamOptions; diff --git a/src/lib/AbstractChatCompletionRunner.ts b/src/lib/AbstractChatCompletionRunner.ts index 39ee4e993..e943a4e4f 100644 --- a/src/lib/AbstractChatCompletionRunner.ts +++ b/src/lib/AbstractChatCompletionRunner.ts @@ -105,7 +105,9 @@ export class AbstractChatCompletionRunner< const message = this.messages[i]; if (isAssistantMessage(message)) { const { function_call, ...rest } = message; - const ret: ChatCompletionMessage = { + + // TODO: support audio here + const ret: Omit = { ...rest, content: (message as ChatCompletionMessage).content ?? null, refusal: (message as ChatCompletionMessage).refusal ?? null, diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 410d520b0..aa7362297 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -298,6 +298,11 @@ export namespace AssistantStreamEvent { data: ThreadsAPI.Thread; event: 'thread.created'; + + /** + * Whether to enable input audio transcription. + */ + enabled?: boolean; } /** @@ -1084,6 +1089,11 @@ export interface ThreadStreamEvent { data: ThreadsAPI.Thread; event: 'thread.created'; + + /** + * Whether to enable input audio transcription. + */ + enabled?: boolean; } export interface AssistantCreateParams { diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 5bc7de955..43ef5662c 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -16,7 +16,10 @@ export type ChatModel = | 'gpt-4o' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-05-13' + | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-audio-preview' + | 'gpt-4o-audio-preview-2024-10-01' | 'chatgpt-4o-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' @@ -45,9 +48,12 @@ export namespace Chat { export import Completions = CompletionsAPI.Completions; export import ChatCompletion = CompletionsAPI.ChatCompletion; export import ChatCompletionAssistantMessageParam = CompletionsAPI.ChatCompletionAssistantMessageParam; + export import ChatCompletionAudio = CompletionsAPI.ChatCompletionAudio; + export import ChatCompletionAudioParam = CompletionsAPI.ChatCompletionAudioParam; export import ChatCompletionChunk = CompletionsAPI.ChatCompletionChunk; export import ChatCompletionContentPart = CompletionsAPI.ChatCompletionContentPart; export import ChatCompletionContentPartImage = CompletionsAPI.ChatCompletionContentPartImage; + export import ChatCompletionContentPartInputAudio = CompletionsAPI.ChatCompletionContentPartInputAudio; export import ChatCompletionContentPartRefusal = CompletionsAPI.ChatCompletionContentPartRefusal; export import ChatCompletionContentPartText = CompletionsAPI.ChatCompletionContentPartText; export import ChatCompletionFunctionCallOption = CompletionsAPI.ChatCompletionFunctionCallOption; @@ -55,6 +61,7 @@ export namespace Chat { export import ChatCompletionMessage = CompletionsAPI.ChatCompletionMessage; export import ChatCompletionMessageParam = CompletionsAPI.ChatCompletionMessageParam; export import ChatCompletionMessageToolCall = CompletionsAPI.ChatCompletionMessageToolCall; + export import ChatCompletionModality = CompletionsAPI.ChatCompletionModality; export import ChatCompletionNamedToolChoice = CompletionsAPI.ChatCompletionNamedToolChoice; export import ChatCompletionRole = CompletionsAPI.ChatCompletionRole; export import ChatCompletionStreamOptions = CompletionsAPI.ChatCompletionStreamOptions; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 27aebdc4c..97174ec1b 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -11,7 +11,10 @@ import { Stream } from '../../streaming'; export class Completions extends APIResource { /** - * Creates a model response for the given chat conversation. + * Creates a model response for the given chat conversation. Learn more in the + * [text generation](https://platform.openai.com/docs/guides/text-generation), + * [vision](https://platform.openai.com/docs/guides/vision), and + * [audio](https://platform.openai.com/docs/guides/audio) guides. */ create( body: ChatCompletionCreateParamsNonStreaming, @@ -138,6 +141,12 @@ export interface ChatCompletionAssistantMessageParam { */ role: 'assistant'; + /** + * Data about a previous audio response from the model. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ + audio?: ChatCompletionAssistantMessageParam.Audio | null; + /** * The contents of the assistant message. Required unless `tool_calls` or * `function_call` is specified. @@ -168,6 +177,17 @@ export interface ChatCompletionAssistantMessageParam { } export namespace ChatCompletionAssistantMessageParam { + /** + * Data about a previous audio response from the model. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ + export interface Audio { + /** + * Unique identifier for a previous audio response from the model. + */ + id: string; + } + /** * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of * a function that should be called, as generated by the model. @@ -188,6 +208,54 @@ export namespace ChatCompletionAssistantMessageParam { } } +/** + * If the audio output modality is requested, this object contains data about the + * audio response from the model. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ +export interface ChatCompletionAudio { + /** + * Unique identifier for this audio response. + */ + id: string; + + /** + * Base64 encoded audio bytes generated by the model, in the format specified in + * the request. + */ + data: string; + + /** + * The Unix timestamp (in seconds) for when this audio response will no longer be + * accessible on the server for use in multi-turn conversations. + */ + expires_at: number; + + /** + * Transcript of the audio generated by the model. + */ + transcript: string; +} + +/** + * Parameters for audio output. Required when audio output is requested with + * `modalities: ["audio"]`. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ +export interface ChatCompletionAudioParam { + /** + * Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, + * or `pcm16`. + */ + format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; + + /** + * Specifies the voice type. Supported voices are `alloy`, `echo`, `fable`, `onyx`, + * `nova`, and `shimmer`. + */ + voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; +} + /** * Represents a streamed chunk of a chat completion response returned by model, * based on the provided input. @@ -371,8 +439,18 @@ export namespace ChatCompletionChunk { } } -export type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage; +/** + * Learn about + * [text inputs](https://platform.openai.com/docs/guides/text-generation). + */ +export type ChatCompletionContentPart = + | ChatCompletionContentPartText + | ChatCompletionContentPartImage + | ChatCompletionContentPartInputAudio; +/** + * Learn about [image inputs](https://platform.openai.com/docs/guides/vision). + */ export interface ChatCompletionContentPartImage { image_url: ChatCompletionContentPartImage.ImageURL; @@ -397,6 +475,32 @@ export namespace ChatCompletionContentPartImage { } } +/** + * Learn about [audio inputs](https://platform.openai.com/docs/guides/audio). + */ +export interface ChatCompletionContentPartInputAudio { + input_audio: ChatCompletionContentPartInputAudio.InputAudio; + + /** + * The type of the content part. Always `input_audio`. + */ + type: 'input_audio'; +} + +export namespace ChatCompletionContentPartInputAudio { + export interface InputAudio { + /** + * Base64 encoded audio data. + */ + data: string; + + /** + * The format of the encoded audio data. Currently supports "wav" and "mp3". + */ + format: 'wav' | 'mp3'; + } +} + export interface ChatCompletionContentPartRefusal { /** * The refusal message generated by the model. @@ -409,6 +513,10 @@ export interface ChatCompletionContentPartRefusal { type: 'refusal'; } +/** + * Learn about + * [text inputs](https://platform.openai.com/docs/guides/text-generation). + */ export interface ChatCompletionContentPartText { /** * The text content. @@ -471,6 +579,13 @@ export interface ChatCompletionMessage { */ role: 'assistant'; + /** + * If the audio output modality is requested, this object contains data about the + * audio response from the model. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ + audio?: ChatCompletionAudio | null; + /** * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of * a function that should be called, as generated by the model. @@ -548,6 +663,8 @@ export namespace ChatCompletionMessageToolCall { } } +export type ChatCompletionModality = 'text' | 'audio'; + /** * Specifies a tool the model should use. Use to force the model to call a specific * function. @@ -743,6 +860,13 @@ export interface ChatCompletionCreateParamsBase { */ model: (string & {}) | ChatAPI.ChatModel; + /** + * Parameters for audio output. Required when audio output is requested with + * `modalities: ["audio"]`. + * [Learn more](https://platform.openai.com/docs/guides/audio). + */ + audio?: ChatCompletionAudioParam | null; + /** * Number between -2.0 and 2.0. Positive values penalize new tokens based on their * existing frequency in the text so far, decreasing the model's likelihood to @@ -812,10 +936,24 @@ export interface ChatCompletionCreateParamsBase { /** * Developer-defined tags and values used for filtering completions in the - * [dashboard](https://platform.openai.com/completions). + * [dashboard](https://platform.openai.com/chat-completions). */ metadata?: Record | null; + /** + * Output types that you would like the model to generate for this request. Most + * models are capable of generating text, which is the default: + * + * `["text"]` + * + * The `gpt-4o-audio-preview` model can also be used to + * [generate audio](https://platform.openai.com/docs/guides/audio). To request that + * this model generate both text and audio responses, you can use: + * + * `["text", "audio"]` + */ + modalities?: Array | null; + /** * How many chat completion choices to generate for each input message. Note that * you will be charged based on the number of generated tokens across all of the @@ -900,8 +1038,9 @@ export interface ChatCompletionCreateParamsBase { stop?: string | null | Array; /** - * Whether or not to store the output of this completion request for traffic - * logging in the [dashboard](https://platform.openai.com/completions). + * Whether or not to store the output of this chat completion request for use in + * our [model distillation](https://platform.openai.com/docs/guides/distillation) + * or [evals](https://platform.openai.com/docs/guides/evals) products. */ store?: boolean | null; @@ -1049,9 +1188,12 @@ export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreamin export namespace Completions { export import ChatCompletion = ChatCompletionsAPI.ChatCompletion; export import ChatCompletionAssistantMessageParam = ChatCompletionsAPI.ChatCompletionAssistantMessageParam; + export import ChatCompletionAudio = ChatCompletionsAPI.ChatCompletionAudio; + export import ChatCompletionAudioParam = ChatCompletionsAPI.ChatCompletionAudioParam; export import ChatCompletionChunk = ChatCompletionsAPI.ChatCompletionChunk; export import ChatCompletionContentPart = ChatCompletionsAPI.ChatCompletionContentPart; export import ChatCompletionContentPartImage = ChatCompletionsAPI.ChatCompletionContentPartImage; + export import ChatCompletionContentPartInputAudio = ChatCompletionsAPI.ChatCompletionContentPartInputAudio; export import ChatCompletionContentPartRefusal = ChatCompletionsAPI.ChatCompletionContentPartRefusal; export import ChatCompletionContentPartText = ChatCompletionsAPI.ChatCompletionContentPartText; export import ChatCompletionFunctionCallOption = ChatCompletionsAPI.ChatCompletionFunctionCallOption; @@ -1059,6 +1201,7 @@ export namespace Completions { export import ChatCompletionMessage = ChatCompletionsAPI.ChatCompletionMessage; export import ChatCompletionMessageParam = ChatCompletionsAPI.ChatCompletionMessageParam; export import ChatCompletionMessageToolCall = ChatCompletionsAPI.ChatCompletionMessageToolCall; + export import ChatCompletionModality = ChatCompletionsAPI.ChatCompletionModality; export import ChatCompletionNamedToolChoice = ChatCompletionsAPI.ChatCompletionNamedToolChoice; export import ChatCompletionRole = ChatCompletionsAPI.ChatCompletionRole; export import ChatCompletionStreamOptions = ChatCompletionsAPI.ChatCompletionStreamOptions; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index 748770948..22803e819 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -3,9 +3,12 @@ export { ChatCompletion, ChatCompletionAssistantMessageParam, + ChatCompletionAudio, + ChatCompletionAudioParam, ChatCompletionChunk, ChatCompletionContentPart, ChatCompletionContentPartImage, + ChatCompletionContentPartInputAudio, ChatCompletionContentPartRefusal, ChatCompletionContentPartText, ChatCompletionFunctionCallOption, @@ -13,6 +16,7 @@ export { ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, + ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionRole, ChatCompletionStreamOptions, diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 4f015b47e..77d4a251c 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -27,6 +27,7 @@ describe('resource completions', () => { const response = await client.chat.completions.create({ messages: [{ content: 'string', role: 'system', name: 'name' }], model: 'gpt-4o', + audio: { format: 'wav', voice: 'alloy' }, frequency_penalty: -2, function_call: 'none', functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], @@ -35,6 +36,7 @@ describe('resource completions', () => { max_completion_tokens: 0, max_tokens: 0, metadata: { foo: 'string' }, + modalities: ['text', 'audio'], n: 1, parallel_tool_calls: true, presence_penalty: -2, From 6ae19ce08eea4f6b3c4865861a6cce09d403cac8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:19:37 +0000 Subject: [PATCH 002/509] release: 4.68.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8c54ecee..91b39801d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.67.3" + ".": "4.68.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 710d09ca9..2fcd3be4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.68.0 (2024-10-17) + +Full Changelog: [v4.67.3...v4.68.0](https://github.com/openai/openai-node/compare/v4.67.3...v4.68.0) + +### Features + +* **api:** add gpt-4o-audio-preview model for chat completions ([#1135](https://github.com/openai/openai-node/issues/1135)) ([17a623f](https://github.com/openai/openai-node/commit/17a623f70050bca4538ad2939055cd9d9b165f89)) + ## 4.67.3 (2024-10-08) Full Changelog: [v4.67.2...v4.67.3](https://github.com/openai/openai-node/compare/v4.67.2...v4.67.3) diff --git a/README.md b/README.md index 407933634..bbfc821d2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.67.3/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.68.0/mod.ts'; ``` diff --git a/package.json b/package.json index e20c1b9c1..807c79098 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.67.3", + "version": "4.68.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index f59404dbc..5e813aeb2 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.67.3/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.68.0/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index 174c31111..12aaa52bb 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.67.3'; // x-release-please-version +export const VERSION = '4.68.0'; // x-release-please-version From 02fd7699130e2ff442aca45622b064bc4eda6fab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:12:40 +0000 Subject: [PATCH 003/509] fix(client): respect x-stainless-retry-count default headers (#1138) --- src/core.ts | 10 +++++++--- tests/index.test.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/src/core.ts b/src/core.ts index d78e9e926..9d90178ab 100644 --- a/src/core.ts +++ b/src/core.ts @@ -386,9 +386,13 @@ export abstract class APIClient { delete reqHeaders['content-type']; } - // Don't set the retry count header if it was already set or removed by the caller. We check `headers`, - // which can contain nulls, instead of `reqHeaders` to account for the removal case. - if (getHeader(headers, 'x-stainless-retry-count') === undefined) { + // Don't set the retry count header if it was already set or removed through default headers or by the + // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to + // account for the removal case. + if ( + getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && + getHeader(headers, 'x-stainless-retry-count') === undefined + ) { reqHeaders['x-stainless-retry-count'] = String(retryCount); } diff --git a/tests/index.test.ts b/tests/index.test.ts index b55ec5f67..f39571121 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -295,6 +295,39 @@ describe('retries', () => { expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count'); }); + test('omit retry count header by default', async () => { + let count = 0; + let capturedRequest: RequestInit | undefined; + const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + count++; + if (count <= 2) { + return new Response(undefined, { + status: 429, + headers: { + 'Retry-After': '0.1', + }, + }); + } + capturedRequest = init; + return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } }); + }; + const client = new OpenAI({ + apiKey: 'My API Key', + fetch: testFetch, + maxRetries: 4, + defaultHeaders: { 'X-Stainless-Retry-Count': null }, + }); + + expect( + await client.request({ + path: '/foo', + method: 'get', + }), + ).toEqual({ a: 1 }); + + expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count'); + }); + test('overwrite retry count header', async () => { let count = 0; let capturedRequest: RequestInit | undefined; From d08bf1a8fa779e6a9349d92ddf65530dd84e686d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:13:06 +0000 Subject: [PATCH 004/509] release: 4.68.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 91b39801d..64f1d21d4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.68.0" + ".": "4.68.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fcd3be4d..9a2102f46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.68.1 (2024-10-18) + +Full Changelog: [v4.68.0...v4.68.1](https://github.com/openai/openai-node/compare/v4.68.0...v4.68.1) + +### Bug Fixes + +* **client:** respect x-stainless-retry-count default headers ([#1138](https://github.com/openai/openai-node/issues/1138)) ([266717b](https://github.com/openai/openai-node/commit/266717b3301828c7df735064a380a055576183bc)) + ## 4.68.0 (2024-10-17) Full Changelog: [v4.67.3...v4.68.0](https://github.com/openai/openai-node/compare/v4.67.3...v4.68.0) diff --git a/README.md b/README.md index bbfc821d2..d4b838897 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.68.0/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.68.1/mod.ts'; ``` diff --git a/package.json b/package.json index 807c79098..538163b0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.68.0", + "version": "4.68.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index 5e813aeb2..b7459b609 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.68.0/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.68.1/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index 12aaa52bb..dcff7c8bd 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.68.0'; // x-release-please-version +export const VERSION = '4.68.1'; // x-release-please-version From 9b27b22f83756c91c9277ce8334da2120b6afe90 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:23:54 +0000 Subject: [PATCH 005/509] chore(internal): update spec version (#1141) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 984e8a8d5..e1a430e50 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8729aaa35436531ab453224af10e67f89677db8f350f0346bb3537489edea649.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-f9320ebf347140052c7f8b0bc5c7db24f5e367c368c8cb34c3606af4e2b6591b.yml From ab7770115e88ff1274cf8863afddd6b58f8f158f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 18:24:22 +0000 Subject: [PATCH 006/509] release: 4.68.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64f1d21d4..7de9a93f1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.68.1" + ".": "4.68.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a2102f46..93cf66d4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.68.2 (2024-10-22) + +Full Changelog: [v4.68.1...v4.68.2](https://github.com/openai/openai-node/compare/v4.68.1...v4.68.2) + +### Chores + +* **internal:** update spec version ([#1141](https://github.com/openai/openai-node/issues/1141)) ([2ccb3e3](https://github.com/openai/openai-node/commit/2ccb3e357aa2f3eb0fa32c619d8336c3b94cc882)) + ## 4.68.1 (2024-10-18) Full Changelog: [v4.68.0...v4.68.1](https://github.com/openai/openai-node/compare/v4.68.0...v4.68.1) diff --git a/README.md b/README.md index d4b838897..5011b82a1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.68.1/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.68.2/mod.ts'; ``` diff --git a/package.json b/package.json index 538163b0f..0eaebee91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.68.1", + "version": "4.68.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index b7459b609..c2276e5ea 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.68.1/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.68.2/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index dcff7c8bd..bb7f3f7bd 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.68.1'; // x-release-please-version +export const VERSION = '4.68.2'; // x-release-please-version From 58a645d572572a3de2688a1fd8511f3edab97866 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:11:28 +0000 Subject: [PATCH 007/509] chore(internal): bumps eslint and related dependencies (#1143) --- yarn.lock | 180 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 92 insertions(+), 88 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5a01e39e3..91b22b941 100644 --- a/yarn.lock +++ b/yarn.lock @@ -322,9 +322,9 @@ eslint-visitor-keys "^3.3.0" "@eslint-community/regexpp@^4.5.1": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.9.0.tgz#7ccb5f58703fa61ffdcbf39e2c604a109e781162" - integrity sha512-zJmuCWj2VLBt4c25CfBIbMZLGLyhkvs7LznyVX5HfpzeocThgIj5XQK4L+g3U36mMcx8bPMhGyPpwCATamC4jQ== + version "4.11.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" + integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== "@eslint-community/regexpp@^4.6.1": version "4.6.2" @@ -857,9 +857,9 @@ pretty-format "^29.0.0" "@types/json-schema@^7.0.12": - version "7.0.13" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" - integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node-fetch@^2.6.4": version "2.6.4" @@ -882,9 +882,9 @@ integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== "@types/semver@^7.5.0": - version "7.5.3" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.3.tgz#9a726e116beb26c24f1ccd6850201e1246122e04" - integrity sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw== + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/stack-utils@^2.0.0": version "2.0.3" @@ -904,15 +904,15 @@ "@types/yargs-parser" "*" "@typescript-eslint/eslint-plugin@^6.7.0": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.7.3.tgz#d98046e9f7102d49a93d944d413c6055c47fafd7" - integrity sha512-vntq452UHNltxsaaN+L9WyuMch8bMd9CqJ3zhzTPXXidwbf5mqqKCVXEuvRZUqLJSTLeWE65lQwyXsRGnXkCTA== + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" + integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/type-utils" "6.7.3" - "@typescript-eslint/utils" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/type-utils" "6.21.0" + "@typescript-eslint/utils" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.2.4" @@ -921,71 +921,72 @@ ts-api-utils "^1.0.1" "@typescript-eslint/parser@^6.7.0": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.7.3.tgz#aaf40092a32877439e5957e18f2d6a91c82cc2fd" - integrity sha512-TlutE+iep2o7R8Lf+yoer3zU6/0EAUc8QIBB3GYBc1KGz4c4TRm83xwXUZVPlZ6YCLss4r77jbu6j3sendJoiQ== - dependencies: - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" + integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== + dependencies: + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.7.3.tgz#07e5709c9bdae3eaf216947433ef97b3b8b7d755" - integrity sha512-wOlo0QnEou9cHO2TdkJmzF7DFGvAKEnB82PuPNHpT8ZKKaZu6Bm63ugOTn9fXNJtvuDPanBc78lGUGGytJoVzQ== +"@typescript-eslint/scope-manager@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" -"@typescript-eslint/type-utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.7.3.tgz#c2c165c135dda68a5e70074ade183f5ad68f3400" - integrity sha512-Fc68K0aTDrKIBvLnKTZ5Pf3MXK495YErrbHb1R6aTpfK5OdSFj0rVN7ib6Tx6ePrZ2gsjLqr0s98NG7l96KSQw== +"@typescript-eslint/type-utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" + integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: - "@typescript-eslint/typescript-estree" "6.7.3" - "@typescript-eslint/utils" "6.7.3" + "@typescript-eslint/typescript-estree" "6.21.0" + "@typescript-eslint/utils" "6.21.0" debug "^4.3.4" ts-api-utils "^1.0.1" -"@typescript-eslint/types@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.7.3.tgz#0402b5628a63f24f2dc9d4a678e9a92cc50ea3e9" - integrity sha512-4g+de6roB2NFcfkZb439tigpAMnvEIg3rIjWQ+EM7IBaYt/CdJt6em9BJ4h4UpdgaBWdmx2iWsafHTrqmgIPNw== +"@typescript-eslint/types@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== -"@typescript-eslint/typescript-estree@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.7.3.tgz#ec5bb7ab4d3566818abaf0e4a8fa1958561b7279" - integrity sha512-YLQ3tJoS4VxLFYHTw21oe1/vIZPRqAO91z6Uv0Ss2BKm/Ag7/RVQBcXTGcXhgJMdA4U+HrKuY5gWlJlvoaKZ5g== +"@typescript-eslint/typescript-estree@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/visitor-keys" "6.7.3" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/visitor-keys" "6.21.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" + minimatch "9.0.3" semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.7.3.tgz#96c655816c373135b07282d67407cb577f62e143" - integrity sha512-vzLkVder21GpWRrmSR9JxGZ5+ibIUSudXlW52qeKpzUEQhRSmyZiVDDj3crAth7+5tmN1ulvgKaCU2f/bPRCzg== +"@typescript-eslint/utils@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.12" "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.7.3" - "@typescript-eslint/types" "6.7.3" - "@typescript-eslint/typescript-estree" "6.7.3" + "@typescript-eslint/scope-manager" "6.21.0" + "@typescript-eslint/types" "6.21.0" + "@typescript-eslint/typescript-estree" "6.21.0" semver "^7.5.4" -"@typescript-eslint/visitor-keys@6.7.3": - version "6.7.3" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.7.3.tgz#83809631ca12909bd2083558d2f93f5747deebb2" - integrity sha512-HEVXkU9IB+nk9o63CeICMHxFWbHWr3E1mpilIQBe9+7L/lH97rleFLVtYsfnWB+JVMaiFnEaxvknvmIzX+CqVg== +"@typescript-eslint/visitor-keys@6.21.0": + version "6.21.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: - "@typescript-eslint/types" "6.7.3" + "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" abort-controller@^3.0.0: @@ -1392,13 +1393,20 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" +debug@^4.3.4: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + dedent@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" @@ -1546,12 +1554,7 @@ eslint-scope@^7.2.2: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1: - version "3.4.2" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz#8c2095440eca8c933bedcadf16fefa44dbe9ba5f" - integrity sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw== - -eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== @@ -1716,18 +1719,7 @@ fast-glob@^3.2.12: merge2 "^1.3.0" micromatch "^4.0.4" -fast-glob@^3.2.9: - version "3.3.1" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" - integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.3.0: +fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1749,9 +1741,9 @@ fast-levenshtein@^2.0.6: integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" - integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" @@ -1974,9 +1966,9 @@ iconv-lite@^0.6.3: safer-buffer ">= 2.1.2 < 3.0.0" ignore@^5.2.0, ignore@^5.2.4: - version "5.2.4" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" - integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + version "5.3.2" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== import-fresh@^3.2.1: version "3.3.0" @@ -2681,6 +2673,13 @@ mimic-fn@^4.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -2710,7 +2709,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.0.0: +ms@^2.0.0, ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -3075,13 +3074,18 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.3, semver@^7.5.4: +semver@^7.5.3: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" +semver@^7.5.4: + version "7.6.3" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -3278,9 +3282,9 @@ tr46@~0.0.3: integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= ts-api-utils@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" - integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== ts-jest@^29.1.0: version "29.1.1" From c239b5cf7723e825250a26cabefeb27aa398be23 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 05:07:12 +0000 Subject: [PATCH 008/509] release: 4.68.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7de9a93f1..eafafb2cf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.68.2" + ".": "4.68.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 93cf66d4e..604e5183c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.68.3 (2024-10-23) + +Full Changelog: [v4.68.2...v4.68.3](https://github.com/openai/openai-node/compare/v4.68.2...v4.68.3) + +### Chores + +* **internal:** bumps eslint and related dependencies ([#1143](https://github.com/openai/openai-node/issues/1143)) ([2643f42](https://github.com/openai/openai-node/commit/2643f42a36208c36daf23470ffcd227a891284eb)) + ## 4.68.2 (2024-10-22) Full Changelog: [v4.68.1...v4.68.2](https://github.com/openai/openai-node/compare/v4.68.1...v4.68.2) diff --git a/README.md b/README.md index 5011b82a1..16d0450bb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.68.2/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.68.3/mod.ts'; ``` diff --git a/package.json b/package.json index 0eaebee91..4fc07b525 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.68.2", + "version": "4.68.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index c2276e5ea..fa0fd26ea 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.68.2/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.68.3/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index bb7f3f7bd..2657a62ac 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.68.2'; // x-release-please-version +export const VERSION = '4.68.3'; // x-release-please-version From 748d77154f570b705c198ccd802a7dc0863690d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:56:39 +0000 Subject: [PATCH 009/509] chore(internal): update spec version (#1146) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e1a430e50..0b0872556 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-f9320ebf347140052c7f8b0bc5c7db24f5e367c368c8cb34c3606af4e2b6591b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b60d5559d5150ecd3b49136064e5e251d832899770ff385b711378389afba370.yml From 813cb4413d7b03bddf6885df7fd4c5928e2ec49f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:57:05 +0000 Subject: [PATCH 010/509] release: 4.68.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index eafafb2cf..b32797c27 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.68.3" + ".": "4.68.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 604e5183c..130b287c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.68.4 (2024-10-23) + +Full Changelog: [v4.68.3...v4.68.4](https://github.com/openai/openai-node/compare/v4.68.3...v4.68.4) + +### Chores + +* **internal:** update spec version ([#1146](https://github.com/openai/openai-node/issues/1146)) ([0165a8d](https://github.com/openai/openai-node/commit/0165a8d79340ede49557e05fd00d6fff9d69d930)) + ## 4.68.3 (2024-10-23) Full Changelog: [v4.68.2...v4.68.3](https://github.com/openai/openai-node/compare/v4.68.2...v4.68.3) diff --git a/README.md b/README.md index 16d0450bb..3bf20a026 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.68.3/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.68.4/mod.ts'; ``` diff --git a/package.json b/package.json index 4fc07b525..ce87796d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.68.3", + "version": "4.68.4", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index fa0fd26ea..6a67bcdde 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.68.3/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.68.4/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index 2657a62ac..5c2c17eaf 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.68.3'; // x-release-please-version +export const VERSION = '4.68.4'; // x-release-please-version From d4966566cb2d804b9892986fe4871eb051a416f0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 17:46:33 +0000 Subject: [PATCH 011/509] docs(readme): minor typo fixes (#1154) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bf20a026..9aabd058e 100644 --- a/README.md +++ b/README.md @@ -444,7 +444,7 @@ Note that requests which time out will be [retried twice by default](#retries). ## Auto-pagination List methods in the OpenAI API are paginated. -You can use `for await … of` syntax to iterate through items across all pages: +You can use the `for await … of` syntax to iterate through items across all pages: ```ts async function fetchAllFineTuningJobs(params) { @@ -457,7 +457,7 @@ async function fetchAllFineTuningJobs(params) { } ``` -Alternatively, you can make request a single page at a time: +Alternatively, you can request a single page at a time: ```ts let page = await client.fineTuning.jobs.list({ limit: 20 }); From 8cafc09f3f4795d9a904f63b067d4f05292dab74 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Oct 2024 20:33:10 +0000 Subject: [PATCH 012/509] fix(internal): support pnpm git installs (#1156) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce87796d1..9f9b3ee86 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { From b8e5d396b1524aaeef31c408d79fb30314e50577 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:11:29 +0000 Subject: [PATCH 013/509] feat(api): add new, expressive voices for Realtime and Audio in Chat Completions (#1157) https://platform.openai.com/docs/changelog --- .stats.yml | 2 +- src/resources/chat/completions.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0b0872556..39413df44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b60d5559d5150ecd3b49136064e5e251d832899770ff385b711378389afba370.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7b0a5d715d94f75ac7795bd4d2175a0e3243af9b935a86c273f371e45583140f.yml diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 97174ec1b..d439e9a25 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -250,10 +250,10 @@ export interface ChatCompletionAudioParam { format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** - * Specifies the voice type. Supported voices are `alloy`, `echo`, `fable`, `onyx`, - * `nova`, and `shimmer`. + * The voice the model uses to respond. Supported voices are `alloy`, `ash`, + * `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. */ - voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; + voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; } /** @@ -308,7 +308,7 @@ export interface ChatCompletionChunk { * contains a null value except for the last chunk which contains the token usage * statistics for the entire request. */ - usage?: CompletionsAPI.CompletionUsage; + usage?: CompletionsAPI.CompletionUsage | null; } export namespace ChatCompletionChunk { From 622c80aaa17c486cbd16cf620b3bee6b73650ba4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:11:59 +0000 Subject: [PATCH 014/509] release: 4.69.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ README.md | 2 +- package.json | 2 +- scripts/build-deno | 2 +- src/version.ts | 2 +- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b32797c27..65aac9575 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.68.4" + ".": "4.69.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 130b287c2..b3b52aaa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.69.0 (2024-10-30) + +Full Changelog: [v4.68.4...v4.69.0](https://github.com/openai/openai-node/compare/v4.68.4...v4.69.0) + +### Features + +* **api:** add new, expressive voices for Realtime and Audio in Chat Completions ([#1157](https://github.com/openai/openai-node/issues/1157)) ([12e501c](https://github.com/openai/openai-node/commit/12e501c8a215a2af29b9b8fceedc5935b6f2feef)) + + +### Bug Fixes + +* **internal:** support pnpm git installs ([#1156](https://github.com/openai/openai-node/issues/1156)) ([b744c5b](https://github.com/openai/openai-node/commit/b744c5b609533e9a6694d6cae0425fe9cd37e26c)) + + +### Documentation + +* **readme:** minor typo fixes ([#1154](https://github.com/openai/openai-node/issues/1154)) ([c6c9f9a](https://github.com/openai/openai-node/commit/c6c9f9aaf75f643016ad73574a7e24a228b5c60f)) + ## 4.68.4 (2024-10-23) Full Changelog: [v4.68.3...v4.68.4](https://github.com/openai/openai-node/compare/v4.68.3...v4.68.4) diff --git a/README.md b/README.md index 9aabd058e..776ea4049 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ You can import in Deno via: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.68.4/mod.ts'; +import OpenAI from 'https://deno.land/x/openai@v4.69.0/mod.ts'; ``` diff --git a/package.json b/package.json index 9f9b3ee86..9e32feabb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.68.4", + "version": "4.69.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/build-deno b/scripts/build-deno index 6a67bcdde..be17942df 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -16,7 +16,7 @@ This is a build produced from https://github.com/openai/openai-node – please g Usage: \`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.68.4/mod.ts"; +import OpenAI from "https://deno.land/x/openai@v4.69.0/mod.ts"; const client = new OpenAI(); \`\`\` diff --git a/src/version.ts b/src/version.ts index 5c2c17eaf..be250f2d6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.68.4'; // x-release-please-version +export const VERSION = '4.69.0'; // x-release-please-version From 6421d69314e89cde4a85d2a70f1dae4cf570d0f7 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 1 Nov 2024 04:32:16 +0000 Subject: [PATCH 015/509] refactor: use type imports for type-only imports (#1159) --- src/index.ts | 377 ++++++++++++------ src/lib/AssistantStream.ts | 3 +- src/resources/audio/audio.ts | 70 ++-- src/resources/audio/index.ts | 24 +- src/resources/audio/speech.ts | 6 +- src/resources/audio/transcriptions.ts | 21 +- src/resources/audio/translations.ts | 17 +- src/resources/batches.ts | 18 +- src/resources/beta/assistants.ts | 37 +- src/resources/beta/beta.ts | 158 +++++--- src/resources/beta/index.ts | 82 ++-- src/resources/beta/threads/index.ts | 126 +++--- src/resources/beta/threads/messages.ts | 71 ++-- src/resources/beta/threads/runs/index.ts | 72 ++-- src/resources/beta/threads/runs/runs.ts | 113 ++++-- src/resources/beta/threads/runs/steps.ts | 48 ++- src/resources/beta/threads/threads.ts | 198 ++++++--- .../beta/vector-stores/file-batches.ts | 11 +- src/resources/beta/vector-stores/files.ts | 17 +- src/resources/beta/vector-stores/index.ts | 48 +-- .../beta/vector-stores/vector-stores.ts | 76 ++-- src/resources/chat/chat.ts | 114 ++++-- src/resources/chat/completions.ts | 71 ++-- src/resources/chat/index.ts | 66 +-- src/resources/completions.ts | 16 +- src/resources/embeddings.ts | 13 +- src/resources/files.ts | 21 +- src/resources/fine-tuning/fine-tuning.ts | 43 +- src/resources/fine-tuning/index.ts | 16 +- src/resources/fine-tuning/jobs/checkpoints.ts | 13 +- src/resources/fine-tuning/jobs/index.ts | 28 +- src/resources/fine-tuning/jobs/jobs.ts | 47 ++- src/resources/images.ts | 17 +- src/resources/index.ts | 74 ++-- src/resources/models.ts | 9 +- src/resources/moderations.ts | 19 +- src/resources/uploads/index.ts | 4 +- src/resources/uploads/parts.ts | 6 +- src/resources/uploads/uploads.ts | 19 +- tsconfig.json | 2 +- 40 files changed, 1307 insertions(+), 884 deletions(-) diff --git a/src/index.ts b/src/index.ts index 56108223a..c1506997b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,108 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Errors from './error'; -import * as Uploads from './uploads'; import { type Agent, type RequestInit } from './_shims/index'; import * as qs from './internal/qs'; import * as Core from './core'; +import * as Errors from './error'; import * as Pagination from './pagination'; +import { type CursorPageParams, CursorPageResponse, PageResponse } from './pagination'; +import * as Uploads from './uploads'; import * as API from './resources/index'; +import { + Batch, + BatchCreateParams, + BatchError, + BatchListParams, + BatchRequestCounts, + Batches, + BatchesPage, +} from './resources/batches'; +import { + Completion, + CompletionChoice, + CompletionCreateParams, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CompletionUsage, + Completions, +} from './resources/completions'; +import { + CreateEmbeddingResponse, + Embedding, + EmbeddingCreateParams, + EmbeddingModel, + Embeddings, +} from './resources/embeddings'; +import { + FileContent, + FileCreateParams, + FileDeleted, + FileListParams, + FileObject, + FileObjectsPage, + FilePurpose, + Files, +} from './resources/files'; +import { + Image, + ImageCreateVariationParams, + ImageEditParams, + ImageGenerateParams, + ImageModel, + Images, + ImagesResponse, +} from './resources/images'; +import { Model, ModelDeleted, Models, ModelsPage } from './resources/models'; +import { + Moderation, + ModerationCreateParams, + ModerationCreateResponse, + ModerationImageURLInput, + ModerationModel, + ModerationMultiModalInput, + ModerationTextInput, + Moderations, +} from './resources/moderations'; +import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; +import { Beta } from './resources/beta/beta'; +import { Chat, ChatModel } from './resources/chat/chat'; +import { + ChatCompletion, + ChatCompletionAssistantMessageParam, + ChatCompletionAudio, + ChatCompletionAudioParam, + ChatCompletionChunk, + ChatCompletionContentPart, + ChatCompletionContentPartImage, + ChatCompletionContentPartInputAudio, + ChatCompletionContentPartRefusal, + ChatCompletionContentPartText, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + ChatCompletionFunctionCallOption, + ChatCompletionFunctionMessageParam, + ChatCompletionMessage, + ChatCompletionMessageParam, + ChatCompletionMessageToolCall, + ChatCompletionModality, + ChatCompletionNamedToolChoice, + ChatCompletionRole, + ChatCompletionStreamOptions, + ChatCompletionSystemMessageParam, + ChatCompletionTokenLogprob, + ChatCompletionTool, + ChatCompletionToolChoiceOption, + ChatCompletionToolMessageParam, + ChatCompletionUserMessageParam, +} from './resources/chat/completions'; +import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { + Upload, + UploadCompleteParams, + UploadCreateParams, + Uploads as UploadsAPIUploads, +} from './resources/uploads/uploads'; export interface ClientOptions { /** @@ -209,138 +305,167 @@ export class OpenAI extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { - OpenAIError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} = Errors; +export const OpenAIError = Errors.OpenAIError; +export const APIError = Errors.APIError; +export const APIConnectionError = Errors.APIConnectionError; +export const APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; +export const APIUserAbortError = Errors.APIUserAbortError; +export const NotFoundError = Errors.NotFoundError; +export const ConflictError = Errors.ConflictError; +export const RateLimitError = Errors.RateLimitError; +export const BadRequestError = Errors.BadRequestError; +export const AuthenticationError = Errors.AuthenticationError; +export const InternalServerError = Errors.InternalServerError; +export const PermissionDeniedError = Errors.PermissionDeniedError; +export const UnprocessableEntityError = Errors.UnprocessableEntityError; export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; -export namespace OpenAI { - export import RequestOptions = Core.RequestOptions; +OpenAI.Completions = Completions; +OpenAI.Chat = Chat; +OpenAI.Embeddings = Embeddings; +OpenAI.Files = Files; +OpenAI.FileObjectsPage = FileObjectsPage; +OpenAI.Images = Images; +OpenAI.Audio = Audio; +OpenAI.Moderations = Moderations; +OpenAI.Models = Models; +OpenAI.ModelsPage = ModelsPage; +OpenAI.FineTuning = FineTuning; +OpenAI.Beta = Beta; +OpenAI.Batches = Batches; +OpenAI.BatchesPage = BatchesPage; +OpenAI.Uploads = UploadsAPIUploads; + +export declare namespace OpenAI { + export type RequestOptions = Core.RequestOptions; export import Page = Pagination.Page; - export import PageResponse = Pagination.PageResponse; + export { type PageResponse as PageResponse }; export import CursorPage = Pagination.CursorPage; - export import CursorPageParams = Pagination.CursorPageParams; - export import CursorPageResponse = Pagination.CursorPageResponse; - - export import Completions = API.Completions; - export import Completion = API.Completion; - export import CompletionChoice = API.CompletionChoice; - export import CompletionUsage = API.CompletionUsage; - export import CompletionCreateParams = API.CompletionCreateParams; - export import CompletionCreateParamsNonStreaming = API.CompletionCreateParamsNonStreaming; - export import CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming; - - export import Chat = API.Chat; - export import ChatModel = API.ChatModel; - export import ChatCompletion = API.ChatCompletion; - export import ChatCompletionAssistantMessageParam = API.ChatCompletionAssistantMessageParam; - export import ChatCompletionAudio = API.ChatCompletionAudio; - export import ChatCompletionAudioParam = API.ChatCompletionAudioParam; - export import ChatCompletionChunk = API.ChatCompletionChunk; - export import ChatCompletionContentPart = API.ChatCompletionContentPart; - export import ChatCompletionContentPartImage = API.ChatCompletionContentPartImage; - export import ChatCompletionContentPartInputAudio = API.ChatCompletionContentPartInputAudio; - export import ChatCompletionContentPartRefusal = API.ChatCompletionContentPartRefusal; - export import ChatCompletionContentPartText = API.ChatCompletionContentPartText; - export import ChatCompletionFunctionCallOption = API.ChatCompletionFunctionCallOption; - export import ChatCompletionFunctionMessageParam = API.ChatCompletionFunctionMessageParam; - export import ChatCompletionMessage = API.ChatCompletionMessage; - export import ChatCompletionMessageParam = API.ChatCompletionMessageParam; - export import ChatCompletionMessageToolCall = API.ChatCompletionMessageToolCall; - export import ChatCompletionModality = API.ChatCompletionModality; - export import ChatCompletionNamedToolChoice = API.ChatCompletionNamedToolChoice; - export import ChatCompletionRole = API.ChatCompletionRole; - export import ChatCompletionStreamOptions = API.ChatCompletionStreamOptions; - export import ChatCompletionSystemMessageParam = API.ChatCompletionSystemMessageParam; - export import ChatCompletionTokenLogprob = API.ChatCompletionTokenLogprob; - export import ChatCompletionTool = API.ChatCompletionTool; - export import ChatCompletionToolChoiceOption = API.ChatCompletionToolChoiceOption; - export import ChatCompletionToolMessageParam = API.ChatCompletionToolMessageParam; - export import ChatCompletionUserMessageParam = API.ChatCompletionUserMessageParam; - export import ChatCompletionCreateParams = API.ChatCompletionCreateParams; - export import ChatCompletionCreateParamsNonStreaming = API.ChatCompletionCreateParamsNonStreaming; - export import ChatCompletionCreateParamsStreaming = API.ChatCompletionCreateParamsStreaming; - - export import Embeddings = API.Embeddings; - export import CreateEmbeddingResponse = API.CreateEmbeddingResponse; - export import Embedding = API.Embedding; - export import EmbeddingModel = API.EmbeddingModel; - export import EmbeddingCreateParams = API.EmbeddingCreateParams; - - export import Files = API.Files; - export import FileContent = API.FileContent; - export import FileDeleted = API.FileDeleted; - export import FileObject = API.FileObject; - export import FilePurpose = API.FilePurpose; - export import FileObjectsPage = API.FileObjectsPage; - export import FileCreateParams = API.FileCreateParams; - export import FileListParams = API.FileListParams; - - export import Images = API.Images; - export import Image = API.Image; - export import ImageModel = API.ImageModel; - export import ImagesResponse = API.ImagesResponse; - export import ImageCreateVariationParams = API.ImageCreateVariationParams; - export import ImageEditParams = API.ImageEditParams; - export import ImageGenerateParams = API.ImageGenerateParams; - - export import Audio = API.Audio; - export import AudioModel = API.AudioModel; - export import AudioResponseFormat = API.AudioResponseFormat; - - export import Moderations = API.Moderations; - export import Moderation = API.Moderation; - export import ModerationImageURLInput = API.ModerationImageURLInput; - export import ModerationModel = API.ModerationModel; - export import ModerationMultiModalInput = API.ModerationMultiModalInput; - export import ModerationTextInput = API.ModerationTextInput; - export import ModerationCreateResponse = API.ModerationCreateResponse; - export import ModerationCreateParams = API.ModerationCreateParams; - - export import Models = API.Models; - export import Model = API.Model; - export import ModelDeleted = API.ModelDeleted; - export import ModelsPage = API.ModelsPage; - - export import FineTuning = API.FineTuning; - - export import Beta = API.Beta; - - export import Batches = API.Batches; - export import Batch = API.Batch; - export import BatchError = API.BatchError; - export import BatchRequestCounts = API.BatchRequestCounts; - export import BatchesPage = API.BatchesPage; - export import BatchCreateParams = API.BatchCreateParams; - export import BatchListParams = API.BatchListParams; - - export import Uploads = API.Uploads; - export import Upload = API.Upload; - export import UploadCreateParams = API.UploadCreateParams; - export import UploadCompleteParams = API.UploadCompleteParams; - - export import ErrorObject = API.ErrorObject; - export import FunctionDefinition = API.FunctionDefinition; - export import FunctionParameters = API.FunctionParameters; - export import ResponseFormatJSONObject = API.ResponseFormatJSONObject; - export import ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; - export import ResponseFormatText = API.ResponseFormatText; + export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; + + export { + Completions as Completions, + type Completion as Completion, + type CompletionChoice as CompletionChoice, + type CompletionUsage as CompletionUsage, + type CompletionCreateParams as CompletionCreateParams, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; + + export { + Chat as Chat, + type ChatModel as ChatModel, + type ChatCompletion as ChatCompletion, + type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, + type ChatCompletionAudio as ChatCompletionAudio, + type ChatCompletionAudioParam as ChatCompletionAudioParam, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatCompletionContentPart as ChatCompletionContentPart, + type ChatCompletionContentPartImage as ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, + type ChatCompletionMessage as ChatCompletionMessage, + type ChatCompletionMessageParam as ChatCompletionMessageParam, + type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, + type ChatCompletionModality as ChatCompletionModality, + type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStreamOptions as ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, + type ChatCompletionTool as ChatCompletionTool, + type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionCreateParams as ChatCompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + }; + + export { + Embeddings as Embeddings, + type CreateEmbeddingResponse as CreateEmbeddingResponse, + type Embedding as Embedding, + type EmbeddingModel as EmbeddingModel, + type EmbeddingCreateParams as EmbeddingCreateParams, + }; + + export { + Files as Files, + type FileContent as FileContent, + type FileDeleted as FileDeleted, + type FileObject as FileObject, + type FilePurpose as FilePurpose, + FileObjectsPage as FileObjectsPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; + + export { + Images as Images, + type Image as Image, + type ImageModel as ImageModel, + type ImagesResponse as ImagesResponse, + type ImageCreateVariationParams as ImageCreateVariationParams, + type ImageEditParams as ImageEditParams, + type ImageGenerateParams as ImageGenerateParams, + }; + + export { Audio as Audio, type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat }; + + export { + Moderations as Moderations, + type Moderation as Moderation, + type ModerationImageURLInput as ModerationImageURLInput, + type ModerationModel as ModerationModel, + type ModerationMultiModalInput as ModerationMultiModalInput, + type ModerationTextInput as ModerationTextInput, + type ModerationCreateResponse as ModerationCreateResponse, + type ModerationCreateParams as ModerationCreateParams, + }; + + export { + Models as Models, + type Model as Model, + type ModelDeleted as ModelDeleted, + ModelsPage as ModelsPage, + }; + + export { FineTuning as FineTuning }; + + export { Beta as Beta }; + + export { + Batches as Batches, + type Batch as Batch, + type BatchError as BatchError, + type BatchRequestCounts as BatchRequestCounts, + BatchesPage as BatchesPage, + type BatchCreateParams as BatchCreateParams, + type BatchListParams as BatchListParams, + }; + + export { + UploadsAPIUploads as Uploads, + type Upload as Upload, + type UploadCreateParams as UploadCreateParams, + type UploadCompleteParams as UploadCompleteParams, + }; + + export type ErrorObject = API.ErrorObject; + export type FunctionDefinition = API.FunctionDefinition; + export type FunctionParameters = API.FunctionParameters; + export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; + export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; + export type ResponseFormatText = API.ResponseFormatText; } // ---------------------- Azure ---------------------- diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index 7c5ffb58e..c826c910e 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -6,7 +6,7 @@ import { Text, ImageFile, TextDelta, - Messages, + MessageDelta, MessageContent, } from 'openai/resources/beta/threads/messages'; import * as Core from 'openai/core'; @@ -31,7 +31,6 @@ import { import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from 'openai/resources/beta/threads/runs/steps'; import { ThreadCreateAndRunParamsBase, Threads } from 'openai/resources/beta/threads/threads'; import { BaseEvents, EventStream } from './EventStream'; -import MessageDelta = Messages.MessageDelta; export interface AssistantStreamEvents extends BaseEvents { run: (run: Run) => void; diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index e06e28094..b9a7ad4f8 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -1,10 +1,26 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as AudioAPI from './audio'; import * as SpeechAPI from './speech'; +import { Speech, SpeechCreateParams, SpeechModel } from './speech'; import * as TranscriptionsAPI from './transcriptions'; +import { + Transcription, + TranscriptionCreateParams, + TranscriptionCreateResponse, + TranscriptionSegment, + TranscriptionVerbose, + TranscriptionWord, + Transcriptions, +} from './transcriptions'; import * as TranslationsAPI from './translations'; +import { + Translation, + TranslationCreateParams, + TranslationCreateResponse, + TranslationVerbose, + Translations, +} from './translations'; export class Audio extends APIResource { transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this._client); @@ -20,30 +36,30 @@ export type AudioModel = 'whisper-1'; */ export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; -export namespace Audio { - export import AudioModel = AudioAPI.AudioModel; - export import AudioResponseFormat = AudioAPI.AudioResponseFormat; - export import Transcriptions = TranscriptionsAPI.Transcriptions; - export import Transcription = TranscriptionsAPI.Transcription; - export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment; - export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose; - export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord; - export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse; - export type TranscriptionCreateParams< - ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = - | AudioAPI.AudioResponseFormat - | undefined, - > = TranscriptionsAPI.TranscriptionCreateParams; - export import Translations = TranslationsAPI.Translations; - export import Translation = TranslationsAPI.Translation; - export import TranslationVerbose = TranslationsAPI.TranslationVerbose; - export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse; - export type TranslationCreateParams< - ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = - | AudioAPI.AudioResponseFormat - | undefined, - > = TranslationsAPI.TranslationCreateParams; - export import Speech = SpeechAPI.Speech; - export import SpeechModel = SpeechAPI.SpeechModel; - export import SpeechCreateParams = SpeechAPI.SpeechCreateParams; +Audio.Transcriptions = Transcriptions; +Audio.Translations = Translations; +Audio.Speech = Speech; + +export declare namespace Audio { + export { type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat }; + + export { + Transcriptions as Transcriptions, + type Transcription as Transcription, + type TranscriptionSegment as TranscriptionSegment, + type TranscriptionVerbose as TranscriptionVerbose, + type TranscriptionWord as TranscriptionWord, + type TranscriptionCreateResponse as TranscriptionCreateResponse, + type TranscriptionCreateParams as TranscriptionCreateParams, + }; + + export { + Translations as Translations, + type Translation as Translation, + type TranslationVerbose as TranslationVerbose, + type TranslationCreateResponse as TranslationCreateResponse, + type TranslationCreateParams as TranslationCreateParams, + }; + + export { Speech as Speech, type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams }; } diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index 952c05b03..2bbe9e3ab 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AudioModel, AudioResponseFormat, Audio } from './audio'; -export { SpeechModel, SpeechCreateParams, Speech } from './speech'; +export { Audio, type AudioModel, type AudioResponseFormat } from './audio'; +export { Speech, type SpeechModel, type SpeechCreateParams } from './speech'; export { - Transcription, - TranscriptionSegment, - TranscriptionVerbose, - TranscriptionWord, - TranscriptionCreateResponse, - TranscriptionCreateParams, Transcriptions, + type Transcription, + type TranscriptionSegment, + type TranscriptionVerbose, + type TranscriptionWord, + type TranscriptionCreateResponse, + type TranscriptionCreateParams, } from './transcriptions'; export { - Translation, - TranslationVerbose, - TranslationCreateResponse, - TranslationCreateParams, Translations, + type Translation, + type TranslationVerbose, + type TranslationCreateResponse, + type TranslationCreateParams, } from './translations'; diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 34fb26b02..da99bf649 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SpeechAPI from './speech'; import { type Response } from '../../_shims/index'; export class Speech extends APIResource { @@ -49,7 +48,6 @@ export interface SpeechCreateParams { speed?: number; } -export namespace Speech { - export import SpeechModel = SpeechAPI.SpeechModel; - export import SpeechCreateParams = SpeechAPI.SpeechCreateParams; +export declare namespace Speech { + export { type SpeechModel as SpeechModel, type SpeechCreateParams as SpeechCreateParams }; } diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 902dc9e5f..dd4258787 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TranscriptionsAPI from './transcriptions'; import * as AudioAPI from './audio'; export class Transcriptions extends APIResource { @@ -205,15 +204,13 @@ export interface TranscriptionCreateParams< timestamp_granularities?: Array<'word' | 'segment'>; } -export namespace Transcriptions { - export import Transcription = TranscriptionsAPI.Transcription; - export import TranscriptionSegment = TranscriptionsAPI.TranscriptionSegment; - export import TranscriptionVerbose = TranscriptionsAPI.TranscriptionVerbose; - export import TranscriptionWord = TranscriptionsAPI.TranscriptionWord; - export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse; - export type TranscriptionCreateParams< - ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = - | AudioAPI.AudioResponseFormat - | undefined, - > = TranscriptionsAPI.TranscriptionCreateParams; +export declare namespace Transcriptions { + export { + type Transcription as Transcription, + type TranscriptionSegment as TranscriptionSegment, + type TranscriptionVerbose as TranscriptionVerbose, + type TranscriptionWord as TranscriptionWord, + type TranscriptionCreateResponse as TranscriptionCreateResponse, + type TranscriptionCreateParams as TranscriptionCreateParams, + }; } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 36c2dc7c2..b98a95044 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TranslationsAPI from './translations'; import * as AudioAPI from './audio'; import * as TranscriptionsAPI from './transcriptions'; @@ -98,13 +97,11 @@ export interface TranslationCreateParams< temperature?: number; } -export namespace Translations { - export import Translation = TranslationsAPI.Translation; - export import TranslationVerbose = TranslationsAPI.TranslationVerbose; - export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse; - export type TranslationCreateParams< - ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = - | AudioAPI.AudioResponseFormat - | undefined, - > = TranslationsAPI.TranslationCreateParams; +export declare namespace Translations { + export { + type Translation as Translation, + type TranslationVerbose as TranslationVerbose, + type TranslationCreateResponse as TranslationCreateResponse, + type TranslationCreateParams as TranslationCreateParams, + }; } diff --git a/src/resources/batches.ts b/src/resources/batches.ts index 738582f9e..e68e7569c 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -244,11 +244,15 @@ export interface BatchCreateParams { export interface BatchListParams extends CursorPageParams {} -export namespace Batches { - export import Batch = BatchesAPI.Batch; - export import BatchError = BatchesAPI.BatchError; - export import BatchRequestCounts = BatchesAPI.BatchRequestCounts; - export import BatchesPage = BatchesAPI.BatchesPage; - export import BatchCreateParams = BatchesAPI.BatchCreateParams; - export import BatchListParams = BatchesAPI.BatchListParams; +Batches.BatchesPage = BatchesPage; + +export declare namespace Batches { + export { + type Batch as Batch, + type BatchError as BatchError, + type BatchRequestCounts as BatchRequestCounts, + BatchesPage as BatchesPage, + type BatchCreateParams as BatchCreateParams, + type BatchListParams as BatchListParams, + }; } diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index aa7362297..6d48089ce 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as AssistantsAPI from './assistants'; import * as Shared from '../shared'; import * as ChatAPI from '../chat/chat'; import * as MessagesAPI from './threads/messages'; @@ -1396,20 +1395,24 @@ export interface AssistantListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export namespace Assistants { - export import Assistant = AssistantsAPI.Assistant; - export import AssistantDeleted = AssistantsAPI.AssistantDeleted; - export import AssistantStreamEvent = AssistantsAPI.AssistantStreamEvent; - export import AssistantTool = AssistantsAPI.AssistantTool; - export import CodeInterpreterTool = AssistantsAPI.CodeInterpreterTool; - export import FileSearchTool = AssistantsAPI.FileSearchTool; - export import FunctionTool = AssistantsAPI.FunctionTool; - export import MessageStreamEvent = AssistantsAPI.MessageStreamEvent; - export import RunStepStreamEvent = AssistantsAPI.RunStepStreamEvent; - export import RunStreamEvent = AssistantsAPI.RunStreamEvent; - export import ThreadStreamEvent = AssistantsAPI.ThreadStreamEvent; - export import AssistantsPage = AssistantsAPI.AssistantsPage; - export import AssistantCreateParams = AssistantsAPI.AssistantCreateParams; - export import AssistantUpdateParams = AssistantsAPI.AssistantUpdateParams; - export import AssistantListParams = AssistantsAPI.AssistantListParams; +Assistants.AssistantsPage = AssistantsPage; + +export declare namespace Assistants { + export { + type Assistant as Assistant, + type AssistantDeleted as AssistantDeleted, + type AssistantStreamEvent as AssistantStreamEvent, + type AssistantTool as AssistantTool, + type CodeInterpreterTool as CodeInterpreterTool, + type FileSearchTool as FileSearchTool, + type FunctionTool as FunctionTool, + type MessageStreamEvent as MessageStreamEvent, + type RunStepStreamEvent as RunStepStreamEvent, + type RunStreamEvent as RunStreamEvent, + type ThreadStreamEvent as ThreadStreamEvent, + AssistantsPage as AssistantsPage, + type AssistantCreateParams as AssistantCreateParams, + type AssistantUpdateParams as AssistantUpdateParams, + type AssistantListParams as AssistantListParams, + }; } diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 0bcf217a8..b904abe4a 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -3,8 +3,59 @@ import { APIResource } from '../../resource'; import * as AssistantsAPI from './assistants'; import * as ChatAPI from './chat/chat'; +import { + Assistant, + AssistantCreateParams, + AssistantDeleted, + AssistantListParams, + AssistantStreamEvent, + AssistantTool, + AssistantUpdateParams, + Assistants, + AssistantsPage, + CodeInterpreterTool, + FileSearchTool, + FunctionTool, + MessageStreamEvent, + RunStepStreamEvent, + RunStreamEvent, + ThreadStreamEvent, +} from './assistants'; import * as ThreadsAPI from './threads/threads'; +import { + AssistantResponseFormatOption, + AssistantToolChoice, + AssistantToolChoiceFunction, + AssistantToolChoiceOption, + Thread, + ThreadCreateAndRunParams, + ThreadCreateAndRunParamsNonStreaming, + ThreadCreateAndRunParamsStreaming, + ThreadCreateAndRunPollParams, + ThreadCreateAndRunStreamParams, + ThreadCreateParams, + ThreadDeleted, + ThreadUpdateParams, + Threads, +} from './threads/threads'; import * as VectorStoresAPI from './vector-stores/vector-stores'; +import { + AutoFileChunkingStrategyParam, + FileChunkingStrategy, + FileChunkingStrategyParam, + OtherFileChunkingStrategyObject, + StaticFileChunkingStrategy, + StaticFileChunkingStrategyObject, + StaticFileChunkingStrategyParam, + VectorStore, + VectorStoreCreateParams, + VectorStoreDeleted, + VectorStoreListParams, + VectorStoreUpdateParams, + VectorStores, + VectorStoresPage, +} from './vector-stores/vector-stores'; +import { Chat } from './chat/chat'; export class Beta extends APIResource { vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client); @@ -13,50 +64,65 @@ export class Beta extends APIResource { threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } -export namespace Beta { - export import VectorStores = VectorStoresAPI.VectorStores; - export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam; - export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy; - export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam; - export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject; - export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy; - export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject; - export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam; - export import VectorStore = VectorStoresAPI.VectorStore; - export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted; - export import VectorStoresPage = VectorStoresAPI.VectorStoresPage; - export import VectorStoreCreateParams = VectorStoresAPI.VectorStoreCreateParams; - export import VectorStoreUpdateParams = VectorStoresAPI.VectorStoreUpdateParams; - export import VectorStoreListParams = VectorStoresAPI.VectorStoreListParams; - export import Chat = ChatAPI.Chat; - export import Assistants = AssistantsAPI.Assistants; - export import Assistant = AssistantsAPI.Assistant; - export import AssistantDeleted = AssistantsAPI.AssistantDeleted; - export import AssistantStreamEvent = AssistantsAPI.AssistantStreamEvent; - export import AssistantTool = AssistantsAPI.AssistantTool; - export import CodeInterpreterTool = AssistantsAPI.CodeInterpreterTool; - export import FileSearchTool = AssistantsAPI.FileSearchTool; - export import FunctionTool = AssistantsAPI.FunctionTool; - export import MessageStreamEvent = AssistantsAPI.MessageStreamEvent; - export import RunStepStreamEvent = AssistantsAPI.RunStepStreamEvent; - export import RunStreamEvent = AssistantsAPI.RunStreamEvent; - export import ThreadStreamEvent = AssistantsAPI.ThreadStreamEvent; - export import AssistantsPage = AssistantsAPI.AssistantsPage; - export import AssistantCreateParams = AssistantsAPI.AssistantCreateParams; - export import AssistantUpdateParams = AssistantsAPI.AssistantUpdateParams; - export import AssistantListParams = AssistantsAPI.AssistantListParams; - export import Threads = ThreadsAPI.Threads; - export import AssistantResponseFormatOption = ThreadsAPI.AssistantResponseFormatOption; - export import AssistantToolChoice = ThreadsAPI.AssistantToolChoice; - export import AssistantToolChoiceFunction = ThreadsAPI.AssistantToolChoiceFunction; - export import AssistantToolChoiceOption = ThreadsAPI.AssistantToolChoiceOption; - export import Thread = ThreadsAPI.Thread; - export import ThreadDeleted = ThreadsAPI.ThreadDeleted; - export import ThreadCreateParams = ThreadsAPI.ThreadCreateParams; - export import ThreadUpdateParams = ThreadsAPI.ThreadUpdateParams; - export import ThreadCreateAndRunParams = ThreadsAPI.ThreadCreateAndRunParams; - export import ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; - export import ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; - export import ThreadCreateAndRunPollParams = ThreadsAPI.ThreadCreateAndRunPollParams; - export import ThreadCreateAndRunStreamParams = ThreadsAPI.ThreadCreateAndRunStreamParams; +Beta.VectorStores = VectorStores; +Beta.VectorStoresPage = VectorStoresPage; +Beta.Assistants = Assistants; +Beta.AssistantsPage = AssistantsPage; +Beta.Threads = Threads; + +export declare namespace Beta { + export { + VectorStores as VectorStores, + type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, + type FileChunkingStrategy as FileChunkingStrategy, + type FileChunkingStrategyParam as FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy as StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type VectorStore as VectorStore, + type VectorStoreDeleted as VectorStoreDeleted, + VectorStoresPage as VectorStoresPage, + type VectorStoreCreateParams as VectorStoreCreateParams, + type VectorStoreUpdateParams as VectorStoreUpdateParams, + type VectorStoreListParams as VectorStoreListParams, + }; + + export { Chat }; + + export { + Assistants as Assistants, + type Assistant as Assistant, + type AssistantDeleted as AssistantDeleted, + type AssistantStreamEvent as AssistantStreamEvent, + type AssistantTool as AssistantTool, + type CodeInterpreterTool as CodeInterpreterTool, + type FileSearchTool as FileSearchTool, + type FunctionTool as FunctionTool, + type MessageStreamEvent as MessageStreamEvent, + type RunStepStreamEvent as RunStepStreamEvent, + type RunStreamEvent as RunStreamEvent, + type ThreadStreamEvent as ThreadStreamEvent, + AssistantsPage as AssistantsPage, + type AssistantCreateParams as AssistantCreateParams, + type AssistantUpdateParams as AssistantUpdateParams, + type AssistantListParams as AssistantListParams, + }; + + export { + Threads as Threads, + type AssistantResponseFormatOption as AssistantResponseFormatOption, + type AssistantToolChoice as AssistantToolChoice, + type AssistantToolChoiceFunction as AssistantToolChoiceFunction, + type AssistantToolChoiceOption as AssistantToolChoiceOption, + type Thread as Thread, + type ThreadDeleted as ThreadDeleted, + type ThreadCreateParams as ThreadCreateParams, + type ThreadUpdateParams as ThreadUpdateParams, + type ThreadCreateAndRunParams as ThreadCreateAndRunParams, + type ThreadCreateAndRunParamsNonStreaming as ThreadCreateAndRunParamsNonStreaming, + type ThreadCreateAndRunParamsStreaming as ThreadCreateAndRunParamsStreaming, + type ThreadCreateAndRunPollParams, + type ThreadCreateAndRunStreamParams, + }; } diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 9fcf805a1..d7111288f 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -1,54 +1,54 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Assistant, - AssistantDeleted, - AssistantStreamEvent, - AssistantTool, - CodeInterpreterTool, - FileSearchTool, - FunctionTool, - MessageStreamEvent, - RunStepStreamEvent, - RunStreamEvent, - ThreadStreamEvent, - AssistantCreateParams, - AssistantUpdateParams, - AssistantListParams, AssistantsPage, Assistants, + type Assistant, + type AssistantDeleted, + type AssistantStreamEvent, + type AssistantTool, + type CodeInterpreterTool, + type FileSearchTool, + type FunctionTool, + type MessageStreamEvent, + type RunStepStreamEvent, + type RunStreamEvent, + type ThreadStreamEvent, + type AssistantCreateParams, + type AssistantUpdateParams, + type AssistantListParams, } from './assistants'; +export { Beta } from './beta'; +export { Chat } from './chat/index'; export { - AssistantResponseFormatOption, - AssistantToolChoice, - AssistantToolChoiceFunction, - AssistantToolChoiceOption, - Thread, - ThreadDeleted, - ThreadCreateParams, - ThreadUpdateParams, - ThreadCreateAndRunParams, - ThreadCreateAndRunParamsNonStreaming, - ThreadCreateAndRunParamsStreaming, - ThreadCreateAndRunPollParams, - ThreadCreateAndRunStreamParams, Threads, + type AssistantResponseFormatOption, + type AssistantToolChoice, + type AssistantToolChoiceFunction, + type AssistantToolChoiceOption, + type Thread, + type ThreadDeleted, + type ThreadCreateParams, + type ThreadUpdateParams, + type ThreadCreateAndRunParams, + type ThreadCreateAndRunParamsNonStreaming, + type ThreadCreateAndRunParamsStreaming, + type ThreadCreateAndRunPollParams, + type ThreadCreateAndRunStreamParams, } from './threads/index'; -export { Beta } from './beta'; -export { Chat } from './chat/index'; export { - AutoFileChunkingStrategyParam, - FileChunkingStrategy, - FileChunkingStrategyParam, - OtherFileChunkingStrategyObject, - StaticFileChunkingStrategy, - StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyParam, - VectorStore, - VectorStoreDeleted, - VectorStoreCreateParams, - VectorStoreUpdateParams, - VectorStoreListParams, VectorStoresPage, VectorStores, + type AutoFileChunkingStrategyParam, + type FileChunkingStrategy, + type FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyParam, + type VectorStore, + type VectorStoreDeleted, + type VectorStoreCreateParams, + type VectorStoreUpdateParams, + type VectorStoreListParams, } from './vector-stores/index'; diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index 1964cffb8..f67a1edde 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -1,73 +1,73 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Annotation, - AnnotationDelta, - FileCitationAnnotation, - FileCitationDeltaAnnotation, - FilePathAnnotation, - FilePathDeltaAnnotation, - ImageFile, - ImageFileContentBlock, - ImageFileDelta, - ImageFileDeltaBlock, - ImageURL, - ImageURLContentBlock, - ImageURLDelta, - ImageURLDeltaBlock, - Message, - MessageContent, - MessageContentDelta, - MessageContentPartParam, - MessageDeleted, - MessageDelta, - MessageDeltaEvent, - RefusalContentBlock, - RefusalDeltaBlock, - Text, - TextContentBlock, - TextContentBlockParam, - TextDelta, - TextDeltaBlock, - MessageCreateParams, - MessageUpdateParams, - MessageListParams, MessagesPage, Messages, + type Annotation, + type AnnotationDelta, + type FileCitationAnnotation, + type FileCitationDeltaAnnotation, + type FilePathAnnotation, + type FilePathDeltaAnnotation, + type ImageFile, + type ImageFileContentBlock, + type ImageFileDelta, + type ImageFileDeltaBlock, + type ImageURL, + type ImageURLContentBlock, + type ImageURLDelta, + type ImageURLDeltaBlock, + type Message, + type MessageContent, + type MessageContentDelta, + type MessageContentPartParam, + type MessageDeleted, + type MessageDelta, + type MessageDeltaEvent, + type RefusalContentBlock, + type RefusalDeltaBlock, + type Text, + type TextContentBlock, + type TextContentBlockParam, + type TextDelta, + type TextDeltaBlock, + type MessageCreateParams, + type MessageUpdateParams, + type MessageListParams, } from './messages'; export { - AssistantResponseFormatOption, - AssistantToolChoice, - AssistantToolChoiceFunction, - AssistantToolChoiceOption, - Thread, - ThreadDeleted, - ThreadCreateParams, - ThreadUpdateParams, - ThreadCreateAndRunParams, - ThreadCreateAndRunParamsNonStreaming, - ThreadCreateAndRunParamsStreaming, - ThreadCreateAndRunPollParams, - ThreadCreateAndRunStreamParams, - Threads, -} from './threads'; -export { - RequiredActionFunctionToolCall, - Run, - RunStatus, - RunCreateParams, - RunCreateParamsNonStreaming, - RunCreateParamsStreaming, - RunUpdateParams, - RunListParams, - RunCreateAndPollParams, - RunCreateAndStreamParams, - RunStreamParams, - RunSubmitToolOutputsParams, - RunSubmitToolOutputsParamsNonStreaming, - RunSubmitToolOutputsParamsStreaming, - RunSubmitToolOutputsAndPollParams, - RunSubmitToolOutputsStreamParams, RunsPage, Runs, + type RequiredActionFunctionToolCall, + type Run, + type RunStatus, + type RunCreateParams, + type RunCreateParamsNonStreaming, + type RunCreateParamsStreaming, + type RunUpdateParams, + type RunListParams, + type RunSubmitToolOutputsParams, + type RunSubmitToolOutputsParamsNonStreaming, + type RunSubmitToolOutputsParamsStreaming, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, + type RunSubmitToolOutputsAndPollParams, + type RunSubmitToolOutputsStreamParams, } from './runs/index'; +export { + Threads, + type AssistantResponseFormatOption, + type AssistantToolChoice, + type AssistantToolChoiceFunction, + type AssistantToolChoiceOption, + type Thread, + type ThreadDeleted, + type ThreadCreateParams, + type ThreadUpdateParams, + type ThreadCreateAndRunParams, + type ThreadCreateAndRunParamsNonStreaming, + type ThreadCreateAndRunParamsStreaming, + type ThreadCreateAndRunPollParams, + type ThreadCreateAndRunStreamParams, +} from './threads'; diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 59c92675b..af7977667 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as MessagesAPI from './messages'; import * as AssistantsAPI from '../assistants'; import { CursorPage, type CursorPageParams } from '../../../pagination'; @@ -722,37 +721,41 @@ export interface MessageListParams extends CursorPageParams { run_id?: string; } -export namespace Messages { - export import Annotation = MessagesAPI.Annotation; - export import AnnotationDelta = MessagesAPI.AnnotationDelta; - export import FileCitationAnnotation = MessagesAPI.FileCitationAnnotation; - export import FileCitationDeltaAnnotation = MessagesAPI.FileCitationDeltaAnnotation; - export import FilePathAnnotation = MessagesAPI.FilePathAnnotation; - export import FilePathDeltaAnnotation = MessagesAPI.FilePathDeltaAnnotation; - export import ImageFile = MessagesAPI.ImageFile; - export import ImageFileContentBlock = MessagesAPI.ImageFileContentBlock; - export import ImageFileDelta = MessagesAPI.ImageFileDelta; - export import ImageFileDeltaBlock = MessagesAPI.ImageFileDeltaBlock; - export import ImageURL = MessagesAPI.ImageURL; - export import ImageURLContentBlock = MessagesAPI.ImageURLContentBlock; - export import ImageURLDelta = MessagesAPI.ImageURLDelta; - export import ImageURLDeltaBlock = MessagesAPI.ImageURLDeltaBlock; - export import Message = MessagesAPI.Message; - export import MessageContent = MessagesAPI.MessageContent; - export import MessageContentDelta = MessagesAPI.MessageContentDelta; - export import MessageContentPartParam = MessagesAPI.MessageContentPartParam; - export import MessageDeleted = MessagesAPI.MessageDeleted; - export import MessageDelta = MessagesAPI.MessageDelta; - export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; - export import RefusalContentBlock = MessagesAPI.RefusalContentBlock; - export import RefusalDeltaBlock = MessagesAPI.RefusalDeltaBlock; - export import Text = MessagesAPI.Text; - export import TextContentBlock = MessagesAPI.TextContentBlock; - export import TextContentBlockParam = MessagesAPI.TextContentBlockParam; - export import TextDelta = MessagesAPI.TextDelta; - export import TextDeltaBlock = MessagesAPI.TextDeltaBlock; - export import MessagesPage = MessagesAPI.MessagesPage; - export import MessageCreateParams = MessagesAPI.MessageCreateParams; - export import MessageUpdateParams = MessagesAPI.MessageUpdateParams; - export import MessageListParams = MessagesAPI.MessageListParams; +Messages.MessagesPage = MessagesPage; + +export declare namespace Messages { + export { + type Annotation as Annotation, + type AnnotationDelta as AnnotationDelta, + type FileCitationAnnotation as FileCitationAnnotation, + type FileCitationDeltaAnnotation as FileCitationDeltaAnnotation, + type FilePathAnnotation as FilePathAnnotation, + type FilePathDeltaAnnotation as FilePathDeltaAnnotation, + type ImageFile as ImageFile, + type ImageFileContentBlock as ImageFileContentBlock, + type ImageFileDelta as ImageFileDelta, + type ImageFileDeltaBlock as ImageFileDeltaBlock, + type ImageURL as ImageURL, + type ImageURLContentBlock as ImageURLContentBlock, + type ImageURLDelta as ImageURLDelta, + type ImageURLDeltaBlock as ImageURLDeltaBlock, + type Message as Message, + type MessageContent as MessageContent, + type MessageContentDelta as MessageContentDelta, + type MessageContentPartParam as MessageContentPartParam, + type MessageDeleted as MessageDeleted, + type MessageDelta as MessageDelta, + type MessageDeltaEvent as MessageDeltaEvent, + type RefusalContentBlock as RefusalContentBlock, + type RefusalDeltaBlock as RefusalDeltaBlock, + type Text as Text, + type TextContentBlock as TextContentBlock, + type TextContentBlockParam as TextContentBlockParam, + type TextDelta as TextDelta, + type TextDeltaBlock as TextDeltaBlock, + MessagesPage as MessagesPage, + type MessageCreateParams as MessageCreateParams, + type MessageUpdateParams as MessageUpdateParams, + type MessageListParams as MessageListParams, + }; } diff --git a/src/resources/beta/threads/runs/index.ts b/src/resources/beta/threads/runs/index.ts index 9496f59e1..9dbe575bc 100644 --- a/src/resources/beta/threads/runs/index.ts +++ b/src/resources/beta/threads/runs/index.ts @@ -1,46 +1,46 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - CodeInterpreterLogs, - CodeInterpreterOutputImage, - CodeInterpreterToolCall, - CodeInterpreterToolCallDelta, - FileSearchToolCall, - FileSearchToolCallDelta, - FunctionToolCall, - FunctionToolCallDelta, - MessageCreationStepDetails, - RunStep, - RunStepDelta, - RunStepDeltaEvent, - RunStepDeltaMessageDelta, - RunStepInclude, - ToolCall, - ToolCallDelta, - ToolCallDeltaObject, - ToolCallsStepDetails, - StepRetrieveParams, - StepListParams, RunStepsPage, Steps, + type CodeInterpreterLogs, + type CodeInterpreterOutputImage, + type CodeInterpreterToolCall, + type CodeInterpreterToolCallDelta, + type FileSearchToolCall, + type FileSearchToolCallDelta, + type FunctionToolCall, + type FunctionToolCallDelta, + type MessageCreationStepDetails, + type RunStep, + type RunStepDelta, + type RunStepDeltaEvent, + type RunStepDeltaMessageDelta, + type RunStepInclude, + type ToolCall, + type ToolCallDelta, + type ToolCallDeltaObject, + type ToolCallsStepDetails, + type StepRetrieveParams, + type StepListParams, } from './steps'; export { - RequiredActionFunctionToolCall, - Run, - RunStatus, - RunCreateParams, - RunCreateParamsNonStreaming, - RunCreateParamsStreaming, - RunUpdateParams, - RunListParams, - RunCreateAndPollParams, - RunCreateAndStreamParams, - RunStreamParams, - RunSubmitToolOutputsParams, - RunSubmitToolOutputsParamsNonStreaming, - RunSubmitToolOutputsParamsStreaming, - RunSubmitToolOutputsAndPollParams, - RunSubmitToolOutputsStreamParams, RunsPage, Runs, + type RequiredActionFunctionToolCall, + type Run, + type RunStatus, + type RunCreateParams, + type RunCreateParamsNonStreaming, + type RunCreateParamsStreaming, + type RunUpdateParams, + type RunListParams, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, + type RunSubmitToolOutputsParams, + type RunSubmitToolOutputsParamsNonStreaming, + type RunSubmitToolOutputsParamsStreaming, + type RunSubmitToolOutputsAndPollParams, + type RunSubmitToolOutputsStreamParams, } from './runs'; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index b48edd5b1..83a447a91 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -13,6 +13,30 @@ import * as ChatAPI from '../../../chat/chat'; import * as MessagesAPI from '../messages'; import * as ThreadsAPI from '../threads'; import * as StepsAPI from './steps'; +import { + CodeInterpreterLogs, + CodeInterpreterOutputImage, + CodeInterpreterToolCall, + CodeInterpreterToolCallDelta, + FileSearchToolCall, + FileSearchToolCallDelta, + FunctionToolCall, + FunctionToolCallDelta, + MessageCreationStepDetails, + RunStep, + RunStepDelta, + RunStepDeltaEvent, + RunStepDeltaMessageDelta, + RunStepInclude, + RunStepsPage, + StepListParams, + StepRetrieveParams, + Steps, + ToolCall, + ToolCallDelta, + ToolCallDeltaObject, + ToolCallsStepDetails, +} from './steps'; import { CursorPage, type CursorPageParams } from '../../../../pagination'; import { Stream } from '../../../../streaming'; @@ -1619,44 +1643,53 @@ export namespace RunSubmitToolOutputsStreamParams { } } -export namespace Runs { - export import RequiredActionFunctionToolCall = RunsAPI.RequiredActionFunctionToolCall; - export import Run = RunsAPI.Run; - export import RunStatus = RunsAPI.RunStatus; - export import RunsPage = RunsAPI.RunsPage; - export import RunCreateParams = RunsAPI.RunCreateParams; - export import RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; - export import RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; - export import RunUpdateParams = RunsAPI.RunUpdateParams; - export import RunListParams = RunsAPI.RunListParams; - export import RunCreateAndPollParams = RunsAPI.RunCreateAndPollParams; - export import RunCreateAndStreamParams = RunsAPI.RunCreateAndStreamParams; - export import RunStreamParams = RunsAPI.RunStreamParams; - export import RunSubmitToolOutputsParams = RunsAPI.RunSubmitToolOutputsParams; - export import RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming; - export import RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming; - export import RunSubmitToolOutputsAndPollParams = RunsAPI.RunSubmitToolOutputsAndPollParams; - export import RunSubmitToolOutputsStreamParams = RunsAPI.RunSubmitToolOutputsStreamParams; - export import Steps = StepsAPI.Steps; - export import CodeInterpreterLogs = StepsAPI.CodeInterpreterLogs; - export import CodeInterpreterOutputImage = StepsAPI.CodeInterpreterOutputImage; - export import CodeInterpreterToolCall = StepsAPI.CodeInterpreterToolCall; - export import CodeInterpreterToolCallDelta = StepsAPI.CodeInterpreterToolCallDelta; - export import FileSearchToolCall = StepsAPI.FileSearchToolCall; - export import FileSearchToolCallDelta = StepsAPI.FileSearchToolCallDelta; - export import FunctionToolCall = StepsAPI.FunctionToolCall; - export import FunctionToolCallDelta = StepsAPI.FunctionToolCallDelta; - export import MessageCreationStepDetails = StepsAPI.MessageCreationStepDetails; - export import RunStep = StepsAPI.RunStep; - export import RunStepDelta = StepsAPI.RunStepDelta; - export import RunStepDeltaEvent = StepsAPI.RunStepDeltaEvent; - export import RunStepDeltaMessageDelta = StepsAPI.RunStepDeltaMessageDelta; - export import RunStepInclude = StepsAPI.RunStepInclude; - export import ToolCall = StepsAPI.ToolCall; - export import ToolCallDelta = StepsAPI.ToolCallDelta; - export import ToolCallDeltaObject = StepsAPI.ToolCallDeltaObject; - export import ToolCallsStepDetails = StepsAPI.ToolCallsStepDetails; - export import RunStepsPage = StepsAPI.RunStepsPage; - export import StepRetrieveParams = StepsAPI.StepRetrieveParams; - export import StepListParams = StepsAPI.StepListParams; +Runs.RunsPage = RunsPage; +Runs.Steps = Steps; +Runs.RunStepsPage = RunStepsPage; + +export declare namespace Runs { + export { + type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, + type Run as Run, + type RunStatus as RunStatus, + RunsPage as RunsPage, + type RunCreateParams as RunCreateParams, + type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, + type RunCreateParamsStreaming as RunCreateParamsStreaming, + type RunUpdateParams as RunUpdateParams, + type RunListParams as RunListParams, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, + type RunSubmitToolOutputsParams as RunSubmitToolOutputsParams, + type RunSubmitToolOutputsParamsNonStreaming as RunSubmitToolOutputsParamsNonStreaming, + type RunSubmitToolOutputsParamsStreaming as RunSubmitToolOutputsParamsStreaming, + type RunSubmitToolOutputsAndPollParams, + type RunSubmitToolOutputsStreamParams, + }; + + export { + Steps as Steps, + type CodeInterpreterLogs as CodeInterpreterLogs, + type CodeInterpreterOutputImage as CodeInterpreterOutputImage, + type CodeInterpreterToolCall as CodeInterpreterToolCall, + type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, + type FileSearchToolCall as FileSearchToolCall, + type FileSearchToolCallDelta as FileSearchToolCallDelta, + type FunctionToolCall as FunctionToolCall, + type FunctionToolCallDelta as FunctionToolCallDelta, + type MessageCreationStepDetails as MessageCreationStepDetails, + type RunStep as RunStep, + type RunStepDelta as RunStepDelta, + type RunStepDeltaEvent as RunStepDeltaEvent, + type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, + type RunStepInclude as RunStepInclude, + type ToolCall as ToolCall, + type ToolCallDelta as ToolCallDelta, + type ToolCallDeltaObject as ToolCallDeltaObject, + type ToolCallsStepDetails as ToolCallsStepDetails, + RunStepsPage as RunStepsPage, + type StepRetrieveParams as StepRetrieveParams, + type StepListParams as StepListParams, + }; } diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index c076191a3..b10bcb868 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -738,26 +738,30 @@ export interface StepListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export namespace Steps { - export import CodeInterpreterLogs = StepsAPI.CodeInterpreterLogs; - export import CodeInterpreterOutputImage = StepsAPI.CodeInterpreterOutputImage; - export import CodeInterpreterToolCall = StepsAPI.CodeInterpreterToolCall; - export import CodeInterpreterToolCallDelta = StepsAPI.CodeInterpreterToolCallDelta; - export import FileSearchToolCall = StepsAPI.FileSearchToolCall; - export import FileSearchToolCallDelta = StepsAPI.FileSearchToolCallDelta; - export import FunctionToolCall = StepsAPI.FunctionToolCall; - export import FunctionToolCallDelta = StepsAPI.FunctionToolCallDelta; - export import MessageCreationStepDetails = StepsAPI.MessageCreationStepDetails; - export import RunStep = StepsAPI.RunStep; - export import RunStepDelta = StepsAPI.RunStepDelta; - export import RunStepDeltaEvent = StepsAPI.RunStepDeltaEvent; - export import RunStepDeltaMessageDelta = StepsAPI.RunStepDeltaMessageDelta; - export import RunStepInclude = StepsAPI.RunStepInclude; - export import ToolCall = StepsAPI.ToolCall; - export import ToolCallDelta = StepsAPI.ToolCallDelta; - export import ToolCallDeltaObject = StepsAPI.ToolCallDeltaObject; - export import ToolCallsStepDetails = StepsAPI.ToolCallsStepDetails; - export import RunStepsPage = StepsAPI.RunStepsPage; - export import StepRetrieveParams = StepsAPI.StepRetrieveParams; - export import StepListParams = StepsAPI.StepListParams; +Steps.RunStepsPage = RunStepsPage; + +export declare namespace Steps { + export { + type CodeInterpreterLogs as CodeInterpreterLogs, + type CodeInterpreterOutputImage as CodeInterpreterOutputImage, + type CodeInterpreterToolCall as CodeInterpreterToolCall, + type CodeInterpreterToolCallDelta as CodeInterpreterToolCallDelta, + type FileSearchToolCall as FileSearchToolCall, + type FileSearchToolCallDelta as FileSearchToolCallDelta, + type FunctionToolCall as FunctionToolCall, + type FunctionToolCallDelta as FunctionToolCallDelta, + type MessageCreationStepDetails as MessageCreationStepDetails, + type RunStep as RunStep, + type RunStepDelta as RunStepDelta, + type RunStepDeltaEvent as RunStepDeltaEvent, + type RunStepDeltaMessageDelta as RunStepDeltaMessageDelta, + type RunStepInclude as RunStepInclude, + type ToolCall as ToolCall, + type ToolCallDelta as ToolCallDelta, + type ToolCallDeltaObject as ToolCallDeltaObject, + type ToolCallsStepDetails as ToolCallsStepDetails, + RunStepsPage as RunStepsPage, + type StepRetrieveParams as StepRetrieveParams, + type StepListParams as StepListParams, + }; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index be959eb30..899645508 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -10,8 +10,63 @@ import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import * as ChatAPI from '../../chat/chat'; import * as MessagesAPI from './messages'; +import { + Annotation, + AnnotationDelta, + FileCitationAnnotation, + FileCitationDeltaAnnotation, + FilePathAnnotation, + FilePathDeltaAnnotation, + ImageFile, + ImageFileContentBlock, + ImageFileDelta, + ImageFileDeltaBlock, + ImageURL, + ImageURLContentBlock, + ImageURLDelta, + ImageURLDeltaBlock, + Message as MessagesAPIMessage, + MessageContent, + MessageContentDelta, + MessageContentPartParam, + MessageCreateParams, + MessageDeleted, + MessageDelta, + MessageDeltaEvent, + MessageListParams, + MessageUpdateParams, + Messages, + MessagesPage, + RefusalContentBlock, + RefusalDeltaBlock, + Text, + TextContentBlock, + TextContentBlockParam, + TextDelta, + TextDeltaBlock, +} from './messages'; import * as VectorStoresAPI from '../vector-stores/vector-stores'; import * as RunsAPI from './runs/runs'; +import { + RequiredActionFunctionToolCall, + Run, + RunCreateAndPollParams, + RunCreateAndStreamParams, + RunCreateParams, + RunCreateParamsNonStreaming, + RunCreateParamsStreaming, + RunListParams, + RunStatus, + RunStreamParams, + RunSubmitToolOutputsAndPollParams, + RunSubmitToolOutputsParams, + RunSubmitToolOutputsParamsNonStreaming, + RunSubmitToolOutputsParamsStreaming, + RunSubmitToolOutputsStreamParams, + RunUpdateParams, + Runs, + RunsPage, +} from './runs/runs'; import { Stream } from '../../../streaming'; export class Threads extends APIResource { @@ -1489,69 +1544,82 @@ export namespace ThreadCreateAndRunStreamParams { } } -export namespace Threads { - export import AssistantResponseFormatOption = ThreadsAPI.AssistantResponseFormatOption; - export import AssistantToolChoice = ThreadsAPI.AssistantToolChoice; - export import AssistantToolChoiceFunction = ThreadsAPI.AssistantToolChoiceFunction; - export import AssistantToolChoiceOption = ThreadsAPI.AssistantToolChoiceOption; - export import Thread = ThreadsAPI.Thread; - export import ThreadDeleted = ThreadsAPI.ThreadDeleted; - export import ThreadCreateParams = ThreadsAPI.ThreadCreateParams; - export import ThreadUpdateParams = ThreadsAPI.ThreadUpdateParams; - export import ThreadCreateAndRunParams = ThreadsAPI.ThreadCreateAndRunParams; - export import ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; - export import ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; - export import ThreadCreateAndRunPollParams = ThreadsAPI.ThreadCreateAndRunPollParams; - export import ThreadCreateAndRunStreamParams = ThreadsAPI.ThreadCreateAndRunStreamParams; - export import Runs = RunsAPI.Runs; - export import RequiredActionFunctionToolCall = RunsAPI.RequiredActionFunctionToolCall; - export import Run = RunsAPI.Run; - export import RunStatus = RunsAPI.RunStatus; - export import RunsPage = RunsAPI.RunsPage; - export import RunCreateParams = RunsAPI.RunCreateParams; - export import RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; - export import RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; - export import RunUpdateParams = RunsAPI.RunUpdateParams; - export import RunListParams = RunsAPI.RunListParams; - export import RunCreateAndPollParams = RunsAPI.RunCreateAndPollParams; - export import RunCreateAndStreamParams = RunsAPI.RunCreateAndStreamParams; - export import RunStreamParams = RunsAPI.RunStreamParams; - export import RunSubmitToolOutputsParams = RunsAPI.RunSubmitToolOutputsParams; - export import RunSubmitToolOutputsParamsNonStreaming = RunsAPI.RunSubmitToolOutputsParamsNonStreaming; - export import RunSubmitToolOutputsParamsStreaming = RunsAPI.RunSubmitToolOutputsParamsStreaming; - export import RunSubmitToolOutputsAndPollParams = RunsAPI.RunSubmitToolOutputsAndPollParams; - export import RunSubmitToolOutputsStreamParams = RunsAPI.RunSubmitToolOutputsStreamParams; - export import Messages = MessagesAPI.Messages; - export import Annotation = MessagesAPI.Annotation; - export import AnnotationDelta = MessagesAPI.AnnotationDelta; - export import FileCitationAnnotation = MessagesAPI.FileCitationAnnotation; - export import FileCitationDeltaAnnotation = MessagesAPI.FileCitationDeltaAnnotation; - export import FilePathAnnotation = MessagesAPI.FilePathAnnotation; - export import FilePathDeltaAnnotation = MessagesAPI.FilePathDeltaAnnotation; - export import ImageFile = MessagesAPI.ImageFile; - export import ImageFileContentBlock = MessagesAPI.ImageFileContentBlock; - export import ImageFileDelta = MessagesAPI.ImageFileDelta; - export import ImageFileDeltaBlock = MessagesAPI.ImageFileDeltaBlock; - export import ImageURL = MessagesAPI.ImageURL; - export import ImageURLContentBlock = MessagesAPI.ImageURLContentBlock; - export import ImageURLDelta = MessagesAPI.ImageURLDelta; - export import ImageURLDeltaBlock = MessagesAPI.ImageURLDeltaBlock; - export import Message = MessagesAPI.Message; - export import MessageContent = MessagesAPI.MessageContent; - export import MessageContentDelta = MessagesAPI.MessageContentDelta; - export import MessageContentPartParam = MessagesAPI.MessageContentPartParam; - export import MessageDeleted = MessagesAPI.MessageDeleted; - export import MessageDelta = MessagesAPI.MessageDelta; - export import MessageDeltaEvent = MessagesAPI.MessageDeltaEvent; - export import RefusalContentBlock = MessagesAPI.RefusalContentBlock; - export import RefusalDeltaBlock = MessagesAPI.RefusalDeltaBlock; - export import Text = MessagesAPI.Text; - export import TextContentBlock = MessagesAPI.TextContentBlock; - export import TextContentBlockParam = MessagesAPI.TextContentBlockParam; - export import TextDelta = MessagesAPI.TextDelta; - export import TextDeltaBlock = MessagesAPI.TextDeltaBlock; - export import MessagesPage = MessagesAPI.MessagesPage; - export import MessageCreateParams = MessagesAPI.MessageCreateParams; - export import MessageUpdateParams = MessagesAPI.MessageUpdateParams; - export import MessageListParams = MessagesAPI.MessageListParams; +Threads.Runs = Runs; +Threads.RunsPage = RunsPage; +Threads.Messages = Messages; +Threads.MessagesPage = MessagesPage; + +export declare namespace Threads { + export { + type AssistantResponseFormatOption as AssistantResponseFormatOption, + type AssistantToolChoice as AssistantToolChoice, + type AssistantToolChoiceFunction as AssistantToolChoiceFunction, + type AssistantToolChoiceOption as AssistantToolChoiceOption, + type Thread as Thread, + type ThreadDeleted as ThreadDeleted, + type ThreadCreateParams as ThreadCreateParams, + type ThreadUpdateParams as ThreadUpdateParams, + type ThreadCreateAndRunParams as ThreadCreateAndRunParams, + type ThreadCreateAndRunParamsNonStreaming as ThreadCreateAndRunParamsNonStreaming, + type ThreadCreateAndRunParamsStreaming as ThreadCreateAndRunParamsStreaming, + type ThreadCreateAndRunPollParams, + type ThreadCreateAndRunStreamParams, + }; + + export { + Runs as Runs, + type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, + type Run as Run, + type RunStatus as RunStatus, + RunsPage as RunsPage, + type RunCreateParams as RunCreateParams, + type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, + type RunCreateParamsStreaming as RunCreateParamsStreaming, + type RunUpdateParams as RunUpdateParams, + type RunListParams as RunListParams, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, + type RunSubmitToolOutputsParams as RunSubmitToolOutputsParams, + type RunSubmitToolOutputsParamsNonStreaming as RunSubmitToolOutputsParamsNonStreaming, + type RunSubmitToolOutputsParamsStreaming as RunSubmitToolOutputsParamsStreaming, + type RunSubmitToolOutputsAndPollParams, + type RunSubmitToolOutputsStreamParams, + }; + + export { + Messages as Messages, + type Annotation as Annotation, + type AnnotationDelta as AnnotationDelta, + type FileCitationAnnotation as FileCitationAnnotation, + type FileCitationDeltaAnnotation as FileCitationDeltaAnnotation, + type FilePathAnnotation as FilePathAnnotation, + type FilePathDeltaAnnotation as FilePathDeltaAnnotation, + type ImageFile as ImageFile, + type ImageFileContentBlock as ImageFileContentBlock, + type ImageFileDelta as ImageFileDelta, + type ImageFileDeltaBlock as ImageFileDeltaBlock, + type ImageURL as ImageURL, + type ImageURLContentBlock as ImageURLContentBlock, + type ImageURLDelta as ImageURLDelta, + type ImageURLDeltaBlock as ImageURLDeltaBlock, + type MessagesAPIMessage as Message, + type MessageContent as MessageContent, + type MessageContentDelta as MessageContentDelta, + type MessageContentPartParam as MessageContentPartParam, + type MessageDeleted as MessageDeleted, + type MessageDelta as MessageDelta, + type MessageDeltaEvent as MessageDeltaEvent, + type RefusalContentBlock as RefusalContentBlock, + type RefusalDeltaBlock as RefusalDeltaBlock, + type Text as Text, + type TextContentBlock as TextContentBlock, + type TextContentBlockParam as TextContentBlockParam, + type TextDelta as TextDelta, + type TextDeltaBlock as TextDeltaBlock, + MessagesPage as MessagesPage, + type MessageCreateParams as MessageCreateParams, + type MessageUpdateParams as MessageUpdateParams, + type MessageListParams as MessageListParams, + }; } diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index 3436d7575..533e6ce03 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -6,7 +6,6 @@ import { sleep } from '../../../core'; import { Uploadable } from '../../../core'; import { allSettledWithThrow } from '../../../lib/Util'; import * as Core from '../../../core'; -import * as FileBatchesAPI from './file-batches'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; @@ -294,10 +293,12 @@ export interface FileBatchListFilesParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export namespace FileBatches { - export import VectorStoreFileBatch = FileBatchesAPI.VectorStoreFileBatch; - export import FileBatchCreateParams = FileBatchesAPI.FileBatchCreateParams; - export import FileBatchListFilesParams = FileBatchesAPI.FileBatchListFilesParams; +export declare namespace FileBatches { + export { + type VectorStoreFileBatch as VectorStoreFileBatch, + type FileBatchCreateParams as FileBatchCreateParams, + type FileBatchListFilesParams as FileBatchListFilesParams, + }; } export { VectorStoreFilesPage }; diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index f82cd63df..a263a0491 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { sleep, Uploadable, isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as FilesAPI from './files'; import * as VectorStoresAPI from './vector-stores'; import { CursorPage, type CursorPageParams } from '../../../pagination'; @@ -286,10 +285,14 @@ export interface FileListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export namespace Files { - export import VectorStoreFile = FilesAPI.VectorStoreFile; - export import VectorStoreFileDeleted = FilesAPI.VectorStoreFileDeleted; - export import VectorStoreFilesPage = FilesAPI.VectorStoreFilesPage; - export import FileCreateParams = FilesAPI.FileCreateParams; - export import FileListParams = FilesAPI.FileListParams; +Files.VectorStoreFilesPage = VectorStoreFilesPage; + +export declare namespace Files { + export { + type VectorStoreFile as VectorStoreFile, + type VectorStoreFileDeleted as VectorStoreFileDeleted, + VectorStoreFilesPage as VectorStoreFilesPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; } diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/beta/vector-stores/index.ts index f70215f8f..89fc0cde0 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/beta/vector-stores/index.ts @@ -1,32 +1,32 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AutoFileChunkingStrategyParam, - FileChunkingStrategy, - FileChunkingStrategyParam, - OtherFileChunkingStrategyObject, - StaticFileChunkingStrategy, - StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyParam, - VectorStore, - VectorStoreDeleted, - VectorStoreCreateParams, - VectorStoreUpdateParams, - VectorStoreListParams, - VectorStoresPage, - VectorStores, -} from './vector-stores'; + FileBatches, + type VectorStoreFileBatch, + type FileBatchCreateParams, + type FileBatchListFilesParams, +} from './file-batches'; export { - VectorStoreFile, - VectorStoreFileDeleted, - FileCreateParams, - FileListParams, VectorStoreFilesPage, Files, + type VectorStoreFile, + type VectorStoreFileDeleted, + type FileCreateParams, + type FileListParams, } from './files'; export { - VectorStoreFileBatch, - FileBatchCreateParams, - FileBatchListFilesParams, - FileBatches, -} from './file-batches'; + VectorStoresPage, + VectorStores, + type AutoFileChunkingStrategyParam, + type FileChunkingStrategy, + type FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyParam, + type VectorStore, + type VectorStoreDeleted, + type VectorStoreCreateParams, + type VectorStoreUpdateParams, + type VectorStoreListParams, +} from './vector-stores'; diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index 3c9aa707d..4d1e83dce 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -3,9 +3,22 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as VectorStoresAPI from './vector-stores'; import * as FileBatchesAPI from './file-batches'; +import { + FileBatchCreateParams, + FileBatchListFilesParams, + FileBatches, + VectorStoreFileBatch, +} from './file-batches'; import * as FilesAPI from './files'; +import { + FileCreateParams, + FileListParams, + Files, + VectorStoreFile, + VectorStoreFileDeleted, + VectorStoreFilesPage, +} from './files'; import { CursorPage, type CursorPageParams } from '../../../pagination'; export class VectorStores extends APIResource { @@ -371,28 +384,41 @@ export interface VectorStoreListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export namespace VectorStores { - export import AutoFileChunkingStrategyParam = VectorStoresAPI.AutoFileChunkingStrategyParam; - export import FileChunkingStrategy = VectorStoresAPI.FileChunkingStrategy; - export import FileChunkingStrategyParam = VectorStoresAPI.FileChunkingStrategyParam; - export import OtherFileChunkingStrategyObject = VectorStoresAPI.OtherFileChunkingStrategyObject; - export import StaticFileChunkingStrategy = VectorStoresAPI.StaticFileChunkingStrategy; - export import StaticFileChunkingStrategyObject = VectorStoresAPI.StaticFileChunkingStrategyObject; - export import StaticFileChunkingStrategyParam = VectorStoresAPI.StaticFileChunkingStrategyParam; - export import VectorStore = VectorStoresAPI.VectorStore; - export import VectorStoreDeleted = VectorStoresAPI.VectorStoreDeleted; - export import VectorStoresPage = VectorStoresAPI.VectorStoresPage; - export import VectorStoreCreateParams = VectorStoresAPI.VectorStoreCreateParams; - export import VectorStoreUpdateParams = VectorStoresAPI.VectorStoreUpdateParams; - export import VectorStoreListParams = VectorStoresAPI.VectorStoreListParams; - export import Files = FilesAPI.Files; - export import VectorStoreFile = FilesAPI.VectorStoreFile; - export import VectorStoreFileDeleted = FilesAPI.VectorStoreFileDeleted; - export import VectorStoreFilesPage = FilesAPI.VectorStoreFilesPage; - export import FileCreateParams = FilesAPI.FileCreateParams; - export import FileListParams = FilesAPI.FileListParams; - export import FileBatches = FileBatchesAPI.FileBatches; - export import VectorStoreFileBatch = FileBatchesAPI.VectorStoreFileBatch; - export import FileBatchCreateParams = FileBatchesAPI.FileBatchCreateParams; - export import FileBatchListFilesParams = FileBatchesAPI.FileBatchListFilesParams; +VectorStores.VectorStoresPage = VectorStoresPage; +VectorStores.Files = Files; +VectorStores.VectorStoreFilesPage = VectorStoreFilesPage; +VectorStores.FileBatches = FileBatches; + +export declare namespace VectorStores { + export { + type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, + type FileChunkingStrategy as FileChunkingStrategy, + type FileChunkingStrategyParam as FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy as StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type VectorStore as VectorStore, + type VectorStoreDeleted as VectorStoreDeleted, + VectorStoresPage as VectorStoresPage, + type VectorStoreCreateParams as VectorStoreCreateParams, + type VectorStoreUpdateParams as VectorStoreUpdateParams, + type VectorStoreListParams as VectorStoreListParams, + }; + + export { + Files as Files, + type VectorStoreFile as VectorStoreFile, + type VectorStoreFileDeleted as VectorStoreFileDeleted, + VectorStoreFilesPage as VectorStoreFilesPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; + + export { + FileBatches as FileBatches, + type VectorStoreFileBatch as VectorStoreFileBatch, + type FileBatchCreateParams as FileBatchCreateParams, + type FileBatchListFilesParams as FileBatchListFilesParams, + }; } diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 43ef5662c..afe4dd08e 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,8 +1,42 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as ChatAPI from './chat'; import * as CompletionsAPI from './completions'; +import { + ChatCompletion, + ChatCompletionAssistantMessageParam, + ChatCompletionAudio, + ChatCompletionAudioParam, + ChatCompletionChunk, + ChatCompletionContentPart, + ChatCompletionContentPartImage, + ChatCompletionContentPartInputAudio, + ChatCompletionContentPartRefusal, + ChatCompletionContentPartText, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + ChatCompletionFunctionCallOption, + ChatCompletionFunctionMessageParam, + ChatCompletionMessage, + ChatCompletionMessageParam, + ChatCompletionMessageToolCall, + ChatCompletionModality, + ChatCompletionNamedToolChoice, + ChatCompletionRole, + ChatCompletionStreamOptions, + ChatCompletionSystemMessageParam, + ChatCompletionTokenLogprob, + ChatCompletionTool, + ChatCompletionToolChoiceOption, + ChatCompletionToolMessageParam, + ChatCompletionUserMessageParam, + CompletionCreateParams, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + Completions, + CreateChatCompletionRequestMessage, +} from './completions'; export class Chat extends APIResource { completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client); @@ -43,42 +77,44 @@ export type ChatModel = | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-16k-0613'; -export namespace Chat { - export import ChatModel = ChatAPI.ChatModel; - export import Completions = CompletionsAPI.Completions; - export import ChatCompletion = CompletionsAPI.ChatCompletion; - export import ChatCompletionAssistantMessageParam = CompletionsAPI.ChatCompletionAssistantMessageParam; - export import ChatCompletionAudio = CompletionsAPI.ChatCompletionAudio; - export import ChatCompletionAudioParam = CompletionsAPI.ChatCompletionAudioParam; - export import ChatCompletionChunk = CompletionsAPI.ChatCompletionChunk; - export import ChatCompletionContentPart = CompletionsAPI.ChatCompletionContentPart; - export import ChatCompletionContentPartImage = CompletionsAPI.ChatCompletionContentPartImage; - export import ChatCompletionContentPartInputAudio = CompletionsAPI.ChatCompletionContentPartInputAudio; - export import ChatCompletionContentPartRefusal = CompletionsAPI.ChatCompletionContentPartRefusal; - export import ChatCompletionContentPartText = CompletionsAPI.ChatCompletionContentPartText; - export import ChatCompletionFunctionCallOption = CompletionsAPI.ChatCompletionFunctionCallOption; - export import ChatCompletionFunctionMessageParam = CompletionsAPI.ChatCompletionFunctionMessageParam; - export import ChatCompletionMessage = CompletionsAPI.ChatCompletionMessage; - export import ChatCompletionMessageParam = CompletionsAPI.ChatCompletionMessageParam; - export import ChatCompletionMessageToolCall = CompletionsAPI.ChatCompletionMessageToolCall; - export import ChatCompletionModality = CompletionsAPI.ChatCompletionModality; - export import ChatCompletionNamedToolChoice = CompletionsAPI.ChatCompletionNamedToolChoice; - export import ChatCompletionRole = CompletionsAPI.ChatCompletionRole; - export import ChatCompletionStreamOptions = CompletionsAPI.ChatCompletionStreamOptions; - export import ChatCompletionSystemMessageParam = CompletionsAPI.ChatCompletionSystemMessageParam; - export import ChatCompletionTokenLogprob = CompletionsAPI.ChatCompletionTokenLogprob; - export import ChatCompletionTool = CompletionsAPI.ChatCompletionTool; - export import ChatCompletionToolChoiceOption = CompletionsAPI.ChatCompletionToolChoiceOption; - export import ChatCompletionToolMessageParam = CompletionsAPI.ChatCompletionToolMessageParam; - export import ChatCompletionUserMessageParam = CompletionsAPI.ChatCompletionUserMessageParam; - /** - * @deprecated ChatCompletionMessageParam should be used instead - */ - export import CreateChatCompletionRequestMessage = CompletionsAPI.CreateChatCompletionRequestMessage; - export import ChatCompletionCreateParams = CompletionsAPI.ChatCompletionCreateParams; - export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; - export import ChatCompletionCreateParamsNonStreaming = CompletionsAPI.ChatCompletionCreateParamsNonStreaming; - export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; - export import ChatCompletionCreateParamsStreaming = CompletionsAPI.ChatCompletionCreateParamsStreaming; - export import CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming; +Chat.Completions = Completions; + +export declare namespace Chat { + export { type ChatModel as ChatModel }; + + export { + Completions as Completions, + type ChatCompletion as ChatCompletion, + type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, + type ChatCompletionAudio as ChatCompletionAudio, + type ChatCompletionAudioParam as ChatCompletionAudioParam, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatCompletionContentPart as ChatCompletionContentPart, + type ChatCompletionContentPartImage as ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, + type ChatCompletionMessage as ChatCompletionMessage, + type ChatCompletionMessageParam as ChatCompletionMessageParam, + type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, + type ChatCompletionModality as ChatCompletionModality, + type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStreamOptions as ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, + type ChatCompletionTool as ChatCompletionTool, + type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + type ChatCompletionCreateParams as ChatCompletionCreateParams, + type CompletionCreateParams as CompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index d439e9a25..430e52bb2 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1185,40 +1185,39 @@ export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreat */ export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreaming; -export namespace Completions { - export import ChatCompletion = ChatCompletionsAPI.ChatCompletion; - export import ChatCompletionAssistantMessageParam = ChatCompletionsAPI.ChatCompletionAssistantMessageParam; - export import ChatCompletionAudio = ChatCompletionsAPI.ChatCompletionAudio; - export import ChatCompletionAudioParam = ChatCompletionsAPI.ChatCompletionAudioParam; - export import ChatCompletionChunk = ChatCompletionsAPI.ChatCompletionChunk; - export import ChatCompletionContentPart = ChatCompletionsAPI.ChatCompletionContentPart; - export import ChatCompletionContentPartImage = ChatCompletionsAPI.ChatCompletionContentPartImage; - export import ChatCompletionContentPartInputAudio = ChatCompletionsAPI.ChatCompletionContentPartInputAudio; - export import ChatCompletionContentPartRefusal = ChatCompletionsAPI.ChatCompletionContentPartRefusal; - export import ChatCompletionContentPartText = ChatCompletionsAPI.ChatCompletionContentPartText; - export import ChatCompletionFunctionCallOption = ChatCompletionsAPI.ChatCompletionFunctionCallOption; - export import ChatCompletionFunctionMessageParam = ChatCompletionsAPI.ChatCompletionFunctionMessageParam; - export import ChatCompletionMessage = ChatCompletionsAPI.ChatCompletionMessage; - export import ChatCompletionMessageParam = ChatCompletionsAPI.ChatCompletionMessageParam; - export import ChatCompletionMessageToolCall = ChatCompletionsAPI.ChatCompletionMessageToolCall; - export import ChatCompletionModality = ChatCompletionsAPI.ChatCompletionModality; - export import ChatCompletionNamedToolChoice = ChatCompletionsAPI.ChatCompletionNamedToolChoice; - export import ChatCompletionRole = ChatCompletionsAPI.ChatCompletionRole; - export import ChatCompletionStreamOptions = ChatCompletionsAPI.ChatCompletionStreamOptions; - export import ChatCompletionSystemMessageParam = ChatCompletionsAPI.ChatCompletionSystemMessageParam; - export import ChatCompletionTokenLogprob = ChatCompletionsAPI.ChatCompletionTokenLogprob; - export import ChatCompletionTool = ChatCompletionsAPI.ChatCompletionTool; - export import ChatCompletionToolChoiceOption = ChatCompletionsAPI.ChatCompletionToolChoiceOption; - export import ChatCompletionToolMessageParam = ChatCompletionsAPI.ChatCompletionToolMessageParam; - export import ChatCompletionUserMessageParam = ChatCompletionsAPI.ChatCompletionUserMessageParam; - /** - * @deprecated ChatCompletionMessageParam should be used instead - */ - export import CreateChatCompletionRequestMessage = ChatCompletionsAPI.CreateChatCompletionRequestMessage; - export import ChatCompletionCreateParams = ChatCompletionsAPI.ChatCompletionCreateParams; - export import CompletionCreateParams = ChatCompletionsAPI.CompletionCreateParams; - export import ChatCompletionCreateParamsNonStreaming = ChatCompletionsAPI.ChatCompletionCreateParamsNonStreaming; - export import CompletionCreateParamsNonStreaming = ChatCompletionsAPI.CompletionCreateParamsNonStreaming; - export import ChatCompletionCreateParamsStreaming = ChatCompletionsAPI.ChatCompletionCreateParamsStreaming; - export import CompletionCreateParamsStreaming = ChatCompletionsAPI.CompletionCreateParamsStreaming; +export declare namespace Completions { + export { + type ChatCompletion as ChatCompletion, + type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, + type ChatCompletionAudio as ChatCompletionAudio, + type ChatCompletionAudioParam as ChatCompletionAudioParam, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatCompletionContentPart as ChatCompletionContentPart, + type ChatCompletionContentPartImage as ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, + type ChatCompletionMessage as ChatCompletionMessage, + type ChatCompletionMessageParam as ChatCompletionMessageParam, + type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, + type ChatCompletionModality as ChatCompletionModality, + type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStreamOptions as ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, + type ChatCompletionTool as ChatCompletionTool, + type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + type ChatCompletionCreateParams as ChatCompletionCreateParams, + type CompletionCreateParams as CompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; } diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index 22803e819..d9366bf74 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -1,38 +1,38 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Chat, type ChatModel } from './chat'; export { - ChatCompletion, - ChatCompletionAssistantMessageParam, - ChatCompletionAudio, - ChatCompletionAudioParam, - ChatCompletionChunk, - ChatCompletionContentPart, - ChatCompletionContentPartImage, - ChatCompletionContentPartInputAudio, - ChatCompletionContentPartRefusal, - ChatCompletionContentPartText, - ChatCompletionFunctionCallOption, - ChatCompletionFunctionMessageParam, - ChatCompletionMessage, - ChatCompletionMessageParam, - ChatCompletionMessageToolCall, - ChatCompletionModality, - ChatCompletionNamedToolChoice, - ChatCompletionRole, - ChatCompletionStreamOptions, - ChatCompletionSystemMessageParam, - ChatCompletionTokenLogprob, - ChatCompletionTool, - ChatCompletionToolChoiceOption, - ChatCompletionToolMessageParam, - ChatCompletionUserMessageParam, - CreateChatCompletionRequestMessage, - ChatCompletionCreateParams, - CompletionCreateParams, - ChatCompletionCreateParamsNonStreaming, - CompletionCreateParamsNonStreaming, - ChatCompletionCreateParamsStreaming, - CompletionCreateParamsStreaming, Completions, + type ChatCompletion, + type ChatCompletionAssistantMessageParam, + type ChatCompletionAudio, + type ChatCompletionAudioParam, + type ChatCompletionChunk, + type ChatCompletionContentPart, + type ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText, + type ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam, + type ChatCompletionMessage, + type ChatCompletionMessageParam, + type ChatCompletionMessageToolCall, + type ChatCompletionModality, + type ChatCompletionNamedToolChoice, + type ChatCompletionRole, + type ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob, + type ChatCompletionTool, + type ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam, + type CreateChatCompletionRequestMessage, + type ChatCompletionCreateParams, + type CompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming, + type CompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming, + type CompletionCreateParamsStreaming, } from './completions'; -export { ChatModel, Chat } from './chat'; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 7acd5d13f..94c4581a1 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -361,11 +361,13 @@ export interface CompletionCreateParamsStreaming extends CompletionCreateParamsB stream: true; } -export namespace Completions { - export import Completion = CompletionsAPI.Completion; - export import CompletionChoice = CompletionsAPI.CompletionChoice; - export import CompletionUsage = CompletionsAPI.CompletionUsage; - export import CompletionCreateParams = CompletionsAPI.CompletionCreateParams; - export import CompletionCreateParamsNonStreaming = CompletionsAPI.CompletionCreateParamsNonStreaming; - export import CompletionCreateParamsStreaming = CompletionsAPI.CompletionCreateParamsStreaming; +export declare namespace Completions { + export { + type Completion as Completion, + type CompletionChoice as CompletionChoice, + type CompletionUsage as CompletionUsage, + type CompletionCreateParams as CompletionCreateParams, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; } diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 6d8e670a7..e2b35f530 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as EmbeddingsAPI from './embeddings'; export class Embeddings extends APIResource { /** @@ -120,9 +119,11 @@ export interface EmbeddingCreateParams { user?: string; } -export namespace Embeddings { - export import CreateEmbeddingResponse = EmbeddingsAPI.CreateEmbeddingResponse; - export import Embedding = EmbeddingsAPI.Embedding; - export import EmbeddingModel = EmbeddingsAPI.EmbeddingModel; - export import EmbeddingCreateParams = EmbeddingsAPI.EmbeddingCreateParams; +export declare namespace Embeddings { + export { + type CreateEmbeddingResponse as CreateEmbeddingResponse, + type Embedding as Embedding, + type EmbeddingModel as EmbeddingModel, + type EmbeddingCreateParams as EmbeddingCreateParams, + }; } diff --git a/src/resources/files.ts b/src/resources/files.ts index ba01a9041..dec815a28 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -5,7 +5,6 @@ import { isRequestOptions } from '../core'; import { sleep } from '../core'; import { APIConnectionTimeoutError } from '../error'; import * as Core from '../core'; -import * as FilesAPI from './files'; import { Page } from '../pagination'; import { type Response } from '../_shims/index'; @@ -221,12 +220,16 @@ export interface FileListParams { purpose?: string; } -export namespace Files { - export import FileContent = FilesAPI.FileContent; - export import FileDeleted = FilesAPI.FileDeleted; - export import FileObject = FilesAPI.FileObject; - export import FilePurpose = FilesAPI.FilePurpose; - export import FileObjectsPage = FilesAPI.FileObjectsPage; - export import FileCreateParams = FilesAPI.FileCreateParams; - export import FileListParams = FilesAPI.FileListParams; +Files.FileObjectsPage = FileObjectsPage; + +export declare namespace Files { + export { + type FileContent as FileContent, + type FileDeleted as FileDeleted, + type FileObject as FileObject, + type FilePurpose as FilePurpose, + FileObjectsPage as FileObjectsPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; } diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index b1ba34ecf..df013c8ec 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -2,21 +2,40 @@ import { APIResource } from '../../resource'; import * as JobsAPI from './jobs/jobs'; +import { + FineTuningJob, + FineTuningJobEvent, + FineTuningJobEventsPage, + FineTuningJobIntegration, + FineTuningJobWandbIntegration, + FineTuningJobWandbIntegrationObject, + FineTuningJobsPage, + JobCreateParams, + JobListEventsParams, + JobListParams, + Jobs, +} from './jobs/jobs'; export class FineTuning extends APIResource { jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); } -export namespace FineTuning { - export import Jobs = JobsAPI.Jobs; - export import FineTuningJob = JobsAPI.FineTuningJob; - export import FineTuningJobEvent = JobsAPI.FineTuningJobEvent; - export import FineTuningJobIntegration = JobsAPI.FineTuningJobIntegration; - export import FineTuningJobWandbIntegration = JobsAPI.FineTuningJobWandbIntegration; - export import FineTuningJobWandbIntegrationObject = JobsAPI.FineTuningJobWandbIntegrationObject; - export import FineTuningJobsPage = JobsAPI.FineTuningJobsPage; - export import FineTuningJobEventsPage = JobsAPI.FineTuningJobEventsPage; - export import JobCreateParams = JobsAPI.JobCreateParams; - export import JobListParams = JobsAPI.JobListParams; - export import JobListEventsParams = JobsAPI.JobListEventsParams; +FineTuning.Jobs = Jobs; +FineTuning.FineTuningJobsPage = FineTuningJobsPage; +FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage; + +export declare namespace FineTuning { + export { + Jobs as Jobs, + type FineTuningJob as FineTuningJob, + type FineTuningJobEvent as FineTuningJobEvent, + type FineTuningJobIntegration as FineTuningJobIntegration, + type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, + type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, + FineTuningJobsPage as FineTuningJobsPage, + FineTuningJobEventsPage as FineTuningJobEventsPage, + type JobCreateParams as JobCreateParams, + type JobListParams as JobListParams, + type JobListEventsParams as JobListEventsParams, + }; } diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 1d8739a0a..4954406b8 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -2,15 +2,15 @@ export { FineTuning } from './fine-tuning'; export { - FineTuningJob, - FineTuningJobEvent, - FineTuningJobIntegration, - FineTuningJobWandbIntegration, - FineTuningJobWandbIntegrationObject, - JobCreateParams, - JobListParams, - JobListEventsParams, FineTuningJobsPage, FineTuningJobEventsPage, Jobs, + type FineTuningJob, + type FineTuningJobEvent, + type FineTuningJobIntegration, + type FineTuningJobWandbIntegration, + type FineTuningJobWandbIntegrationObject, + type JobCreateParams, + type JobListParams, + type JobListEventsParams, } from './jobs/index'; diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index 02896b26d..b3018ac5f 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as CheckpointsAPI from './checkpoints'; import { CursorPage, type CursorPageParams } from '../../../pagination'; export class Checkpoints extends APIResource { @@ -101,8 +100,12 @@ export namespace FineTuningJobCheckpoint { export interface CheckpointListParams extends CursorPageParams {} -export namespace Checkpoints { - export import FineTuningJobCheckpoint = CheckpointsAPI.FineTuningJobCheckpoint; - export import FineTuningJobCheckpointsPage = CheckpointsAPI.FineTuningJobCheckpointsPage; - export import CheckpointListParams = CheckpointsAPI.CheckpointListParams; +Checkpoints.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage; + +export declare namespace Checkpoints { + export { + type FineTuningJobCheckpoint as FineTuningJobCheckpoint, + FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, + type CheckpointListParams as CheckpointListParams, + }; } diff --git a/src/resources/fine-tuning/jobs/index.ts b/src/resources/fine-tuning/jobs/index.ts index 275c776e9..7a05b48b2 100644 --- a/src/resources/fine-tuning/jobs/index.ts +++ b/src/resources/fine-tuning/jobs/index.ts @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - FineTuningJob, - FineTuningJobEvent, - FineTuningJobIntegration, - FineTuningJobWandbIntegration, - FineTuningJobWandbIntegrationObject, - JobCreateParams, - JobListParams, - JobListEventsParams, + FineTuningJobCheckpointsPage, + Checkpoints, + type FineTuningJobCheckpoint, + type CheckpointListParams, +} from './checkpoints'; +export { FineTuningJobsPage, FineTuningJobEventsPage, Jobs, + type FineTuningJob, + type FineTuningJobEvent, + type FineTuningJobIntegration, + type FineTuningJobWandbIntegration, + type FineTuningJobWandbIntegrationObject, + type JobCreateParams, + type JobListParams, + type JobListEventsParams, } from './jobs'; -export { - FineTuningJobCheckpoint, - CheckpointListParams, - FineTuningJobCheckpointsPage, - Checkpoints, -} from './checkpoints'; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 54b5c4e6a..275fad869 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -3,8 +3,13 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as JobsAPI from './jobs'; import * as CheckpointsAPI from './checkpoints'; +import { + CheckpointListParams, + Checkpoints, + FineTuningJobCheckpoint, + FineTuningJobCheckpointsPage, +} from './checkpoints'; import { CursorPage, type CursorPageParams } from '../../../pagination'; export class Jobs extends APIResource { @@ -445,19 +450,29 @@ export interface JobListParams extends CursorPageParams {} export interface JobListEventsParams extends CursorPageParams {} -export namespace Jobs { - export import FineTuningJob = JobsAPI.FineTuningJob; - export import FineTuningJobEvent = JobsAPI.FineTuningJobEvent; - export import FineTuningJobIntegration = JobsAPI.FineTuningJobIntegration; - export import FineTuningJobWandbIntegration = JobsAPI.FineTuningJobWandbIntegration; - export import FineTuningJobWandbIntegrationObject = JobsAPI.FineTuningJobWandbIntegrationObject; - export import FineTuningJobsPage = JobsAPI.FineTuningJobsPage; - export import FineTuningJobEventsPage = JobsAPI.FineTuningJobEventsPage; - export import JobCreateParams = JobsAPI.JobCreateParams; - export import JobListParams = JobsAPI.JobListParams; - export import JobListEventsParams = JobsAPI.JobListEventsParams; - export import Checkpoints = CheckpointsAPI.Checkpoints; - export import FineTuningJobCheckpoint = CheckpointsAPI.FineTuningJobCheckpoint; - export import FineTuningJobCheckpointsPage = CheckpointsAPI.FineTuningJobCheckpointsPage; - export import CheckpointListParams = CheckpointsAPI.CheckpointListParams; +Jobs.FineTuningJobsPage = FineTuningJobsPage; +Jobs.FineTuningJobEventsPage = FineTuningJobEventsPage; +Jobs.Checkpoints = Checkpoints; +Jobs.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage; + +export declare namespace Jobs { + export { + type FineTuningJob as FineTuningJob, + type FineTuningJobEvent as FineTuningJobEvent, + type FineTuningJobIntegration as FineTuningJobIntegration, + type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, + type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, + FineTuningJobsPage as FineTuningJobsPage, + FineTuningJobEventsPage as FineTuningJobEventsPage, + type JobCreateParams as JobCreateParams, + type JobListParams as JobListParams, + type JobListEventsParams as JobListEventsParams, + }; + + export { + Checkpoints as Checkpoints, + type FineTuningJobCheckpoint as FineTuningJobCheckpoint, + FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, + type CheckpointListParams as CheckpointListParams, + }; } diff --git a/src/resources/images.ts b/src/resources/images.ts index fdd0b8881..f4d59b941 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as ImagesAPI from './images'; export class Images extends APIResource { /** @@ -207,11 +206,13 @@ export interface ImageGenerateParams { user?: string; } -export namespace Images { - export import Image = ImagesAPI.Image; - export import ImageModel = ImagesAPI.ImageModel; - export import ImagesResponse = ImagesAPI.ImagesResponse; - export import ImageCreateVariationParams = ImagesAPI.ImageCreateVariationParams; - export import ImageEditParams = ImagesAPI.ImageEditParams; - export import ImageGenerateParams = ImagesAPI.ImageGenerateParams; +export declare namespace Images { + export { + type Image as Image, + type ImageModel as ImageModel, + type ImagesResponse as ImagesResponse, + type ImageCreateVariationParams as ImageCreateVariationParams, + type ImageEditParams as ImageEditParams, + type ImageGenerateParams as ImageGenerateParams, + }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 15c5db77f..ad0302357 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -2,62 +2,62 @@ export * from './chat/index'; export * from './shared'; -export { AudioModel, AudioResponseFormat, Audio } from './audio/audio'; +export { Audio, type AudioModel, type AudioResponseFormat } from './audio/audio'; export { - Batch, - BatchError, - BatchRequestCounts, - BatchCreateParams, - BatchListParams, BatchesPage, Batches, + type Batch, + type BatchError, + type BatchRequestCounts, + type BatchCreateParams, + type BatchListParams, } from './batches'; export { Beta } from './beta/beta'; export { - Completion, - CompletionChoice, - CompletionUsage, - CompletionCreateParams, - CompletionCreateParamsNonStreaming, - CompletionCreateParamsStreaming, Completions, + type Completion, + type CompletionChoice, + type CompletionUsage, + type CompletionCreateParams, + type CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming, } from './completions'; export { - CreateEmbeddingResponse, - Embedding, - EmbeddingModel, - EmbeddingCreateParams, Embeddings, + type CreateEmbeddingResponse, + type Embedding, + type EmbeddingModel, + type EmbeddingCreateParams, } from './embeddings'; export { - FileContent, - FileDeleted, - FileObject, - FilePurpose, - FileCreateParams, - FileListParams, FileObjectsPage, Files, + type FileContent, + type FileDeleted, + type FileObject, + type FilePurpose, + type FileCreateParams, + type FileListParams, } from './files'; export { FineTuning } from './fine-tuning/fine-tuning'; export { - Image, - ImageModel, - ImagesResponse, - ImageCreateVariationParams, - ImageEditParams, - ImageGenerateParams, Images, + type Image, + type ImageModel, + type ImagesResponse, + type ImageCreateVariationParams, + type ImageEditParams, + type ImageGenerateParams, } from './images'; -export { Model, ModelDeleted, ModelsPage, Models } from './models'; +export { ModelsPage, Models, type Model, type ModelDeleted } from './models'; export { - Moderation, - ModerationImageURLInput, - ModerationModel, - ModerationMultiModalInput, - ModerationTextInput, - ModerationCreateResponse, - ModerationCreateParams, Moderations, + type Moderation, + type ModerationImageURLInput, + type ModerationModel, + type ModerationMultiModalInput, + type ModerationTextInput, + type ModerationCreateResponse, + type ModerationCreateParams, } from './moderations'; -export { Upload, UploadCreateParams, UploadCompleteParams, Uploads } from './uploads/uploads'; +export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from './uploads/uploads'; diff --git a/src/resources/models.ts b/src/resources/models.ts index 178915747..6d8cd5296 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as ModelsAPI from './models'; import { Page } from '../pagination'; export class Models extends APIResource { @@ -69,8 +68,8 @@ export interface ModelDeleted { object: string; } -export namespace Models { - export import Model = ModelsAPI.Model; - export import ModelDeleted = ModelsAPI.ModelDeleted; - export import ModelsPage = ModelsAPI.ModelsPage; +Models.ModelsPage = ModelsPage; + +export declare namespace Models { + export { type Model as Model, type ModelDeleted as ModelDeleted, ModelsPage as ModelsPage }; } diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index ba800509e..cdde12a62 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -import * as ModerationsAPI from './moderations'; export class Moderations extends APIResource { /** @@ -357,12 +356,14 @@ export interface ModerationCreateParams { model?: (string & {}) | ModerationModel; } -export namespace Moderations { - export import Moderation = ModerationsAPI.Moderation; - export import ModerationImageURLInput = ModerationsAPI.ModerationImageURLInput; - export import ModerationModel = ModerationsAPI.ModerationModel; - export import ModerationMultiModalInput = ModerationsAPI.ModerationMultiModalInput; - export import ModerationTextInput = ModerationsAPI.ModerationTextInput; - export import ModerationCreateResponse = ModerationsAPI.ModerationCreateResponse; - export import ModerationCreateParams = ModerationsAPI.ModerationCreateParams; +export declare namespace Moderations { + export { + type Moderation as Moderation, + type ModerationImageURLInput as ModerationImageURLInput, + type ModerationModel as ModerationModel, + type ModerationMultiModalInput as ModerationMultiModalInput, + type ModerationTextInput as ModerationTextInput, + type ModerationCreateResponse as ModerationCreateResponse, + type ModerationCreateParams as ModerationCreateParams, + }; } diff --git a/src/resources/uploads/index.ts b/src/resources/uploads/index.ts index 1a353d312..200d3567e 100644 --- a/src/resources/uploads/index.ts +++ b/src/resources/uploads/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Upload, UploadCreateParams, UploadCompleteParams, Uploads } from './uploads'; -export { UploadPart, PartCreateParams, Parts } from './parts'; +export { Parts, type UploadPart, type PartCreateParams } from './parts'; +export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from './uploads'; diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index a4af5c606..9b54c99e6 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PartsAPI from './parts'; export class Parts extends APIResource { /** @@ -62,7 +61,6 @@ export interface PartCreateParams { data: Core.Uploadable; } -export namespace Parts { - export import UploadPart = PartsAPI.UploadPart; - export import PartCreateParams = PartsAPI.PartCreateParams; +export declare namespace Parts { + export { type UploadPart as UploadPart, type PartCreateParams as PartCreateParams }; } diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 1c3ed708d..78fa3a7b5 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -2,9 +2,9 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as UploadsAPI from './uploads'; import * as FilesAPI from '../files'; import * as PartsAPI from './parts'; +import { PartCreateParams, Parts, UploadPart } from './parts'; export class Uploads extends APIResource { parts: PartsAPI.Parts = new PartsAPI.Parts(this._client); @@ -159,11 +159,14 @@ export interface UploadCompleteParams { md5?: string; } -export namespace Uploads { - export import Upload = UploadsAPI.Upload; - export import UploadCreateParams = UploadsAPI.UploadCreateParams; - export import UploadCompleteParams = UploadsAPI.UploadCompleteParams; - export import Parts = PartsAPI.Parts; - export import UploadPart = PartsAPI.UploadPart; - export import PartCreateParams = PartsAPI.PartCreateParams; +Uploads.Parts = Parts; + +export declare namespace Uploads { + export { + type Upload as Upload, + type UploadCreateParams as UploadCreateParams, + type UploadCompleteParams as UploadCompleteParams, + }; + + export { Parts as Parts, type UploadPart as UploadPart, type PartCreateParams as PartCreateParams }; } diff --git a/tsconfig.json b/tsconfig.json index 5f99085fc..09a702fca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "openai/_shims/auto/*": ["src/_shims/auto/*-node"], "openai/*": ["src/*"], - "openai": ["src/index.ts"], + "openai": ["src/index.ts"] }, "noEmit": true, From 362d868426e5777183a52da8df432fa34f722442 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 1 Nov 2024 16:54:12 +0000 Subject: [PATCH 016/509] feat: publish to jsr (#1165) --- .github/workflows/create-releases.yml | 22 +-- .github/workflows/publish-deno.yml | 44 ----- .github/workflows/publish-jsr.yml | 30 ++++ .gitignore | 2 +- README.md | 6 +- bin/publish-jsr | 11 ++ jsr.json | 8 + release-please-config.json | 2 +- scripts/build-deno | 41 +---- scripts/git-publish-deno.sh | 77 --------- scripts/utils/denoify.ts | 226 -------------------------- src/core.ts | 10 +- src/error.ts | 2 +- src/index.ts | 28 ++-- src/streaming.ts | 4 +- tsconfig.deno.json | 11 +- tsconfig.json | 1 + 17 files changed, 88 insertions(+), 437 deletions(-) delete mode 100644 .github/workflows/publish-deno.yml create mode 100644 .github/workflows/publish-jsr.yml create mode 100644 bin/publish-jsr create mode 100644 jsr.json delete mode 100755 scripts/git-publish-deno.sh delete mode 100644 scripts/utils/denoify.ts diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index d5ae1f755..3a753b31c 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -22,27 +22,12 @@ jobs: repo: ${{ github.event.repository.full_name }} stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} - - name: Generate a token - id: generate_token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: 'openai' - repositories: 'openai-node,openai-deno-build' - - name: Set up Node if: ${{ steps.release.outputs.releases_created }} uses: actions/setup-node@v3 with: node-version: '18' - - name: Set up Deno - if: ${{ steps.release.outputs.releases_created }} - uses: denoland/setup-deno@v1 - with: - deno-version: v1.35.1 - - name: Install dependencies if: ${{ steps.release.outputs.releases_created }} run: | @@ -55,11 +40,8 @@ jobs: env: NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} - - name: Publish to Deno + - name: Publish to JSR if: ${{ steps.release.outputs.releases_created }} run: | - bash ./scripts/git-publish-deno.sh - env: - DENO_PUSH_REMOTE_URL: https://username:${{ steps.generate_token.outputs.token }}@github.com/openai/openai-deno-build.git - DENO_PUSH_BRANCH: main + bash ./bin/publish-jsr diff --git a/.github/workflows/publish-deno.yml b/.github/workflows/publish-deno.yml deleted file mode 100644 index 894c516a0..000000000 --- a/.github/workflows/publish-deno.yml +++ /dev/null @@ -1,44 +0,0 @@ -# workflow for re-running publishing to Deno in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-deno.yml -name: Publish Deno -on: - workflow_dispatch: - -jobs: - publish: - name: publish - runs-on: ubuntu-latest - environment: publish - - steps: - - uses: actions/checkout@v4 - - - name: Generate a token - id: generate_token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.APP_ID }} - private-key: ${{ secrets.APP_PRIVATE_KEY }} - owner: 'openai' - repositories: 'openai-node,openai-deno-build' - - - name: Set up Node - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Set up Deno - uses: denoland/setup-deno@v1 - with: - deno-version: v1.35.1 - - - name: Install dependencies - run: | - yarn install - - - name: Publish to Deno - run: | - bash ./scripts/git-publish-deno.sh - env: - DENO_PUSH_REMOTE_URL: https://username:${{ steps.generate_token.outputs.token }}@github.com/openai/openai-deno-build.git - DENO_PUSH_BRANCH: main diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml new file mode 100644 index 000000000..1e46d6bfb --- /dev/null +++ b/.github/workflows/publish-jsr.yml @@ -0,0 +1,30 @@ +# workflow for re-running publishing to JSR in case it fails for some reason +# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml +name: Publish JSR +on: + workflow_dispatch: + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + environment: publish + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + run: | + yarn install + + - name: Publish to JSR + run: | + bash ./bin/publish-jsr diff --git a/.gitignore b/.gitignore index 0af7568e5..81c4c41ca 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ yarn-error.log codegen.log Brewfile.lock.json dist -/deno +dist-deno /*.tgz .idea/ tmp diff --git a/README.md b/README.md index 776ea4049..caa3f9d4a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenAI Node API Library -[![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) +[![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript. @@ -14,12 +14,12 @@ To learn how to use the OpenAI API, check out our [API Reference](https://platfo npm install openai ``` -You can import in Deno via: +You can also import from jsr: ```ts -import OpenAI from 'https://deno.land/x/openai@v4.69.0/mod.ts'; +import OpenAI from 'jsr:@openai/openai'; ``` diff --git a/bin/publish-jsr b/bin/publish-jsr new file mode 100644 index 000000000..1b7365087 --- /dev/null +++ b/bin/publish-jsr @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -eux + +# Build the project +yarn build + +# Navigate to the dist directory +cd dist-deno + +npx jsr publish ${JSR_TOKEN:+"--token=$JSR_TOKEN"} diff --git a/jsr.json b/jsr.json new file mode 100644 index 000000000..fefb5b291 --- /dev/null +++ b/jsr.json @@ -0,0 +1,8 @@ +{ + "name": "@openai/openai", + "version": "4.47.1", + "exports": "./index.ts", + "publish": { + "exclude": ["!."] + } +} diff --git a/release-please-config.json b/release-please-config.json index 0a9347796..377a76e99 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -63,6 +63,6 @@ "extra-files": [ "src/version.ts", "README.md", - "scripts/build-deno" + "jsr.json" ] } diff --git a/scripts/build-deno b/scripts/build-deno index be17942df..7d542cf24 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -4,47 +4,16 @@ set -exuo pipefail cd "$(dirname "$0")/.." -rm -rf deno; mkdir deno -cp -rp src/* deno +rm -rf dist-deno; mkdir dist-deno +cp -rp src/* jsr.json dist-deno -# x-release-please-start-version -cat << EOF > deno/README.md -# OpenAI Node API Library - Deno build - -This is a build produced from https://github.com/openai/openai-node – please go there to read the source and docs, file issues, etc. - -Usage: - -\`\`\`ts -import OpenAI from "https://deno.land/x/openai@v4.69.0/mod.ts"; - -const client = new OpenAI(); -\`\`\` - -Note that in most Deno environments, you can also do this: - -\`\`\`ts -import OpenAI from "npm:openai"; -\`\`\` -EOF -# x-release-please-end - -rm deno/_shims/auto/*-node.ts -for dir in deno/_shims deno/_shims/auto; do +rm dist-deno/_shims/auto/*-node.ts +for dir in dist-deno/_shims dist-deno/_shims/auto; do rm "${dir}"/*.{d.ts,js,mjs} for file in "${dir}"/*-deno.ts; do mv -- "$file" "${file%-deno.ts}.ts" done done for file in LICENSE CHANGELOG.md; do - if [ -e "${file}" ]; then cp "${file}" deno; fi + if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done -npm exec ts-node -T -- scripts/utils/denoify.ts -deno fmt deno -deno check deno/mod.ts -if [ -e deno_tests ]; then - deno test deno_tests --allow-env -fi - -# make sure that nothing crashes when we load the Deno module -(cd deno && deno run mod.ts) diff --git a/scripts/git-publish-deno.sh b/scripts/git-publish-deno.sh deleted file mode 100755 index 701db735e..000000000 --- a/scripts/git-publish-deno.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash - -set -exuo pipefail - -cd "$(dirname "$0")/.." - -# This script pushes the contents of the `deno` directory to the `deno` branch, -# and creates a `vx.x.x-deno` tag, so that Deno users can -# import OpenAI from "https://raw.githubusercontent.com/openai/openai-node/vx.x.x-deno/mod.ts" - -# It's also possible to publish to deno.land. You can do this by: -# - Creating a separate GitHub repo -# - Add the deno.land webhook to the repo as described at https://deno.com/add_module -# - Set the following environment variables when running this script: -# - DENO_PUSH_REMOTE_URL - the remote url of the separate GitHub repo -# - DENO_PUSH_BRANCH - the branch you want to push to in that repo (probably `main`) -# - DENO_MAIN_BRANCH - the branch you want as the main branch in that repo (probably `main`, sometimes `master`) -# - DENO_PUSH_VERSION - defaults to version in package.json -# - DENO_PUSH_RELEASE_TAG - defaults to v$DENO_PUSH_VERSION-deno - -die () { - echo >&2 "$@" - exit 1 -} - -# Allow caller to set the following environment variables, but provide defaults -# if unset -# : "${FOO:=bar}" sets FOO=bar unless it's set and non-empty -# https://stackoverflow.com/questions/307503/whats-a-concise-way-to-check-that-environment-variables-are-set-in-a-unix-shell -# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html - -: "${DENO_PUSH_VERSION:=$(node -p 'require("./package.json").version')}" -: "${DENO_PUSH_BRANCH:=deno}" -: "${DENO_MAIN_BRANCH:=main}" -: "${DENO_PUSH_REMOTE_URL:=$(git remote get-url origin)}" -: "${DENO_GIT_USER_NAME:="Stainless Bot"}" -: "${DENO_GIT_USER_EMAIL:="bot@stainlessapi.com"}" -if [[ $DENO_PUSH_BRANCH = "deno" ]]; then - : "${DENO_PUSH_RELEASE_TAG:="v$DENO_PUSH_VERSION-deno"}" -else - : "${DENO_PUSH_RELEASE_TAG:="v$DENO_PUSH_VERSION"}" -fi - -if [ ! -e deno ]; then ./scripts/build; fi - -# We want to commit and push a branch where everything inside the deno -# directory is at root level in the branch. - -# We can do this by temporarily creating a git repository inside deno, -# committing files to the branch, and pushing it to the remote. - -cd deno -rm -rf .git -git init -b "$DENO_MAIN_BRANCH" -git remote add origin "$DENO_PUSH_REMOTE_URL" -if git fetch origin "$DENO_PUSH_RELEASE_TAG"; then - die "Tag $DENO_PUSH_RELEASE_TAG already exists" -fi -if git fetch origin "$DENO_PUSH_BRANCH"; then - # the branch already exists on the remote; "check out" the branch without - # changing files in the working directory - git branch "$DENO_PUSH_BRANCH" -t origin/"$DENO_PUSH_BRANCH" - git symbolic-ref HEAD refs/heads/"$DENO_PUSH_BRANCH" - git reset -else - # the branch doesn't exist on the remote yet - git checkout -b "$DENO_PUSH_BRANCH" -fi - -git config user.email "$DENO_GIT_USER_EMAIL" -git config user.name "$DENO_GIT_USER_NAME" - -git add . -git commit -m "chore(deno): release $DENO_PUSH_VERSION" -git tag -a "$DENO_PUSH_RELEASE_TAG" -m "release $DENO_PUSH_VERSION" -git push --tags --set-upstream origin "$DENO_PUSH_BRANCH" -rm -rf .git diff --git a/scripts/utils/denoify.ts b/scripts/utils/denoify.ts deleted file mode 100644 index 52705802a..000000000 --- a/scripts/utils/denoify.ts +++ /dev/null @@ -1,226 +0,0 @@ -import path from 'path'; -import * as tm from 'ts-morph'; -import { name as pkgName } from '../../package.json'; -import fs from 'fs'; - -const rootDir = path.resolve(__dirname, '../..'); -const denoDir = path.join(rootDir, 'deno'); -const tsConfigFilePath = path.join(rootDir, 'tsconfig.deno.json'); - -async function denoify() { - const project = new tm.Project({ tsConfigFilePath }); - - for (const file of project.getSourceFiles()) { - if (!file.getFilePath().startsWith(denoDir + '/')) continue; - - let addedBuffer = false, - addedProcess = false; - file.forEachDescendant((node) => { - switch (node.getKind()) { - case tm.ts.SyntaxKind.ExportDeclaration: { - const decl: tm.ExportDeclaration = node as any; - if (decl.isTypeOnly()) return; - for (const named of decl.getNamedExports()) { - // Convert `export { Foo } from './foo.ts'` - // to `export { type Foo } from './foo.ts'` - // if `./foo.ts` only exports types for `Foo` - if (!named.isTypeOnly() && !hasValueDeclarations(named)) { - named.replaceWithText(`type ${named.getText()}`); - } - } - break; - } - case tm.ts.SyntaxKind.ImportEqualsDeclaration: { - const decl: tm.ImportEqualsDeclaration = node as any; - if (decl.isTypeOnly()) return; - - const ref = decl.getModuleReference(); - if (!hasValueDeclarations(ref)) { - const params = isBuiltinType(ref.getType()) ? [] : ref.getType().getTypeArguments(); - if (params.length) { - const paramsStr = params.map((p: tm.TypeParameter) => p.getText()).join(', '); - const bindingsStr = params - .map((p: tm.TypeParameter) => p.getSymbol()?.getName() || p.getText()) - .join(', '); - decl.replaceWithText( - `export type ${decl.getName()}<${paramsStr}> = ${ref.getText()}<${bindingsStr}>`, - ); - } else { - decl.replaceWithText(`export type ${decl.getName()} = ${ref.getText()}`); - } - } - break; - } - case tm.ts.SyntaxKind.Identifier: { - const id = node as tm.Identifier; - if (!addedBuffer && id.getText() === 'Buffer') { - addedBuffer = true; - file?.addVariableStatement({ - declarations: [ - { - name: 'Buffer', - type: 'any', - }, - ], - hasDeclareKeyword: true, - }); - file?.addTypeAlias({ - name: 'Buffer', - type: 'any', - }); - } - if (!addedProcess && id.getText() === 'process') { - addedProcess = true; - file?.addVariableStatement({ - declarations: [ - { - name: 'process', - type: 'any', - }, - ], - hasDeclareKeyword: true, - }); - } - } - } - }); - } - - await project.save(); - - for (const file of project.getSourceFiles()) { - if (!file.getFilePath().startsWith(denoDir + '/')) continue; - for (const decl of [...file.getImportDeclarations(), ...file.getExportDeclarations()]) { - const moduleSpecifier = decl.getModuleSpecifier(); - if (!moduleSpecifier) continue; - let specifier = moduleSpecifier.getLiteralValue().replace(/^node:/, ''); - if (!specifier || specifier.startsWith('http')) continue; - - if (nodeStdModules.has(specifier)) { - // convert node builtins to deno.land/std - specifier = `https://deno.land/std@0.177.0/node/${specifier}.ts`; - } else if (specifier.startsWith(pkgName + '/')) { - // convert self-referencing module specifiers to relative paths - specifier = file.getRelativePathAsModuleSpecifierTo(denoDir + specifier.substring(pkgName.length)); - } else if (!decl.isModuleSpecifierRelative()) { - specifier = `npm:${specifier}`; - } - - if (specifier.startsWith('./') || specifier.startsWith('../')) { - // there may be CJS directory module specifiers that implicitly resolve - // to /index.ts. Add an explicit /index.ts to the end - const sourceFile = decl.getModuleSpecifierSourceFile(); - if (sourceFile && /\/index\.ts$/.test(sourceFile.getFilePath()) && !/\/mod\.ts$/.test(specifier)) { - if (/\/index(\.ts)?$/.test(specifier)) { - specifier = specifier.replace(/\/index(\.ts)?$/, '/mod.ts'); - } else { - specifier += '/mod.ts'; - } - } - // add explicit .ts file extensions to relative module specifiers - specifier = specifier.replace(/(\.[^./]*)?$/, '.ts'); - } - moduleSpecifier.replaceWithText(JSON.stringify(specifier)); - } - } - - await project.save(); - - await Promise.all( - project.getSourceFiles().map(async (f) => { - const filePath = f.getFilePath(); - if (filePath.endsWith('index.ts')) { - const newPath = filePath.replace(/index\.ts$/, 'mod.ts'); - await fs.promises.rename(filePath, newPath); - } - }), - ); -} - -const nodeStdModules = new Set([ - 'assert', - 'assertion_error', - 'async_hooks', - 'buffer', - 'child_process', - 'cluster', - 'console', - 'constants', - 'crypto', - 'dgram', - 'diagnostics_channel', - 'dns', - 'domain', - 'events', - 'fs', - 'global', - 'http', - 'http2', - 'https', - 'inspector', - 'module_all', - 'module_esm', - 'module', - 'net', - 'os', - 'path', - 'perf_hooks', - 'process', - 'punycode', - 'querystring', - 'readline', - 'repl', - 'stream', - 'string_decoder', - 'sys', - 'timers', - 'tls', - 'tty', - 'upstream_modules', - 'url', - 'util', - 'v8', - 'vm', - 'wasi', - 'worker_threads', - 'zlib', -]); - -const typeDeclarationKinds = new Set([ - tm.ts.SyntaxKind.InterfaceDeclaration, - tm.ts.SyntaxKind.ModuleDeclaration, - tm.ts.SyntaxKind.TypeAliasDeclaration, -]); - -const builtinTypeNames = new Set(['Array', 'Set', 'Map', 'Record', 'Promise']); - -function isBuiltinType(type: tm.Type): boolean { - const symbol = type.getSymbol(); - return ( - symbol != null && - builtinTypeNames.has(symbol.getName()) && - symbol.getDeclarations().some((d) => d.getSourceFile().getFilePath().includes('node_modules/typescript')) - ); -} - -function hasValueDeclarations(nodes?: tm.Node): boolean; -function hasValueDeclarations(nodes?: tm.Node[]): boolean; -function hasValueDeclarations(nodes?: tm.Node | tm.Node[]): boolean { - if (nodes && !Array.isArray(nodes)) { - return ( - !isBuiltinType(nodes.getType()) && hasValueDeclarations(nodes.getType().getSymbol()?.getDeclarations()) - ); - } - return nodes ? - nodes.some((n) => { - const parent = n.getParent(); - return ( - !typeDeclarationKinds.has(n.getKind()) && - // sometimes the node will be the right hand side of a type alias - (!parent || !typeDeclarationKinds.has(parent.getKind())) - ); - }) - : false; -} - -denoify(); diff --git a/src/core.ts b/src/core.ts index 9d90178ab..0c8e69ffc 100644 --- a/src/core.ts +++ b/src/core.ts @@ -431,7 +431,7 @@ export abstract class APIClient { error: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { return APIError.generate(status, error, message, headers); } @@ -703,9 +703,9 @@ export abstract class AbstractPage implements AsyncIterable { return await this.#client.requestAPIList(this.constructor as any, nextOptions); } - async *iterPages() { + async *iterPages(): AsyncGenerator { // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: AbstractPage = this; + let page: this = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); @@ -713,7 +713,7 @@ export abstract class AbstractPage implements AsyncIterable { } } - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; @@ -762,7 +762,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; diff --git a/src/error.ts b/src/error.ts index 87eeea046..72b4f7bfd 100644 --- a/src/error.ts +++ b/src/error.ts @@ -59,7 +59,7 @@ export class APIError extends OpenAIError { errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { if (!status) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } diff --git a/src/index.ts b/src/index.ts index c1506997b..33b0848e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -305,19 +305,21 @@ export class OpenAI extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const OpenAIError = Errors.OpenAIError; -export const APIError = Errors.APIError; -export const APIConnectionError = Errors.APIConnectionError; -export const APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; -export const APIUserAbortError = Errors.APIUserAbortError; -export const NotFoundError = Errors.NotFoundError; -export const ConflictError = Errors.ConflictError; -export const RateLimitError = Errors.RateLimitError; -export const BadRequestError = Errors.BadRequestError; -export const AuthenticationError = Errors.AuthenticationError; -export const InternalServerError = Errors.InternalServerError; -export const PermissionDeniedError = Errors.PermissionDeniedError; -export const UnprocessableEntityError = Errors.UnprocessableEntityError; +export { + OpenAIError, + APIError, + APIConnectionError, + APIConnectionTimeoutError, + APIUserAbortError, + NotFoundError, + ConflictError, + RateLimitError, + BadRequestError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, +} from './error'; export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; diff --git a/src/streaming.ts b/src/streaming.ts index 597ee89fa..b48f3ff1d 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -22,7 +22,7 @@ export class Stream implements AsyncIterable { this.controller = controller; } - static fromSSEResponse(response: Response, controller: AbortController) { + static fromSSEResponse(response: Response, controller: AbortController): Stream { let consumed = false; async function* iterator(): AsyncIterator { @@ -90,7 +90,7 @@ export class Stream implements AsyncIterable { * Generates a Stream from a newline-separated ReadableStream * where each item is a JSON value. */ - static fromReadableStream(readableStream: ReadableStream, controller: AbortController) { + static fromReadableStream(readableStream: ReadableStream, controller: AbortController): Stream { let consumed = false; async function* iterLines(): AsyncGenerator { diff --git a/tsconfig.deno.json b/tsconfig.deno.json index d0e9473d9..849e070db 100644 --- a/tsconfig.deno.json +++ b/tsconfig.deno.json @@ -1,19 +1,14 @@ { "extends": "./tsconfig.json", - "include": ["deno"], + "include": ["dist-deno"], "exclude": [], "compilerOptions": { - "rootDir": "./deno", + "rootDir": "./dist-deno", "lib": ["es2020", "DOM"], - "paths": { - "openai/_shims/auto/*": ["deno/_shims/auto/*-deno"], - "openai/*": ["deno/*"], - "openai": ["deno/index.ts"], - }, "noEmit": true, "declaration": true, "declarationMap": true, - "outDir": "deno", + "outDir": "dist-deno", "pretty": true, "sourceMap": true } diff --git a/tsconfig.json b/tsconfig.json index 09a702fca..33767f7b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,6 +32,7 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, + "isolatedModules": true, "skipLibCheck": true } From 1c1417ef15f0f7d718773447e338b429c7871723 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 1 Nov 2024 16:57:31 +0000 Subject: [PATCH 017/509] chore(internal): fix isolated modules exports --- src/resources/beta/chat/completions.ts | 34 ++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index 03ea0aab5..c9360a95c 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -3,29 +3,14 @@ import * as Core from '../../../core'; import { APIResource } from '../../../resource'; import { ChatCompletionRunner, ChatCompletionFunctionRunnerParams } from '../../../lib/ChatCompletionRunner'; -export { ChatCompletionRunner, ChatCompletionFunctionRunnerParams } from '../../../lib/ChatCompletionRunner'; import { ChatCompletionStreamingRunner, ChatCompletionStreamingFunctionRunnerParams, } from '../../../lib/ChatCompletionStreamingRunner'; -export { - ChatCompletionStreamingRunner, - ChatCompletionStreamingFunctionRunnerParams, -} from '../../../lib/ChatCompletionStreamingRunner'; import { BaseFunctionsArgs } from '../../../lib/RunnableFunction'; -export { - RunnableFunction, - RunnableFunctions, - RunnableFunctionWithParse, - RunnableFunctionWithoutParse, - ParsingFunction, - ParsingToolFunction, -} from '../../../lib/RunnableFunction'; import { RunnerOptions } from '../../../lib/AbstractChatCompletionRunner'; import { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; -export { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; import { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; -export { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; import { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; import { ChatCompletion, @@ -34,7 +19,26 @@ import { ChatCompletionMessageToolCall, } from '../../chat/completions'; import { ExtractParsedContentFromParams, parseChatCompletion, validateInputTools } from '../../../lib/parser'; + +export { + ChatCompletionStreamingRunner, + type ChatCompletionStreamingFunctionRunnerParams, +} from '../../../lib/ChatCompletionStreamingRunner'; +export { + type RunnableFunction, + type RunnableFunctions, + type RunnableFunctionWithParse, + type RunnableFunctionWithoutParse, + ParsingFunction, + ParsingToolFunction, +} from '../../../lib/RunnableFunction'; +export { type ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; +export { type ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; export { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; +export { + ChatCompletionRunner, + type ChatCompletionFunctionRunnerParams, +} from '../../../lib/ChatCompletionRunner'; export interface ParsedFunction extends ChatCompletionMessageToolCall.Function { parsed_arguments?: unknown; From f5260ff160cec852f58ff92300d473c05b53f02e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:58:17 +0000 Subject: [PATCH 018/509] release: 4.70.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65aac9575..d07bcaba7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.69.0" + ".": "4.70.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b3b52aaa3..3f355b2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.70.0 (2024-11-01) + +Full Changelog: [v4.69.0...v4.70.0](https://github.com/openai/openai-node/compare/v4.69.0...v4.70.0) + +### Features + +* publish to jsr ([#1165](https://github.com/openai/openai-node/issues/1165)) ([5aa93a7](https://github.com/openai/openai-node/commit/5aa93a7fe704ef1ad077787852db38dc29104534)) + + +### Chores + +* **internal:** fix isolated modules exports ([9cd1958](https://github.com/openai/openai-node/commit/9cd19584dcc6f4004ea1adcee917aa88a37d5f1c)) + + +### Refactors + +* use type imports for type-only imports ([#1159](https://github.com/openai/openai-node/issues/1159)) ([07bbaf6](https://github.com/openai/openai-node/commit/07bbaf6ecac9a5e36471a35488020853ddf9214f)) + ## 4.69.0 (2024-10-30) Full Changelog: [v4.68.4...v4.69.0](https://github.com/openai/openai-node/compare/v4.68.4...v4.69.0) diff --git a/package.json b/package.json index 9e32feabb..f200fdb53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.69.0", + "version": "4.70.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index be250f2d6..f298c56c6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.69.0'; // x-release-please-version +export const VERSION = '4.70.0'; // x-release-please-version From 9180285caf1aec6da05aa4a0058db39bd875cb60 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 1 Nov 2024 19:29:35 +0000 Subject: [PATCH 019/509] fix: don't require deno to run build-deno (#1167) --- scripts/build | 2 +- src/streaming.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build b/scripts/build index b4d686af5..0246c90e3 100755 --- a/scripts/build +++ b/scripts/build @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs (cd dist && node -e 'require("openai")') (cd dist && node -e 'import("openai")' --input-type=module) -if [ "${OPENAI_DISABLE_DENO_BUILD:-0}" != "1" ] && command -v deno &> /dev/null && [ -e ./scripts/build-deno ] +if [ "${OPENAI_DISABLE_DENO_BUILD:-0}" != "1" ] && [ -e ./scripts/build-deno ] then ./scripts/build-deno fi diff --git a/src/streaming.ts b/src/streaming.ts index b48f3ff1d..2891e6ac3 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -2,7 +2,7 @@ import { ReadableStream, type Response } from './_shims/index'; import { OpenAIError } from './error'; import { LineDecoder } from './internal/decoders/line'; -import { APIError } from 'openai/error'; +import { APIError } from './error'; type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; From 9b569856e1f39156cebbb939b7b7149b0f494c88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:29:56 +0000 Subject: [PATCH 020/509] release: 4.70.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d07bcaba7..f458b24a5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.70.0" + ".": "4.70.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f355b2b4..7525af900 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.70.1 (2024-11-01) + +Full Changelog: [v4.70.0...v4.70.1](https://github.com/openai/openai-node/compare/v4.70.0...v4.70.1) + +### Bug Fixes + +* don't require deno to run build-deno ([#1167](https://github.com/openai/openai-node/issues/1167)) ([9d857bc](https://github.com/openai/openai-node/commit/9d857bc531a0bb3939f7660e49b31ccc38f60dd3)) + ## 4.70.0 (2024-11-01) Full Changelog: [v4.69.0...v4.70.0](https://github.com/openai/openai-node/compare/v4.69.0...v4.70.0) diff --git a/package.json b/package.json index f200fdb53..7e14e3b3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.70.0", + "version": "4.70.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index f298c56c6..654369eef 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.70.0'; // x-release-please-version +export const VERSION = '4.70.1'; // x-release-please-version From a3df48926c506bfe649336adcf14011e20f539b9 Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Fri, 1 Nov 2024 15:36:55 -0400 Subject: [PATCH 021/509] fix: skip deno ecosystem test --- ecosystem-tests/cli.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index c03ea668a..b0ff712f1 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -95,15 +95,16 @@ const projectRunners = { await run('bun', ['test']); } }, - deno: async () => { - // we don't need to explicitly install the package here - // because our deno setup relies on `rootDir/deno` to exist - // which is an artifact produced from our build process - await run('deno', ['task', 'install']); - await run('deno', ['task', 'check']); - - if (state.live) await run('deno', ['task', 'test']); - }, + // Temporarily comment this out until we can test with JSR transformations end-to-end. + // deno: async () => { + // // we don't need to explicitly install the package here + // // because our deno setup relies on `rootDir/deno` to exist + // // which is an artifact produced from our build process + // await run('deno', ['task', 'install']); + // await run('deno', ['task', 'check']); + + // if (state.live) await run('deno', ['task', 'test']); + // }, }; let projectNames = Object.keys(projectRunners) as Array; From dfd4bbe7412bd41622058434f193db4ad1672bbe Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Fri, 1 Nov 2024 15:39:43 -0400 Subject: [PATCH 022/509] fix: add permissions to github workflow --- .github/workflows/create-releases.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index 3a753b31c..19b7dd831 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -12,6 +12,9 @@ jobs: if: github.ref == 'refs/heads/master' && github.repository == 'openai/openai-node' runs-on: ubuntu-latest environment: publish + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 From 53f6ecc9e333a6e9adac2179efecdfe3f2ff6d8a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:40:03 +0000 Subject: [PATCH 023/509] release: 4.70.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f458b24a5..0d068338b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.70.1" + ".": "4.70.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7525af900..09e00049c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.70.2 (2024-11-01) + +Full Changelog: [v4.70.1...v4.70.2](https://github.com/openai/openai-node/compare/v4.70.1...v4.70.2) + +### Bug Fixes + +* add permissions to github workflow ([ee75e00](https://github.com/openai/openai-node/commit/ee75e00b0fbf82553b219ee8948a8077e9c26a24)) +* skip deno ecosystem test ([5b181b0](https://github.com/openai/openai-node/commit/5b181b01b62139f8da35d426914c82b8425af141)) + ## 4.70.1 (2024-11-01) Full Changelog: [v4.70.0...v4.70.1](https://github.com/openai/openai-node/compare/v4.70.0...v4.70.1) diff --git a/package.json b/package.json index 7e14e3b3b..cd5fbe3f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.70.1", + "version": "4.70.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 654369eef..f4beff9fa 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.70.1'; // x-release-please-version +export const VERSION = '4.70.2'; // x-release-please-version From 5d6188d685f371b219456f5b5251e0f33cc3fd27 Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Fri, 1 Nov 2024 23:39:30 -0400 Subject: [PATCH 024/509] fix: change streaming helper imports to be relative --- src/lib/AbstractChatCompletionRunner.ts | 10 ++++----- src/lib/AssistantStream.ts | 26 ++++++++++++------------ src/lib/ChatCompletionRunner.ts | 6 +++--- src/lib/ChatCompletionStream.ts | 16 +++++++-------- src/lib/ChatCompletionStreamingRunner.ts | 8 ++++---- src/lib/EventStream.ts | 2 +- src/lib/chatCompletionUtils.ts | 2 +- src/lib/parser.ts | 2 +- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/lib/AbstractChatCompletionRunner.ts b/src/lib/AbstractChatCompletionRunner.ts index e943a4e4f..406f5a431 100644 --- a/src/lib/AbstractChatCompletionRunner.ts +++ b/src/lib/AbstractChatCompletionRunner.ts @@ -1,13 +1,13 @@ -import * as Core from 'openai/core'; -import { type CompletionUsage } from 'openai/resources/completions'; +import * as Core from '../core'; +import { type CompletionUsage } from '../resources/completions'; import { type ChatCompletion, type ChatCompletionMessage, type ChatCompletionMessageParam, type ChatCompletionCreateParams, type ChatCompletionTool, -} from 'openai/resources/chat/completions'; -import { OpenAIError } from 'openai/error'; +} from '../resources/chat/completions'; +import { OpenAIError } from '../error'; import { type RunnableFunction, isRunnableFunctionWithParse, @@ -23,7 +23,7 @@ import { isAssistantMessage, isFunctionMessage, isToolMessage } from './chatComp import { BaseEvents, EventStream } from './EventStream'; import { ParsedChatCompletion } from '../resources/beta/chat/completions'; import OpenAI from '../index'; -import { isAutoParsableTool, parseChatCompletion } from 'openai/lib/parser'; +import { isAutoParsableTool, parseChatCompletion } from '../lib/parser'; const DEFAULT_MAX_CHAT_COMPLETIONS = 10; export interface RunnerOptions extends Core.RequestOptions { diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index c826c910e..caf68e7dd 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -8,9 +8,9 @@ import { TextDelta, MessageDelta, MessageContent, -} from 'openai/resources/beta/threads/messages'; -import * as Core from 'openai/core'; -import { RequestOptions } from 'openai/core'; +} from '../resources/beta/threads/messages'; +import * as Core from '../core'; +import { RequestOptions } from '../core'; import { Run, RunCreateParamsBase, @@ -18,18 +18,18 @@ import { Runs, RunSubmitToolOutputsParamsBase, RunSubmitToolOutputsParamsStreaming, -} from 'openai/resources/beta/threads/runs/runs'; -import { type ReadableStream } from 'openai/_shims/index'; -import { Stream } from 'openai/streaming'; -import { APIUserAbortError, OpenAIError } from 'openai/error'; +} from '../resources/beta/threads/runs/runs'; +import { type ReadableStream } from '../_shims/index'; +import { Stream } from '../streaming'; +import { APIUserAbortError, OpenAIError } from '../error'; import { AssistantStreamEvent, MessageStreamEvent, RunStepStreamEvent, RunStreamEvent, -} from 'openai/resources/beta/assistants'; -import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from 'openai/resources/beta/threads/runs/steps'; -import { ThreadCreateAndRunParamsBase, Threads } from 'openai/resources/beta/threads/threads'; +} from '../resources/beta/assistants'; +import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from '../resources/beta/threads/runs/steps'; +import { ThreadCreateAndRunParamsBase, Threads } from '../resources/beta/threads/threads'; import { BaseEvents, EventStream } from './EventStream'; export interface AssistantStreamEvents extends BaseEvents { @@ -192,7 +192,7 @@ export class AssistantStream runs: Runs, params: RunSubmitToolOutputsParamsStream, options: RequestOptions | undefined, - ) { + ): AssistantStream { const runner = new AssistantStream(); runner._run(() => runner._runToolAssistantStream(threadId, runId, runs, params, { @@ -238,7 +238,7 @@ export class AssistantStream params: ThreadCreateAndRunParamsBaseStream, thread: Threads, options?: RequestOptions, - ) { + ): AssistantStream { const runner = new AssistantStream(); runner._run(() => runner._threadAssistantStream(params, thread, { @@ -254,7 +254,7 @@ export class AssistantStream runs: Runs, params: RunCreateParamsBaseStream, options?: RequestOptions, - ) { + ): AssistantStream { const runner = new AssistantStream(); runner._run(() => runner._runAssistantStream(threadId, runs, params, { diff --git a/src/lib/ChatCompletionRunner.ts b/src/lib/ChatCompletionRunner.ts index 0b962a110..9e68e6671 100644 --- a/src/lib/ChatCompletionRunner.ts +++ b/src/lib/ChatCompletionRunner.ts @@ -1,7 +1,7 @@ import { type ChatCompletionMessageParam, type ChatCompletionCreateParamsNonStreaming, -} from 'openai/resources/chat/completions'; +} from '../resources/chat/completions'; import { type RunnableFunctions, type BaseFunctionsArgs, RunnableTools } from './RunnableFunction'; import { AbstractChatCompletionRunner, @@ -9,8 +9,8 @@ import { RunnerOptions, } from './AbstractChatCompletionRunner'; import { isAssistantMessage } from './chatCompletionUtils'; -import OpenAI from 'openai/index'; -import { AutoParseableTool } from 'openai/lib/parser'; +import OpenAI from '../index'; +import { AutoParseableTool } from '../lib/parser'; export interface ChatCompletionRunnerEvents extends AbstractChatCompletionRunnerEvents { content: (content: string) => void; diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index e3661c8c1..a88f8a23b 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -1,10 +1,10 @@ -import * as Core from 'openai/core'; +import * as Core from '../core'; import { OpenAIError, APIUserAbortError, LengthFinishReasonError, ContentFilterFinishReasonError, -} from 'openai/error'; +} from '../error'; import { ChatCompletionTokenLogprob, type ChatCompletion, @@ -12,15 +12,15 @@ import { type ChatCompletionCreateParams, type ChatCompletionCreateParamsStreaming, type ChatCompletionCreateParamsBase, -} from 'openai/resources/chat/completions'; +} from '../resources/chat/completions'; import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from 'openai/_shims/index'; -import { Stream } from 'openai/streaming'; -import OpenAI from 'openai/index'; -import { ParsedChatCompletion } from 'openai/resources/beta/chat/completions'; +import { type ReadableStream } from '../_shims/index'; +import { Stream } from '../streaming'; +import OpenAI from '../index'; +import { ParsedChatCompletion } from '../resources/beta/chat/completions'; import { AutoParseableResponseFormat, hasAutoParseableInput, @@ -28,7 +28,7 @@ import { isAutoParsableTool, maybeParseChatCompletion, shouldParseToolCall, -} from 'openai/lib/parser'; +} from '../lib/parser'; import { partialParse } from '../_vendor/partial-json-parser/parser'; export interface ContentDeltaEvent { diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index ea6c74116..ba0c6496f 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -1,13 +1,13 @@ import { type ChatCompletionChunk, type ChatCompletionCreateParamsStreaming, -} from 'openai/resources/chat/completions'; +} from '../resources/chat/completions'; import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from 'openai/_shims/index'; +import { type ReadableStream } from '../_shims/index'; import { RunnableTools, type BaseFunctionsArgs, type RunnableFunctions } from './RunnableFunction'; import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream'; -import OpenAI from 'openai/index'; -import { AutoParseableTool } from 'openai/lib/parser'; +import OpenAI from '../index'; +import { AutoParseableTool } from '../lib/parser'; export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunnerEvents { content: (contentDelta: string, contentSnapshot: string) => void; diff --git a/src/lib/EventStream.ts b/src/lib/EventStream.ts index a18c771dd..d3f485e9d 100644 --- a/src/lib/EventStream.ts +++ b/src/lib/EventStream.ts @@ -1,4 +1,4 @@ -import { APIUserAbortError, OpenAIError } from 'openai/error'; +import { APIUserAbortError, OpenAIError } from '../error'; export class EventStream { controller: AbortController = new AbortController(); diff --git a/src/lib/chatCompletionUtils.ts b/src/lib/chatCompletionUtils.ts index a0d9099de..7e9f8a093 100644 --- a/src/lib/chatCompletionUtils.ts +++ b/src/lib/chatCompletionUtils.ts @@ -3,7 +3,7 @@ import { type ChatCompletionFunctionMessageParam, type ChatCompletionMessageParam, type ChatCompletionToolMessageParam, -} from 'openai/resources'; +} from '../resources'; export const isAssistantMessage = ( message: ChatCompletionMessageParam | null | undefined, diff --git a/src/lib/parser.ts b/src/lib/parser.ts index 8bf2a3a36..f2678e312 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -13,7 +13,7 @@ import { ParsedFunctionToolCall, } from '../resources/beta/chat/completions'; import { ResponseFormatJSONSchema } from '../resources/shared'; -import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from 'openai/error'; +import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from '../error'; type AnyChatCompletionCreateParams = | ChatCompletionCreateParams From e0b675f7ee8202a7522be588f4bc297553f5fb3a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 05:07:32 +0000 Subject: [PATCH 025/509] release: 4.70.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0d068338b..6c3b02fed 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.70.2" + ".": "4.70.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 09e00049c..abe273b81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.70.3 (2024-11-04) + +Full Changelog: [v4.70.2...v4.70.3](https://github.com/openai/openai-node/compare/v4.70.2...v4.70.3) + +### Bug Fixes + +* change streaming helper imports to be relative ([e73b7cf](https://github.com/openai/openai-node/commit/e73b7cf84272bd02a39a67795d49db23db2d970f)) + ## 4.70.2 (2024-11-01) Full Changelog: [v4.70.1...v4.70.2](https://github.com/openai/openai-node/compare/v4.70.1...v4.70.2) diff --git a/package.json b/package.json index cd5fbe3f8..e9d130380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.70.2", + "version": "4.70.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index f4beff9fa..04f8abf02 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.70.2'; // x-release-please-version +export const VERSION = '4.70.3'; // x-release-please-version From 840179f42eeffc8e533f4b7b2a38e36c593ad8e5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 22:43:08 +0000 Subject: [PATCH 026/509] feat(api): add support for predicted outputs (#1172) --- .stats.yml | 2 +- api.md | 1 + src/index.ts | 2 + src/resources/audio/speech.ts | 4 +- src/resources/audio/transcriptions.ts | 2 +- src/resources/audio/translations.ts | 2 +- src/resources/beta/assistants.ts | 36 +++++++-------- src/resources/beta/threads/messages.ts | 4 +- src/resources/beta/threads/runs/runs.ts | 18 ++++---- src/resources/beta/threads/runs/steps.ts | 8 ++-- src/resources/beta/threads/threads.ts | 10 ++--- .../beta/vector-stores/file-batches.ts | 4 +- src/resources/beta/vector-stores/files.ts | 4 +- .../beta/vector-stores/vector-stores.ts | 4 +- src/resources/chat/chat.ts | 2 + src/resources/chat/completions.ts | 44 +++++++++++++++---- src/resources/chat/index.ts | 1 + src/resources/completions.ts | 24 +++++++--- src/resources/embeddings.ts | 6 +-- src/resources/files.ts | 17 ++++--- src/resources/fine-tuning/jobs/jobs.ts | 2 +- src/resources/images.ts | 6 +-- src/resources/moderations.ts | 2 +- src/resources/uploads/uploads.ts | 2 +- tests/api-resources/chat/completions.test.ts | 1 + tests/api-resources/files.test.ts | 5 ++- 26 files changed, 133 insertions(+), 80 deletions(-) diff --git a/.stats.yml b/.stats.yml index 39413df44..f368bc881 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7b0a5d715d94f75ac7795bd4d2175a0e3243af9b935a86c273f371e45583140f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2f8ca92b9b1879fd535b685e4767338413fcd533d42f3baac13a9c41da3fce35.yml diff --git a/api.md b/api.md index da60f65bd..465730de8 100644 --- a/api.md +++ b/api.md @@ -48,6 +48,7 @@ Types: - ChatCompletionMessageToolCall - ChatCompletionModality - ChatCompletionNamedToolChoice +- ChatCompletionPredictionContent - ChatCompletionRole - ChatCompletionStreamOptions - ChatCompletionSystemMessageParam diff --git a/src/index.ts b/src/index.ts index 33b0848e4..c3299e00d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -87,6 +87,7 @@ import { ChatCompletionMessageToolCall, ChatCompletionModality, ChatCompletionNamedToolChoice, + ChatCompletionPredictionContent, ChatCompletionRole, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, @@ -379,6 +380,7 @@ export declare namespace OpenAI { type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index da99bf649..1cda80f79 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -22,7 +22,7 @@ export interface SpeechCreateParams { input: string; /** - * One of the available [TTS models](https://platform.openai.com/docs/models/tts): + * One of the available [TTS models](https://platform.openai.com/docs/models#tts): * `tts-1` or `tts-1-hd` */ model: (string & {}) | SpeechModel; @@ -31,7 +31,7 @@ export interface SpeechCreateParams { * The voice to use when generating the audio. Supported voices are `alloy`, * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are * available in the - * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech/voice-options). + * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). */ voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index dd4258787..0b6da4620 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -174,7 +174,7 @@ export interface TranscriptionCreateParams< /** * 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) + * [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) * should match the audio language. */ prompt?: string; diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index b98a95044..c6bf7c870 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -76,7 +76,7 @@ export interface TranslationCreateParams< /** * 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) + * [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) * should be in English. */ prompt?: string; diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 6d48089ce..0e657b1d4 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -121,8 +121,8 @@ export interface Assistant { * ID of the model to use. You can use the * [List models](https://platform.openai.com/docs/api-reference/models/list) API to * see all of your available models, or see our - * [Model overview](https://platform.openai.com/docs/models/overview) for - * descriptions of them. + * [Model overview](https://platform.openai.com/docs/models) for descriptions of + * them. */ model: string; @@ -145,8 +145,8 @@ export interface Assistant { /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -620,7 +620,7 @@ export namespace AssistantStreamEvent { /** * Occurs when an - * [error](https://platform.openai.com/docs/guides/error-codes/api-errors) occurs. + * [error](https://platform.openai.com/docs/guides/error-codes#api-errors) occurs. * This can happen due to an internal server error or a timeout. */ export interface ErrorEvent { @@ -663,7 +663,7 @@ export namespace FileSearchTool { * * Note that the file search tool may output fewer than `max_num_results` results. * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ max_num_results?: number; @@ -673,7 +673,7 @@ export namespace FileSearchTool { * will use the `auto` ranker and a score_threshold of 0. * * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ ranking_options?: FileSearch.RankingOptions; @@ -685,7 +685,7 @@ export namespace FileSearchTool { * will use the `auto` ranker and a score_threshold of 0. * * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ export interface RankingOptions { @@ -1100,8 +1100,8 @@ export interface AssistantCreateParams { * ID of the model to use. You can use the * [List models](https://platform.openai.com/docs/api-reference/models/list) API to * see all of your available models, or see our - * [Model overview](https://platform.openai.com/docs/models/overview) for - * descriptions of them. + * [Model overview](https://platform.openai.com/docs/models) for descriptions of + * them. */ model: (string & {}) | ChatAPI.ChatModel; @@ -1131,8 +1131,8 @@ export interface AssistantCreateParams { /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -1277,8 +1277,8 @@ export interface AssistantUpdateParams { * ID of the model to use. You can use the * [List models](https://platform.openai.com/docs/api-reference/models/list) API to * see all of your available models, or see our - * [Model overview](https://platform.openai.com/docs/models/overview) for - * descriptions of them. + * [Model overview](https://platform.openai.com/docs/models) for descriptions of + * them. */ model?: string; @@ -1289,8 +1289,8 @@ export interface AssistantUpdateParams { /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -1383,8 +1383,8 @@ export interface AssistantListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index af7977667..8124f56cd 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -704,8 +704,8 @@ export interface MessageListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 83a447a91..814ad3e89 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -435,7 +435,7 @@ export interface Run { /** * Whether to enable - * [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) + * [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) * during tool use. */ parallel_tool_calls: boolean; @@ -448,8 +448,8 @@ export interface Run { /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -660,7 +660,7 @@ export interface RunCreateParamsBase { * search result content. * * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ include?: Array; @@ -721,15 +721,15 @@ export interface RunCreateParamsBase { /** * Body param: Whether to enable - * [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) + * [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) * during tool use. */ parallel_tool_calls?: boolean; /** * Body param: Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -909,8 +909,8 @@ export interface RunListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index b10bcb868..6c6722b62 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -705,7 +705,7 @@ export interface StepRetrieveParams { * to fetch the file search result content. * * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ include?: Array; @@ -715,8 +715,8 @@ export interface StepListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; @@ -726,7 +726,7 @@ export interface StepListParams extends CursorPageParams { * to fetch the file search result content. * * See the - * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings) + * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) * for more information. */ include?: Array; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 899645508..453d8fa10 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -176,8 +176,8 @@ export class Threads extends APIResource { /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -565,15 +565,15 @@ export interface ThreadCreateAndRunParamsBase { /** * Whether to enable - * [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) + * [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) * during tool use. */ parallel_tool_calls?: boolean; /** * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4), * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index 533e6ce03..2c47cb9c2 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -276,8 +276,8 @@ export interface FileBatchListFilesParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index a263a0491..1fda9a99b 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -268,8 +268,8 @@ export interface FileListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index 4d1e83dce..35ad8c369 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -372,8 +372,8 @@ export interface VectorStoreListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place * in the list. For instance, if you make a list request and receive 100 objects, - * ending with obj_foo, your subsequent call can include before=obj_foo in order to - * fetch the previous page of the list. + * starting with obj_foo, your subsequent call can include before=obj_foo in order + * to fetch the previous page of the list. */ before?: string; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index afe4dd08e..351430f8c 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -23,6 +23,7 @@ import { ChatCompletionMessageToolCall, ChatCompletionModality, ChatCompletionNamedToolChoice, + ChatCompletionPredictionContent, ChatCompletionRole, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, @@ -101,6 +102,7 @@ export declare namespace Chat { type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 430e52bb2..9d344744a 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -469,7 +469,7 @@ export namespace ChatCompletionContentPartImage { /** * Specifies the detail level of the image. Learn more in the - * [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding). + * [Vision guide](https://platform.openai.com/docs/guides/vision#low-or-high-fidelity-image-understanding). */ detail?: 'auto' | 'low' | 'high'; } @@ -687,6 +687,25 @@ export namespace ChatCompletionNamedToolChoice { } } +/** + * Static predicted output content, such as the content of a text file that is + * being regenerated. + */ +export interface ChatCompletionPredictionContent { + /** + * The content that should be matched when generating a model response. If + * generated tokens would match this content, the entire model response can be + * returned much more quickly. + */ + content: string | Array; + + /** + * The type of the predicted content you want to provide. This type is currently + * always `content`. + */ + type: 'content'; +} + /** * The role of the author of a message */ @@ -855,7 +874,7 @@ export interface ChatCompletionCreateParamsBase { /** * ID of the model to use. See the - * [model endpoint compatibility](https://platform.openai.com/docs/models/model-endpoint-compatibility) + * [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility) * table for details on which models work with the Chat API. */ model: (string & {}) | ChatAPI.ChatModel; @@ -872,7 +891,7 @@ export interface ChatCompletionCreateParamsBase { * existing frequency in the text so far, decreasing the model's likelihood to * repeat the same line verbatim. * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details) + * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ frequency_penalty?: number | null; @@ -963,25 +982,31 @@ export interface ChatCompletionCreateParamsBase { /** * Whether to enable - * [parallel function calling](https://platform.openai.com/docs/guides/function-calling/parallel-function-calling) + * [parallel function calling](https://platform.openai.com/docs/guides/function-calling#configuring-parallel-function-calling) * during tool use. */ parallel_tool_calls?: boolean; + /** + * Static predicted output content, such as the content of a text file that is + * being regenerated. + */ + prediction?: ChatCompletionPredictionContent | null; + /** * Number between -2.0 and 2.0. Positive values penalize new tokens based on * whether they appear in the text so far, increasing the model's likelihood to * talk about new topics. * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details) + * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ presence_penalty?: number | null; /** * An object specifying the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4o mini](https://platform.openai.com/docs/models/gpt-4o-mini), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-and-gpt-4-turbo) and + * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), + * [GPT-4o mini](https://platform.openai.com/docs/models#gpt-4o-mini), + * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4) and * all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured @@ -1107,7 +1132,7 @@ export interface ChatCompletionCreateParamsBase { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } @@ -1204,6 +1229,7 @@ export declare namespace Completions { type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index d9366bf74..262bf75a2 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -20,6 +20,7 @@ export { type ChatCompletionMessageToolCall, type ChatCompletionModality, type ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent, type ChatCompletionRole, type ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam, diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 94c4581a1..be75a46f0 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -137,6 +137,12 @@ export namespace CompletionUsage { * Breakdown of tokens used in a completion. */ export interface CompletionTokensDetails { + /** + * When using Predicted Outputs, the number of tokens in the prediction that + * appeared in the completion. + */ + accepted_prediction_tokens?: number; + /** * Audio input tokens generated by the model. */ @@ -146,6 +152,14 @@ export namespace CompletionUsage { * Tokens generated by the model for reasoning. */ reasoning_tokens?: number; + + /** + * When using Predicted Outputs, the number of tokens in the prediction that did + * not appear in the completion. However, like reasoning tokens, these tokens are + * still counted in the total completion tokens for purposes of billing, output, + * and context window limits. + */ + rejected_prediction_tokens?: number; } /** @@ -171,8 +185,8 @@ export interface CompletionCreateParamsBase { * ID of the model to use. You can use the * [List models](https://platform.openai.com/docs/api-reference/models/list) API to * see all of your available models, or see our - * [Model overview](https://platform.openai.com/docs/models/overview) for - * descriptions of them. + * [Model overview](https://platform.openai.com/docs/models) for descriptions of + * them. */ model: (string & {}) | 'gpt-3.5-turbo-instruct' | 'davinci-002' | 'babbage-002'; @@ -209,7 +223,7 @@ export interface CompletionCreateParamsBase { * existing frequency in the text so far, decreasing the model's likelihood to * repeat the same line verbatim. * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details) + * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ frequency_penalty?: number | null; @@ -264,7 +278,7 @@ export interface CompletionCreateParamsBase { * whether they appear in the text so far, increasing the model's likelihood to * talk about new topics. * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation/parameter-details) + * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ presence_penalty?: number | null; @@ -327,7 +341,7 @@ export interface CompletionCreateParamsBase { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index e2b35f530..4b1644a68 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -94,8 +94,8 @@ export interface EmbeddingCreateParams { * ID of the model to use. You can use the * [List models](https://platform.openai.com/docs/api-reference/models/list) API to * see all of your available models, or see our - * [Model overview](https://platform.openai.com/docs/models/overview) for - * descriptions of them. + * [Model overview](https://platform.openai.com/docs/models) for descriptions of + * them. */ model: (string & {}) | EmbeddingModel; @@ -114,7 +114,7 @@ export interface EmbeddingCreateParams { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } diff --git a/src/resources/files.ts b/src/resources/files.ts index dec815a28..48d8f8747 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -5,7 +5,7 @@ import { isRequestOptions } from '../core'; import { sleep } from '../core'; import { APIConnectionTimeoutError } from '../error'; import * as Core from '../core'; -import { Page } from '../pagination'; +import { CursorPage, type CursorPageParams } from '../pagination'; import { type Response } from '../_shims/index'; export class Files extends APIResource { @@ -44,7 +44,7 @@ export class Files extends APIResource { } /** - * Returns a list of files that belong to the user's organization. + * Returns a list of files. */ list(query?: FileListParams, options?: Core.RequestOptions): Core.PagePromise; list(options?: Core.RequestOptions): Core.PagePromise; @@ -111,10 +111,7 @@ export class Files extends APIResource { } } -/** - * Note: no pagination actually occurs yet, this is for forwards-compatibility. - */ -export class FileObjectsPage extends Page {} +export class FileObjectsPage extends CursorPage {} export type FileContent = string; @@ -213,7 +210,13 @@ export interface FileCreateParams { purpose: FilePurpose; } -export interface FileListParams { +export interface FileListParams extends CursorPageParams { + /** + * Sort order by the `created_at` timestamp of the objects. `asc` for ascending + * order and `desc` for descending order. + */ + order?: 'asc' | 'desc'; + /** * Only return files with the given purpose. */ diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 275fad869..0c320e028 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -304,7 +304,7 @@ export interface FineTuningJobWandbIntegrationObject { export interface JobCreateParams { /** * The name of the model to fine-tune. You can select one of the - * [supported models](https://platform.openai.com/docs/guides/fine-tuning/which-models-can-be-fine-tuned). + * [supported models](https://platform.openai.com/docs/guides/fine-tuning#which-models-can-be-fine-tuned). */ model: (string & {}) | 'babbage-002' | 'davinci-002' | 'gpt-3.5-turbo' | 'gpt-4o-mini'; diff --git a/src/resources/images.ts b/src/resources/images.ts index f4d59b941..8e1c6d92e 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -94,7 +94,7 @@ export interface ImageCreateVariationParams { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } @@ -146,7 +146,7 @@ export interface ImageEditParams { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } @@ -201,7 +201,7 @@ export interface ImageGenerateParams { /** * A unique identifier representing your end-user, which can help OpenAI to monitor * and detect abuse. - * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids). + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; } diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index cdde12a62..f7b16166d 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -351,7 +351,7 @@ export interface ModerationCreateParams { * The content moderation model you would like to use. Learn more in * [the moderation guide](https://platform.openai.com/docs/guides/moderation), and * learn about available models - * [here](https://platform.openai.com/docs/models/moderation). + * [here](https://platform.openai.com/docs/models#moderation). */ model?: (string & {}) | ModerationModel; } diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 78fa3a7b5..8491d0fe2 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -25,7 +25,7 @@ export class Uploads extends APIResource { * For certain `purpose`s, the correct `mime_type` must be specified. Please refer * to documentation for the supported MIME types for your use case: * - * - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search/supported-files) + * - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search#supported-files) * * For guidance on the proper filename extensions for each purpose, please follow * the documentation on diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 77d4a251c..180a1d77f 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -39,6 +39,7 @@ describe('resource completions', () => { modalities: ['text', 'audio'], n: 1, parallel_tool_calls: true, + prediction: { content: 'string', type: 'content' }, presence_penalty: -2, response_format: { type: 'text' }, seed: -9007199254740991, diff --git a/tests/api-resources/files.test.ts b/tests/api-resources/files.test.ts index bbaa45a65..c907c4987 100644 --- a/tests/api-resources/files.test.ts +++ b/tests/api-resources/files.test.ts @@ -69,7 +69,10 @@ describe('resource files', () => { 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.files.list({ purpose: 'purpose' }, { path: '/_stainless_unknown_path' }), + client.files.list( + { after: 'after', limit: 0, order: 'asc', purpose: 'purpose' }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(OpenAI.NotFoundError); }); From 35cfdb8d400d90403319418bfe345e0d1bd24be5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 22:43:34 +0000 Subject: [PATCH 027/509] release: 4.71.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ package.json | 2 +- src/version.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6c3b02fed..b295c3f54 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.70.3" + ".": "4.71.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index abe273b81..bb769c53e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.71.0 (2024-11-04) + +Full Changelog: [v4.70.3...v4.71.0](https://github.com/openai/openai-node/compare/v4.70.3...v4.71.0) + +### Features + +* **api:** add support for predicted outputs ([#1172](https://github.com/openai/openai-node/issues/1172)) ([08a7bb4](https://github.com/openai/openai-node/commit/08a7bb4d4b751aeed9655bfcb9fa27fc79a767c4)) + ## 4.70.3 (2024-11-04) Full Changelog: [v4.70.2...v4.70.3](https://github.com/openai/openai-node/compare/v4.70.2...v4.70.3) diff --git a/package.json b/package.json index e9d130380..501d4f31e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.70.3", + "version": "4.71.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 04f8abf02..273878132 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.70.3'; // x-release-please-version +export const VERSION = '4.71.0'; // x-release-please-version From f0a1288d37683e8eee7df6a9e5838fbfee35cbe3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 Nov 2024 21:19:10 +0000 Subject: [PATCH 028/509] fix: change release please configuration for jsr.json (#1174) --- release-please-config.json | 6 +++++- scripts/build-deno | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 377a76e99..1aa2fb613 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -63,6 +63,10 @@ "extra-files": [ "src/version.ts", "README.md", - "jsr.json" + { + "type": "json", + "path": "jsr.json", + "jsonpath": "$.version" + } ] } diff --git a/scripts/build-deno b/scripts/build-deno index 7d542cf24..4a2000a66 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -14,6 +14,6 @@ for dir in dist-deno/_shims dist-deno/_shims/auto; do mv -- "$file" "${file%-deno.ts}.ts" done done -for file in LICENSE CHANGELOG.md; do +for file in README.md LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done From f41f1811c90b3e3b54a4356c8e2ca39189f4ce66 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 05:06:50 +0000 Subject: [PATCH 029/509] release: 4.71.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 6 ++++-- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b295c3f54..6fbbb03de 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.71.0" + ".": "4.71.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index bb769c53e..1e74a8ee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.71.1 (2024-11-06) + +Full Changelog: [v4.71.0...v4.71.1](https://github.com/openai/openai-node/compare/v4.71.0...v4.71.1) + +### Bug Fixes + +* change release please configuration for jsr.json ([#1174](https://github.com/openai/openai-node/issues/1174)) ([c39efba](https://github.com/openai/openai-node/commit/c39efba812209c8906315596cc0a56e54ae8590a)) + ## 4.71.0 (2024-11-04) Full Changelog: [v4.70.3...v4.71.0](https://github.com/openai/openai-node/compare/v4.70.3...v4.71.0) diff --git a/jsr.json b/jsr.json index fefb5b291..48a838612 100644 --- a/jsr.json +++ b/jsr.json @@ -1,8 +1,10 @@ { "name": "@openai/openai", - "version": "4.47.1", + "version": "4.71.1", "exports": "./index.ts", "publish": { - "exclude": ["!."] + "exclude": [ + "!." + ] } } diff --git a/package.json b/package.json index 501d4f31e..dd3dfba7a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.71.0", + "version": "4.71.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 273878132..3474c77c3 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.71.0'; // x-release-please-version +export const VERSION = '4.71.1'; // x-release-please-version From 4dfb0c6aa7c4530665bc7d6beebcd04aa1490e27 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:50:47 +0000 Subject: [PATCH 030/509] chore(ecosystem-tests): bump wrangler version (#1178) Co-authored-by: stainless-bot --- .../cloudflare-worker/package-lock.json | 301 +++++++++++------- .../cloudflare-worker/package.json | 2 +- 2 files changed, 189 insertions(+), 114 deletions(-) diff --git a/ecosystem-tests/cloudflare-worker/package-lock.json b/ecosystem-tests/cloudflare-worker/package-lock.json index 0673bb27c..99d787f75 100644 --- a/ecosystem-tests/cloudflare-worker/package-lock.json +++ b/ecosystem-tests/cloudflare-worker/package-lock.json @@ -17,7 +17,7 @@ "start-server-and-test": "^2.0.0", "ts-jest": "^29.1.0", "typescript": "5.0.4", - "wrangler": "^3.0.0" + "wrangler": "^3.85.0" } }, "node_modules/@ampproject/remapping": { @@ -662,18 +662,21 @@ "dev": true }, "node_modules/@cloudflare/kv-asset-handler": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz", - "integrity": "sha512-MVbXLbTcAotOPUj0pAMhVtJ+3/kFkwJqc5qNOleOZTv6QkZZABDMS21dSrSlVswEHwrpWC03e4fWytjqKvuE2A==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz", + "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==", "dev": true, "dependencies": { "mime": "^3.0.0" + }, + "engines": { + "node": ">=16.13" } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20231030.0.tgz", - "integrity": "sha512-J4PQ9utPxLya9yHdMMx3AZeC5M/6FxcoYw6jo9jbDDFTy+a4Gslqf4Im9We3aeOEdPXa3tgQHVQOSelJSZLhIw==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241022.0.tgz", + "integrity": "sha512-1NNYun37myMTgCUiPQEJ0cMal4mKZVTpkD0b2tx9hV70xji+frVJcSK8YVLeUm1P+Rw1d/ct8DMgQuCpsz3Fsw==", "cpu": [ "x64" ], @@ -687,9 +690,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20231030.0.tgz", - "integrity": "sha512-WSJJjm11Del4hSneiNB7wTXGtBXI4QMCH9l5qf4iT5PAW8cESGcCmdHtWDWDtGAAGcvmLT04KNvmum92vRKKQQ==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241022.0.tgz", + "integrity": "sha512-FOO/0P0U82EsTLTdweNVgw+4VOk5nghExLPLSppdOziq6IR5HVgP44Kmq5LdsUeHUhwUmfOh9hzaTpkNzUqKvw==", "cpu": [ "arm64" ], @@ -703,9 +706,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20231030.0.tgz", - "integrity": "sha512-2HUeRTvoCC17fxE0qdBeR7J9dO8j4A8ZbdcvY8pZxdk+zERU6+N03RTbk/dQMU488PwiDvcC3zZqS4gwLfVT8g==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241022.0.tgz", + "integrity": "sha512-RsNc19BQJG9yd+ngnjuDeG9ywZG+7t1L4JeglgceyY5ViMNMKVO7Zpbsu69kXslU9h6xyQG+lrmclg3cBpnhYA==", "cpu": [ "x64" ], @@ -719,9 +722,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20231030.0.tgz", - "integrity": "sha512-4/GK5zHh+9JbUI6Z5xTCM0ZmpKKHk7vu9thmHjUxtz+o8Ne9DoD7DlDvXQWgMF6XGaTubDWyp3ttn+Qv8jDFuQ==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241022.0.tgz", + "integrity": "sha512-x5mUXpKxfsosxcFmcq5DaqLs37PejHYVRsNz1cWI59ma7aC4y4Qn6Tf3i0r9MwQTF/MccP4SjVslMU6m4W7IaA==", "cpu": [ "arm64" ], @@ -735,9 +738,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20231030.0.tgz", - "integrity": "sha512-fb/Jgj8Yqy3PO1jLhk7mTrHMkR8jklpbQFud6rL/aMAn5d6MQbaSrYOCjzkKGp0Zng8D2LIzSl+Fc0C9Sggxjg==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241022.0.tgz", + "integrity": "sha512-eBCClx4szCOgKqOlxxbdNszMqQf3MRG1B9BRIqEM/diDfdR9IrZ8l3FaEm+l9gXgPmS6m1NBn40aWuGBl8UTSw==", "cpu": [ "x64" ], @@ -750,12 +753,47 @@ "node": ">=16" } }, + "node_modules/@cloudflare/workers-shared": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.7.0.tgz", + "integrity": "sha512-LLQRTqx7lKC7o2eCYMpyc5FXV8d0pUX6r3A+agzhqS9aoR5A6zCPefwQGcvbKx83ozX22ATZcemwxQXn12UofQ==", + "dev": true, + "dependencies": { + "mime": "^3.0.0", + "zod": "^3.22.3" + }, + "engines": { + "node": ">=16.7.0" + } + }, "node_modules/@cloudflare/workers-types": { - "version": "4.20230821.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230821.0.tgz", - "integrity": "sha512-lVQSyr5E4CEkQw7WIdsrMTj+kHjsm28mJ0B5AhNFByKR+16KTFsU/RW/nGLKHHW2jxT5lvYI+HjNQMzC9QR8Ng==", + "version": "4.20241106.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241106.0.tgz", + "integrity": "sha512-pI4ivacmp+vgNO/siHDsZ6BdITR0LC4Mh/1+yzVLcl9U75pt5DUDCOWOiqIRFXRq6H65DPnJbEPFo3x9UfgofQ==", "dev": true }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@esbuild-plugins/node-globals-polyfill": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", @@ -1142,6 +1180,15 @@ "node": ">=12" } }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "dev": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -1655,9 +1702,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -1667,10 +1714,13 @@ } }, "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, "engines": { "node": ">=0.4.0" } @@ -1983,18 +2033,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dev": true, - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2198,9 +2236,9 @@ "dev": true }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", "dev": true, "engines": { "node": ">= 0.6" @@ -2249,6 +2287,16 @@ "node": ">= 12" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "dev": true, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2289,6 +2337,12 @@ "node": ">=0.10.0" } }, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "dev": true + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -3038,6 +3092,12 @@ "node": ">=8" } }, + "node_modules/itty-time": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/itty-time/-/itty-time-1.0.6.tgz", + "integrity": "sha512-+P8IZaLLBtFv8hCkIjcymZOp4UJ+xW6bSlQsXGqrkmJh7vSiMFSlNne0mCYagEE0N7HDNR5jJBRxwN0oYv61Rw==", + "dev": true + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -3894,23 +3954,23 @@ } }, "node_modules/miniflare": { - "version": "3.20231030.3", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20231030.3.tgz", - "integrity": "sha512-lquHSh0XiO8uoWDujOLHtDS9mkUTJTc5C5amiQ6A++5y0f+DWiMqbDBvvwjlYf4Dvqk6ChFya9dztk7fg2ZVxA==", + "version": "3.20241022.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241022.0.tgz", + "integrity": "sha512-x9Fbq1Hmz1f0osIT9Qmj78iX4UpCP2EqlZnA/tzj/3+I49vc3Kq0fNqSSKplcdf6HlCHdL3fOBicmreQF4BUUQ==", "dev": true, "dependencies": { + "@cspotcode/source-map-support": "0.8.1", "acorn": "^8.8.0", "acorn-walk": "^8.2.0", "capnp-ts": "^0.7.0", "exit-hook": "^2.2.1", "glob-to-regexp": "^0.4.1", - "source-map-support": "0.5.21", "stoppable": "^1.1.0", - "undici": "^5.22.1", - "workerd": "1.20231030.0", - "ws": "^8.11.0", + "undici": "^5.28.4", + "workerd": "1.20241022.0", + "ws": "^8.17.1", "youch": "^3.2.2", - "zod": "^3.20.6" + "zod": "^3.22.3" }, "bin": { "miniflare": "bootstrap.js" @@ -3919,16 +3979,6 @@ "node": ">=16.13" } }, - "node_modules/miniflare/node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -4066,6 +4116,12 @@ "node": ">=8" } }, + "node_modules/ohash": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.4.tgz", + "integrity": "sha512-FlDryZAahJmEF3VR3w1KogSEdWX3WhA5GPakFx4J81kEAiHyLMpdLLElS8n8dfNadMgAne/MywcvmogzscVt4g==", + "dev": true + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -4193,9 +4249,15 @@ "dev": true }, "node_modules/path-to-regexp": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", - "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true + }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", "dev": true }, "node_modules/pause-stream": { @@ -4613,15 +4675,6 @@ "duplexer": "~0.1.1" } }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "dev": true, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -4878,18 +4931,37 @@ "node": ">=12.20" } }, + "node_modules/ufo": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.4.tgz", + "integrity": "sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==", + "dev": true + }, "node_modules/undici": { - "version": "5.23.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.23.0.tgz", - "integrity": "sha512-1D7w+fvRsqlQ9GscLBwcAJinqcZGHUKjbOmXdlE/v8BvEGXjeWAax+341q44EuTcHXXnfyKNbKRq4Lg7OzhMmg==", + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", "dev": true, "dependencies": { - "busboy": "^1.6.0" + "@fastify/busboy": "^2.0.0" }, "engines": { "node": ">=14.0" } }, + "node_modules/unenv": { + "name": "unenv-nightly", + "version": "2.0.0-20241024-111401-d4156ac", + "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241024-111401-d4156ac.tgz", + "integrity": "sha512-xJO1hfY+Te+/XnfCYrCbFbRcgu6XEODND1s5wnVbaBCkuQX7JXF7fHEXPrukFE2j8EOH848P8QN19VO47XN8hw==", + "dev": true, + "dependencies": { + "defu": "^6.1.4", + "ohash": "^1.1.4", + "pathe": "^1.1.2", + "ufo": "^1.5.4" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", @@ -4986,9 +5058,9 @@ } }, "node_modules/workerd": { - "version": "1.20231030.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20231030.0.tgz", - "integrity": "sha512-+FSW+d31f8RrjHanFf/R9A+Z0csf3OtsvzdPmAKuwuZm/5HrBv83cvG9fFeTxl7/nI6irUUXIRF9xcj/NomQzQ==", + "version": "1.20241022.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241022.0.tgz", + "integrity": "sha512-jyGXsgO9DRcJyx6Ovv7gUyDPc3UYC2i/E0p9GFUg6GUzpldw4Y93y9kOmdfsOnKZ3+lY53veSiUniiBPE6Q2NQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -4998,32 +5070,37 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20231030.0", - "@cloudflare/workerd-darwin-arm64": "1.20231030.0", - "@cloudflare/workerd-linux-64": "1.20231030.0", - "@cloudflare/workerd-linux-arm64": "1.20231030.0", - "@cloudflare/workerd-windows-64": "1.20231030.0" + "@cloudflare/workerd-darwin-64": "1.20241022.0", + "@cloudflare/workerd-darwin-arm64": "1.20241022.0", + "@cloudflare/workerd-linux-64": "1.20241022.0", + "@cloudflare/workerd-linux-arm64": "1.20241022.0", + "@cloudflare/workerd-windows-64": "1.20241022.0" } }, "node_modules/wrangler": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.19.0.tgz", - "integrity": "sha512-pY7xWqkQn6DJ+1vz9YHz2pCftEmK+JCTj9sqnucp0NZnlUiILDmBWegsjjCLZycgfiA62J213N7NvjLPr2LB8w==", + "version": "3.85.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.85.0.tgz", + "integrity": "sha512-r5YCWUaF4ApLnloNE6jHHgRYdFzYHoajTlC1tns42UzQ2Ls63VAqD3b0cxOqzDUfmlSb3skpmu0B0Ssi3QWPAg==", "dev": true, "dependencies": { - "@cloudflare/kv-asset-handler": "^0.2.0", + "@cloudflare/kv-asset-handler": "0.3.4", + "@cloudflare/workers-shared": "0.7.0", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", "chokidar": "^3.5.3", + "date-fns": "^4.1.0", "esbuild": "0.17.19", - "miniflare": "3.20231030.3", + "itty-time": "^1.0.6", + "miniflare": "3.20241022.0", "nanoid": "^3.3.3", - "path-to-regexp": "^6.2.0", + "path-to-regexp": "^6.3.0", + "resolve": "^1.22.8", "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", - "source-map": "0.6.1", - "source-map-support": "0.5.21", + "source-map": "^0.6.1", + "unenv": "npm:unenv-nightly@2.0.0-20241024-111401-d4156ac", + "workerd": "1.20241022.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -5035,16 +5112,14 @@ }, "optionalDependencies": { "fsevents": "~2.3.2" - } - }, - "node_modules/wrangler/node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^4.20241022.0" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } } }, "node_modules/wrap-ansi": { @@ -5084,9 +5159,9 @@ } }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "dev": true, "engines": { "node": ">=10.0.0" @@ -5165,20 +5240,20 @@ } }, "node_modules/youch": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.2.3.tgz", - "integrity": "sha512-ZBcWz/uzZaQVdCvfV4uk616Bbpf2ee+F/AvuKDR5EwX/Y4v06xWdtMluqTD7+KlZdM93lLm9gMZYo0sKBS0pgw==", + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", + "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==", "dev": true, "dependencies": { - "cookie": "^0.5.0", + "cookie": "^0.7.1", "mustache": "^4.2.0", "stacktracey": "^2.1.8" } }, "node_modules/zod": { - "version": "3.22.2", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.2.tgz", - "integrity": "sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg==", + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "dev": true, "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/ecosystem-tests/cloudflare-worker/package.json b/ecosystem-tests/cloudflare-worker/package.json index 463de4045..3034e97f7 100644 --- a/ecosystem-tests/cloudflare-worker/package.json +++ b/ecosystem-tests/cloudflare-worker/package.json @@ -17,7 +17,7 @@ "start-server-and-test": "^2.0.0", "ts-jest": "^29.1.0", "typescript": "5.0.4", - "wrangler": "^3.0.0" + "wrangler": "^3.85.0" }, "dependencies": { "node-fetch": "^3.3.1" From 34306573a15a03a1e84177aa2f74d8e63adc0bf0 Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Mon, 11 Nov 2024 17:43:09 -0500 Subject: [PATCH 031/509] feat: add back deno runtime testing without type checks --- ecosystem-tests/cli.ts | 18 ++++++++---------- ecosystem-tests/deno/deno.jsonc | 7 +++---- scripts/build-deno | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index b0ff712f1..4803b47c2 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -95,16 +95,14 @@ const projectRunners = { await run('bun', ['test']); } }, - // Temporarily comment this out until we can test with JSR transformations end-to-end. - // deno: async () => { - // // we don't need to explicitly install the package here - // // because our deno setup relies on `rootDir/deno` to exist - // // which is an artifact produced from our build process - // await run('deno', ['task', 'install']); - // await run('deno', ['task', 'check']); - - // if (state.live) await run('deno', ['task', 'test']); - // }, + deno: async () => { + // we don't need to explicitly install the package here + // because our deno setup relies on `rootDir/dist-deno` to exist + // which is an artifact produced from our build process + await run('deno', ['task', 'install', '--unstable-sloppy-imports']); + + if (state.live) await run('deno', ['task', 'test']); + }, }; let projectNames = Object.keys(projectRunners) as Array; diff --git a/ecosystem-tests/deno/deno.jsonc b/ecosystem-tests/deno/deno.jsonc index 7de05f2ba..46d7ee486 100644 --- a/ecosystem-tests/deno/deno.jsonc +++ b/ecosystem-tests/deno/deno.jsonc @@ -1,11 +1,10 @@ { "tasks": { "install": "deno install --node-modules-dir main_test.ts -f", - "check": "deno lint && deno check main_test.ts", - "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir" + "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir --unstable-sloppy-imports --no-check" }, "imports": { - "openai": "../../deno/mod.ts", - "openai/": "../../deno/" + "openai": "../../dist-deno/index.ts", + "openai/": "../../dist-deno/" } } diff --git a/scripts/build-deno b/scripts/build-deno index 4a2000a66..dfce83548 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -7,13 +7,21 @@ cd "$(dirname "$0")/.." rm -rf dist-deno; mkdir dist-deno cp -rp src/* jsr.json dist-deno +rm -rf dist-deno/shims + +rm dist-deno/_shims/node*.{js,mjs,ts} +rm dist-deno/_shims/manual*.{js,mjs,ts} +rm dist-deno/_shims/index.{d.ts,js,mjs} +for file in dist-deno/_shims/*-deno.ts; do + mv -- "$file" "${file%-deno.ts}.ts" +done + rm dist-deno/_shims/auto/*-node.ts -for dir in dist-deno/_shims dist-deno/_shims/auto; do - rm "${dir}"/*.{d.ts,js,mjs} - for file in "${dir}"/*-deno.ts; do - mv -- "$file" "${file%-deno.ts}.ts" - done +rm dist-deno/_shims/auto/*.{d.ts,js,mjs} +for file in dist-deno/_shims/auto/*-deno.ts; do + mv -- "$file" "${file%-deno.ts}.ts" done + for file in README.md LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done From a92cc1dbc4ab3284c6654d69d5c39399a867f601 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:00:36 +0000 Subject: [PATCH 032/509] release: 4.72.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6fbbb03de..e53c9dd88 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.71.1" + ".": "4.72.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e74a8ee3..951ef0784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.72.0 (2024-11-12) + +Full Changelog: [v4.71.1...v4.72.0](https://github.com/openai/openai-node/compare/v4.71.1...v4.72.0) + +### Features + +* add back deno runtime testing without type checks ([1626cf5](https://github.com/openai/openai-node/commit/1626cf57e94706e1fc8b2f9ff4f173fe486d5150)) + + +### Chores + +* **ecosystem-tests:** bump wrangler version ([#1178](https://github.com/openai/openai-node/issues/1178)) ([4dfb0c6](https://github.com/openai/openai-node/commit/4dfb0c6aa7c4530665bc7d6beebcd04aa1490e27)) + ## 4.71.1 (2024-11-06) Full Changelog: [v4.71.0...v4.71.1](https://github.com/openai/openai-node/compare/v4.71.0...v4.71.1) diff --git a/jsr.json b/jsr.json index 48a838612..ad1751852 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.71.1", + "version": "4.72.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index dd3dfba7a..85fbed4f1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.71.1", + "version": "4.72.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 3474c77c3..cad6e2320 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.71.1'; // x-release-please-version +export const VERSION = '4.72.0'; // x-release-please-version From f555dd6503bc4ccd4d13f4e1a1d36fbbfd51c369 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 12 Nov 2024 16:47:12 +0000 Subject: [PATCH 033/509] chore(internal): use reexports not destructuring (#1181) --- src/index.ts | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/src/index.ts b/src/index.ts index c3299e00d..8e7e7804e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -306,25 +306,6 @@ export class OpenAI extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export { - OpenAIError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} from './error'; - -export import toFile = Uploads.toFile; -export import fileFromPath = Uploads.fileFromPath; - OpenAI.Completions = Completions; OpenAI.Chat = Chat; OpenAI.Embeddings = Embeddings; @@ -340,7 +321,6 @@ OpenAI.Beta = Beta; OpenAI.Batches = Batches; OpenAI.BatchesPage = BatchesPage; OpenAI.Uploads = UploadsAPIUploads; - export declare namespace OpenAI { export type RequestOptions = Core.RequestOptions; @@ -664,4 +644,21 @@ const API_KEY_SENTINEL = ''; // ---------------------- End Azure ---------------------- +export { toFile, fileFromPath } from 'openai/uploads'; +export { + OpenAIError, + APIError, + APIConnectionError, + APIConnectionTimeoutError, + APIUserAbortError, + NotFoundError, + ConflictError, + RateLimitError, + BadRequestError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, +} from 'openai/error'; + export default OpenAI; From 4ec402790cf3cfbccbf3ef9b61d577b0118977e8 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 12 Nov 2024 16:48:27 +0000 Subject: [PATCH 034/509] docs: bump models in example snippets to gpt-4o (#1184) --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index caa3f9d4a..8d30be928 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ const client = new OpenAI({ async function main() { const chatCompletion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], - model: 'gpt-3.5-turbo', + model: 'gpt-4o', }); } @@ -57,7 +57,7 @@ const client = new OpenAI(); async function main() { const stream = await client.chat.completions.create({ - model: 'gpt-4', + model: 'gpt-4o', messages: [{ role: 'user', content: 'Say this is a test' }], stream: true, }); @@ -87,7 +87,7 @@ const client = new OpenAI({ async function main() { const params: OpenAI.Chat.ChatCompletionCreateParams = { messages: [{ role: 'user', content: 'Say this is a test' }], - model: 'gpt-3.5-turbo', + model: 'gpt-4o', }; const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params); } @@ -333,7 +333,7 @@ a subclass of `APIError` will be thrown: ```ts async function main() { const job = await client.fineTuning.jobs - .create({ model: 'gpt-3.5-turbo', training_file: 'file-abc123' }) + .create({ model: 'gpt-4o', training_file: 'file-abc123' }) .catch(async (err) => { if (err instanceof OpenAI.APIError) { console.log(err.status); // 400 @@ -415,7 +415,7 @@ const client = new OpenAI({ }); // Or, configure per-request: -await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I get the name of the current day in Node.js?' }], model: 'gpt-3.5-turbo' }, { +await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I get the name of the current day in JavaScript?' }], model: 'gpt-4o' }, { maxRetries: 5, }); ``` @@ -432,7 +432,7 @@ const client = new OpenAI({ }); // Override per-request: -await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I list all files in a directory using Python?' }], model: 'gpt-3.5-turbo' }, { +await client.chat.completions.create({ messages: [{ role: 'user', content: 'How can I list all files in a directory using Python?' }], model: 'gpt-4o' }, { timeout: 5 * 1000, }); ``` @@ -485,13 +485,13 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi const client = new OpenAI(); const response = await client.chat.completions - .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' }) + .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }) .asResponse(); console.log(response.headers.get('X-My-Header')); console.log(response.statusText); // access the underlying Response object const { data: chatCompletion, response: raw } = await client.chat.completions - .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-3.5-turbo' }) + .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }) .withResponse(); console.log(raw.headers.get('X-My-Header')); console.log(chatCompletion); From 524b9e82ae13a3b5093dcfbfd1169a798cf99ab4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:59:44 +0000 Subject: [PATCH 035/509] fix(docs): add missing await to pagination example (#1190) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d30be928..2f05654b4 100644 --- a/README.md +++ b/README.md @@ -467,7 +467,7 @@ for (const fineTuningJob of page.data) { // Convenience methods are provided for manually paginating: while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); // ... } ``` From 8ee6c0335673f2ecf84ea11bdfc990adab607e20 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 15 Nov 2024 08:31:55 +0000 Subject: [PATCH 036/509] chore(client): drop unused devDependency (#1191) --- package.json | 1 - src/index.ts | 4 ++-- yarn.lock | 40 ---------------------------------------- 3 files changed, 2 insertions(+), 43 deletions(-) diff --git a/package.json b/package.json index 85fbed4f1..8a61d468f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "prettier": "^3.0.0", "prettier-2": "npm:prettier@^2", "ts-jest": "^29.1.0", - "ts-morph": "^19.0.0", "ts-node": "^10.5.0", "tsc-multi": "^1.1.0", "tsconfig-paths": "^4.0.0", diff --git a/src/index.ts b/src/index.ts index 8e7e7804e..58d7410e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -644,7 +644,7 @@ const API_KEY_SENTINEL = ''; // ---------------------- End Azure ---------------------- -export { toFile, fileFromPath } from 'openai/uploads'; +export { toFile, fileFromPath } from './uploads'; export { OpenAIError, APIError, @@ -659,6 +659,6 @@ export { InternalServerError, PermissionDeniedError, UnprocessableEntityError, -} from 'openai/error'; +} from './error'; export default OpenAI; diff --git a/yarn.lock b/yarn.lock index 91b22b941..e139e1fbe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -759,16 +759,6 @@ dependencies: "@swc/counter" "^0.1.3" -"@ts-morph/common@~0.20.0": - version "0.20.0" - resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.20.0.tgz#3f161996b085ba4519731e4d24c35f6cba5b80af" - integrity sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q== - dependencies: - fast-glob "^3.2.12" - minimatch "^7.4.3" - mkdirp "^2.1.6" - path-browserify "^1.0.1" - "@tsconfig/node10@^1.0.7": version "1.0.8" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" @@ -1315,11 +1305,6 @@ co@^4.6.0: resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== -code-block-writer@^12.0.0: - version "12.0.0" - resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-12.0.0.tgz#4dd58946eb4234105aff7f0035977b2afdc2a770" - integrity sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w== - collect-v8-coverage@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" @@ -2687,23 +2672,11 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" -minimatch@^7.4.3: - version "7.4.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" - integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== - dependencies: - brace-expansion "^2.0.1" - minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -mkdirp@^2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" - integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -2867,11 +2840,6 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" -path-browserify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" - integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -3300,14 +3268,6 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" -ts-morph@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-19.0.0.tgz#43e95fb0156c3fe3c77c814ac26b7d0be2f93169" - integrity sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ== - dependencies: - "@ts-morph/common" "~0.20.0" - code-block-writer "^12.0.0" - ts-node@^10.5.0: version "10.7.0" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" From 12f93346857196b93f94865cc3744d769e5e519c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:42:10 +0000 Subject: [PATCH 037/509] chore(internal): spec update (#1195) --- .stats.yml | 2 +- .../audio/transcriptions.test.ts | 2 +- tests/api-resources/beta/assistants.test.ts | 8 +- .../beta/threads/messages.test.ts | 15 +- .../beta/threads/runs/runs.test.ts | 99 +-------- .../beta/threads/threads.test.ts | 198 +----------------- tests/api-resources/chat/completions.test.ts | 10 +- .../fine-tuning/jobs/jobs.test.ts | 25 +-- tests/api-resources/uploads/uploads.test.ts | 9 +- 9 files changed, 22 insertions(+), 346 deletions(-) diff --git a/.stats.yml b/.stats.yml index f368bc881..fdef8d274 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2f8ca92b9b1879fd535b685e4767338413fcd533d42f3baac13a9c41da3fce35.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fb9db2d2c1f0d6b39d8ee042db5d5c59acba6ad1daf47c18792c1f5fb24b3401.yml diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index ef2797911..86ef5e576 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -31,7 +31,7 @@ describe('resource transcriptions', () => { prompt: 'prompt', response_format: 'json', temperature: 0, - timestamp_granularities: ['word', 'segment'], + timestamp_granularities: ['word'], }); }); }); diff --git a/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index fdc325254..a64465c77 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -30,15 +30,13 @@ describe('resource assistants', () => { response_format: 'auto', temperature: 1, tool_resources: { - code_interpreter: { file_ids: ['string', 'string', 'string'] }, + code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [ - { chunking_strategy: { type: 'auto' }, file_ids: ['string', 'string', 'string'], metadata: {} }, - ], + vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], }, }, - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], + tools: [{ type: 'code_interpreter' }], top_p: 1, }); }); diff --git a/tests/api-resources/beta/threads/messages.test.ts b/tests/api-resources/beta/threads/messages.test.ts index bfbcab1cb..c1f5f7b6e 100644 --- a/tests/api-resources/beta/threads/messages.test.ts +++ b/tests/api-resources/beta/threads/messages.test.ts @@ -27,20 +27,7 @@ describe('resource messages', () => { const response = await client.beta.threads.messages.create('thread_id', { content: 'string', role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], - }, - { - file_id: 'file_id', - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], - }, - { - file_id: 'file_id', - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], - }, - ], + attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], metadata: {}, }); }); diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 352d775c0..4fd8261ac 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -29,94 +29,7 @@ describe('resource runs', () => { { content: 'string', role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], + attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], metadata: {}, }, ], @@ -130,7 +43,7 @@ describe('resource runs', () => { stream: false, temperature: 1, tool_choice: 'none', - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], + tools: [{ type: 'code_interpreter' }], top_p: 1, truncation_strategy: { type: 'auto', last_messages: 1 }, }); @@ -214,7 +127,7 @@ describe('resource runs', () => { test('submitToolOutputs: only required params', async () => { const responsePromise = client.beta.threads.runs.submitToolOutputs('thread_id', 'run_id', { - tool_outputs: [{}, {}, {}], + tool_outputs: [{}], }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -227,11 +140,7 @@ describe('resource runs', () => { test('submitToolOutputs: required and optional params', async () => { const response = await client.beta.threads.runs.submitToolOutputs('thread_id', 'run_id', { - tool_outputs: [ - { output: 'output', tool_call_id: 'tool_call_id' }, - { output: 'output', tool_call_id: 'tool_call_id' }, - { output: 'output', tool_call_id: 'tool_call_id' }, - ], + tool_outputs: [{ output: 'output', tool_call_id: 'tool_call_id' }], stream: false, }); }); diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index dc0a94a7d..aba266316 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -36,109 +36,16 @@ describe('resource threads', () => { { content: 'string', role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], + attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], metadata: {}, }, ], metadata: {}, tool_resources: { - code_interpreter: { file_ids: ['string', 'string', 'string'] }, + code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [ - { - chunking_strategy: { type: 'auto' }, - file_ids: ['string', 'string', 'string'], - metadata: {}, - }, - ], + vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], }, }, }, @@ -222,114 +129,25 @@ describe('resource threads', () => { { content: 'string', role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], - metadata: {}, - }, - { - content: 'string', - role: 'user', - attachments: [ - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - { - file_id: 'file_id', - tools: [ - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - { type: 'code_interpreter' }, - ], - }, - ], + attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], metadata: {}, }, ], metadata: {}, tool_resources: { - code_interpreter: { file_ids: ['string', 'string', 'string'] }, + code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'], - vector_stores: [ - { chunking_strategy: { type: 'auto' }, file_ids: ['string', 'string', 'string'], metadata: {} }, - ], + vector_stores: [{ chunking_strategy: { type: 'auto' }, file_ids: ['string'], metadata: {} }], }, }, }, tool_choice: 'none', tool_resources: { - code_interpreter: { file_ids: ['string', 'string', 'string'] }, + code_interpreter: { file_ids: ['string'] }, file_search: { vector_store_ids: ['string'] }, }, - tools: [{ type: 'code_interpreter' }, { type: 'code_interpreter' }, { type: 'code_interpreter' }], + tools: [{ type: 'code_interpreter' }], top_p: 1, truncation_strategy: { type: 'auto', last_messages: 1 }, }); diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 180a1d77f..5dcbf9ad6 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -36,7 +36,7 @@ describe('resource completions', () => { max_completion_tokens: 0, max_tokens: 0, metadata: { foo: 'string' }, - modalities: ['text', 'audio'], + modalities: ['text'], n: 1, parallel_tool_calls: true, prediction: { content: 'string', type: 'content' }, @@ -55,14 +55,6 @@ describe('resource completions', () => { function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, type: 'function', }, - { - function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, - type: 'function', - }, - { - function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, - type: 'function', - }, ], top_logprobs: 0, top_p: 1, diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index 646c2f5cf..0ab09768a 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -31,30 +31,7 @@ describe('resource jobs', () => { integrations: [ { type: 'wandb', - wandb: { - project: 'my-wandb-project', - entity: 'entity', - name: 'name', - tags: ['custom-tag', 'custom-tag', 'custom-tag'], - }, - }, - { - type: 'wandb', - wandb: { - project: 'my-wandb-project', - entity: 'entity', - name: 'name', - tags: ['custom-tag', 'custom-tag', 'custom-tag'], - }, - }, - { - type: 'wandb', - wandb: { - project: 'my-wandb-project', - entity: 'entity', - name: 'name', - tags: ['custom-tag', 'custom-tag', 'custom-tag'], - }, + wandb: { project: 'my-wandb-project', entity: 'entity', name: 'name', tags: ['custom-tag'] }, }, ], seed: 42, diff --git a/tests/api-resources/uploads/uploads.test.ts b/tests/api-resources/uploads/uploads.test.ts index e4e3c6d30..c9ea4ddd7 100644 --- a/tests/api-resources/uploads/uploads.test.ts +++ b/tests/api-resources/uploads/uploads.test.ts @@ -53,9 +53,7 @@ describe('resource uploads', () => { }); test('complete: only required params', async () => { - const responsePromise = client.uploads.complete('upload_abc123', { - part_ids: ['string', 'string', 'string'], - }); + const responsePromise = client.uploads.complete('upload_abc123', { part_ids: ['string'] }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -66,9 +64,6 @@ describe('resource uploads', () => { }); test('complete: required and optional params', async () => { - const response = await client.uploads.complete('upload_abc123', { - part_ids: ['string', 'string', 'string'], - md5: 'md5', - }); + const response = await client.uploads.complete('upload_abc123', { part_ids: ['string'], md5: 'md5' }); }); }); From 6961c37f2e581bcc12ec2bbe77df2b9b260fe297 Mon Sep 17 00:00:00 2001 From: Young-Jin Park Date: Mon, 18 Nov 2024 16:11:29 -0500 Subject: [PATCH 038/509] feat: bump model in all example snippets to gpt-4o --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2f05654b4..c363eaa98 100644 --- a/README.md +++ b/README.md @@ -173,7 +173,7 @@ const openai = new OpenAI(); async function main() { const stream = await openai.beta.chat.completions.stream({ - model: 'gpt-4', + model: 'gpt-4o', messages: [{ role: 'user', content: 'Say this is a test' }], stream: true, }); @@ -226,7 +226,7 @@ const client = new OpenAI(); async function main() { const runner = client.beta.chat.completions .runTools({ - model: 'gpt-3.5-turbo', + model: 'gpt-4o', messages: [{ role: 'user', content: 'How is the weather this week?' }], tools: [ { @@ -368,7 +368,7 @@ Error codes are as followed: All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI. ```ts -const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4' }); +const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }); console.log(completion._request_id) // req_123 ``` @@ -392,7 +392,7 @@ const azureADTokenProvider = getBearerTokenProvider(credential, scope); const openai = new AzureOpenAI({ azureADTokenProvider }); const result = await openai.chat.completions.create({ - model: 'gpt-4-1106-preview', + model: 'gpt-4o', messages: [{ role: 'user', content: 'Say hello!' }], }); From ebdb4f72cc01afbee649aca009fdaf413e61c507 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 17:57:52 +0000 Subject: [PATCH 039/509] docs: improve jsr documentation (#1197) --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c363eaa98..5d6ba1a8b 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,21 @@ To learn how to use the OpenAI API, check out our [API Reference](https://platfo npm install openai ``` -You can also import from jsr: +### Installation from JSR - +```sh +deno add jsr:@openai/openai +npx jsr add @openai/openai +``` + +These commands will make the module importable from the `@openai/openai` scope: + +You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime: ```ts import OpenAI from 'jsr:@openai/openai'; ``` - - ## Usage The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples). The code below shows how to get started using the chat completions API. @@ -622,7 +627,7 @@ TypeScript >= 4.5 is supported. The following runtimes are supported: - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. -- Deno v1.28.0 or higher, using `import OpenAI from "npm:openai"`. +- Deno v1.28.0 or higher. - Bun 1.0 or later. - Cloudflare Workers. - Vercel Edge Runtime. From e34981c00f2f0360baffe870bcc38786030671bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:41:02 +0000 Subject: [PATCH 040/509] docs: change readme title (#1198) --- README.md | 2 +- scripts/build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d6ba1a8b..d89e121f1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenAI Node API Library +# OpenAI TypeScript and JavaScript API Library [![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) diff --git a/scripts/build b/scripts/build index 0246c90e3..4e86f99e2 100755 --- a/scripts/build +++ b/scripts/build @@ -32,7 +32,7 @@ npm exec tsc-multi # copy over handwritten .js/.mjs/.d.ts files cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto -# we need to add exports = module.exports = OpenAI Node to index.js; +# we need to add exports = module.exports = OpenAI to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/utils/fix-index-exports.cjs From 3968ef1c4fa860ff246e0e803808752b261c18ce Mon Sep 17 00:00:00 2001 From: Eric He Date: Wed, 20 Nov 2024 02:35:46 -0800 Subject: [PATCH 041/509] docs(readme): fix incorrect fileBatches.uploadAndPoll params (#1200) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d89e121f1..ec17427a6 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ const fileList = [ ... ]; -const batch = await openai.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, fileList); +const batch = await openai.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, {files: fileList}); ``` ### Streaming Helpers From 0feeafd21ba4b6281cc3b9dafa2919b1e2e4d1c3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:17:02 +0000 Subject: [PATCH 042/509] feat(api): add gpt-4o-2024-11-20 model (#1201) --- .stats.yml | 2 +- src/resources/batches.ts | 2 +- src/resources/chat/chat.ts | 1 + src/resources/chat/completions.ts | 5 +++-- src/resources/files.ts | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index fdef8d274..4827e5388 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fb9db2d2c1f0d6b39d8ee042db5d5c59acba6ad1daf47c18792c1f5fb24b3401.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-aa9b01fc0c17eb0cbc200533fc20d6a49c5e764ceaf8049e08b294532be6e9ff.yml diff --git a/src/resources/batches.ts b/src/resources/batches.ts index e68e7569c..ec5ca6331 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -232,7 +232,7 @@ export interface BatchCreateParams { * Your input file must be formatted as a * [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), * and must be uploaded with the purpose `batch`. The file can contain up to 50,000 - * requests, and can be up to 100 MB in size. + * requests, and can be up to 200 MB in size. */ input_file_id: string; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 351430f8c..09cd3d123 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -49,6 +49,7 @@ export type ChatModel = | 'o1-mini' | 'o1-mini-2024-09-12' | 'gpt-4o' + | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-05-13' | 'gpt-4o-realtime-preview' diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 9d344744a..8e9a4385e 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -250,8 +250,9 @@ export interface ChatCompletionAudioParam { format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** - * The voice the model uses to respond. Supported voices are `alloy`, `ash`, - * `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. + * The voice the model uses to respond. Supported voices are `ash`, `ballad`, + * `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, + * `echo`, and `shimmer`; these voices are less expressive). */ voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; } diff --git a/src/resources/files.ts b/src/resources/files.ts index 48d8f8747..42a7bdfba 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -25,7 +25,7 @@ export class Files extends APIResource { * [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) * models. * - * The Batch API only supports `.jsonl` files up to 100 MB in size. The input also + * The Batch API only supports `.jsonl` files up to 200 MB in size. The input also * has a specific required * [format](https://platform.openai.com/docs/api-reference/batch/request-input). * From 1e9391bc17c29287f2b7bb8acf77390f3e727ad2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:17:37 +0000 Subject: [PATCH 043/509] release: 4.73.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 29 +++++++++++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e53c9dd88..d3e848620 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.72.0" + ".": "4.73.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 951ef0784..51741f552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 4.73.0 (2024-11-20) + +Full Changelog: [v4.72.0...v4.73.0](https://github.com/openai/openai-node/compare/v4.72.0...v4.73.0) + +### Features + +* **api:** add gpt-4o-2024-11-20 model ([#1201](https://github.com/openai/openai-node/issues/1201)) ([0feeafd](https://github.com/openai/openai-node/commit/0feeafd21ba4b6281cc3b9dafa2919b1e2e4d1c3)) +* bump model in all example snippets to gpt-4o ([6961c37](https://github.com/openai/openai-node/commit/6961c37f2e581bcc12ec2bbe77df2b9b260fe297)) + + +### Bug Fixes + +* **docs:** add missing await to pagination example ([#1190](https://github.com/openai/openai-node/issues/1190)) ([524b9e8](https://github.com/openai/openai-node/commit/524b9e82ae13a3b5093dcfbfd1169a798cf99ab4)) + + +### Chores + +* **client:** drop unused devDependency ([#1191](https://github.com/openai/openai-node/issues/1191)) ([8ee6c03](https://github.com/openai/openai-node/commit/8ee6c0335673f2ecf84ea11bdfc990adab607e20)) +* **internal:** spec update ([#1195](https://github.com/openai/openai-node/issues/1195)) ([12f9334](https://github.com/openai/openai-node/commit/12f93346857196b93f94865cc3744d769e5e519c)) +* **internal:** use reexports not destructuring ([#1181](https://github.com/openai/openai-node/issues/1181)) ([f555dd6](https://github.com/openai/openai-node/commit/f555dd6503bc4ccd4d13f4e1a1d36fbbfd51c369)) + + +### Documentation + +* bump models in example snippets to gpt-4o ([#1184](https://github.com/openai/openai-node/issues/1184)) ([4ec4027](https://github.com/openai/openai-node/commit/4ec402790cf3cfbccbf3ef9b61d577b0118977e8)) +* change readme title ([#1198](https://github.com/openai/openai-node/issues/1198)) ([e34981c](https://github.com/openai/openai-node/commit/e34981c00f2f0360baffe870bcc38786030671bf)) +* improve jsr documentation ([#1197](https://github.com/openai/openai-node/issues/1197)) ([ebdb4f7](https://github.com/openai/openai-node/commit/ebdb4f72cc01afbee649aca009fdaf413e61c507)) +* **readme:** fix incorrect fileBatches.uploadAndPoll params ([#1200](https://github.com/openai/openai-node/issues/1200)) ([3968ef1](https://github.com/openai/openai-node/commit/3968ef1c4fa860ff246e0e803808752b261c18ce)) + ## 4.72.0 (2024-11-12) Full Changelog: [v4.71.1...v4.72.0](https://github.com/openai/openai-node/compare/v4.71.1...v4.72.0) diff --git a/jsr.json b/jsr.json index ad1751852..f09f5bbab 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.72.0", + "version": "4.73.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 8a61d468f..13e8ee3bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.72.0", + "version": "4.73.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index cad6e2320..4e3a33b17 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.72.0'; // x-release-please-version +export const VERSION = '4.73.0'; // x-release-please-version From aa5443624b4dc206ede08a743ec276b3a576861f Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 22 Nov 2024 19:56:39 +0000 Subject: [PATCH 044/509] docs(readme): mention `.withResponse()` for streaming request ID (#1202) --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index ec17427a6..ac9c84a42 100644 --- a/README.md +++ b/README.md @@ -377,6 +377,18 @@ const completion = await client.chat.completions.create({ messages: [{ role: 'us console.log(completion._request_id) // req_123 ``` +You can also access the Request ID using the `.withResponse()` method: + +```ts +const { data: stream, request_id } = await openai.chat.completions + .create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + stream: true, + }) + .withResponse(); +``` + ## Microsoft Azure OpenAI To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` From 3f8634ed111782e3090a25d1d8640e050fb2c45b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 05:07:22 +0000 Subject: [PATCH 045/509] release: 4.73.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d3e848620..92fcace17 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.73.0" + ".": "4.73.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 51741f552..c32a0ce32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.73.1 (2024-11-25) + +Full Changelog: [v4.73.0...v4.73.1](https://github.com/openai/openai-node/compare/v4.73.0...v4.73.1) + +### Documentation + +* **readme:** mention `.withResponse()` for streaming request ID ([#1202](https://github.com/openai/openai-node/issues/1202)) ([b6800d4](https://github.com/openai/openai-node/commit/b6800d4dea2729fe3b0864171ce8fb3b2cc1b21c)) + ## 4.73.0 (2024-11-20) Full Changelog: [v4.72.0...v4.73.0](https://github.com/openai/openai-node/compare/v4.72.0...v4.73.0) diff --git a/jsr.json b/jsr.json index f09f5bbab..0bd5eab3f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.73.0", + "version": "4.73.1", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 13e8ee3bc..685d59f56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.73.0", + "version": "4.73.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 4e3a33b17..28fbb6572 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.73.0'; // x-release-please-version +export const VERSION = '4.73.1'; // x-release-please-version From 2628a0bc6a380478889d94cf6f08cb179eab9e9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:15:42 +0000 Subject: [PATCH 046/509] feat(internal): make git install file structure match npm (#1204) --- package.json | 2 +- scripts/utils/check-is-in-git-install.sh | 2 +- scripts/utils/git-swap.sh | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 scripts/utils/git-swap.sh diff --git a/package.json b/package.json index 685d59f56..87004d273 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build": "./scripts/build", "prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1", "format": "prettier --write --cache --cache-strategy metadata . !dist", - "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi", + "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi", "tsn": "ts-node -r tsconfig-paths/register", "lint": "./scripts/lint", "fix": "./scripts/format" diff --git a/scripts/utils/check-is-in-git-install.sh b/scripts/utils/check-is-in-git-install.sh index 36bcedc20..1354eb432 100755 --- a/scripts/utils/check-is-in-git-install.sh +++ b/scripts/utils/check-is-in-git-install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check if you happen to call prepare for a repository that's already in node_modules. [ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] || # The name of the containing directory that 'npm` uses, which looks like diff --git a/scripts/utils/git-swap.sh b/scripts/utils/git-swap.sh new file mode 100755 index 000000000..79d1888eb --- /dev/null +++ b/scripts/utils/git-swap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -exuo pipefail +# the package is published to NPM from ./dist +# we want the final file structure for git installs to match the npm installs, so we + +# delete everything except ./dist and ./node_modules +find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' + + +# move everything from ./dist to . +mv dist/* . + +# delete the now-empty ./dist +rmdir dist From d40c61cfc8c4f5f6aea4ffdd3ea3909e02b92bd5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 05:07:36 +0000 Subject: [PATCH 047/509] release: 4.74.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 92fcace17..8edd9c22e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.73.1" + ".": "4.74.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c32a0ce32..595091ff3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.74.0 (2024-12-02) + +Full Changelog: [v4.73.1...v4.74.0](https://github.com/openai/openai-node/compare/v4.73.1...v4.74.0) + +### Features + +* **internal:** make git install file structure match npm ([#1204](https://github.com/openai/openai-node/issues/1204)) ([e7c4c6d](https://github.com/openai/openai-node/commit/e7c4c6d23adbe52300053a8d35db6e341c438703)) + ## 4.73.1 (2024-11-25) Full Changelog: [v4.73.0...v4.73.1](https://github.com/openai/openai-node/compare/v4.73.0...v4.73.1) diff --git a/jsr.json b/jsr.json index 0bd5eab3f..eb073e7e6 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.73.1", + "version": "4.74.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 87004d273..7e188774a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.73.1", + "version": "4.74.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 28fbb6572..b8dd781be 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.73.1'; // x-release-please-version +export const VERSION = '4.74.0'; // x-release-please-version From d0e210dd43b8cfbc804111b9923a26dd30bcc87f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 02:02:23 +0000 Subject: [PATCH 048/509] feat: improve docs for jsr README.md (#1208) --- scripts/build-deno | 2 + scripts/utils/convert-jsr-readme.cjs | 140 +++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 scripts/utils/convert-jsr-readme.cjs diff --git a/scripts/build-deno b/scripts/build-deno index dfce83548..bce31078e 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -25,3 +25,5 @@ done for file in README.md LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done + +node scripts/utils/convert-jsr-readme.cjs ./dist-deno/README.md diff --git a/scripts/utils/convert-jsr-readme.cjs b/scripts/utils/convert-jsr-readme.cjs new file mode 100644 index 000000000..f9d089c73 --- /dev/null +++ b/scripts/utils/convert-jsr-readme.cjs @@ -0,0 +1,140 @@ +const fs = require('fs'); +const { parse } = require('@typescript-eslint/parser'); +const { TSError } = require('@typescript-eslint/typescript-estree'); + +/** + * Quick and dirty AST traversal + */ +function traverse(node, visitor) { + if (!node || typeof node.type !== 'string') return; + visitor.node?.(node); + visitor[node.type]?.(node); + for (const key in node) { + const value = node[key]; + if (Array.isArray(value)) { + for (const elem of value) traverse(elem, visitor); + } else if (value instanceof Object) { + traverse(value, visitor); + } + } +} + +/** + * Helper method for replacing arbitrary ranges of text in input code. + */ +function replaceRanges(code, replacer) { + const replacements = []; + replacer({ replace: (range, replacement) => replacements.push({ range, replacement }) }); + + if (!replacements.length) return code; + replacements.sort((a, b) => a.range[0] - b.range[0]); + const overlapIndex = replacements.findIndex( + (r, index) => index > 0 && replacements[index - 1].range[1] > r.range[0], + ); + if (overlapIndex >= 0) { + throw new Error( + `replacements overlap: ${JSON.stringify(replacements[overlapIndex - 1])} and ${JSON.stringify( + replacements[overlapIndex], + )}`, + ); + } + + const parts = []; + let end = 0; + for (const { + range: [from, to], + replacement, + } of replacements) { + if (from > end) parts.push(code.substring(end, from)); + parts.push(replacement); + end = to; + } + if (end < code.length) parts.push(code.substring(end)); + return parts.join(''); +} + +function replaceProcessEnv(content) { + // Replace process.env['KEY'] and process.env.KEY with Deno.env.get('KEY') + return content.replace(/process\.env(?:\.|\[['"])(.+?)(?:['"]\])/g, "Deno.env.get('$1')"); +} + +function replaceProcessStdout(content) { + return content.replace(/process\.stdout.write\(([^)]+)\)/g, 'Deno.stdout.writeSync($1)'); +} + +function replaceInstallationDirections(content) { + // Remove npm installation section + return content.replace(/```sh\nnpm install.*?\n```.*### Installation from JSR\n\n/s, ''); +} + +/** + * Maps over module paths in imports and exports + */ +function replaceImports(code, config) { + try { + const ast = parse(code, { sourceType: 'module', range: true }); + return replaceRanges(code, ({ replace }) => + traverse(ast, { + node(node) { + switch (node.type) { + case 'ImportDeclaration': + case 'ExportNamedDeclaration': + case 'ExportAllDeclaration': + case 'ImportExpression': + if (node.source) { + const { range, value } = node.source; + if (value.startsWith(config.npm)) { + replace(range, JSON.stringify(value.replace(config.npm, config.jsr))); + } + } + } + }, + }), + ); + } catch (e) { + if (e instanceof TSError) { + // This can error if the code block is not valid TS, in this case give up trying to transform the imports. + console.warn(`Original codeblock could not be parsed, replace import skipped: ${e}\n\n${code}`); + return code; + } + throw e; + } +} + +function processReadme(config, file) { + try { + let readmeContent = fs.readFileSync(file, 'utf8'); + + // First replace installation directions + readmeContent = replaceInstallationDirections(readmeContent); + + // Replace content in all code blocks with a single regex + readmeContent = readmeContent.replaceAll( + /```(?:typescript|ts|javascript|js)\n([\s\S]*?)```/g, + (match, codeBlock) => { + try { + let transformedCode = codeBlock.trim(); + transformedCode = replaceImports(transformedCode, config); + transformedCode = replaceProcessEnv(transformedCode); + transformedCode = replaceProcessStdout(transformedCode); + return '```typescript\n' + transformedCode + '\n```'; + } catch (error) { + console.warn(`Failed to transform code block: ${error}\n\n${codeBlock}`); + return match; // Return original code block if transformation fails + } + }, + ); + + fs.writeFileSync(file, readmeContent); + } catch (error) { + console.error('Error processing README:', error); + throw error; + } +} + +const config = { + npm: 'openai', + jsr: '@openai/openai', +}; + +processReadme(config, process.argv[2]); From ddb27b660950735f13934759c3db049bcf4dafd5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 05:07:20 +0000 Subject: [PATCH 049/509] release: 4.75.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8edd9c22e..6258f1481 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.74.0" + ".": "4.75.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 595091ff3..2d91a77c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.75.0 (2024-12-03) + +Full Changelog: [v4.74.0...v4.75.0](https://github.com/openai/openai-node/compare/v4.74.0...v4.75.0) + +### Features + +* improve docs for jsr README.md ([#1208](https://github.com/openai/openai-node/issues/1208)) ([338527e](https://github.com/openai/openai-node/commit/338527e40361e2de899a63f280d4ec2db5e87f3c)) + ## 4.74.0 (2024-12-02) Full Changelog: [v4.73.1...v4.74.0](https://github.com/openai/openai-node/compare/v4.73.1...v4.74.0) diff --git a/jsr.json b/jsr.json index eb073e7e6..a394539d1 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.74.0", + "version": "4.75.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 7e188774a..5738871a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.74.0", + "version": "4.75.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index b8dd781be..82fc52958 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.74.0'; // x-release-please-version +export const VERSION = '4.75.0'; // x-release-please-version From 0f74bf4576ed26884f9ef9148bd854e60250c1a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:20:25 +0000 Subject: [PATCH 050/509] chore: bump openapi url (#1210) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4827e5388..19920c8be 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-aa9b01fc0c17eb0cbc200533fc20d6a49c5e764ceaf8049e08b294532be6e9ff.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-d702cba829ceda336f44d0eb89ce61dba353849a40f0193e7007439345daf1bb.yml From f19c56e6087423cb2ef20aaa6b597467f4d81e48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:53:30 +0000 Subject: [PATCH 051/509] feat(api): updates (#1212) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 19920c8be..3cc042fe0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-d702cba829ceda336f44d0eb89ce61dba353849a40f0193e7007439345daf1bb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2e0e0678be19d1118fd796af291822075e40538dba326611e177e9f3dc245a53.yml From fbd968576357e635e541a3475a67fb741f603292 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 05:07:39 +0000 Subject: [PATCH 052/509] release: 4.76.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6258f1481..1cc8c9627 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.75.0" + ".": "4.76.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d91a77c9..e68b45e8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.76.0 (2024-12-05) + +Full Changelog: [v4.75.0...v4.76.0](https://github.com/openai/openai-node/compare/v4.75.0...v4.76.0) + +### Features + +* **api:** updates ([#1212](https://github.com/openai/openai-node/issues/1212)) ([e0fedf2](https://github.com/openai/openai-node/commit/e0fedf2c5a91d0c03d8dad6854b366f77eab4923)) + + +### Chores + +* bump openapi url ([#1210](https://github.com/openai/openai-node/issues/1210)) ([3fa95a4](https://github.com/openai/openai-node/commit/3fa95a429d4b2adecce35a7b96b73f6d5e88eeeb)) + ## 4.75.0 (2024-12-03) Full Changelog: [v4.74.0...v4.75.0](https://github.com/openai/openai-node/compare/v4.74.0...v4.75.0) diff --git a/jsr.json b/jsr.json index a394539d1..2c6820969 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.75.0", + "version": "4.76.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 5738871a3..fae301ee7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.75.0", + "version": "4.76.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 82fc52958..b4cc35ca9 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.75.0'; // x-release-please-version +export const VERSION = '4.76.0'; // x-release-please-version From c35555790a7cba54517f43e080d2b2dc6d8ea404 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:32:44 +0000 Subject: [PATCH 053/509] chore(internal): remove unnecessary getRequestClient function (#1215) --- src/core.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/core.ts b/src/core.ts index 0c8e69ffc..803496412 100644 --- a/src/core.ts +++ b/src/core.ts @@ -558,19 +558,13 @@ export abstract class APIClient { const timeout = setTimeout(() => controller.abort(), ms); return ( - this.getRequestClient() - // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - .fetch.call(undefined, url, { signal: controller.signal as any, ...options }) - .finally(() => { - clearTimeout(timeout); - }) + // use undefined this binding; fetch errors if bound to something else in browser/cloudflare + this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => { + clearTimeout(timeout); + }) ); } - protected getRequestClient(): RequestClient { - return { fetch: this.fetch }; - } - private shouldRetry(response: Response): boolean { // Note this is not a standard header. const shouldRetryHeader = response.headers.get('x-should-retry'); From fb4820e04a9d579e9a8913dd98cc29cf32a9a7cc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:57:28 +0000 Subject: [PATCH 054/509] chore(internal): bump cross-spawn to v7.0.6 (#1217) Note: it is a dev transitive dependency. --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index e139e1fbe..f86935095 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1370,9 +1370,9 @@ create-require@^1.1.0: integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== cross-spawn@^7.0.2, cross-spawn@^7.0.3: - version "7.0.3" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" - integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" shebang-command "^2.0.0" From 6e8c1d06dcf098ec3dabe1128d29b22eee4f4b58 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:58:00 +0000 Subject: [PATCH 055/509] release: 4.76.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1cc8c9627..10a72c4fa 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.76.0" + ".": "4.76.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e68b45e8a..7ea1f7f7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.76.1 (2024-12-10) + +Full Changelog: [v4.76.0...v4.76.1](https://github.com/openai/openai-node/compare/v4.76.0...v4.76.1) + +### Chores + +* **internal:** bump cross-spawn to v7.0.6 ([#1217](https://github.com/openai/openai-node/issues/1217)) ([c07ad29](https://github.com/openai/openai-node/commit/c07ad298d58e5aeaf816ee3de65fd59bf3fc8b66)) +* **internal:** remove unnecessary getRequestClient function ([#1215](https://github.com/openai/openai-node/issues/1215)) ([bef3925](https://github.com/openai/openai-node/commit/bef392526cd339f45c574bc476649c77be36c612)) + ## 4.76.0 (2024-12-05) Full Changelog: [v4.75.0...v4.76.0](https://github.com/openai/openai-node/compare/v4.75.0...v4.76.0) diff --git a/jsr.json b/jsr.json index 2c6820969..3fa6b07da 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.76.0", + "version": "4.76.1", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index fae301ee7..ddffb2c6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.76.0", + "version": "4.76.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index b4cc35ca9..4f8b7224e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.76.0'; // x-release-please-version +export const VERSION = '4.76.1'; // x-release-please-version From 94ef9d75f20699e80c81fb0defd31dc62d8d3585 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 10 Dec 2024 22:25:12 +0000 Subject: [PATCH 056/509] chore(types): nicer error class types + jsdocs (#1219) --- src/error.ts | 64 ++++++++++++++++++++-------------------------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/src/error.ts b/src/error.ts index 72b4f7bfd..f3dc57610 100644 --- a/src/error.ts +++ b/src/error.ts @@ -4,10 +4,17 @@ import { castToError, Headers } from './core'; export class OpenAIError extends Error {} -export class APIError extends OpenAIError { - readonly status: number | undefined; - readonly headers: Headers | undefined; - readonly error: Object | undefined; +export class APIError< + TStatus extends number | undefined = number | undefined, + THeaders extends Headers | undefined = Headers | undefined, + TError extends Object | undefined = Object | undefined, +> extends OpenAIError { + /** HTTP status for the response that caused the error */ + readonly status: TStatus; + /** HTTP headers for the response that caused the error */ + readonly headers: THeaders; + /** JSON body of the response that caused the error */ + readonly error: TError; readonly code: string | null | undefined; readonly param: string | null | undefined; @@ -15,19 +22,14 @@ export class APIError extends OpenAIError { readonly request_id: string | null | undefined; - constructor( - status: number | undefined, - error: Object | undefined, - message: string | undefined, - headers: Headers | undefined, - ) { + constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { super(`${APIError.makeMessage(status, error, message)}`); this.status = status; this.headers = headers; this.request_id = headers?.['x-request-id']; + this.error = error; const data = error as Record; - this.error = data; this.code = data?.['code']; this.param = data?.['param']; this.type = data?.['type']; @@ -60,7 +62,7 @@ export class APIError extends OpenAIError { message: string | undefined, headers: Headers | undefined, ): APIError { - if (!status) { + if (!status || !headers) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } @@ -102,17 +104,13 @@ export class APIError extends OpenAIError { } } -export class APIUserAbortError extends APIError { - override readonly status: undefined = undefined; - +export class APIUserAbortError extends APIError { constructor({ message }: { message?: string } = {}) { super(undefined, undefined, message || 'Request was aborted.', undefined); } } -export class APIConnectionError extends APIError { - override readonly status: undefined = undefined; - +export class APIConnectionError extends APIError { constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) { super(undefined, undefined, message || 'Connection error.', undefined); // in some environments the 'cause' property is already declared @@ -127,35 +125,21 @@ export class APIConnectionTimeoutError extends APIConnectionError { } } -export class BadRequestError extends APIError { - override readonly status: 400 = 400; -} +export class BadRequestError extends APIError<400, Headers> {} -export class AuthenticationError extends APIError { - override readonly status: 401 = 401; -} +export class AuthenticationError extends APIError<401, Headers> {} -export class PermissionDeniedError extends APIError { - override readonly status: 403 = 403; -} +export class PermissionDeniedError extends APIError<403, Headers> {} -export class NotFoundError extends APIError { - override readonly status: 404 = 404; -} +export class NotFoundError extends APIError<404, Headers> {} -export class ConflictError extends APIError { - override readonly status: 409 = 409; -} +export class ConflictError extends APIError<409, Headers> {} -export class UnprocessableEntityError extends APIError { - override readonly status: 422 = 422; -} +export class UnprocessableEntityError extends APIError<422, Headers> {} -export class RateLimitError extends APIError { - override readonly status: 429 = 429; -} +export class RateLimitError extends APIError<429, Headers> {} -export class InternalServerError extends APIError {} +export class InternalServerError extends APIError {} export class LengthFinishReasonError extends OpenAIError { constructor() { From f13fed4137bbbe2e6e0a83c1820ccdeecb6ddf01 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:17:57 +0000 Subject: [PATCH 057/509] chore(internal): update isAbsoluteURL (#1223) --- src/core.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.ts b/src/core.ts index 803496412..e1a93f272 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1013,8 +1013,8 @@ export const safeJSON = (text: string) => { } }; -// https://stackoverflow.com/a/19709846 -const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i'); +// https://url.spec.whatwg.org/#url-scheme-string +const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; const isAbsoluteURL = (url: string): boolean => { return startsWithSchemeRegexp.test(url); }; From 6608f957b62a734c93c006bade5e3b0b8b577c4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 05:07:38 +0000 Subject: [PATCH 058/509] release: 4.76.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 10a72c4fa..47a7d26b6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.76.1" + ".": "4.76.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ea1f7f7f..27946ddea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.76.2 (2024-12-12) + +Full Changelog: [v4.76.1...v4.76.2](https://github.com/openai/openai-node/compare/v4.76.1...v4.76.2) + +### Chores + +* **internal:** update isAbsoluteURL ([#1223](https://github.com/openai/openai-node/issues/1223)) ([e908ed7](https://github.com/openai/openai-node/commit/e908ed759996fb7706baf46d094fc77419423971)) +* **types:** nicer error class types + jsdocs ([#1219](https://github.com/openai/openai-node/issues/1219)) ([576d24c](https://github.com/openai/openai-node/commit/576d24cc4b3d766dfe28a6031bdc24ac1b711655)) + ## 4.76.1 (2024-12-10) Full Changelog: [v4.76.0...v4.76.1](https://github.com/openai/openai-node/compare/v4.76.0...v4.76.1) diff --git a/jsr.json b/jsr.json index 3fa6b07da..101edee15 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.76.1", + "version": "4.76.2", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index ddffb2c6a..53b82f070 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.76.1", + "version": "4.76.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 4f8b7224e..7117b1feb 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.76.1'; // x-release-please-version +export const VERSION = '4.76.2'; // x-release-please-version From 28649f8de711c6379edb6b9e656a9ac3bafdf763 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 13 Dec 2024 09:43:39 +0000 Subject: [PATCH 059/509] chore(internal): better ecosystem test debugging --- ecosystem-tests/cli.ts | 4 ++++ package.json | 3 ++- yarn.lock | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 4803b47c2..00120e5f9 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -4,6 +4,10 @@ import yargs from 'yargs'; import assert from 'assert'; import path from 'path'; +// @ts-ignore +var SegfaultHandler = require('segfault-handler'); +SegfaultHandler.registerHandler('crash.log'); + const TAR_NAME = 'openai.tgz'; const PACK_FOLDER = '.pack'; const PACK_FILE = `${PACK_FOLDER}/${TAR_NAME}`; diff --git a/package.json b/package.json index 53b82f070..35873e1c1 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,12 @@ "eslint": "^8.49.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-unused-imports": "^3.0.0", - "iconv-lite": "^0.6.3", "fast-check": "^3.22.0", + "iconv-lite": "^0.6.3", "jest": "^29.4.0", "prettier": "^3.0.0", "prettier-2": "npm:prettier@^2", + "segfault-handler": "^1.3.0", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", "tsc-multi": "^1.1.0", diff --git a/yarn.lock b/yarn.lock index f86935095..c0220f984 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1169,6 +1169,13 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== +bindings@^1.2.1: + version "1.5.0" + resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" + integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== + dependencies: + file-uri-to-path "1.0.0" + bplist-parser@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" @@ -1746,6 +1753,11 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" +file-uri-to-path@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" + integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== + fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -2687,6 +2699,11 @@ ms@^2.0.0, ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +nan@^2.14.0: + version "2.22.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.0.tgz#31bc433fc33213c97bad36404bb68063de604de3" + integrity sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw== + natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -3037,6 +3054,14 @@ safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +segfault-handler@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/segfault-handler/-/segfault-handler-1.3.0.tgz#054bc847832fa14f218ba6a79e42877501c8870e" + integrity sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg== + dependencies: + bindings "^1.2.1" + nan "^2.14.0" + semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" From 3a6bfe41e3b7277032844ff12186d6f0d0f83554 Mon Sep 17 00:00:00 2001 From: Guspan Tanadi <36249910+guspan-tanadi@users.noreply.github.com> Date: Fri, 13 Dec 2024 21:27:45 +0700 Subject: [PATCH 060/509] docs(README): fix helpers section links (#1224) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ac9c84a42..b03bcd870 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ main(); ``` Streaming with `openai.beta.chat.completions.stream({…})` exposes -[various helpers for your convenience](helpers.md#events) including event handlers and promises. +[various helpers for your convenience](helpers.md#chat-events) including event handlers and promises. Alternatively, you can use `openai.chat.completions.create({ stream: true, … })` which only returns an async iterable of the chunks in the stream and thus uses less memory @@ -285,12 +285,12 @@ main(); // Final content: "It's looking cold and rainy - you might want to wear a jacket!" ``` -Like with `.stream()`, we provide a variety of [helpers and events](helpers.md#events). +Like with `.stream()`, we provide a variety of [helpers and events](helpers.md#chat-events). Note that `runFunctions` was previously available as well, but has been deprecated in favor of `runTools`. Read more about various examples such as with integrating with [zod](helpers.md#integrate-with-zod), -[next.js](helpers.md#integrate-wtih-next-js), and [proxying a stream to the browser](helpers.md#proxy-streaming-to-a-browser). +[next.js](helpers.md#integrate-with-nextjs), and [proxying a stream to the browser](helpers.md#proxy-streaming-to-a-browser). ## File uploads From f361a0c0eb6ae72a902863d6e338f71dc55e416a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:28:16 +0000 Subject: [PATCH 061/509] release: 4.76.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 47a7d26b6..52c31fe71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.76.2" + ".": "4.76.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 27946ddea..4b6f57fe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.76.3 (2024-12-13) + +Full Changelog: [v4.76.2...v4.76.3](https://github.com/openai/openai-node/compare/v4.76.2...v4.76.3) + +### Chores + +* **internal:** better ecosystem test debugging ([86fc0a8](https://github.com/openai/openai-node/commit/86fc0a81ede2780d3fcebaabff3d9fa9a36cc9c0)) + + +### Documentation + +* **README:** fix helpers section links ([#1224](https://github.com/openai/openai-node/issues/1224)) ([efbe30a](https://github.com/openai/openai-node/commit/efbe30a156cec1836d3db28f663066b33be57ba2)) + ## 4.76.2 (2024-12-12) Full Changelog: [v4.76.1...v4.76.2](https://github.com/openai/openai-node/compare/v4.76.1...v4.76.2) diff --git a/jsr.json b/jsr.json index 101edee15..ef9ce6848 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.76.2", + "version": "4.76.3", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 35873e1c1..47f363ba1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.76.2", + "version": "4.76.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 7117b1feb..01cd56405 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.76.2'; // x-release-please-version +export const VERSION = '4.76.3'; // x-release-please-version From bd1a82dc8f867c271fc6f226c7d98f8de439ab7c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:26:31 +0000 Subject: [PATCH 062/509] chore(internal): fix some typos (#1227) --- src/core.ts | 4 ++-- tests/index.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core.ts b/src/core.ts index e1a93f272..68f1e676a 100644 --- a/src/core.ts +++ b/src/core.ts @@ -198,7 +198,7 @@ export abstract class APIClient { maxRetries = 2, timeout = 600000, // 10 minutes httpAgent, - fetch: overridenFetch, + fetch: overriddenFetch, }: { baseURL: string; maxRetries?: number | undefined; @@ -211,7 +211,7 @@ export abstract class APIClient { this.timeout = validatePositiveInteger('timeout', timeout); this.httpAgent = httpAgent; - this.fetch = overridenFetch ?? fetch; + this.fetch = overriddenFetch ?? fetch; } protected authHeaders(opts: FinalRequestOptions): Headers { diff --git a/tests/index.test.ts b/tests/index.test.ts index f39571121..bf113e7bb 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -177,7 +177,7 @@ describe('instantiate client', () => { expect(client.apiKey).toBe('My API Key'); }); - test('with overriden environment variable arguments', () => { + test('with overridden environment variable arguments', () => { // set options via env var process.env['OPENAI_API_KEY'] = 'another My API Key'; const client = new OpenAI({ apiKey: 'My API Key' }); From 4984aaccbddcd05349c0c47c608b387b5b1f7ef6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:56:30 +0000 Subject: [PATCH 063/509] feat(api): new o1 and GPT-4o models + preference fine-tuning (#1229) learn more here: https://platform.openai.com/docs/changelog --- .stats.yml | 2 +- api.md | 2 + src/index.ts | 4 + src/resources/chat/chat.ts | 11 +- src/resources/chat/completions.ts | 96 +++++-- src/resources/chat/index.ts | 2 + src/resources/fine-tuning/jobs/jobs.ts | 270 +++++++++++++++++- tests/api-resources/chat/completions.test.ts | 5 +- .../fine-tuning/jobs/jobs.test.ts | 14 + 9 files changed, 372 insertions(+), 34 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3cc042fe0..d4d7d3c40 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2e0e0678be19d1118fd796af291822075e40538dba326611e177e9f3dc245a53.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-779ea2754025daf5e18eb8ceb203ec321692636bc3a999338556a479178efa6c.yml diff --git a/api.md b/api.md index 465730de8..54bcf08d7 100644 --- a/api.md +++ b/api.md @@ -41,6 +41,7 @@ Types: - ChatCompletionContentPartInputAudio - ChatCompletionContentPartRefusal - ChatCompletionContentPartText +- ChatCompletionDeveloperMessageParam - ChatCompletionFunctionCallOption - ChatCompletionFunctionMessageParam - ChatCompletionMessage @@ -49,6 +50,7 @@ Types: - ChatCompletionModality - ChatCompletionNamedToolChoice - ChatCompletionPredictionContent +- ChatCompletionReasoningEffort - ChatCompletionRole - ChatCompletionStreamOptions - ChatCompletionSystemMessageParam diff --git a/src/index.ts b/src/index.ts index 58d7410e4..2320850fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -80,6 +80,7 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, ChatCompletionMessage, @@ -88,6 +89,7 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, + ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, @@ -353,6 +355,7 @@ export declare namespace OpenAI { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, type ChatCompletionMessage as ChatCompletionMessage, @@ -361,6 +364,7 @@ export declare namespace OpenAI { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 09cd3d123..2230b19bd 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -16,6 +16,7 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, ChatCompletionMessage, @@ -24,6 +25,7 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, + ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, @@ -44,6 +46,8 @@ export class Chat extends APIResource { } export type ChatModel = + | 'o1' + | 'o1-2024-12-17' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o1-mini' @@ -52,10 +56,11 @@ export type ChatModel = | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-05-13' - | 'gpt-4o-realtime-preview' - | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' + | 'gpt-4o-audio-preview-2024-12-17' + | 'gpt-4o-mini-audio-preview' + | 'gpt-4o-mini-audio-preview-2024-12-17' | 'chatgpt-4o-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' @@ -96,6 +101,7 @@ export declare namespace Chat { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, type ChatCompletionMessage as ChatCompletionMessage, @@ -104,6 +110,7 @@ export declare namespace Chat { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 8e9a4385e..31f5814cb 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -15,6 +15,12 @@ export class Completions extends APIResource { * [text generation](https://platform.openai.com/docs/guides/text-generation), * [vision](https://platform.openai.com/docs/guides/vision), and * [audio](https://platform.openai.com/docs/guides/audio) guides. + * + * Parameter support can differ depending on the model used to generate the + * response, particularly for newer reasoning models. Parameters that are only + * supported for reasoning models are noted below. For the current state of + * unsupported parameters in reasoning models, + * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning). */ create( body: ChatCompletionCreateParamsNonStreaming, @@ -135,6 +141,9 @@ export namespace ChatCompletion { } } +/** + * Messages sent by the model in response to user messages. + */ export interface ChatCompletionAssistantMessageParam { /** * The role of the messages author, in this case `assistant`. @@ -530,6 +539,29 @@ export interface ChatCompletionContentPartText { type: 'text'; } +/** + * Developer-provided instructions that the model should follow, regardless of + * messages sent by the user. With o1 models and newer, `developer` messages + * replace the previous `system` messages. + */ +export interface ChatCompletionDeveloperMessageParam { + /** + * The contents of the developer message. + */ + content: string | Array; + + /** + * The role of the messages author, in this case `developer`. + */ + role: 'developer'; + + /** + * An optional name for the participant. Provides the model information to + * differentiate between participants of the same role. + */ + name?: string; +} + /** * Specifying a particular function via `{"name": "my_function"}` forces the model * to call that function. @@ -620,7 +652,13 @@ export namespace ChatCompletionMessage { } } +/** + * Developer-provided instructions that the model should follow, regardless of + * messages sent by the user. With o1 models and newer, `developer` messages + * replace the previous `system` messages. + */ export type ChatCompletionMessageParam = + | ChatCompletionDeveloperMessageParam | ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam @@ -707,6 +745,16 @@ export interface ChatCompletionPredictionContent { type: 'content'; } +/** + * **o1 models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ +export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high'; + /** * The role of the author of a message */ @@ -725,6 +773,11 @@ export interface ChatCompletionStreamOptions { include_usage?: boolean; } +/** + * Developer-provided instructions that the model should follow, regardless of + * messages sent by the user. With o1 models and newer, use `developer` messages + * for this purpose instead. + */ export interface ChatCompletionSystemMessageParam { /** * The contents of the system message. @@ -835,6 +888,10 @@ export interface ChatCompletionToolMessageParam { tool_call_id: string; } +/** + * Messages sent by an end user, containing prompts or additional context + * information. + */ export interface ChatCompletionUserMessageParam { /** * The contents of the user message. @@ -891,20 +948,22 @@ export interface ChatCompletionCreateParamsBase { * Number between -2.0 and 2.0. Positive values penalize new tokens based on their * existing frequency in the text so far, decreasing the model's likelihood to * repeat the same line verbatim. - * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ frequency_penalty?: number | null; /** * Deprecated in favor of `tool_choice`. * - * Controls which (if any) function is called by the model. `none` means the model - * will not call a function and instead generates a message. `auto` means the model - * can pick between generating a message or calling a function. Specifying a - * particular function via `{"name": "my_function"}` forces the model to call that + * Controls which (if any) function is called by the model. + * + * `none` means the model will not call a function and instead generates a message. + * + * `auto` means the model can pick between generating a message or calling a * function. * + * Specifying a particular function via `{"name": "my_function"}` forces the model + * to call that function. + * * `none` is the default when no functions are present. `auto` is the default if * functions are present. */ @@ -998,17 +1057,21 @@ export interface ChatCompletionCreateParamsBase { * Number between -2.0 and 2.0. Positive values penalize new tokens based on * whether they appear in the text so far, increasing the model's likelihood to * talk about new topics. - * - * [See more information about frequency and presence penalties.](https://platform.openai.com/docs/guides/text-generation) */ presence_penalty?: number | null; /** - * An object specifying the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), - * [GPT-4o mini](https://platform.openai.com/docs/models#gpt-4o-mini), - * [GPT-4 Turbo](https://platform.openai.com/docs/models#gpt-4-turbo-and-gpt-4) and - * all GPT-3.5 Turbo models newer than `gpt-3.5-turbo-1106`. + * **o1 models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: ChatCompletionReasoningEffort; + + /** + * An object specifying the format that the model must output. * * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured * Outputs which ensures the model will match your supplied JSON schema. Learn more @@ -1088,9 +1151,8 @@ export interface ChatCompletionCreateParamsBase { /** * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will * make the output more random, while lower values like 0.2 will make it more - * focused and deterministic. - * - * We generally recommend altering this or `top_p` but not both. + * focused and deterministic. We generally recommend altering this or `top_p` but + * not both. */ temperature?: number | null; @@ -1223,6 +1285,7 @@ export declare namespace Completions { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, type ChatCompletionMessage as ChatCompletionMessage, @@ -1231,6 +1294,7 @@ export declare namespace Completions { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index 262bf75a2..c3be19402 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -13,6 +13,7 @@ export { type ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal, type ChatCompletionContentPartText, + type ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam, type ChatCompletionMessage, @@ -21,6 +22,7 @@ export { type ChatCompletionModality, type ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort, type ChatCompletionRole, type ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 0c320e028..44dd011aa 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -127,9 +127,8 @@ export interface FineTuningJob { finished_at: number | null; /** - * The hyperparameters used for the fine-tuning job. See the - * [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for - * more details. + * The hyperparameters used for the fine-tuning job. This value will only be + * returned when running `supervised` jobs. */ hyperparameters: FineTuningJob.Hyperparameters; @@ -195,6 +194,11 @@ export interface FineTuningJob { * A list of integrations to enable for this fine-tuning job. */ integrations?: Array | null; + + /** + * The method used for fine-tuning. + */ + method?: FineTuningJob.Method; } export namespace FineTuningJob { @@ -221,18 +225,125 @@ export namespace FineTuningJob { } /** - * The hyperparameters used for the fine-tuning job. See the - * [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) for - * more details. + * The hyperparameters used for the fine-tuning job. This value will only be + * returned when running `supervised` jobs. */ export interface Hyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + /** * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. "auto" decides the optimal number of epochs based - * on the size of the dataset. If setting the number manually, we support any - * number between 1 and 50 epochs. + * through the training dataset. + */ + n_epochs?: 'auto' | number; + } + + /** + * The method used for fine-tuning. + */ + export interface Method { + /** + * Configuration for the DPO fine-tuning method. + */ + dpo?: Method.Dpo; + + /** + * Configuration for the supervised fine-tuning method. */ - n_epochs: 'auto' | number; + supervised?: Method.Supervised; + + /** + * The type of method. Is either `supervised` or `dpo`. + */ + type?: 'supervised' | 'dpo'; + } + + export namespace Method { + /** + * Configuration for the DPO fine-tuning method. + */ + export interface Dpo { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: Dpo.Hyperparameters; + } + + export namespace Dpo { + /** + * The hyperparameters used for the fine-tuning job. + */ + export interface Hyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * The beta value for the DPO method. A higher beta value will increase the weight + * of the penalty between the policy and reference model. + */ + beta?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + } + } + + /** + * Configuration for the supervised fine-tuning method. + */ + export interface Supervised { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: Supervised.Hyperparameters; + } + + export namespace Supervised { + /** + * The hyperparameters used for the fine-tuning job. + */ + export interface Hyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + } + } } } @@ -240,15 +351,40 @@ export namespace FineTuningJob { * Fine-tuning job event object */ export interface FineTuningJobEvent { + /** + * The object identifier. + */ id: string; + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ created_at: number; + /** + * The log level of the event. + */ level: 'info' | 'warn' | 'error'; + /** + * The message of the event. + */ message: string; + /** + * The object type, which is always "fine_tuning.job.event". + */ object: 'fine_tuning.job.event'; + + /** + * The data associated with the event. + */ + data?: unknown; + + /** + * The type of event. + */ + type?: 'message' | 'metrics'; } export type FineTuningJobIntegration = FineTuningJobWandbIntegrationObject; @@ -318,8 +454,10 @@ export interface JobCreateParams { * your file with the purpose `fine-tune`. * * The contents of the file should differ depending on if the model uses the - * [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or + * [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input), * [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) + * format, or if the fine-tuning method uses the + * [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input) * format. * * See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) @@ -328,7 +466,8 @@ export interface JobCreateParams { training_file: string; /** - * The hyperparameters used for the fine-tuning job. + * The hyperparameters used for the fine-tuning job. This value is now deprecated + * in favor of `method`, and should be passed in under the `method` parameter. */ hyperparameters?: JobCreateParams.Hyperparameters; @@ -337,6 +476,11 @@ export interface JobCreateParams { */ integrations?: Array | null; + /** + * The method used for fine-tuning. + */ + method?: JobCreateParams.Method; + /** * The seed controls the reproducibility of the job. Passing in the same seed and * job parameters should produce the same results, but may differ in rare cases. If @@ -372,7 +516,9 @@ export interface JobCreateParams { export namespace JobCreateParams { /** - * The hyperparameters used for the fine-tuning job. + * @deprecated: The hyperparameters used for the fine-tuning job. This value is now + * deprecated in favor of `method`, and should be passed in under the `method` + * parameter. */ export interface Hyperparameters { /** @@ -444,6 +590,104 @@ export namespace JobCreateParams { tags?: Array; } } + + /** + * The method used for fine-tuning. + */ + export interface Method { + /** + * Configuration for the DPO fine-tuning method. + */ + dpo?: Method.Dpo; + + /** + * Configuration for the supervised fine-tuning method. + */ + supervised?: Method.Supervised; + + /** + * The type of method. Is either `supervised` or `dpo`. + */ + type?: 'supervised' | 'dpo'; + } + + export namespace Method { + /** + * Configuration for the DPO fine-tuning method. + */ + export interface Dpo { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: Dpo.Hyperparameters; + } + + export namespace Dpo { + /** + * The hyperparameters used for the fine-tuning job. + */ + export interface Hyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * The beta value for the DPO method. A higher beta value will increase the weight + * of the penalty between the policy and reference model. + */ + beta?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + } + } + + /** + * Configuration for the supervised fine-tuning method. + */ + export interface Supervised { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: Supervised.Hyperparameters; + } + + export namespace Supervised { + /** + * The hyperparameters used for the fine-tuning job. + */ + export interface Hyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + } + } + } } export interface JobListParams extends CursorPageParams {} diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 5dcbf9ad6..dfc09f69b 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -11,7 +11,7 @@ const client = new OpenAI({ describe('resource completions', () => { test('create: only required params', async () => { const responsePromise = client.chat.completions.create({ - messages: [{ content: 'string', role: 'system' }], + messages: [{ content: 'string', role: 'developer' }], model: 'gpt-4o', }); const rawResponse = await responsePromise.asResponse(); @@ -25,7 +25,7 @@ describe('resource completions', () => { test('create: required and optional params', async () => { const response = await client.chat.completions.create({ - messages: [{ content: 'string', role: 'system', name: 'name' }], + messages: [{ content: 'string', role: 'developer', name: 'name' }], model: 'gpt-4o', audio: { format: 'wav', voice: 'alloy' }, frequency_penalty: -2, @@ -41,6 +41,7 @@ describe('resource completions', () => { parallel_tool_calls: true, prediction: { content: 'string', type: 'content' }, presence_penalty: -2, + reasoning_effort: 'low', response_format: { type: 'text' }, seed: -9007199254740991, service_tier: 'auto', diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index 0ab09768a..4de83a8b7 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -34,6 +34,20 @@ describe('resource jobs', () => { wandb: { project: 'my-wandb-project', entity: 'entity', name: 'name', tags: ['custom-tag'] }, }, ], + method: { + dpo: { + hyperparameters: { + batch_size: 'auto', + beta: 'auto', + learning_rate_multiplier: 'auto', + n_epochs: 'auto', + }, + }, + supervised: { + hyperparameters: { batch_size: 'auto', learning_rate_multiplier: 'auto', n_epochs: 'auto' }, + }, + type: 'supervised', + }, seed: 42, suffix: 'x', validation_file: 'file-abc123', From 13fa61db5e3407be684868db488c46d95f6805bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:05:03 +0000 Subject: [PATCH 064/509] chore(internal): spec update (#1230) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d4d7d3c40..7b5235e3c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-779ea2754025daf5e18eb8ceb203ec321692636bc3a999338556a479178efa6c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0d64ca9e45f51b4279f87b205eeb3a3576df98407698ce053f2e2302c1c08df1.yml From 21c3ed6db585433880c2462b3c62abcbe7ec6903 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:05:30 +0000 Subject: [PATCH 065/509] release: 4.77.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 52c31fe71..6b843f931 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.76.3" + ".": "4.77.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6f57fe4..d33ce4c1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.77.0 (2024-12-17) + +Full Changelog: [v4.76.3...v4.77.0](https://github.com/openai/openai-node/compare/v4.76.3...v4.77.0) + +### Features + +* **api:** new o1 and GPT-4o models + preference fine-tuning ([#1229](https://github.com/openai/openai-node/issues/1229)) ([2e872d4](https://github.com/openai/openai-node/commit/2e872d4ac3717ab8f61741efffb7a31acd798338)) + + +### Chores + +* **internal:** fix some typos ([#1227](https://github.com/openai/openai-node/issues/1227)) ([d51fcfe](https://github.com/openai/openai-node/commit/d51fcfe3a66550a684eeeb0e6f17e1d9825cdf78)) +* **internal:** spec update ([#1230](https://github.com/openai/openai-node/issues/1230)) ([ed2b61d](https://github.com/openai/openai-node/commit/ed2b61d32703b64d9f91223bc02627a607f60483)) + ## 4.76.3 (2024-12-13) Full Changelog: [v4.76.2...v4.76.3](https://github.com/openai/openai-node/compare/v4.76.2...v4.76.3) diff --git a/jsr.json b/jsr.json index ef9ce6848..d76a2040e 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.76.3", + "version": "4.77.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 47f363ba1..54633aa5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.76.3", + "version": "4.77.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 01cd56405..fdf4e5224 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.76.3'; // x-release-please-version +export const VERSION = '4.77.0'; // x-release-please-version From a97ea73cafcb56e94be7ff691c4022da575cf60e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:16:46 +0000 Subject: [PATCH 066/509] chore(internal): spec update (#1231) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7b5235e3c..248cc366d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0d64ca9e45f51b4279f87b205eeb3a3576df98407698ce053f2e2302c1c08df1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml From 4a213dad6f2104dc02a75724acc62134d25db472 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:07:12 +0000 Subject: [PATCH 067/509] fix(client): normalize method (#1235) --- src/core.ts | 12 +++++++++++- tests/index.test.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index 68f1e676a..972cceaec 100644 --- a/src/core.ts +++ b/src/core.ts @@ -557,9 +557,19 @@ export abstract class APIClient { const timeout = setTimeout(() => controller.abort(), ms); + const fetchOptions = { + signal: controller.signal as any, + ...options, + }; + if (fetchOptions.method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = fetchOptions.method.toUpperCase(); + } + return ( // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => { + this.fetch.call(undefined, url, fetchOptions).finally(() => { clearTimeout(timeout); }) ); diff --git a/tests/index.test.ts b/tests/index.test.ts index bf113e7bb..a6f0040a4 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -122,6 +122,19 @@ describe('instantiate client', () => { expect(spy).toHaveBeenCalledTimes(1); }); + test('normalized method', async () => { + let capturedRequest: RequestInit | undefined; + const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + capturedRequest = init; + return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); + }; + + const client = new OpenAI({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch }); + + await client.patch('/foo'); + expect(capturedRequest?.method).toEqual('PATCH'); + }); + describe('baseUrl', () => { test('trailing slash', () => { const client = new OpenAI({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); From 63879681ccaca3dc1e17b27464e2f830b8f63b4f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:54:17 +0000 Subject: [PATCH 068/509] docs: minor formatting changes (#1236) --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8bbc1b07..dde09d52d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ## Setting up the environment -This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable). +This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install). Other package managers may work but are not officially supported for development. To set up the repository, run: @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can … ``` -``` -chmod +x examples/.ts +```sh +$ chmod +x examples/.ts # run the example against your api -yarn tsn -T examples/.ts +$ yarn tsn -T examples/.ts ``` ## Using the repository from source From 7a857b3a609eaa471292bf8337ae5ae69dd74ac2 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 16:32:18 +0000 Subject: [PATCH 069/509] feat: initial alpha changes --- .eslintrc.js | 19 + README.md | 27 +- api.md | 89 +- jest.config.ts | 2 +- package.json | 77 +- scripts/build | 8 +- scripts/build-deno | 15 - scripts/lint | 11 +- scripts/utils/attw-report.cjs | 21 + scripts/utils/fix-index-exports.cjs | 7 +- scripts/utils/postprocess-files.cjs | 199 +-- src/_shims/MultipartBody.ts | 9 - src/_shims/README.md | 46 - src/_shims/auto/runtime-bun.ts | 4 - src/_shims/auto/runtime-deno.ts | 4 - src/_shims/auto/runtime-node.ts | 4 - src/_shims/auto/runtime.ts | 4 - src/_shims/auto/types-deno.ts | 4 - src/_shims/auto/types-node.ts | 4 - src/_shims/auto/types.d.ts | 101 -- src/_shims/auto/types.js | 3 - src/_shims/auto/types.mjs | 3 - src/_shims/bun-runtime.ts | 14 - src/_shims/index-deno.ts | 110 -- src/_shims/index.d.ts | 81 -- src/_shims/index.js | 13 - src/_shims/index.mjs | 7 - src/_shims/manual-types.d.ts | 12 - src/_shims/manual-types.js | 3 - src/_shims/manual-types.mjs | 3 - src/_shims/node-runtime.ts | 81 -- src/_shims/node-types.d.ts | 42 - src/_shims/node-types.js | 3 - src/_shims/node-types.mjs | 3 - src/_shims/registry.ts | 65 - src/_shims/web-runtime.ts | 103 -- src/_shims/web-types.d.ts | 83 -- src/_shims/web-types.js | 3 - src/_shims/web-types.mjs | 3 - src/api-promise.ts | 93 ++ src/azure.ts | 194 +++ src/client.ts | 896 ++++++++++++ src/core.ts | 1243 ----------------- src/error.ts | 6 +- src/index.ts | 661 +-------- src/internal/builtin-types.ts | 79 ++ src/internal/detect-platform.ts | 192 +++ src/internal/errors.ts | 18 + src/internal/headers.ts | 96 ++ src/internal/parse.ts | 70 + src/internal/polyfill/crypto.node.d.ts | 10 + src/internal/polyfill/crypto.node.js | 11 + src/internal/polyfill/crypto.node.mjs | 2 + src/internal/polyfill/file.node.d.ts | 9 + src/internal/polyfill/file.node.js | 17 + src/internal/polyfill/file.node.mjs | 9 + src/internal/request-options.ts | 71 + src/internal/shim-types.d.ts | 28 + src/internal/shims.ts | 124 ++ src/internal/types.ts | 6 + src/internal/utils.ts | 8 + src/internal/utils/base64.ts | 40 + src/internal/utils/env.ts | 20 + src/internal/utils/log.ts | 9 + src/internal/utils/sleep.ts | 3 + src/internal/utils/uuid.ts | 13 + src/internal/utils/values.ts | 94 ++ src/pagination.ts | 145 +- src/resource.ts | 2 +- src/resources/audio/speech.ts | 6 +- src/resources/audio/transcriptions.ts | 26 +- src/resources/audio/translations.ts | 27 +- src/resources/batches.ts | 35 +- src/resources/beta/assistants.ts | 46 +- src/resources/beta/beta.ts | 6 +- src/resources/beta/index.ts | 4 +- src/resources/beta/threads/index.ts | 8 +- src/resources/beta/threads/messages.ts | 91 +- src/resources/beta/threads/runs/index.ts | 51 +- src/resources/beta/threads/runs/runs.ts | 174 +-- src/resources/beta/threads/runs/steps.ts | 104 +- src/resources/beta/threads/threads.ts | 56 +- .../beta/vector-stores/file-batches.ts | 108 +- src/resources/beta/vector-stores/files.ts | 80 +- src/resources/beta/vector-stores/index.ts | 8 +- .../beta/vector-stores/vector-stores.ts | 56 +- src/resources/chat/chat.ts | 2 - src/resources/chat/completions.ts | 21 +- src/resources/chat/index.ts | 1 - src/resources/completions.ts | 15 +- src/resources/embeddings.ts | 8 +- src/resources/files.ts | 51 +- src/resources/fine-tuning/fine-tuning.ts | 6 +- src/resources/fine-tuning/index.ts | 4 +- src/resources/fine-tuning/jobs/checkpoints.ts | 35 +- src/resources/fine-tuning/jobs/index.ts | 6 +- src/resources/fine-tuning/jobs/jobs.ts | 74 +- src/resources/images.ts | 23 +- src/resources/index.ts | 6 +- src/resources/models.ts | 23 +- src/resources/moderations.ts | 8 +- src/resources/uploads/parts.ts | 17 +- src/resources/uploads/uploads.ts | 17 +- src/shims/node.ts | 50 - src/shims/web.ts | 50 - src/streaming.ts | 5 +- src/uploads.ts | 111 +- .../audio/transcriptions.test.ts | 1 - .../api-resources/audio/translations.test.ts | 1 - tests/api-resources/batches.test.ts | 22 - tests/api-resources/beta/assistants.test.ts | 26 +- .../beta/threads/messages.test.ts | 41 +- .../beta/threads/runs/runs.test.ts | 47 +- .../beta/threads/runs/steps.test.ts | 70 +- .../beta/threads/threads.test.ts | 26 +- .../beta/vector-stores/file-batches.test.ts | 69 +- .../beta/vector-stores/files.test.ts | 40 +- .../beta/vector-stores/vector-stores.test.ts | 26 +- tests/api-resources/chat/completions.test.ts | 1 - tests/api-resources/completions.test.ts | 1 - tests/api-resources/embeddings.test.ts | 1 - tests/api-resources/files.test.ts | 40 +- .../fine-tuning/jobs/checkpoints.test.ts | 10 - .../fine-tuning/jobs/jobs.test.ts | 29 - tests/api-resources/images.test.ts | 1 - tests/api-resources/models.test.ts | 26 +- tests/api-resources/moderations.test.ts | 1 - tests/api-resources/uploads/parts.test.ts | 1 - tests/api-resources/uploads/uploads.test.ts | 8 - tests/base64.test.ts | 80 ++ tests/buildHeaders.test.ts | 88 ++ tests/form.test.ts | 4 +- tests/index.test.ts | 132 +- tests/responses.test.ts | 23 - tests/streaming.test.ts | 1 - tests/uploads.test.ts | 12 +- tsconfig.build.json | 2 +- tsconfig.dist-src.json | 2 +- tsconfig.json | 3 +- yarn.lock | 560 +++++--- 140 files changed, 3812 insertions(+), 4461 deletions(-) create mode 100644 scripts/utils/attw-report.cjs delete mode 100644 src/_shims/MultipartBody.ts delete mode 100644 src/_shims/README.md delete mode 100644 src/_shims/auto/runtime-bun.ts delete mode 100644 src/_shims/auto/runtime-deno.ts delete mode 100644 src/_shims/auto/runtime-node.ts delete mode 100644 src/_shims/auto/runtime.ts delete mode 100644 src/_shims/auto/types-deno.ts delete mode 100644 src/_shims/auto/types-node.ts delete mode 100644 src/_shims/auto/types.d.ts delete mode 100644 src/_shims/auto/types.js delete mode 100644 src/_shims/auto/types.mjs delete mode 100644 src/_shims/bun-runtime.ts delete mode 100644 src/_shims/index-deno.ts delete mode 100644 src/_shims/index.d.ts delete mode 100644 src/_shims/index.js delete mode 100644 src/_shims/index.mjs delete mode 100644 src/_shims/manual-types.d.ts delete mode 100644 src/_shims/manual-types.js delete mode 100644 src/_shims/manual-types.mjs delete mode 100644 src/_shims/node-runtime.ts delete mode 100644 src/_shims/node-types.d.ts delete mode 100644 src/_shims/node-types.js delete mode 100644 src/_shims/node-types.mjs delete mode 100644 src/_shims/registry.ts delete mode 100644 src/_shims/web-runtime.ts delete mode 100644 src/_shims/web-types.d.ts delete mode 100644 src/_shims/web-types.js delete mode 100644 src/_shims/web-types.mjs create mode 100644 src/api-promise.ts create mode 100644 src/azure.ts create mode 100644 src/client.ts delete mode 100644 src/core.ts create mode 100644 src/internal/builtin-types.ts create mode 100644 src/internal/detect-platform.ts create mode 100644 src/internal/errors.ts create mode 100644 src/internal/headers.ts create mode 100644 src/internal/parse.ts create mode 100644 src/internal/polyfill/crypto.node.d.ts create mode 100644 src/internal/polyfill/crypto.node.js create mode 100644 src/internal/polyfill/crypto.node.mjs create mode 100644 src/internal/polyfill/file.node.d.ts create mode 100644 src/internal/polyfill/file.node.js create mode 100644 src/internal/polyfill/file.node.mjs create mode 100644 src/internal/request-options.ts create mode 100644 src/internal/shim-types.d.ts create mode 100644 src/internal/shims.ts create mode 100644 src/internal/types.ts create mode 100644 src/internal/utils.ts create mode 100644 src/internal/utils/base64.ts create mode 100644 src/internal/utils/env.ts create mode 100644 src/internal/utils/log.ts create mode 100644 src/internal/utils/sleep.ts create mode 100644 src/internal/utils/uuid.ts create mode 100644 src/internal/utils/values.ts delete mode 100644 src/shims/node.ts delete mode 100644 src/shims/web.ts create mode 100644 tests/base64.test.ts create mode 100644 tests/buildHeaders.test.ts diff --git a/.eslintrc.js b/.eslintrc.js index 60f0e7a35..c12fdc463 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,6 +5,25 @@ module.exports = { 'no-unused-vars': 'off', 'prettier/prettier': 'error', 'unused-imports/no-unused-imports': 'error', + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + group: ['openai', 'openai/*'], + message: 'Use a relative import, not a package import.', + }, + ], + }, + ], }, + overrides: [ + { + files: ['tests/**', 'examples/**'], + rules: { + 'no-restricted-imports': 'off', + }, + }, + ], root: true, }; diff --git a/README.md b/README.md index b03bcd870..eb659577f 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,6 @@ Request parameters that correspond to file uploads can be passed in many differe ```ts import fs from 'fs'; -import fetch from 'node-fetch'; import OpenAI, { toFile } from 'openai'; const client = new OpenAI(); @@ -560,21 +559,23 @@ validate or strip extra properties from the response from the API. ### Customizing the fetch client -By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments. +By default, this library expects a global `fetch` function is defined. -If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment, -(for example, if you are running Node with `--experimental-fetch` or using NextJS which polyfills with `undici`), -add the following import before your first import `from "OpenAI"`: +If you want to use a different `fetch` function, you can either polyfill the global: ```ts -// Tell TypeScript and the package to use the global web fetch instead of node-fetch. -// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed. -import 'openai/shims/web'; -import OpenAI from 'openai'; +import fetch from 'my-fetch'; + +globalThis.fetch = fetch; ``` -To do the inverse, add `import "openai/shims/node"` (which does import polyfills). -This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/openai/openai-node/tree/master/src/_shims#readme)). +Or pass it to the client: + +```ts +import fetch from 'my-fetch'; + +const client = new OpenAI({ fetch }); +``` ### Logging and middleware @@ -620,6 +621,8 @@ await client.models.list({ }); ``` +## Frequently Asked Questions + ## Semantic versioning This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: @@ -634,7 +637,7 @@ We are keen for your feedback; please open an [issue](https://www.github.com/ope ## Requirements -TypeScript >= 4.5 is supported. +TypeScript >= 4.9 is supported. The following runtimes are supported: diff --git a/api.md b/api.md index 54bcf08d7..cd4c59e0c 100644 --- a/api.md +++ b/api.md @@ -59,7 +59,6 @@ Types: - ChatCompletionToolChoiceOption - ChatCompletionToolMessageParam - ChatCompletionUserMessageParam -- CreateChatCompletionRequestMessage Methods: @@ -89,11 +88,11 @@ Types: Methods: - client.files.create({ ...params }) -> FileObject -- client.files.retrieve(fileId) -> FileObject +- client.files.retrieve(fileID) -> FileObject - client.files.list({ ...params }) -> FileObjectsPage -- client.files.del(fileId) -> FileDeleted -- client.files.content(fileId) -> Response -- client.files.retrieveContent(fileId) -> string +- client.files.delete(fileID) -> FileDeleted +- client.files.content(fileID) -> Response +- client.files.retrieveContent(fileID) -> string - client.files.waitForProcessing(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise<FileObject> # Images @@ -179,7 +178,7 @@ Methods: - client.models.retrieve(model) -> Model - client.models.list() -> ModelsPage -- client.models.del(model) -> ModelDeleted +- client.models.delete(model) -> ModelDeleted # FineTuning @@ -196,10 +195,10 @@ Types: Methods: - client.fineTuning.jobs.create({ ...params }) -> FineTuningJob -- client.fineTuning.jobs.retrieve(fineTuningJobId) -> FineTuningJob +- client.fineTuning.jobs.retrieve(fineTuningJobID) -> FineTuningJob - client.fineTuning.jobs.list({ ...params }) -> FineTuningJobsPage -- client.fineTuning.jobs.cancel(fineTuningJobId) -> FineTuningJob -- client.fineTuning.jobs.listEvents(fineTuningJobId, { ...params }) -> FineTuningJobEventsPage +- client.fineTuning.jobs.cancel(fineTuningJobID) -> FineTuningJob +- client.fineTuning.jobs.listEvents(fineTuningJobID, { ...params }) -> FineTuningJobEventsPage ### Checkpoints @@ -209,7 +208,7 @@ Types: Methods: -- client.fineTuning.jobs.checkpoints.list(fineTuningJobId, { ...params }) -> FineTuningJobCheckpointsPage +- client.fineTuning.jobs.checkpoints.list(fineTuningJobID, { ...params }) -> FineTuningJobCheckpointsPage # Beta @@ -230,10 +229,10 @@ Types: Methods: - client.beta.vectorStores.create({ ...params }) -> VectorStore -- client.beta.vectorStores.retrieve(vectorStoreId) -> VectorStore -- client.beta.vectorStores.update(vectorStoreId, { ...params }) -> VectorStore +- client.beta.vectorStores.retrieve(vectorStoreID) -> VectorStore +- client.beta.vectorStores.update(vectorStoreID, { ...params }) -> VectorStore - client.beta.vectorStores.list({ ...params }) -> VectorStoresPage -- client.beta.vectorStores.del(vectorStoreId) -> VectorStoreDeleted +- client.beta.vectorStores.delete(vectorStoreID) -> VectorStoreDeleted ### Files @@ -244,10 +243,10 @@ Types: Methods: -- client.beta.vectorStores.files.create(vectorStoreId, { ...params }) -> VectorStoreFile -- client.beta.vectorStores.files.retrieve(vectorStoreId, fileId) -> VectorStoreFile -- client.beta.vectorStores.files.list(vectorStoreId, { ...params }) -> VectorStoreFilesPage -- client.beta.vectorStores.files.del(vectorStoreId, fileId) -> VectorStoreFileDeleted +- client.beta.vectorStores.files.create(vectorStoreID, { ...params }) -> VectorStoreFile +- client.beta.vectorStores.files.retrieve(fileID, { ...params }) -> VectorStoreFile +- client.beta.vectorStores.files.list(vectorStoreID, { ...params }) -> VectorStoreFilesPage +- client.beta.vectorStores.files.delete(fileID, { ...params }) -> VectorStoreFileDeleted - client.beta.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> - client.beta.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> - client.beta.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> @@ -261,10 +260,10 @@ Types: Methods: -- client.beta.vectorStores.fileBatches.create(vectorStoreId, { ...params }) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.retrieve(vectorStoreId, batchId) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.cancel(vectorStoreId, batchId) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.listFiles(vectorStoreId, batchId, { ...params }) -> VectorStoreFilesPage +- client.beta.vectorStores.fileBatches.create(vectorStoreID, { ...params }) -> VectorStoreFileBatch +- client.beta.vectorStores.fileBatches.retrieve(batchID, { ...params }) -> VectorStoreFileBatch +- client.beta.vectorStores.fileBatches.cancel(batchID, { ...params }) -> VectorStoreFileBatch +- client.beta.vectorStores.fileBatches.listFiles(batchID, { ...params }) -> VectorStoreFilesPage - client.beta.vectorStores.fileBatches.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFileBatch> - client.beta.vectorStores.fileBatches.poll(vectorStoreId, batchId, options?) -> Promise<VectorStoreFileBatch> - client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options?) -> Promise<VectorStoreFileBatch> @@ -298,10 +297,10 @@ Types: Methods: - client.beta.assistants.create({ ...params }) -> Assistant -- client.beta.assistants.retrieve(assistantId) -> Assistant -- client.beta.assistants.update(assistantId, { ...params }) -> Assistant +- client.beta.assistants.retrieve(assistantID) -> Assistant +- client.beta.assistants.update(assistantID, { ...params }) -> Assistant - client.beta.assistants.list({ ...params }) -> AssistantsPage -- client.beta.assistants.del(assistantId) -> AssistantDeleted +- client.beta.assistants.delete(assistantID) -> AssistantDeleted ## Threads @@ -317,9 +316,9 @@ Types: Methods: - client.beta.threads.create({ ...params }) -> Thread -- client.beta.threads.retrieve(threadId) -> Thread -- client.beta.threads.update(threadId, { ...params }) -> Thread -- client.beta.threads.del(threadId) -> ThreadDeleted +- client.beta.threads.retrieve(threadID) -> Thread +- client.beta.threads.update(threadID, { ...params }) -> Thread +- client.beta.threads.delete(threadID) -> ThreadDeleted - client.beta.threads.createAndRun({ ...params }) -> Run - client.beta.threads.createAndRunPoll(body, options?) -> Promise<Threads.Run> - client.beta.threads.createAndRunStream(body, options?) -> AssistantStream @@ -334,12 +333,12 @@ Types: Methods: -- client.beta.threads.runs.create(threadId, { ...params }) -> Run -- client.beta.threads.runs.retrieve(threadId, runId) -> Run -- client.beta.threads.runs.update(threadId, runId, { ...params }) -> Run -- client.beta.threads.runs.list(threadId, { ...params }) -> RunsPage -- client.beta.threads.runs.cancel(threadId, runId) -> Run -- client.beta.threads.runs.submitToolOutputs(threadId, runId, { ...params }) -> Run +- client.beta.threads.runs.create(threadID, { ...params }) -> Run +- client.beta.threads.runs.retrieve(runID, { ...params }) -> Run +- client.beta.threads.runs.update(runID, { ...params }) -> Run +- client.beta.threads.runs.list(threadID, { ...params }) -> RunsPage +- client.beta.threads.runs.cancel(runID, { ...params }) -> Run +- client.beta.threads.runs.submitToolOutputs(runID, { ...params }) -> Run - client.beta.threads.runs.createAndPoll(threadId, body, options?) -> Promise<Run> - client.beta.threads.runs.createAndStream(threadId, body, options?) -> AssistantStream - client.beta.threads.runs.poll(threadId, runId, options?) -> Promise<Run> @@ -372,8 +371,8 @@ Types: Methods: -- client.beta.threads.runs.steps.retrieve(threadId, runId, stepId, { ...params }) -> RunStep -- client.beta.threads.runs.steps.list(threadId, runId, { ...params }) -> RunStepsPage +- client.beta.threads.runs.steps.retrieve(stepID, { ...params }) -> RunStep +- client.beta.threads.runs.steps.list(runID, { ...params }) -> RunStepsPage ### Messages @@ -410,11 +409,11 @@ Types: Methods: -- client.beta.threads.messages.create(threadId, { ...params }) -> Message -- client.beta.threads.messages.retrieve(threadId, messageId) -> Message -- client.beta.threads.messages.update(threadId, messageId, { ...params }) -> Message -- client.beta.threads.messages.list(threadId, { ...params }) -> MessagesPage -- client.beta.threads.messages.del(threadId, messageId) -> MessageDeleted +- client.beta.threads.messages.create(threadID, { ...params }) -> Message +- client.beta.threads.messages.retrieve(messageID, { ...params }) -> Message +- client.beta.threads.messages.update(messageID, { ...params }) -> Message +- client.beta.threads.messages.list(threadID, { ...params }) -> MessagesPage +- client.beta.threads.messages.delete(messageID, { ...params }) -> MessageDeleted # Batches @@ -427,9 +426,9 @@ Types: Methods: - client.batches.create({ ...params }) -> Batch -- client.batches.retrieve(batchId) -> Batch +- client.batches.retrieve(batchID) -> Batch - client.batches.list({ ...params }) -> BatchesPage -- client.batches.cancel(batchId) -> Batch +- client.batches.cancel(batchID) -> Batch # Uploads @@ -440,8 +439,8 @@ Types: Methods: - client.uploads.create({ ...params }) -> Upload -- client.uploads.cancel(uploadId) -> Upload -- client.uploads.complete(uploadId, { ...params }) -> Upload +- client.uploads.cancel(uploadID) -> Upload +- client.uploads.complete(uploadID, { ...params }) -> Upload ## Parts @@ -451,4 +450,4 @@ Types: Methods: -- client.uploads.parts.create(uploadId, { ...params }) -> UploadPart +- client.uploads.parts.create(uploadID, { ...params }) -> UploadPart diff --git a/jest.config.ts b/jest.config.ts index aa2853fd2..f78198b16 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -8,9 +8,9 @@ const config: JestConfigWithTsJest = { }, moduleNameMapper: { '^openai$': '/src/index.ts', - '^openai/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', '^openai/(.*)$': '/src/$1', }, + setupFilesAfterEnv: ['/jest.setup.ts'], modulePathIgnorePatterns: [ '/ecosystem-tests/', '/dist/', diff --git a/package.json b/package.json index 54633aa5d..f0dbc9c9a 100644 --- a/package.json +++ b/package.json @@ -23,21 +23,15 @@ "lint": "./scripts/lint", "fix": "./scripts/format" }, - "dependencies": { - "@types/node": "^18.11.18", - "@types/node-fetch": "^2.6.4", - "abort-controller": "^3.0.0", - "agentkeepalive": "^4.2.1", - "form-data-encoder": "1.7.2", - "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7" - }, + "dependencies": {}, "devDependencies": { + "@arethetypeswrong/cli": "^0.17.0", "@swc/core": "^1.3.102", "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", + "@types/node": "^20.17.6", "@typescript-eslint/eslint-plugin": "^6.7.0", - "@typescript-eslint/parser": "^6.7.0", + "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.49.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-unused-imports": "^3.0.0", @@ -45,83 +39,32 @@ "iconv-lite": "^0.6.3", "jest": "^29.4.0", "prettier": "^3.0.0", - "prettier-2": "npm:prettier@^2", - "segfault-handler": "^1.3.0", + "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "^1.1.0", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "typescript": "^4.8.2", "zod": "^3.23.8" }, - "sideEffects": [ - "./_shims/index.js", - "./_shims/index.mjs", - "./shims/node.js", - "./shims/node.mjs", - "./shims/web.js", - "./shims/web.mjs" - ], "imports": { "openai": ".", "openai/*": "./src/*" }, "exports": { - "./_shims/auto/*": { - "deno": { - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*.js", - "default": "./dist/_shims/auto/*.mjs" - }, - "bun": { - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*-bun.js", - "default": "./dist/_shims/auto/*-bun.mjs" - }, - "browser": { - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*.js", - "default": "./dist/_shims/auto/*.mjs" - }, - "worker": { - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*.js", - "default": "./dist/_shims/auto/*.mjs" - }, - "workerd": { - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*.js", - "default": "./dist/_shims/auto/*.mjs" - }, - "node": { - "types": "./dist/_shims/auto/*-node.d.ts", - "require": "./dist/_shims/auto/*-node.js", - "default": "./dist/_shims/auto/*-node.mjs" - }, - "types": "./dist/_shims/auto/*.d.ts", - "require": "./dist/_shims/auto/*.js", - "default": "./dist/_shims/auto/*.mjs" - }, ".": { - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" + "import": "./dist/index.mjs", + "require": "./dist/index.js" }, "./*.mjs": { - "types": "./dist/*.d.ts", "default": "./dist/*.mjs" }, "./*.js": { - "types": "./dist/*.d.ts", "default": "./dist/*.js" }, "./*": { - "types": "./dist/*.d.ts", - "require": "./dist/*.js", - "default": "./dist/*.mjs" + "import": "./dist/*.mjs", + "require": "./dist/*.js" } }, "bin": "./bin/cli", diff --git a/scripts/build b/scripts/build index 4e86f99e2..aadf87be6 100755 --- a/scripts/build +++ b/scripts/build @@ -15,7 +15,6 @@ rm -rf dist; mkdir dist # Copy src to dist/src and build from dist/src into dist, so that # the source map for index.js.map will refer to ./src/index.ts etc cp -rp src README.md dist -rm dist/src/_shims/*-deno.ts dist/src/_shims/auto/*-deno.ts for file in LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist; fi done @@ -29,9 +28,6 @@ node scripts/utils/make-dist-package-json.cjs > dist/package.json # build to .js/.mjs/.d.ts files npm exec tsc-multi -# copy over handwritten .js/.mjs/.d.ts files -cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims -cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto # we need to add exports = module.exports = OpenAI to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs @@ -42,6 +38,10 @@ node scripts/utils/fix-index-exports.cjs # the same export default statement) cp dist/index.d.ts dist/index.d.mts cp tsconfig.dist-src.json dist/src/tsconfig.json +cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts +cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts +mkdir -p dist/internal/polyfill +cp src/internal/polyfill/*.{mjs,js,d.ts} dist/internal/polyfill node scripts/utils/postprocess-files.cjs diff --git a/scripts/build-deno b/scripts/build-deno index bce31078e..028d9dfe5 100755 --- a/scripts/build-deno +++ b/scripts/build-deno @@ -7,21 +7,6 @@ cd "$(dirname "$0")/.." rm -rf dist-deno; mkdir dist-deno cp -rp src/* jsr.json dist-deno -rm -rf dist-deno/shims - -rm dist-deno/_shims/node*.{js,mjs,ts} -rm dist-deno/_shims/manual*.{js,mjs,ts} -rm dist-deno/_shims/index.{d.ts,js,mjs} -for file in dist-deno/_shims/*-deno.ts; do - mv -- "$file" "${file%-deno.ts}.ts" -done - -rm dist-deno/_shims/auto/*-node.ts -rm dist-deno/_shims/auto/*.{d.ts,js,mjs} -for file in dist-deno/_shims/auto/*-deno.ts; do - mv -- "$file" "${file%-deno.ts}.ts" -done - for file in README.md LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist-deno; fi done diff --git a/scripts/lint b/scripts/lint index 6ba75dfb5..0096d1e51 100755 --- a/scripts/lint +++ b/scripts/lint @@ -7,5 +7,12 @@ cd "$(dirname "$0")/.." echo "==> Running eslint" ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . -echo "==> Running tsc" -./node_modules/.bin/tsc --noEmit +echo "==> Building" +./scripts/build # also checks types + +echo "==> Running Are The Types Wrong?" +./node_modules/.bin/attw --pack dist -f json >.attw.json || true +node scripts/utils/attw-report.cjs + +echo "==> Running publint" +./node_modules/.bin/publint dist diff --git a/scripts/utils/attw-report.cjs b/scripts/utils/attw-report.cjs new file mode 100644 index 000000000..e45e7952b --- /dev/null +++ b/scripts/utils/attw-report.cjs @@ -0,0 +1,21 @@ +const fs = require('fs'); +const problems = Object.values(JSON.parse(fs.readFileSync('.attw.json', 'utf-8')).problems) + .flat() + .filter( + (problem) => + !( + // This is intentional, if the user specifies .mjs they get ESM. + ( + (problem.kind === 'CJSResolvesToESM' && problem.entrypoint.endsWith('.mjs')) || + // This is intentional for backwards compat reasons. + (problem.kind === 'MissingExportEquals' && problem.implementationFileName.endsWith('/index.js')) + ) + ), + ); +fs.unlinkSync('.attw.json'); +if (problems.length) { + process.stdout.write('The types are wrong!\n' + JSON.stringify(problems, null, 2) + '\n'); + process.exitCode = 1; +} else { + process.stdout.write('Types ok!\n'); +} diff --git a/scripts/utils/fix-index-exports.cjs b/scripts/utils/fix-index-exports.cjs index ee5cebb85..e5e10b3e7 100644 --- a/scripts/utils/fix-index-exports.cjs +++ b/scripts/utils/fix-index-exports.cjs @@ -8,7 +8,10 @@ const indexJs = let before = fs.readFileSync(indexJs, 'utf8'); let after = before.replace( - /^\s*exports\.default\s*=\s*(\w+)/m, - 'exports = module.exports = $1;\nmodule.exports.AzureOpenAI = AzureOpenAI;\nexports.default = $1', + /^(\s*Object\.defineProperty\s*\(exports,\s*["']__esModule["'].+)$/m, + `exports = module.exports = function (...args) { + return new exports.default(...args) + } + $1`.replace(/^ /gm, ''), ); fs.writeFileSync(indexJs, after, 'utf8'); diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index c46a46d07..deae575e3 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -1,98 +1,11 @@ +// @ts-check const fs = require('fs'); const path = require('path'); -const { parse } = require('@typescript-eslint/parser'); - -const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'openai/'; const distDir = process.env['DIST_PATH'] ? path.resolve(process.env['DIST_PATH']) : path.resolve(__dirname, '..', '..', 'dist'); -const distSrcDir = path.join(distDir, 'src'); - -/** - * Quick and dirty AST traversal - */ -function traverse(node, visitor) { - if (!node || typeof node.type !== 'string') return; - visitor.node?.(node); - visitor[node.type]?.(node); - for (const key in node) { - const value = node[key]; - if (Array.isArray(value)) { - for (const elem of value) traverse(elem, visitor); - } else if (value instanceof Object) { - traverse(value, visitor); - } - } -} - -/** - * Helper method for replacing arbitrary ranges of text in input code. - * - * The `replacer` is a function that will be called with a mini-api. For example: - * - * replaceRanges('foobar', ({ replace }) => replace([0, 3], 'baz')) // 'bazbar' - * - * The replaced ranges must not be overlapping. - */ -function replaceRanges(code, replacer) { - const replacements = []; - replacer({ replace: (range, replacement) => replacements.push({ range, replacement }) }); - - if (!replacements.length) return code; - replacements.sort((a, b) => a.range[0] - b.range[0]); - const overlapIndex = replacements.findIndex( - (r, index) => index > 0 && replacements[index - 1].range[1] > r.range[0], - ); - if (overlapIndex >= 0) { - throw new Error( - `replacements overlap: ${JSON.stringify(replacements[overlapIndex - 1])} and ${JSON.stringify( - replacements[overlapIndex], - )}`, - ); - } - - const parts = []; - let end = 0; - for (const { - range: [from, to], - replacement, - } of replacements) { - if (from > end) parts.push(code.substring(end, from)); - parts.push(replacement); - end = to; - } - if (end < code.length) parts.push(code.substring(end)); - return parts.join(''); -} - -/** - * Like calling .map(), where the iteratee is called on the path in every import or export from statement. - * @returns the transformed code - */ -function mapModulePaths(code, iteratee) { - const ast = parse(code, { range: true }); - return replaceRanges(code, ({ replace }) => - traverse(ast, { - node(node) { - switch (node.type) { - case 'ImportDeclaration': - case 'ExportNamedDeclaration': - case 'ExportAllDeclaration': - case 'ImportExpression': - if (node.source) { - const { range, value } = node.source; - const transformed = iteratee(value); - if (transformed !== value) { - replace(range, JSON.stringify(transformed)); - } - } - } - }, - }), - ); -} async function* walk(dir) { for await (const d of await fs.promises.opendir(dir)) { @@ -103,63 +16,79 @@ async function* walk(dir) { } async function postprocess() { - for await (const file of walk(path.resolve(__dirname, '..', '..', 'dist'))) { - if (!/\.([cm]?js|(\.d)?[cm]?ts)$/.test(file)) continue; + for await (const file of walk(distDir)) { + if (!/(\.d)?[cm]?ts$/.test(file)) continue; const code = await fs.promises.readFile(file, 'utf8'); - let transformed = mapModulePaths(code, (importPath) => { - if (file.startsWith(distSrcDir)) { - if (importPath.startsWith(pkgImportPath)) { - // convert self-references in dist/src to relative paths - let relativePath = path.relative( - path.dirname(file), - path.join(distSrcDir, importPath.substring(pkgImportPath.length)), - ); - if (!relativePath.startsWith('.')) relativePath = `./${relativePath}`; - return relativePath; - } - return importPath; - } - if (importPath.startsWith('.')) { - // add explicit file extensions to relative imports - const { dir, name } = path.parse(importPath); - const ext = /\.mjs$/.test(file) ? '.mjs' : '.js'; - return `${dir}/${name}${ext}`; - } - return importPath; - }); - - if (file.startsWith(distSrcDir) && !file.endsWith('_shims/index.d.ts')) { - // strip out `unknown extends Foo ? never :` shim guards in dist/src - // to prevent errors from appearing in Go To Source - transformed = transformed.replace( - new RegExp('unknown extends (typeof )?\\S+ \\? \\S+ :\\s*'.replace(/\s+/, '\\s+'), 'gm'), - // replace with same number of characters to avoid breaking source maps - (match) => ' '.repeat(match.length), - ); - } - - if (file.endsWith('.d.ts')) { - // work around bad tsc behavior - // if we have `import { type Readable } from 'openai/_shims/index'`, - // tsc sometimes replaces `Readable` with `import("stream").Readable` inline - // in the output .d.ts - transformed = transformed.replace(/import\("stream"\).Readable/g, 'Readable'); - } - - // strip out lib="dom" and types="node" references; these are needed at build time, - // but would pollute the user's TS environment - transformed = transformed.replace( - /^ *\/\/\/ * ' '.repeat(match.length - 1) + '\n', ); if (transformed !== code) { - await fs.promises.writeFile(file, transformed, 'utf8'); console.error(`wrote ${path.relative(process.cwd(), file)}`); + await fs.promises.writeFile(file, transformed, 'utf8'); + } + } + + const newExports = { + '.': { + require: { + types: './index.d.ts', + default: './index.js', + }, + types: './index.d.mts', + default: './index.mjs', + }, + }; + + for (const entry of await fs.promises.readdir(distDir, { withFileTypes: true })) { + if (entry.isDirectory() && entry.name !== 'src' && entry.name !== 'internal' && entry.name !== 'bin') { + const subpath = './' + entry.name; + newExports[subpath + '/*.mjs'] = { + default: subpath + '/*.mjs', + }; + newExports[subpath + '/*.js'] = { + default: subpath + '/*.js', + }; + newExports[subpath + '/*'] = { + import: subpath + '/*.mjs', + require: subpath + '/*.js', + }; + } else if (entry.isFile() && /\.[cm]?js$/.test(entry.name)) { + const { name, ext } = path.parse(entry.name); + const subpathWithoutExt = './' + name; + const subpath = './' + entry.name; + newExports[subpathWithoutExt] ||= { import: undefined, require: undefined }; + const isModule = ext[1] === 'm'; + if (isModule) { + newExports[subpathWithoutExt].import = subpath; + } else { + newExports[subpathWithoutExt].require = subpath; + } + newExports[subpath] = { + default: subpath, + }; } } + await fs.promises.writeFile( + 'dist/package.json', + JSON.stringify( + Object.assign( + /** @type {Record} */ ( + JSON.parse(await fs.promises.readFile('dist/package.json', 'utf-8')) + ), + { + exports: newExports, + }, + ), + null, + 2, + ), + ); } postprocess(); diff --git a/src/_shims/MultipartBody.ts b/src/_shims/MultipartBody.ts deleted file mode 100644 index af3b11188..000000000 --- a/src/_shims/MultipartBody.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export class MultipartBody { - constructor(public body: any) {} - get [Symbol.toStringTag](): string { - return 'MultipartBody'; - } -} diff --git a/src/_shims/README.md b/src/_shims/README.md deleted file mode 100644 index b3a349b41..000000000 --- a/src/_shims/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# 👋 Wondering what everything in here does? - -`openai` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various -edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM). - -To do this, `openai` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node. - -It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to -automatically select the correct shims for each environment. However, conditional exports are a fairly new -feature and not supported everywhere. For instance, the TypeScript `"moduleResolution": "node"` - -setting doesn't consult the `exports` map, compared to `"moduleResolution": "nodeNext"`, which does. -Unfortunately that's still the default setting, and it can result in errors like -getting the wrong raw `Response` type from `.asResponse()`, for example. - -The user can work around these issues by manually importing one of: - -- `import 'openai/shims/node'` -- `import 'openai/shims/web'` - -All of the code here in `_shims` handles selecting the automatic default shims or manual overrides. - -### How it works - Runtime - -Runtime shims get installed by calling `setShims` exported by `openai/_shims/registry`. - -Manually importing `openai/shims/node` or `openai/shims/web`, calls `setShims` with the respective runtime shims. - -All client code imports shims from `openai/_shims/index`, which: - -- checks if shims have been set manually -- if not, calls `setShims` with the shims from `openai/_shims/auto/runtime` -- re-exports the installed shims from `openai/_shims/registry`. - -`openai/_shims/auto/runtime` exports web runtime shims. -If the `node` export condition is set, the export map replaces it with `openai/_shims/auto/runtime-node`. - -### How it works - Type time - -All client code imports shim types from `openai/_shims/index`, which selects the manual types from `openai/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `openai/_shims/auto/types`. - -`openai/_shims/manual-types` exports an empty namespace. -Manually importing `openai/shims/node` or `openai/shims/web` merges declarations into this empty namespace, so they get picked up by `openai/_shims/index`. - -`openai/_shims/auto/types` exports web type definitions. -If the `node` export condition is set, the export map replaces it with `openai/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`. diff --git a/src/_shims/auto/runtime-bun.ts b/src/_shims/auto/runtime-bun.ts deleted file mode 100644 index e053254b3..000000000 --- a/src/_shims/auto/runtime-bun.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../bun-runtime'; diff --git a/src/_shims/auto/runtime-deno.ts b/src/_shims/auto/runtime-deno.ts deleted file mode 100644 index 62b7a39ee..000000000 --- a/src/_shims/auto/runtime-deno.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../web-runtime'; diff --git a/src/_shims/auto/runtime-node.ts b/src/_shims/auto/runtime-node.ts deleted file mode 100644 index 0ae2216fe..000000000 --- a/src/_shims/auto/runtime-node.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../node-runtime'; diff --git a/src/_shims/auto/runtime.ts b/src/_shims/auto/runtime.ts deleted file mode 100644 index 62b7a39ee..000000000 --- a/src/_shims/auto/runtime.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../web-runtime'; diff --git a/src/_shims/auto/types-deno.ts b/src/_shims/auto/types-deno.ts deleted file mode 100644 index 226fb15a0..000000000 --- a/src/_shims/auto/types-deno.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../web-types'; diff --git a/src/_shims/auto/types-node.ts b/src/_shims/auto/types-node.ts deleted file mode 100644 index 2625a8b70..000000000 --- a/src/_shims/auto/types-node.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export * from '../node-types'; diff --git a/src/_shims/auto/types.d.ts b/src/_shims/auto/types.d.ts deleted file mode 100644 index d7755070b..000000000 --- a/src/_shims/auto/types.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export type Agent = any; - -// @ts-ignore -declare const _fetch: unknown extends typeof fetch ? never : typeof fetch; -export { _fetch as fetch }; - -// @ts-ignore -type _Request = unknown extends Request ? never : Request; -export { _Request as Request }; - -// @ts-ignore -type _RequestInfo = unknown extends RequestInfo ? never : RequestInfo; -export { type _RequestInfo as RequestInfo }; - -// @ts-ignore -type _RequestInit = unknown extends RequestInit ? never : RequestInit; -export { type _RequestInit as RequestInit }; - -// @ts-ignore -type _Response = unknown extends Response ? never : Response; -export { _Response as Response }; - -// @ts-ignore -type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit; -export { type _ResponseInit as ResponseInit }; - -// @ts-ignore -type _ResponseType = unknown extends ResponseType ? never : ResponseType; -export { type _ResponseType as ResponseType }; - -// @ts-ignore -type _BodyInit = unknown extends BodyInit ? never : BodyInit; -export { type _BodyInit as BodyInit }; - -// @ts-ignore -type _Headers = unknown extends Headers ? never : Headers; -export { _Headers as Headers }; - -// @ts-ignore -type _HeadersInit = unknown extends HeadersInit ? never : HeadersInit; -export { type _HeadersInit as HeadersInit }; - -type EndingType = 'native' | 'transparent'; - -export interface BlobPropertyBag { - endings?: EndingType; - type?: string; -} - -export interface FilePropertyBag extends BlobPropertyBag { - lastModified?: number; -} - -export type FileFromPathOptions = Omit; - -// @ts-ignore -type _FormData = unknown extends FormData ? never : FormData; -// @ts-ignore -declare const _FormData: unknown extends typeof FormData ? never : typeof FormData; -export { _FormData as FormData }; - -// @ts-ignore -type _File = unknown extends File ? never : File; -// @ts-ignore -declare const _File: unknown extends typeof File ? never : typeof File; -export { _File as File }; - -// @ts-ignore -type _Blob = unknown extends Blob ? never : Blob; -// @ts-ignore -declare const _Blob: unknown extends typeof Blob ? never : typeof Blob; -export { _Blob as Blob }; - -export declare class Readable { - readable: boolean; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - read(size?: number): any; - pause(): this; - resume(): this; - isPaused(): boolean; - destroy(error?: Error): this; - [Symbol.asyncIterator](): AsyncIterableIterator; -} - -export declare class FsReadStream extends Readable { - path: {}; // node type is string | Buffer -} - -// @ts-ignore -type _ReadableStream = unknown extends ReadableStream ? never : ReadableStream; -// @ts-ignore -declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream; -export { _ReadableStream as ReadableStream }; diff --git a/src/_shims/auto/types.js b/src/_shims/auto/types.js deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/auto/types.js +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/auto/types.mjs b/src/_shims/auto/types.mjs deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/auto/types.mjs +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/bun-runtime.ts b/src/_shims/bun-runtime.ts deleted file mode 100644 index 8d5aaab0c..000000000 --- a/src/_shims/bun-runtime.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import { type Shims } from './registry'; -import { getRuntime as getWebRuntime } from './web-runtime'; -import { ReadStream as FsReadStream } from 'node:fs'; - -export function getRuntime(): Shims { - const runtime = getWebRuntime(); - function isFsReadStream(value: any): value is FsReadStream { - return value instanceof FsReadStream; - } - return { ...runtime, isFsReadStream }; -} diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts deleted file mode 100644 index d9eabb5a9..000000000 --- a/src/_shims/index-deno.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { MultipartBody } from './MultipartBody'; -import { type RequestOptions } from '../core'; - -export const kind: string = 'web'; - -export type Agent = any; - -const _fetch = fetch; -type _fetch = typeof fetch; -export { _fetch as fetch }; - -const _Request = Request; -type _Request = Request; -export { _Request as Request }; - -type _RequestInfo = RequestInfo; -export { type _RequestInfo as RequestInfo }; - -type _RequestInit = RequestInit; -export { type _RequestInit as RequestInit }; - -const _Response = Response; -type _Response = Response; -export { _Response as Response }; - -type _ResponseInit = ResponseInit; -export { type _ResponseInit as ResponseInit }; - -type _ResponseType = ResponseType; -export { type _ResponseType as ResponseType }; - -type _BodyInit = BodyInit; -export { type _BodyInit as BodyInit }; - -const _Headers = Headers; -type _Headers = Headers; -export { _Headers as Headers }; - -type _HeadersInit = HeadersInit; -export { type _HeadersInit as HeadersInit }; - -type EndingType = 'native' | 'transparent'; - -export interface BlobPropertyBag { - endings?: EndingType; - type?: string; -} - -export interface FilePropertyBag extends BlobPropertyBag { - lastModified?: number; -} - -export type FileFromPathOptions = Omit; - -const _FormData = FormData; -type _FormData = FormData; -export { _FormData as FormData }; - -const _File = File; -type _File = File; -export { _File as File }; - -const _Blob = Blob; -type _Blob = Blob; -export { _Blob as Blob }; - -export async function getMultipartRequestOptions>( - form: FormData, - opts: RequestOptions, -): Promise> { - return { - ...opts, - body: new MultipartBody(form) as any, - }; -} - -export function getDefaultAgent(url: string) { - return undefined; -} -export function fileFromPath() { - throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads', - ); -} - -export const isFsReadStream = (value: any) => false; - -export declare class Readable { - readable: boolean; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - read(size?: number): any; - pause(): this; - resume(): this; - isPaused(): boolean; - destroy(error?: Error): this; - [Symbol.asyncIterator](): AsyncIterableIterator; -} - -export declare class FsReadStream extends Readable { - path: {}; // node type is string | Buffer -} - -const _ReadableStream = ReadableStream; -type _ReadableStream = ReadableStream; -export { _ReadableStream as ReadableStream }; diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts deleted file mode 100644 index d867b293b..000000000 --- a/src/_shims/index.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import { manual } from './manual-types'; -import * as auto from 'openai/_shims/auto/types'; -import { type RequestOptions } from '../core'; - -type SelectType = unknown extends Manual ? Auto : Manual; - -export const kind: string; - -// @ts-ignore -export type Agent = SelectType; - -// @ts-ignore -export const fetch: SelectType; - -// @ts-ignore -export type Request = SelectType; -// @ts-ignore -export type RequestInfo = SelectType; -// @ts-ignore -export type RequestInit = SelectType; - -// @ts-ignore -export type Response = SelectType; -// @ts-ignore -export type ResponseInit = SelectType; -// @ts-ignore -export type ResponseType = SelectType; -// @ts-ignore -export type BodyInit = SelectType; -// @ts-ignore -export type Headers = SelectType; -// @ts-ignore -export const Headers: SelectType; -// @ts-ignore -export type HeadersInit = SelectType; - -// @ts-ignore -export type BlobPropertyBag = SelectType; -// @ts-ignore -export type FilePropertyBag = SelectType; -// @ts-ignore -export type FileFromPathOptions = SelectType; -// @ts-ignore -export type FormData = SelectType; -// @ts-ignore -export const FormData: SelectType; -// @ts-ignore -export type File = SelectType; -// @ts-ignore -export const File: SelectType; -// @ts-ignore -export type Blob = SelectType; -// @ts-ignore -export const Blob: SelectType; - -// @ts-ignore -export type Readable = SelectType; -// @ts-ignore -export type FsReadStream = SelectType; -// @ts-ignore -export type ReadableStream = SelectType; -// @ts-ignore -export const ReadableStream: SelectType; - -export function getMultipartRequestOptions>( - form: FormData, - opts: RequestOptions, -): Promise>; - -export function getDefaultAgent(url: string): any; - -// @ts-ignore -export type FileFromPathOptions = SelectType; - -export function fileFromPath(path: string, options?: FileFromPathOptions): Promise; -export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; - -export function isFsReadStream(value: any): value is FsReadStream; diff --git a/src/_shims/index.js b/src/_shims/index.js deleted file mode 100644 index b5fc8229e..000000000 --- a/src/_shims/index.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -const shims = require('./registry'); -const auto = require('openai/_shims/auto/runtime'); -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); -for (const property of Object.keys(shims)) { - Object.defineProperty(exports, property, { - get() { - return shims[property]; - }, - }); -} diff --git a/src/_shims/index.mjs b/src/_shims/index.mjs deleted file mode 100644 index 81665e610..000000000 --- a/src/_shims/index.mjs +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import * as shims from './registry.mjs'; -import * as auto from 'openai/_shims/auto/runtime'; -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); -export * from './registry.mjs'; diff --git a/src/_shims/manual-types.d.ts b/src/_shims/manual-types.d.ts deleted file mode 100644 index 3d00fc243..000000000 --- a/src/_shims/manual-types.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -/** - * Types will get added to this namespace when you import one of the following: - * - * import 'openai/shims/node' - * import 'openai/shims/web' - * - * Importing more than one will cause type and runtime errors. - */ -export namespace manual {} diff --git a/src/_shims/manual-types.js b/src/_shims/manual-types.js deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/manual-types.js +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/manual-types.mjs b/src/_shims/manual-types.mjs deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/manual-types.mjs +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/node-runtime.ts b/src/_shims/node-runtime.ts deleted file mode 100644 index ab9f2ab5c..000000000 --- a/src/_shims/node-runtime.ts +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import * as nf from 'node-fetch'; -import * as fd from 'formdata-node'; -import { type File, type FilePropertyBag } from 'formdata-node'; -import KeepAliveAgent from 'agentkeepalive'; -import { AbortController as AbortControllerPolyfill } from 'abort-controller'; -import { ReadStream as FsReadStream } from 'node:fs'; -import { type Agent } from 'node:http'; -import { FormDataEncoder } from 'form-data-encoder'; -import { Readable } from 'node:stream'; -import { type RequestOptions } from '../core'; -import { MultipartBody } from './MultipartBody'; -import { type Shims } from './registry'; -import { ReadableStream } from 'node:stream/web'; - -type FileFromPathOptions = Omit; - -let fileFromPathWarned = false; - -/** - * @deprecated use fs.createReadStream('./my/file.txt') instead - */ -async function fileFromPath(path: string): Promise; -async function fileFromPath(path: string, filename?: string): Promise; -async function fileFromPath(path: string, options?: FileFromPathOptions): Promise; -async function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; -async function fileFromPath(path: string, ...args: any[]): Promise { - // this import fails in environments that don't handle export maps correctly, like old versions of Jest - const { fileFromPath: _fileFromPath } = await import('formdata-node/file-from-path'); - - if (!fileFromPathWarned) { - console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`); - fileFromPathWarned = true; - } - // @ts-ignore - return await _fileFromPath(path, ...args); -} - -const defaultHttpAgent: Agent = new KeepAliveAgent({ keepAlive: true, timeout: 5 * 60 * 1000 }); -const defaultHttpsAgent: Agent = new KeepAliveAgent.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 }); - -async function getMultipartRequestOptions>( - form: fd.FormData, - opts: RequestOptions, -): Promise> { - const encoder = new FormDataEncoder(form); - const readable = Readable.from(encoder); - const body = new MultipartBody(readable); - const headers = { - ...opts.headers, - ...encoder.headers, - 'Content-Length': encoder.contentLength, - }; - - return { ...opts, body: body as any, headers }; -} - -export function getRuntime(): Shims { - // Polyfill global object if needed. - if (typeof AbortController === 'undefined') { - // @ts-expect-error (the types are subtly different, but compatible in practice) - globalThis.AbortController = AbortControllerPolyfill; - } - return { - kind: 'node', - fetch: nf.default, - Request: nf.Request, - Response: nf.Response, - Headers: nf.Headers, - FormData: fd.FormData, - Blob: fd.Blob, - File: fd.File, - ReadableStream, - getMultipartRequestOptions, - getDefaultAgent: (url: string): Agent => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent), - fileFromPath, - isFsReadStream: (value: any): value is FsReadStream => value instanceof FsReadStream, - }; -} diff --git a/src/_shims/node-types.d.ts b/src/_shims/node-types.d.ts deleted file mode 100644 index c159e5fa7..000000000 --- a/src/_shims/node-types.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import * as nf from 'node-fetch'; -import * as fd from 'formdata-node'; - -export { type Agent } from 'node:http'; -export { type Readable } from 'node:stream'; -export { type ReadStream as FsReadStream } from 'node:fs'; -export { ReadableStream } from 'node:stream/web'; - -export const fetch: typeof nf.default; - -export type Request = nf.Request; -export type RequestInfo = nf.RequestInfo; -export type RequestInit = nf.RequestInit; - -export type Response = nf.Response; -export type ResponseInit = nf.ResponseInit; -export type ResponseType = nf.ResponseType; -export type BodyInit = nf.BodyInit; -export type Headers = nf.Headers; -export type HeadersInit = nf.HeadersInit; - -type EndingType = 'native' | 'transparent'; -export interface BlobPropertyBag { - endings?: EndingType; - type?: string; -} - -export interface FilePropertyBag extends BlobPropertyBag { - lastModified?: number; -} - -export type FileFromPathOptions = Omit; - -export type FormData = fd.FormData; -export const FormData: typeof fd.FormData; -export type File = fd.File; -export const File: typeof fd.File; -export type Blob = fd.Blob; -export const Blob: typeof fd.Blob; diff --git a/src/_shims/node-types.js b/src/_shims/node-types.js deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/node-types.js +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/node-types.mjs b/src/_shims/node-types.mjs deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/node-types.mjs +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/registry.ts b/src/_shims/registry.ts deleted file mode 100644 index 1fa39642e..000000000 --- a/src/_shims/registry.ts +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import { type RequestOptions } from '../core'; - -export interface Shims { - kind: string; - fetch: any; - Request: any; - Response: any; - Headers: any; - FormData: any; - Blob: any; - File: any; - ReadableStream: any; - getMultipartRequestOptions: >( - form: Shims['FormData'], - opts: RequestOptions, - ) => Promise>; - getDefaultAgent: (url: string) => any; - fileFromPath: - | ((path: string, filename?: string, options?: {}) => Promise) - | ((path: string, options?: {}) => Promise); - isFsReadStream: (value: any) => boolean; -} - -export let auto = false; -export let kind: Shims['kind'] | undefined = undefined; -export let fetch: Shims['fetch'] | undefined = undefined; -export let Request: Shims['Request'] | undefined = undefined; -export let Response: Shims['Response'] | undefined = undefined; -export let Headers: Shims['Headers'] | undefined = undefined; -export let FormData: Shims['FormData'] | undefined = undefined; -export let Blob: Shims['Blob'] | undefined = undefined; -export let File: Shims['File'] | undefined = undefined; -export let ReadableStream: Shims['ReadableStream'] | undefined = undefined; -export let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined = undefined; -export let getDefaultAgent: Shims['getDefaultAgent'] | undefined = undefined; -export let fileFromPath: Shims['fileFromPath'] | undefined = undefined; -export let isFsReadStream: Shims['isFsReadStream'] | undefined = undefined; - -export function setShims(shims: Shims, options: { auto: boolean } = { auto: false }) { - if (auto) { - throw new Error( - `you must \`import 'openai/shims/${shims.kind}'\` before importing anything else from openai`, - ); - } - if (kind) { - throw new Error(`can't \`import 'openai/shims/${shims.kind}'\` after \`import 'openai/shims/${kind}'\``); - } - auto = options.auto; - kind = shims.kind; - fetch = shims.fetch; - Request = shims.Request; - Response = shims.Response; - Headers = shims.Headers; - FormData = shims.FormData; - Blob = shims.Blob; - File = shims.File; - ReadableStream = shims.ReadableStream; - getMultipartRequestOptions = shims.getMultipartRequestOptions; - getDefaultAgent = shims.getDefaultAgent; - fileFromPath = shims.fileFromPath; - isFsReadStream = shims.isFsReadStream; -} diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts deleted file mode 100644 index a5e90bcf8..000000000 --- a/src/_shims/web-runtime.ts +++ /dev/null @@ -1,103 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -import { MultipartBody } from './MultipartBody'; -import { type RequestOptions } from '../core'; -import { type Shims } from './registry'; - -export function getRuntime({ manuallyImported }: { manuallyImported?: boolean } = {}): Shims { - const recommendation = - manuallyImported ? - `You may need to use polyfills` - : `Add one of these imports before your first \`import … from 'openai'\`: -- \`import 'openai/shims/node'\` (if you're running on Node) -- \`import 'openai/shims/web'\` (otherwise) -`; - - let _fetch, _Request, _Response, _Headers; - try { - // @ts-ignore - _fetch = fetch; - // @ts-ignore - _Request = Request; - // @ts-ignore - _Response = Response; - // @ts-ignore - _Headers = Headers; - } catch (error) { - throw new Error( - `this environment is missing the following Web Fetch API type: ${ - (error as any).message - }. ${recommendation}`, - ); - } - - return { - kind: 'web', - fetch: _fetch, - Request: _Request, - Response: _Response, - Headers: _Headers, - FormData: - // @ts-ignore - typeof FormData !== 'undefined' ? FormData : ( - class FormData { - // @ts-ignore - constructor() { - throw new Error( - `file uploads aren't supported in this environment yet as 'FormData' is undefined. ${recommendation}`, - ); - } - } - ), - Blob: - typeof Blob !== 'undefined' ? Blob : ( - class Blob { - constructor() { - throw new Error( - `file uploads aren't supported in this environment yet as 'Blob' is undefined. ${recommendation}`, - ); - } - } - ), - File: - // @ts-ignore - typeof File !== 'undefined' ? File : ( - class File { - // @ts-ignore - constructor() { - throw new Error( - `file uploads aren't supported in this environment yet as 'File' is undefined. ${recommendation}`, - ); - } - } - ), - ReadableStream: - // @ts-ignore - typeof ReadableStream !== 'undefined' ? ReadableStream : ( - class ReadableStream { - // @ts-ignore - constructor() { - throw new Error( - `streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`, - ); - } - } - ), - getMultipartRequestOptions: async >( - // @ts-ignore - form: FormData, - opts: RequestOptions, - ): Promise> => ({ - ...opts, - body: new MultipartBody(form) as any, - }), - getDefaultAgent: (url: string) => undefined, - fileFromPath: () => { - throw new Error( - 'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads', - ); - }, - isFsReadStream: (value: any) => false, - }; -} diff --git a/src/_shims/web-types.d.ts b/src/_shims/web-types.d.ts deleted file mode 100644 index 4ff351383..000000000 --- a/src/_shims/web-types.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ -export type Agent = any; - -declare const _fetch: typeof fetch; -export { _fetch as fetch }; - -type _Request = Request; -export { _Request as Request }; - -type _RequestInfo = RequestInfo; -export { type _RequestInfo as RequestInfo }; - -type _RequestInit = RequestInit; -export { type _RequestInit as RequestInit }; - -type _Response = Response; -export { _Response as Response }; - -type _ResponseInit = ResponseInit; -export { type _ResponseInit as ResponseInit }; - -type _ResponseType = ResponseType; -export { type _ResponseType as ResponseType }; - -type _BodyInit = BodyInit; -export { type _BodyInit as BodyInit }; - -type _Headers = Headers; -export { _Headers as Headers }; - -type _HeadersInit = HeadersInit; -export { type _HeadersInit as HeadersInit }; - -type EndingType = 'native' | 'transparent'; - -export interface BlobPropertyBag { - endings?: EndingType; - type?: string; -} - -export interface FilePropertyBag extends BlobPropertyBag { - lastModified?: number; -} - -export type FileFromPathOptions = Omit; - -type _FormData = FormData; -declare const _FormData: typeof FormData; -export { _FormData as FormData }; - -type _File = File; -declare const _File: typeof File; -export { _File as File }; - -type _Blob = Blob; -declare const _Blob: typeof Blob; -export { _Blob as Blob }; - -export declare class Readable { - readable: boolean; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - read(size?: number): any; - pause(): this; - resume(): this; - isPaused(): boolean; - destroy(error?: Error): this; - [Symbol.asyncIterator](): AsyncIterableIterator; -} - -export declare class FsReadStream extends Readable { - path: {}; // node type is string | Buffer -} - -type _ReadableStream = ReadableStream; -declare const _ReadableStream: typeof ReadableStream; -export { _ReadableStream as ReadableStream }; diff --git a/src/_shims/web-types.js b/src/_shims/web-types.js deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/web-types.js +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/_shims/web-types.mjs b/src/_shims/web-types.mjs deleted file mode 100644 index ddbdb799c..000000000 --- a/src/_shims/web-types.mjs +++ /dev/null @@ -1,3 +0,0 @@ -/** - * Disclaimer: modules in _shims aren't intended to be imported by SDK users. - */ diff --git a/src/api-promise.ts b/src/api-promise.ts new file mode 100644 index 000000000..fd39a6364 --- /dev/null +++ b/src/api-promise.ts @@ -0,0 +1,93 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { type PromiseOrValue } from './internal/types'; +import { + type APIResponseProps, + defaultParseResponse, + type WithRequestID, + addRequestID, +} from './internal/parse'; + +/** + * A subclass of `Promise` providing additional helper methods + * for interacting with the SDK. + */ +export class APIPromise extends Promise> { + private parsedPromise: Promise> | undefined; + + constructor( + private responsePromise: Promise, + private parseResponse: ( + props: APIResponseProps, + ) => PromiseOrValue> = defaultParseResponse, + ) { + super((resolve) => { + // this is maybe a bit weird but this has to be a no-op to not implicitly + // parse the response body; instead .then, .catch, .finally are overridden + // to parse the response + resolve(null as any); + }); + } + + _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { + return new APIPromise(this.responsePromise, async (props) => + addRequestID(transform(await this.parseResponse(props), props), props.response), + ); + } + + /** + * Gets the raw `Response` instance instead of parsing the response + * data. + * + * If you want to parse the response body but still get the `Response` + * instance, you can use {@link withResponse()}. + * + * 👋 Getting the wrong TypeScript type for `Response`? + * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` + * to your `tsconfig.json`. + */ + asResponse(): Promise { + return this.responsePromise.then((p) => p.response); + } + + /** + * Gets the parsed response data, the raw `Response` instance and the ID of the request, + * returned via the X-Request-ID header which is useful for debugging requests and reporting + * issues to OpenAI. + * + * If you just want to get the raw `Response` instance without parsing it, + * you can use {@link asResponse()}. + * + * 👋 Getting the wrong TypeScript type for `Response`? + * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` + * to your `tsconfig.json`. + */ + async withResponse(): Promise<{ data: T; response: Response }> { + const [data, response] = await Promise.all([this.parse(), this.asResponse()]); + return { data, response, request_id: response.headers.get('x-request-id') }; + } + + private parse(): Promise> { + if (!this.parsedPromise) { + this.parsedPromise = this.responsePromise.then(this.parseResponse) as any as Promise>; + } + return this.parsedPromise; + } + + override then, TResult2 = never>( + onfulfilled?: ((value: WithRequestID) => TResult1 | PromiseLike) | undefined | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, + ): Promise { + return this.parse().then(onfulfilled, onrejected); + } + + override catch( + onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null, + ): Promise | TResult> { + return this.parse().catch(onrejected); + } + + override finally(onfinally?: (() => void) | undefined | null): Promise> { + return this.parse().finally(onfinally); + } +} diff --git a/src/azure.ts b/src/azure.ts new file mode 100644 index 000000000..5fd30d40f --- /dev/null +++ b/src/azure.ts @@ -0,0 +1,194 @@ +import type { RequestInit } from './internal/builtin-types'; +import * as Errors from './error'; +import { FinalRequestOptions } from './internal/request-options'; +import { isObj, readEnv } from './internal/utils'; +import { ClientOptions, OpenAI } from './client'; +import { buildHeaders } from './internal/headers'; + +/** API Client for interfacing with the Azure OpenAI API. */ +export interface AzureClientOptions extends ClientOptions { + /** + * Defaults to process.env['OPENAI_API_VERSION']. + */ + apiVersion?: string | undefined; + + /** + * Your Azure endpoint, including the resource, e.g. `https://example-resource.azure.openai.com/` + */ + endpoint?: string | undefined; + + /** + * A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`. + * Note: this means you won't be able to use non-deployment endpoints. Not supported with Assistants APIs. + */ + deployment?: string | undefined; + + /** + * Defaults to process.env['AZURE_OPENAI_API_KEY']. + */ + apiKey?: string | undefined; + + /** + * A function that returns an access token for Microsoft Entra (formerly known as Azure Active Directory), + * which will be invoked on every request. + */ + azureADTokenProvider?: (() => Promise) | undefined; +} + +/** API Client for interfacing with the Azure OpenAI API. */ +export class AzureOpenAI extends OpenAI { + private _azureADTokenProvider: (() => Promise) | undefined; + private _deployment: string | undefined; + apiVersion: string = ''; + /** + * API Client for interfacing with the Azure OpenAI API. + * + * @param {string | undefined} [opts.apiVersion=process.env['OPENAI_API_VERSION'] ?? undefined] + * @param {string | undefined} [opts.endpoint=process.env['AZURE_OPENAI_ENDPOINT'] ?? undefined] - Your Azure endpoint, including the resource, e.g. `https://example-resource.azure.openai.com/` + * @param {string | undefined} [opts.apiKey=process.env['AZURE_OPENAI_API_KEY'] ?? undefined] + * @param {string | undefined} opts.deployment - A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`. + * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] + * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL']] - Sets the base URL for the API, e.g. `https://example-resource.azure.openai.com/openai/`. + * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. + * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. + * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. + * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. + * @param {Headers} opts.defaultHeaders - Default headers to include with every request to the API. + * @param {DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API. + * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. + */ + constructor({ + baseURL = readEnv('OPENAI_BASE_URL'), + apiKey = readEnv('AZURE_OPENAI_API_KEY'), + apiVersion = readEnv('OPENAI_API_VERSION'), + endpoint, + deployment, + azureADTokenProvider, + dangerouslyAllowBrowser, + ...opts + }: AzureClientOptions = {}) { + if (!apiVersion) { + throw new Errors.OpenAIError( + "The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).", + ); + } + + if (typeof azureADTokenProvider === 'function') { + dangerouslyAllowBrowser = true; + } + + if (!azureADTokenProvider && !apiKey) { + throw new Errors.OpenAIError( + 'Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.', + ); + } + + if (azureADTokenProvider && apiKey) { + throw new Errors.OpenAIError( + 'The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.', + ); + } + + // define a sentinel value to avoid any typing issues + apiKey ??= API_KEY_SENTINEL; + + opts.defaultQuery = { ...opts.defaultQuery, 'api-version': apiVersion }; + + if (!baseURL) { + if (!endpoint) { + endpoint = process.env['AZURE_OPENAI_ENDPOINT']; + } + + if (!endpoint) { + throw new Errors.OpenAIError( + 'Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable', + ); + } + + baseURL = `${endpoint}/openai`; + } else { + if (endpoint) { + throw new Errors.OpenAIError('baseURL and endpoint are mutually exclusive'); + } + } + + super({ + apiKey, + baseURL, + ...opts, + ...(dangerouslyAllowBrowser !== undefined ? { dangerouslyAllowBrowser } : {}), + }); + + this._azureADTokenProvider = azureADTokenProvider; + this.apiVersion = apiVersion; + this._deployment = deployment; + } + + override buildRequest(options: FinalRequestOptions): { + req: RequestInit; + url: string; + timeout: number; + } { + if (_deployments_endpoints.has(options.path) && options.method === 'post' && options.body !== undefined) { + if (!isObj(options.body)) { + throw new Error('Expected request body to be an object'); + } + const model = this._deployment || options.body['model']; + if (model !== undefined && !this.baseURL.includes('/deployments')) { + options.path = `/deployments/${model}${options.path}`; + } + } + return super.buildRequest(options); + } + + private async _getAzureADToken(): Promise { + if (typeof this._azureADTokenProvider === 'function') { + const token = await this._azureADTokenProvider(); + if (!token || typeof token !== 'string') { + throw new Errors.OpenAIError( + `Expected 'azureADTokenProvider' argument to return a string but it returned ${token}`, + ); + } + return token; + } + return undefined; + } + + protected override authHeaders(opts: FinalRequestOptions): Headers { + return new Headers(); + } + + protected override async prepareOptions(opts: FinalRequestOptions): Promise { + /** + * The user should provide a bearer token provider if they want + * to use Azure AD authentication. The user shouldn't set the + * Authorization header manually because the header is overwritten + * with the Azure AD token if a bearer token provider is provided. + */ + if (opts.headers?.['api-key']) { + return super.prepareOptions(opts); + } + const token = await this._getAzureADToken(); + opts.headers ??= {}; + if (token) { + opts.headers['Authorization'] = `Bearer ${token}`; + } else if (this.apiKey !== API_KEY_SENTINEL) { + opts.headers['api-key'] = this.apiKey; + } else { + throw new Errors.OpenAIError('Unable to handle auth'); + } + return super.prepareOptions(opts); + } +} + +const _deployments_endpoints = new Set([ + '/completions', + '/chat/completions', + '/embeddings', + '/audio/transcriptions', + '/audio/translations', + '/audio/speech', + '/images/generations', +]); + +const API_KEY_SENTINEL = ''; diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 000000000..6d4d6d6bc --- /dev/null +++ b/src/client.ts @@ -0,0 +1,896 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; +import type { HTTPMethod, PromiseOrValue } from './internal/types'; +import { debug } from './internal/utils/log'; +import { uuid4 } from './internal/utils/uuid'; +import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values'; +import { sleep } from './internal/utils/sleep'; +import { castToError } from './internal/errors'; +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 { VERSION } from './version'; +import { isBlobLike } from './uploads'; +import { buildHeaders } from './internal/headers'; +import * as Errors from './error'; +import * as Pagination from './pagination'; +import { AbstractPage, type CursorPageParams, CursorPageResponse, PageResponse } from './pagination'; +import * as Uploads from './uploads'; +import * as API from './resources/index'; +import { APIPromise } from './api-promise'; +import { type Fetch } from './internal/builtin-types'; +import { isRunningInBrowser } from './internal/detect-platform'; +import { HeadersLike, NullableHeaders } from './internal/headers'; +import { FinalRequestOptions, RequestOptions } from './internal/request-options'; +import { + Batch, + BatchCreateParams, + BatchError, + BatchListParams, + BatchRequestCounts, + Batches, + BatchesPage, +} from './resources/batches'; +import { + Completion, + CompletionChoice, + CompletionCreateParams, + CompletionCreateParamsNonStreaming, + CompletionCreateParamsStreaming, + CompletionUsage, + Completions, +} from './resources/completions'; +import { + CreateEmbeddingResponse, + Embedding, + EmbeddingCreateParams, + EmbeddingModel, + Embeddings, +} from './resources/embeddings'; +import { + FileContent, + FileCreateParams, + FileDeleted, + FileListParams, + FileObject, + FileObjectsPage, + FilePurpose, + Files, +} from './resources/files'; +import { + Image, + ImageCreateVariationParams, + ImageEditParams, + ImageGenerateParams, + ImageModel, + Images, + ImagesResponse, +} from './resources/images'; +import { Model, ModelDeleted, Models, ModelsPage } from './resources/models'; +import { + Moderation, + ModerationCreateParams, + ModerationCreateResponse, + ModerationImageURLInput, + ModerationModel, + ModerationMultiModalInput, + ModerationTextInput, + Moderations, +} from './resources/moderations'; +import { readEnv } from './internal/utils/env'; +import { isEmptyObj } from './internal/utils/values'; +import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; +import { Beta } from './resources/beta/beta'; +import { Chat, ChatModel } from './resources/chat/chat'; +import { + ChatCompletion, + ChatCompletionAssistantMessageParam, + ChatCompletionAudio, + ChatCompletionAudioParam, + ChatCompletionChunk, + ChatCompletionContentPart, + ChatCompletionContentPartImage, + ChatCompletionContentPartInputAudio, + ChatCompletionContentPartRefusal, + ChatCompletionContentPartText, + ChatCompletionCreateParams, + ChatCompletionCreateParamsNonStreaming, + ChatCompletionCreateParamsStreaming, + ChatCompletionDeveloperMessageParam, + ChatCompletionFunctionCallOption, + ChatCompletionFunctionMessageParam, + ChatCompletionMessage, + ChatCompletionMessageParam, + ChatCompletionMessageToolCall, + ChatCompletionModality, + ChatCompletionNamedToolChoice, + ChatCompletionPredictionContent, + ChatCompletionReasoningEffort, + ChatCompletionRole, + ChatCompletionStreamOptions, + ChatCompletionSystemMessageParam, + ChatCompletionTokenLogprob, + ChatCompletionTool, + ChatCompletionToolChoiceOption, + ChatCompletionToolMessageParam, + ChatCompletionUserMessageParam, +} from './resources/chat/completions'; +import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { + Upload, + UploadCompleteParams, + UploadCreateParams, + Uploads as UploadsAPIUploads, +} from './resources/uploads/uploads'; + +const safeJSON = (text: string) => { + try { + return JSON.parse(text); + } catch (err) { + return undefined; + } +}; + +export interface ClientOptions { + /** + * Defaults to process.env['OPENAI_API_KEY']. + */ + apiKey?: string | undefined; + + /** + * Defaults to process.env['OPENAI_ORG_ID']. + */ + organization?: string | null | undefined; + + /** + * Defaults to process.env['OPENAI_PROJECT_ID']. + */ + project?: string | null | undefined; + + /** + * Override the default base URL for the API, e.g., "https://api.example.com/v2/" + * + * Defaults to process.env['OPENAI_BASE_URL']. + */ + baseURL?: string | null | undefined; + + /** + * The maximum amount of time (in milliseconds) that the client should wait for a response + * from the server before timing out a single request. + * + * Note that request timeouts are retried by default, so in a worst-case scenario you may wait + * much longer than this timeout before the promise succeeds or fails. + */ + timeout?: number; + + /** + * An HTTP agent used to manage HTTP(S) connections. + * + * If not provided, an agent will be constructed by default in the Node.js environment, + * otherwise no agent is used. + */ + httpAgent?: Shims.Agent; + + /** + * Specify a custom `fetch` function implementation. + * + * If not provided, we expect that `fetch` is defined globally. + */ + fetch?: Fetch | undefined; + + /** + * The maximum number of times that the client will retry a request in case of a + * temporary failure, like a network error or a 5XX error from the server. + * + * @default 2 + */ + maxRetries?: number; + + /** + * Default headers to include with every request to the API. + * + * These can be removed in individual requests by explicitly setting the + * header to `null` in request options. + */ + defaultHeaders?: HeadersLike; + + /** + * Default query parameters to include with every request to the API. + * + * These can be removed in individual requests by explicitly setting the + * param to `undefined` in request options. + */ + defaultQuery?: Record; + + /** + * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. + * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. + */ + dangerouslyAllowBrowser?: boolean; +} + +type FinalizedRequestInit = RequestInit & { headers: Headers }; + +/** + * API Client for interfacing with the OpenAI API. + */ +export class OpenAI { + apiKey: string; + organization: string | null; + project: string | null; + + baseURL: string; + maxRetries: number; + timeout: number; + httpAgent: Shims.Agent | undefined; + + private fetch: Fetch; + #encoder: Opts.RequestEncoder; + protected idempotencyHeader?: string; + private _options: ClientOptions; + + /** + * API Client for interfacing with the OpenAI API. + * + * @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? undefined] + * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] + * @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null] + * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL'] ?? https://api.openai.com/v1] - Override the default base URL for the API. + * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. + * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. + * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. + * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. + * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. + * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. + * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. + */ + constructor({ + baseURL = readEnv('OPENAI_BASE_URL'), + apiKey = readEnv('OPENAI_API_KEY'), + organization = readEnv('OPENAI_ORG_ID') ?? null, + project = readEnv('OPENAI_PROJECT_ID') ?? null, + ...opts + }: ClientOptions = {}) { + if (apiKey === undefined) { + throw new Errors.OpenAIError( + "The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).", + ); + } + + const options: ClientOptions = { + apiKey, + organization, + project, + ...opts, + baseURL: baseURL || `https://api.openai.com/v1`, + }; + + if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) { + throw new Errors.OpenAIError( + "It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n", + ); + } + + this.baseURL = options.baseURL!; + this.timeout = options.timeout ?? OpenAI.DEFAULT_TIMEOUT /* 10 minutes */; + this.httpAgent = options.httpAgent; + this.maxRetries = options.maxRetries ?? 2; + this.fetch = options.fetch ?? Shims.getDefaultFetch(); + this.#encoder = Opts.FallbackEncoder; + + this._options = options; + + this.apiKey = apiKey; + this.organization = organization; + this.project = project; + } + + protected defaultQuery(): Record | undefined { + return this._options.defaultQuery; + } + + protected validateHeaders({ values, nulls }: NullableHeaders) { + return; + } + + protected authHeaders(opts: FinalRequestOptions): Headers | undefined { + return new Headers({ Authorization: `Bearer ${this.apiKey}` }); + } + + protected stringifyQuery(query: Record): string { + return qs.stringify(query, { arrayFormat: 'brackets' }); + } + + private getUserAgent(): string { + return `${this.constructor.name}/JS ${VERSION}`; + } + + protected defaultIdempotencyKey(): string { + return `stainless-node-retry-${uuid4()}`; + } + + protected makeStatusError( + status: number, + error: Object, + message: string | undefined, + headers: Headers, + ): Errors.APIError { + return Errors.APIError.generate(status, error, message, headers); + } + + buildURL(path: string, query: Record | null | undefined): string { + const url = + isAbsoluteURL(path) ? + new URL(path) + : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); + + const defaultQuery = this.defaultQuery(); + if (!isEmptyObj(defaultQuery)) { + query = { ...defaultQuery, ...query }; + } + + if (typeof query === 'object' && query && !Array.isArray(query)) { + url.search = this.stringifyQuery(query as Record); + } + + return url.toString(); + } + + private calculateContentLength(body: unknown): string | null { + if (typeof body === 'string') { + if (typeof Buffer !== 'undefined') { + return Buffer.byteLength(body, 'utf8').toString(); + } + + if (typeof TextEncoder !== 'undefined') { + const encoder = new TextEncoder(); + const encoded = encoder.encode(body); + return encoded.length.toString(); + } + } else if (ArrayBuffer.isView(body)) { + return body.byteLength.toString(); + } + + return null; + } + + /** + * Used as a callback for mutating the given `FinalRequestOptions` object. + */ + protected async prepareOptions(options: FinalRequestOptions): Promise {} + + /** + * Used as a callback for mutating the given `RequestInit` object. + * + * This is useful for cases where you want to add certain headers based off of + * the request properties, e.g. `method` or `url`. + */ + protected async prepareRequest( + request: RequestInit, + { url, options }: { url: string; options: FinalRequestOptions }, + ): Promise {} + + get(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('get', path, opts); + } + + post(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('post', path, opts); + } + + patch(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('patch', path, opts); + } + + put(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('put', path, opts); + } + + delete(path: string, opts?: PromiseOrValue): APIPromise { + return this.methodRequest('delete', path, opts); + } + + private methodRequest( + method: HTTPMethod, + path: string, + opts?: PromiseOrValue, + ): APIPromise { + return this.request( + Promise.resolve(opts).then(async (opts) => { + const body = + opts && isBlobLike(opts?.body) ? new DataView(await opts.body.arrayBuffer()) + : opts?.body instanceof DataView ? opts.body + : opts?.body instanceof ArrayBuffer ? new DataView(opts.body) + : opts && ArrayBuffer.isView(opts?.body) ? new DataView(opts.body.buffer) + : opts?.body; + return { method, path, ...opts, body }; + }), + ); + } + + request( + options: PromiseOrValue, + remainingRetries: number | null = null, + ): APIPromise { + return new APIPromise(this.makeRequest(options, remainingRetries)); + } + + private async makeRequest( + optionsInput: PromiseOrValue, + retriesRemaining: number | null, + ): Promise { + const options = await optionsInput; + const maxRetries = options.maxRetries ?? this.maxRetries; + if (retriesRemaining == null) { + retriesRemaining = maxRetries; + } + + await this.prepareOptions(options); + + const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); + + await this.prepareRequest(req, { url, options }); + + debug('request', url, options, req.headers); + + if (options.signal?.aborted) { + throw new Errors.APIUserAbortError(); + } + + const controller = new AbortController(); + const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); + + if (response instanceof Error) { + if (options.signal?.aborted) { + throw new Errors.APIUserAbortError(); + } + if (retriesRemaining) { + return this.retryRequest(options, retriesRemaining); + } + if (response.name === 'AbortError') { + throw new Errors.APIConnectionTimeoutError(); + } + throw new Errors.APIConnectionError({ cause: response }); + } + + if (!response.ok) { + if (retriesRemaining && this.shouldRetry(response)) { + const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; + debug(`response (error; ${retryMessage})`, response.status, url, response.headers); + return this.retryRequest(options, retriesRemaining, response.headers); + } + + const errText = await response.text().catch((err: any) => castToError(err).message); + const errJSON = safeJSON(errText); + const errMessage = errJSON ? undefined : errText; + const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; + + debug(`response (error; ${retryMessage})`, response.status, url, response.headers, errMessage); + + const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); + throw err; + } + + return { response, options, controller }; + } + + getAPIList = Pagination.AbstractPage>( + path: string, + Page: new (...args: any[]) => PageClass, + opts?: RequestOptions, + ): Pagination.PagePromise { + return this.requestAPIList(Page, { method: 'get', path, ...opts }); + } + + requestAPIList< + Item = unknown, + PageClass extends Pagination.AbstractPage = Pagination.AbstractPage, + >( + Page: new (...args: ConstructorParameters) => PageClass, + options: FinalRequestOptions, + ): Pagination.PagePromise { + const request = this.makeRequest(options, null); + return new Pagination.PagePromise(this as any as OpenAI, request, Page); + } + + async fetchWithTimeout( + url: RequestInfo, + init: RequestInit | undefined, + ms: number, + controller: AbortController, + ): Promise { + const { signal, method, ...options } = init || {}; + if (signal) signal.addEventListener('abort', () => controller.abort()); + + const timeout = setTimeout(() => controller.abort(), ms); + + const isReadableBody = Shims.isReadableLike(options.body); + + const fetchOptions: RequestInit = { + signal: controller.signal as any, + ...(isReadableBody ? { duplex: 'half' } : {}), + method: 'GET', + ...options, + }; + if (method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = method.toUpperCase(); + } + + return ( + // use undefined this binding; fetch errors if bound to something else in browser/cloudflare + this.fetch.call(undefined, url, fetchOptions).finally(() => { + clearTimeout(timeout); + }) + ); + } + + private shouldRetry(response: Response): boolean { + // Note this is not a standard header. + const shouldRetryHeader = response.headers.get('x-should-retry'); + + // If the server explicitly says whether or not to retry, obey. + if (shouldRetryHeader === 'true') return true; + if (shouldRetryHeader === 'false') return false; + + // Retry on request timeouts. + if (response.status === 408) return true; + + // Retry on lock timeouts. + if (response.status === 409) return true; + + // Retry on rate limits. + if (response.status === 429) return true; + + // Retry internal errors. + if (response.status >= 500) return true; + + return false; + } + + private async retryRequest( + options: FinalRequestOptions, + retriesRemaining: number, + responseHeaders?: Headers | undefined, + ): Promise { + let timeoutMillis: number | undefined; + + // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it. + const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms'); + if (retryAfterMillisHeader) { + const timeoutMs = parseFloat(retryAfterMillisHeader); + if (!Number.isNaN(timeoutMs)) { + timeoutMillis = timeoutMs; + } + } + + // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After + const retryAfterHeader = responseHeaders?.get('retry-after'); + if (retryAfterHeader && !timeoutMillis) { + const timeoutSeconds = parseFloat(retryAfterHeader); + if (!Number.isNaN(timeoutSeconds)) { + timeoutMillis = timeoutSeconds * 1000; + } else { + timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); + } + } + + // 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)) { + const maxRetries = options.maxRetries ?? this.maxRetries; + timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); + } + await sleep(timeoutMillis); + + return this.makeRequest(options, retriesRemaining - 1); + } + + private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number { + const initialRetryDelay = 0.5; + const maxRetryDelay = 8.0; + + const numRetries = maxRetries - retriesRemaining; + + // Apply exponential backoff, but not more than the max. + const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); + + // Apply some jitter, take up to at most 25 percent of the retry time. + const jitter = 1 - Math.random() * 0.25; + + return sleepSeconds * jitter * 1000; + } + + buildRequest( + options: FinalRequestOptions, + { retryCount = 0 }: { retryCount?: number } = {}, + ): { req: FinalizedRequestInit; url: string; timeout: number } { + const { method, path, query } = options; + + const url = this.buildURL(path!, query as Record); + if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); + const timeout = options.timeout ?? this.timeout; + const httpAgent = options.httpAgent ?? this.httpAgent; + const minAgentTimeout = timeout + 1000; + if ( + typeof (httpAgent as any)?.options?.timeout === 'number' && + minAgentTimeout > ((httpAgent as any).options.timeout ?? 0) + ) { + // Allow any given request to bump our agent active socket timeout. + // This may seem strange, but leaking active sockets should be rare and not particularly problematic, + // and without mutating agent we would need to create more of them. + // This tradeoff optimizes for performance. + (httpAgent as any).options.timeout = minAgentTimeout; + } + + const { bodyHeaders, body } = this.buildBody({ options }); + const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount }); + + const req: FinalizedRequestInit = { + method, + headers: reqHeaders, + ...(httpAgent && { agent: httpAgent }), + ...(options.signal && { signal: options.signal }), + ...((globalThis as any).ReadableStream && + body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }), + ...(body && { body }), + }; + + return { req, url, timeout }; + } + + private buildHeaders({ + options, + method, + bodyHeaders, + retryCount, + }: { + options: FinalRequestOptions; + method: HTTPMethod; + bodyHeaders: HeadersLike; + retryCount: number; + }): Headers { + let idempotencyHeaders: HeadersLike = {}; + if (this.idempotencyHeader && method !== 'get') { + if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); + idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey; + } + + const headers = buildHeaders([ + idempotencyHeaders, + { + Accept: 'application/json', + 'User-Agent': this.getUserAgent(), + 'X-Stainless-Retry-Count': String(retryCount), + ...getPlatformHeaders(), + 'OpenAI-Organization': this.organization, + 'OpenAI-Project': this.project, + }, + this.authHeaders(options), + this._options.defaultHeaders, + bodyHeaders, + options.headers, + ]); + + this.validateHeaders(headers); + + return headers.values; + } + + private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): { + bodyHeaders: HeadersLike; + body: BodyInit | undefined; + } { + if (!body) { + return { bodyHeaders: undefined, body: undefined }; + } + const headers = buildHeaders([rawHeaders]); + if ( + // Pass raw type verbatim + ArrayBuffer.isView(body) || + body instanceof ArrayBuffer || + body instanceof DataView || + (typeof body === 'string' && + // Preserve legacy string encoding behavior for now + headers.values.has('content-type')) || + // `Blob` is superset of `File` + body instanceof Blob || + // `FormData` -> `multipart/form-data` + body instanceof FormData || + // `URLSearchParams` -> `application/x-www-form-urlencoded` + body instanceof URLSearchParams || + // Send chunked stream (each chunk has own `length`) + ((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream) + ) { + return { bodyHeaders: undefined, body: body as BodyInit }; + } else if ( + typeof body === 'object' && + (Symbol.asyncIterator in body || + (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) + ) { + return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) }; + } else { + return this.#encoder({ body, headers }); + } + } + + static OpenAI = this; + static DEFAULT_TIMEOUT = 600000; // 10 minutes + + static OpenAIError = Errors.OpenAIError; + static APIError = Errors.APIError; + static APIConnectionError = Errors.APIConnectionError; + static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; + static APIUserAbortError = Errors.APIUserAbortError; + static NotFoundError = Errors.NotFoundError; + static ConflictError = Errors.ConflictError; + static RateLimitError = Errors.RateLimitError; + static BadRequestError = Errors.BadRequestError; + static AuthenticationError = Errors.AuthenticationError; + static InternalServerError = Errors.InternalServerError; + static PermissionDeniedError = Errors.PermissionDeniedError; + static UnprocessableEntityError = Errors.UnprocessableEntityError; + + static toFile = Uploads.toFile; + + completions: API.Completions = new API.Completions(this); + chat: API.Chat = new API.Chat(this); + embeddings: API.Embeddings = new API.Embeddings(this); + files: API.Files = new API.Files(this); + images: API.Images = new API.Images(this); + audio: API.Audio = new API.Audio(this); + moderations: API.Moderations = new API.Moderations(this); + models: API.Models = new API.Models(this); + fineTuning: API.FineTuning = new API.FineTuning(this); + beta: API.Beta = new API.Beta(this); + batches: API.Batches = new API.Batches(this); + uploads: API.Uploads = new API.Uploads(this); +} +OpenAI.Completions = Completions; +OpenAI.Chat = Chat; +OpenAI.Embeddings = Embeddings; +OpenAI.Files = Files; +OpenAI.Images = Images; +OpenAI.Audio = Audio; +OpenAI.Moderations = Moderations; +OpenAI.Models = Models; +OpenAI.FineTuning = FineTuning; +OpenAI.Beta = Beta; +OpenAI.Batches = Batches; +OpenAI.Uploads = UploadsAPIUploads; +export declare namespace OpenAI { + export type RequestOptions = Opts.RequestOptions; + + export import Page = Pagination.Page; + export { type PageResponse as PageResponse }; + + export import CursorPage = Pagination.CursorPage; + export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; + + export { + Completions as Completions, + type Completion as Completion, + type CompletionChoice as CompletionChoice, + type CompletionUsage as CompletionUsage, + type CompletionCreateParams as CompletionCreateParams, + type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, + type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + }; + + export { + Chat as Chat, + type ChatModel as ChatModel, + type ChatCompletion as ChatCompletion, + type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, + type ChatCompletionAudio as ChatCompletionAudio, + type ChatCompletionAudioParam as ChatCompletionAudioParam, + type ChatCompletionChunk as ChatCompletionChunk, + type ChatCompletionContentPart as ChatCompletionContentPart, + type ChatCompletionContentPartImage as ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, + type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, + type ChatCompletionMessage as ChatCompletionMessage, + type ChatCompletionMessageParam as ChatCompletionMessageParam, + type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, + type ChatCompletionModality as ChatCompletionModality, + type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent as ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, + type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStreamOptions as ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, + type ChatCompletionTool as ChatCompletionTool, + type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionCreateParams as ChatCompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + }; + + export { + Embeddings as Embeddings, + type CreateEmbeddingResponse as CreateEmbeddingResponse, + type Embedding as Embedding, + type EmbeddingModel as EmbeddingModel, + type EmbeddingCreateParams as EmbeddingCreateParams, + }; + + export { + Files as Files, + type FileContent as FileContent, + type FileDeleted as FileDeleted, + type FileObject as FileObject, + type FilePurpose as FilePurpose, + type FileObjectsPage as FileObjectsPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; + + export { + Images as Images, + type Image as Image, + type ImageModel as ImageModel, + type ImagesResponse as ImagesResponse, + type ImageCreateVariationParams as ImageCreateVariationParams, + type ImageEditParams as ImageEditParams, + type ImageGenerateParams as ImageGenerateParams, + }; + + export { Audio as Audio, type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat }; + + export { + Moderations as Moderations, + type Moderation as Moderation, + type ModerationImageURLInput as ModerationImageURLInput, + type ModerationModel as ModerationModel, + type ModerationMultiModalInput as ModerationMultiModalInput, + type ModerationTextInput as ModerationTextInput, + type ModerationCreateResponse as ModerationCreateResponse, + type ModerationCreateParams as ModerationCreateParams, + }; + + export { + Models as Models, + type Model as Model, + type ModelDeleted as ModelDeleted, + type ModelsPage as ModelsPage, + }; + + export { FineTuning as FineTuning }; + + export { Beta as Beta }; + + export { + Batches as Batches, + type Batch as Batch, + type BatchError as BatchError, + type BatchRequestCounts as BatchRequestCounts, + type BatchesPage as BatchesPage, + type BatchCreateParams as BatchCreateParams, + type BatchListParams as BatchListParams, + }; + + export { + UploadsAPIUploads as Uploads, + type Upload as Upload, + type UploadCreateParams as UploadCreateParams, + type UploadCompleteParams as UploadCompleteParams, + }; + + export type ErrorObject = API.ErrorObject; + export type FunctionDefinition = API.FunctionDefinition; + export type FunctionParameters = API.FunctionParameters; + export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; + export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; + export type ResponseFormatText = API.ResponseFormatText; +} diff --git a/src/core.ts b/src/core.ts deleted file mode 100644 index 972cceaec..000000000 --- a/src/core.ts +++ /dev/null @@ -1,1243 +0,0 @@ -import { VERSION } from './version'; -import { Stream } from './streaming'; -import { - OpenAIError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, -} from './error'; -import { - kind as shimsKind, - type Readable, - getDefaultAgent, - type Agent, - fetch, - type RequestInfo, - type RequestInit, - type Response, - type HeadersInit, -} from './_shims/index'; -export { type Response }; -import { BlobLike, isBlobLike, isMultipartBody } from './uploads'; -export { - maybeMultipartFormRequestOptions, - multipartFormRequestOptions, - createForm, - type Uploadable, -} from './uploads'; - -export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise; - -type PromiseOrValue = T | Promise; - -type APIResponseProps = { - response: Response; - options: FinalRequestOptions; - controller: AbortController; -}; - -async function defaultParseResponse(props: APIResponseProps): Promise> { - const { response } = props; - if (props.options.stream) { - debug('response', response.status, response.url, response.headers, response.body); - - // Note: there is an invariant here that isn't represented in the type system - // that if you set `stream: true` the response type must also be `Stream` - - if (props.options.__streamClass) { - return props.options.__streamClass.fromSSEResponse(response, props.controller) as any; - } - - return Stream.fromSSEResponse(response, props.controller) as any; - } - - // fetch refuses to read the body when the status code is 204. - if (response.status === 204) { - return null as WithRequestID; - } - - if (props.options.__binaryResponse) { - return response as unknown as WithRequestID; - } - - const contentType = response.headers.get('content-type'); - const isJSON = - contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); - if (isJSON) { - const json = await response.json(); - - debug('response', response.status, response.url, response.headers, json); - - return _addRequestID(json, response); - } - - const text = await response.text(); - debug('response', response.status, response.url, response.headers, text); - - // TODO handle blob, arraybuffer, other content types, etc. - return text as unknown as WithRequestID; -} - -type WithRequestID = - T extends Array | Response | AbstractPage ? T - : T extends Record ? T & { _request_id?: string | null } - : T; - -function _addRequestID(value: T, response: Response): WithRequestID { - if (!value || typeof value !== 'object' || Array.isArray(value)) { - return value as WithRequestID; - } - - return Object.defineProperty(value, '_request_id', { - value: response.headers.get('x-request-id'), - enumerable: false, - }) as WithRequestID; -} - -/** - * A subclass of `Promise` providing additional helper methods - * for interacting with the SDK. - */ -export class APIPromise extends Promise> { - private parsedPromise: Promise> | undefined; - - constructor( - private responsePromise: Promise, - private parseResponse: ( - props: APIResponseProps, - ) => PromiseOrValue> = defaultParseResponse, - ) { - super((resolve) => { - // this is maybe a bit weird but this has to be a no-op to not implicitly - // parse the response body; instead .then, .catch, .finally are overridden - // to parse the response - resolve(null as any); - }); - } - - _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { - return new APIPromise(this.responsePromise, async (props) => - _addRequestID(transform(await this.parseResponse(props), props), props.response), - ); - } - - /** - * Gets the raw `Response` instance instead of parsing the response - * data. - * - * If you want to parse the response body but still get the `Response` - * instance, you can use {@link withResponse()}. - * - * 👋 Getting the wrong TypeScript type for `Response`? - * Try setting `"moduleResolution": "NodeNext"` if you can, - * or add one of these imports before your first `import … from 'openai'`: - * - `import 'openai/shims/node'` (if you're running on Node) - * - `import 'openai/shims/web'` (otherwise) - */ - asResponse(): Promise { - return this.responsePromise.then((p) => p.response); - } - - /** - * Gets the parsed response data, the raw `Response` instance and the ID of the request, - * returned via the X-Request-ID header which is useful for debugging requests and reporting - * issues to OpenAI. - * - * If you just want to get the raw `Response` instance without parsing it, - * you can use {@link asResponse()}. - * - * - * 👋 Getting the wrong TypeScript type for `Response`? - * Try setting `"moduleResolution": "NodeNext"` if you can, - * or add one of these imports before your first `import … from 'openai'`: - * - `import 'openai/shims/node'` (if you're running on Node) - * - `import 'openai/shims/web'` (otherwise) - */ - async withResponse(): Promise<{ data: T; response: Response; request_id: string | null | undefined }> { - const [data, response] = await Promise.all([this.parse(), this.asResponse()]); - return { data, response, request_id: response.headers.get('x-request-id') }; - } - - private parse(): Promise> { - if (!this.parsedPromise) { - this.parsedPromise = this.responsePromise.then(this.parseResponse) as any as Promise>; - } - return this.parsedPromise; - } - - override then, TResult2 = never>( - onfulfilled?: ((value: WithRequestID) => TResult1 | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, - ): Promise { - return this.parse().then(onfulfilled, onrejected); - } - - override catch( - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null, - ): Promise | TResult> { - return this.parse().catch(onrejected); - } - - override finally(onfinally?: (() => void) | undefined | null): Promise> { - return this.parse().finally(onfinally); - } -} - -export abstract class APIClient { - baseURL: string; - maxRetries: number; - timeout: number; - httpAgent: Agent | undefined; - - private fetch: Fetch; - protected idempotencyHeader?: string; - - constructor({ - baseURL, - maxRetries = 2, - timeout = 600000, // 10 minutes - httpAgent, - fetch: overriddenFetch, - }: { - baseURL: string; - maxRetries?: number | undefined; - timeout: number | undefined; - httpAgent: Agent | undefined; - fetch: Fetch | undefined; - }) { - this.baseURL = baseURL; - this.maxRetries = validatePositiveInteger('maxRetries', maxRetries); - this.timeout = validatePositiveInteger('timeout', timeout); - this.httpAgent = httpAgent; - - this.fetch = overriddenFetch ?? fetch; - } - - protected authHeaders(opts: FinalRequestOptions): Headers { - return {}; - } - - /** - * Override this to add your own default headers, for example: - * - * { - * ...super.defaultHeaders(), - * Authorization: 'Bearer 123', - * } - */ - protected defaultHeaders(opts: FinalRequestOptions): Headers { - return { - Accept: 'application/json', - 'Content-Type': 'application/json', - 'User-Agent': this.getUserAgent(), - ...getPlatformHeaders(), - ...this.authHeaders(opts), - }; - } - - protected abstract defaultQuery(): DefaultQuery | undefined; - - /** - * Override this to add your own headers validation: - */ - protected validateHeaders(headers: Headers, customHeaders: Headers) {} - - protected defaultIdempotencyKey(): string { - return `stainless-node-retry-${uuid4()}`; - } - - get(path: string, opts?: PromiseOrValue>): APIPromise { - return this.methodRequest('get', path, opts); - } - - post(path: string, opts?: PromiseOrValue>): APIPromise { - return this.methodRequest('post', path, opts); - } - - patch(path: string, opts?: PromiseOrValue>): APIPromise { - return this.methodRequest('patch', path, opts); - } - - put(path: string, opts?: PromiseOrValue>): APIPromise { - return this.methodRequest('put', path, opts); - } - - delete(path: string, opts?: PromiseOrValue>): APIPromise { - return this.methodRequest('delete', path, opts); - } - - private methodRequest( - method: HTTPMethod, - path: string, - opts?: PromiseOrValue>, - ): APIPromise { - return this.request( - Promise.resolve(opts).then(async (opts) => { - const body = - opts && isBlobLike(opts?.body) ? new DataView(await opts.body.arrayBuffer()) - : opts?.body instanceof DataView ? opts.body - : opts?.body instanceof ArrayBuffer ? new DataView(opts.body) - : opts && ArrayBuffer.isView(opts?.body) ? new DataView(opts.body.buffer) - : opts?.body; - return { method, path, ...opts, body }; - }), - ); - } - - getAPIList = AbstractPage>( - path: string, - Page: new (...args: any[]) => PageClass, - opts?: RequestOptions, - ): PagePromise { - return this.requestAPIList(Page, { method: 'get', path, ...opts }); - } - - private calculateContentLength(body: unknown): string | null { - if (typeof body === 'string') { - if (typeof Buffer !== 'undefined') { - return Buffer.byteLength(body, 'utf8').toString(); - } - - if (typeof TextEncoder !== 'undefined') { - const encoder = new TextEncoder(); - const encoded = encoder.encode(body); - return encoded.length.toString(); - } - } else if (ArrayBuffer.isView(body)) { - return body.byteLength.toString(); - } - - return null; - } - - buildRequest( - options: FinalRequestOptions, - { retryCount = 0 }: { retryCount?: number } = {}, - ): { req: RequestInit; url: string; timeout: number } { - const { method, path, query, headers: headers = {} } = options; - - const body = - ArrayBuffer.isView(options.body) || (options.__binaryRequest && typeof options.body === 'string') ? - options.body - : isMultipartBody(options.body) ? options.body.body - : options.body ? JSON.stringify(options.body, null, 2) - : null; - const contentLength = this.calculateContentLength(body); - - const url = this.buildURL(path!, query); - if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); - const timeout = options.timeout ?? this.timeout; - const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url); - const minAgentTimeout = timeout + 1000; - if ( - typeof (httpAgent as any)?.options?.timeout === 'number' && - minAgentTimeout > ((httpAgent as any).options.timeout ?? 0) - ) { - // Allow any given request to bump our agent active socket timeout. - // This may seem strange, but leaking active sockets should be rare and not particularly problematic, - // and without mutating agent we would need to create more of them. - // This tradeoff optimizes for performance. - (httpAgent as any).options.timeout = minAgentTimeout; - } - - if (this.idempotencyHeader && method !== 'get') { - if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); - headers[this.idempotencyHeader] = options.idempotencyKey; - } - - const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount }); - - const req: RequestInit = { - method, - ...(body && { body: body as any }), - headers: reqHeaders, - ...(httpAgent && { agent: httpAgent }), - // @ts-ignore node-fetch uses a custom AbortSignal type that is - // not compatible with standard web types - signal: options.signal ?? null, - }; - - return { req, url, timeout }; - } - - private buildHeaders({ - options, - headers, - contentLength, - retryCount, - }: { - options: FinalRequestOptions; - headers: Record; - contentLength: string | null | undefined; - retryCount: number; - }): Record { - const reqHeaders: Record = {}; - if (contentLength) { - reqHeaders['content-length'] = contentLength; - } - - const defaultHeaders = this.defaultHeaders(options); - applyHeadersMut(reqHeaders, defaultHeaders); - applyHeadersMut(reqHeaders, headers); - - // let builtin fetch set the Content-Type for multipart bodies - if (isMultipartBody(options.body) && shimsKind !== 'node') { - delete reqHeaders['content-type']; - } - - // Don't set the retry count header if it was already set or removed through default headers or by the - // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to - // account for the removal case. - if ( - getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && - getHeader(headers, 'x-stainless-retry-count') === undefined - ) { - reqHeaders['x-stainless-retry-count'] = String(retryCount); - } - - this.validateHeaders(reqHeaders, headers); - - return reqHeaders; - } - - /** - * Used as a callback for mutating the given `FinalRequestOptions` object. - */ - protected async prepareOptions(options: FinalRequestOptions): Promise {} - - /** - * Used as a callback for mutating the given `RequestInit` object. - * - * This is useful for cases where you want to add certain headers based off of - * the request properties, e.g. `method` or `url`. - */ - protected async prepareRequest( - request: RequestInit, - { url, options }: { url: string; options: FinalRequestOptions }, - ): Promise {} - - protected parseHeaders(headers: HeadersInit | null | undefined): Record { - return ( - !headers ? {} - : Symbol.iterator in headers ? - Object.fromEntries(Array.from(headers as Iterable).map((header) => [...header])) - : { ...headers } - ); - } - - protected makeStatusError( - status: number | undefined, - error: Object | undefined, - message: string | undefined, - headers: Headers | undefined, - ): APIError { - return APIError.generate(status, error, message, headers); - } - - request( - options: PromiseOrValue>, - remainingRetries: number | null = null, - ): APIPromise { - return new APIPromise(this.makeRequest(options, remainingRetries)); - } - - private async makeRequest( - optionsInput: PromiseOrValue>, - retriesRemaining: number | null, - ): Promise { - const options = await optionsInput; - const maxRetries = options.maxRetries ?? this.maxRetries; - if (retriesRemaining == null) { - retriesRemaining = maxRetries; - } - - await this.prepareOptions(options); - - const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); - - await this.prepareRequest(req, { url, options }); - - debug('request', url, options, req.headers); - - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - - const controller = new AbortController(); - const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); - - if (response instanceof Error) { - if (options.signal?.aborted) { - throw new APIUserAbortError(); - } - if (retriesRemaining) { - return this.retryRequest(options, retriesRemaining); - } - if (response.name === 'AbortError') { - throw new APIConnectionTimeoutError(); - } - throw new APIConnectionError({ cause: response }); - } - - const responseHeaders = createResponseHeaders(response.headers); - - if (!response.ok) { - if (retriesRemaining && this.shouldRetry(response)) { - const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; - debug(`response (error; ${retryMessage})`, response.status, url, responseHeaders); - return this.retryRequest(options, retriesRemaining, responseHeaders); - } - - const errText = await response.text().catch((e) => castToError(e).message); - const errJSON = safeJSON(errText); - const errMessage = errJSON ? undefined : errText; - const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; - - debug(`response (error; ${retryMessage})`, response.status, url, responseHeaders, errMessage); - - const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders); - throw err; - } - - return { response, options, controller }; - } - - requestAPIList = AbstractPage>( - Page: new (...args: ConstructorParameters) => PageClass, - options: FinalRequestOptions, - ): PagePromise { - const request = this.makeRequest(options, null); - return new PagePromise(this, request, Page); - } - - buildURL(path: string, query: Req | null | undefined): string { - const url = - isAbsoluteURL(path) ? - new URL(path) - : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); - - const defaultQuery = this.defaultQuery(); - if (!isEmptyObj(defaultQuery)) { - query = { ...defaultQuery, ...query } as Req; - } - - if (typeof query === 'object' && query && !Array.isArray(query)) { - url.search = this.stringifyQuery(query as Record); - } - - return url.toString(); - } - - protected stringifyQuery(query: Record): string { - return Object.entries(query) - .filter(([_, value]) => typeof value !== 'undefined') - .map(([key, value]) => { - if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { - return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`; - } - if (value === null) { - return `${encodeURIComponent(key)}=`; - } - throw new OpenAIError( - `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`, - ); - }) - .join('&'); - } - - async fetchWithTimeout( - url: RequestInfo, - init: RequestInit | undefined, - ms: number, - controller: AbortController, - ): Promise { - const { signal, ...options } = init || {}; - if (signal) signal.addEventListener('abort', () => controller.abort()); - - const timeout = setTimeout(() => controller.abort(), ms); - - const fetchOptions = { - signal: controller.signal as any, - ...options, - }; - if (fetchOptions.method) { - // Custom methods like 'patch' need to be uppercased - // See https://github.com/nodejs/undici/issues/2294 - fetchOptions.method = fetchOptions.method.toUpperCase(); - } - - return ( - // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - this.fetch.call(undefined, url, fetchOptions).finally(() => { - clearTimeout(timeout); - }) - ); - } - - private shouldRetry(response: Response): boolean { - // Note this is not a standard header. - const shouldRetryHeader = response.headers.get('x-should-retry'); - - // If the server explicitly says whether or not to retry, obey. - if (shouldRetryHeader === 'true') return true; - if (shouldRetryHeader === 'false') return false; - - // Retry on request timeouts. - if (response.status === 408) return true; - - // Retry on lock timeouts. - if (response.status === 409) return true; - - // Retry on rate limits. - if (response.status === 429) return true; - - // Retry internal errors. - if (response.status >= 500) return true; - - return false; - } - - private async retryRequest( - options: FinalRequestOptions, - retriesRemaining: number, - responseHeaders?: Headers | undefined, - ): Promise { - let timeoutMillis: number | undefined; - - // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it. - const retryAfterMillisHeader = responseHeaders?.['retry-after-ms']; - if (retryAfterMillisHeader) { - const timeoutMs = parseFloat(retryAfterMillisHeader); - if (!Number.isNaN(timeoutMs)) { - timeoutMillis = timeoutMs; - } - } - - // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After - const retryAfterHeader = responseHeaders?.['retry-after']; - if (retryAfterHeader && !timeoutMillis) { - const timeoutSeconds = parseFloat(retryAfterHeader); - if (!Number.isNaN(timeoutSeconds)) { - timeoutMillis = timeoutSeconds * 1000; - } else { - timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); - } - } - - // 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)) { - const maxRetries = options.maxRetries ?? this.maxRetries; - timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); - } - await sleep(timeoutMillis); - - return this.makeRequest(options, retriesRemaining - 1); - } - - private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number { - const initialRetryDelay = 0.5; - const maxRetryDelay = 8.0; - - const numRetries = maxRetries - retriesRemaining; - - // Apply exponential backoff, but not more than the max. - const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); - - // Apply some jitter, take up to at most 25 percent of the retry time. - const jitter = 1 - Math.random() * 0.25; - - return sleepSeconds * jitter * 1000; - } - - private getUserAgent(): string { - return `${this.constructor.name}/JS ${VERSION}`; - } -} - -export type PageInfo = { url: URL } | { params: Record | null }; - -export abstract class AbstractPage implements AsyncIterable { - #client: APIClient; - protected options: FinalRequestOptions; - - protected response: Response; - protected body: unknown; - - constructor(client: APIClient, response: Response, body: unknown, options: FinalRequestOptions) { - this.#client = client; - this.options = options; - this.response = response; - this.body = body; - } - - /** - * @deprecated Use nextPageInfo instead - */ - abstract nextPageParams(): Partial> | null; - abstract nextPageInfo(): PageInfo | null; - - abstract getPaginatedItems(): Item[]; - - hasNextPage(): boolean { - const items = this.getPaginatedItems(); - if (!items.length) return false; - return this.nextPageInfo() != null; - } - - async getNextPage(): Promise { - const nextInfo = this.nextPageInfo(); - if (!nextInfo) { - throw new OpenAIError( - 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.', - ); - } - const nextOptions = { ...this.options }; - if ('params' in nextInfo && typeof nextOptions.query === 'object') { - nextOptions.query = { ...nextOptions.query, ...nextInfo.params }; - } else if ('url' in nextInfo) { - const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()]; - for (const [key, value] of params) { - nextInfo.url.searchParams.set(key, value as any); - } - nextOptions.query = undefined; - nextOptions.path = nextInfo.url.toString(); - } - return await this.#client.requestAPIList(this.constructor as any, nextOptions); - } - - async *iterPages(): AsyncGenerator { - // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: this = this; - yield page; - while (page.hasNextPage()) { - page = await page.getNextPage(); - yield page; - } - } - - async *[Symbol.asyncIterator](): AsyncGenerator { - for await (const page of this.iterPages()) { - for (const item of page.getPaginatedItems()) { - yield item; - } - } - } -} - -/** - * This subclass of Promise will resolve to an instantiated Page once the request completes. - * - * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: - * - * for await (const item of client.items.list()) { - * console.log(item) - * } - */ -export class PagePromise< - PageClass extends AbstractPage, - Item = ReturnType[number], - > - extends APIPromise - implements AsyncIterable -{ - constructor( - client: APIClient, - request: Promise, - Page: new (...args: ConstructorParameters) => PageClass, - ) { - super( - request, - async (props) => - new Page( - client, - props.response, - await defaultParseResponse(props), - props.options, - ) as WithRequestID, - ); - } - - /** - * Allow auto-paginating iteration on an unawaited list call, eg: - * - * for await (const item of client.items.list()) { - * console.log(item) - * } - */ - async *[Symbol.asyncIterator](): AsyncGenerator { - const page = await this; - for await (const item of page) { - yield item; - } - } -} - -export const createResponseHeaders = ( - headers: Awaited>['headers'], -): Record => { - return new Proxy( - Object.fromEntries( - // @ts-ignore - headers.entries(), - ), - { - get(target, name) { - const key = name.toString(); - return target[key.toLowerCase()] || target[key]; - }, - }, - ); -}; - -type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; - -export type RequestClient = { fetch: Fetch }; -export type Headers = Record; -export type DefaultQuery = Record; -export type KeysEnum = { [P in keyof Required]: true }; - -export type RequestOptions< - Req = unknown | Record | Readable | BlobLike | ArrayBufferView | ArrayBuffer, -> = { - method?: HTTPMethod; - path?: string; - query?: Req | undefined; - body?: Req | null | undefined; - headers?: Headers | undefined; - - maxRetries?: number; - stream?: boolean | undefined; - timeout?: number; - httpAgent?: Agent; - signal?: AbortSignal | undefined | null; - idempotencyKey?: string; - - __binaryRequest?: boolean | undefined; - __binaryResponse?: boolean | undefined; - __streamClass?: typeof Stream; -}; - -// This is required so that we can determine if a given object matches the RequestOptions -// type at runtime. While this requires duplication, it is enforced by the TypeScript -// compiler such that any missing / extraneous keys will cause an error. -const requestOptionsKeys: KeysEnum = { - method: true, - path: true, - query: true, - body: true, - headers: true, - - maxRetries: true, - stream: true, - timeout: true, - httpAgent: true, - signal: true, - idempotencyKey: true, - - __binaryRequest: true, - __binaryResponse: true, - __streamClass: true, -}; - -export const isRequestOptions = (obj: unknown): obj is RequestOptions => { - return ( - typeof obj === 'object' && - obj !== null && - !isEmptyObj(obj) && - Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k)) - ); -}; - -export type FinalRequestOptions | Readable | DataView> = - RequestOptions & { - method: HTTPMethod; - path: string; - }; - -declare const Deno: any; -declare const EdgeRuntime: any; -type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown'; -type PlatformName = - | 'MacOS' - | 'Linux' - | 'Windows' - | 'FreeBSD' - | 'OpenBSD' - | 'iOS' - | 'Android' - | `Other:${string}` - | 'Unknown'; -type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari'; -type PlatformProperties = { - 'X-Stainless-Lang': 'js'; - 'X-Stainless-Package-Version': string; - 'X-Stainless-OS': PlatformName; - 'X-Stainless-Arch': Arch; - 'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown'; - 'X-Stainless-Runtime-Version': string; -}; -const getPlatformProperties = (): PlatformProperties => { - if (typeof Deno !== 'undefined' && Deno.build != null) { - return { - 'X-Stainless-Lang': 'js', - 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': normalizePlatform(Deno.build.os), - 'X-Stainless-Arch': normalizeArch(Deno.build.arch), - 'X-Stainless-Runtime': 'deno', - 'X-Stainless-Runtime-Version': - typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown', - }; - } - if (typeof EdgeRuntime !== 'undefined') { - return { - 'X-Stainless-Lang': 'js', - 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': 'Unknown', - 'X-Stainless-Arch': `other:${EdgeRuntime}`, - 'X-Stainless-Runtime': 'edge', - 'X-Stainless-Runtime-Version': process.version, - }; - } - // Check if Node.js - if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') { - return { - 'X-Stainless-Lang': 'js', - 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': normalizePlatform(process.platform), - 'X-Stainless-Arch': normalizeArch(process.arch), - 'X-Stainless-Runtime': 'node', - 'X-Stainless-Runtime-Version': process.version, - }; - } - - const browserInfo = getBrowserInfo(); - if (browserInfo) { - return { - 'X-Stainless-Lang': 'js', - 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': 'Unknown', - 'X-Stainless-Arch': 'unknown', - 'X-Stainless-Runtime': `browser:${browserInfo.browser}`, - 'X-Stainless-Runtime-Version': browserInfo.version, - }; - } - - // TODO add support for Cloudflare workers, etc. - return { - 'X-Stainless-Lang': 'js', - 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': 'Unknown', - 'X-Stainless-Arch': 'unknown', - 'X-Stainless-Runtime': 'unknown', - 'X-Stainless-Runtime-Version': 'unknown', - }; -}; - -type BrowserInfo = { - browser: Browser; - version: string; -}; - -declare const navigator: { userAgent: string } | undefined; - -// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts -function getBrowserInfo(): BrowserInfo | null { - if (typeof navigator === 'undefined' || !navigator) { - return null; - } - - // NOTE: The order matters here! - const browserPatterns = [ - { key: 'edge' as const, pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: 'ie' as const, pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: 'ie' as const, pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: 'chrome' as const, pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: 'firefox' as const, pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, - { key: 'safari' as const, pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ }, - ]; - - // Find the FIRST matching browser - for (const { key, pattern } of browserPatterns) { - const match = pattern.exec(navigator.userAgent); - if (match) { - const major = match[1] || 0; - const minor = match[2] || 0; - const patch = match[3] || 0; - - return { browser: key, version: `${major}.${minor}.${patch}` }; - } - } - - return null; -} - -const normalizeArch = (arch: string): Arch => { - // Node docs: - // - https://nodejs.org/api/process.html#processarch - // Deno docs: - // - https://doc.deno.land/deno/stable/~/Deno.build - if (arch === 'x32') return 'x32'; - if (arch === 'x86_64' || arch === 'x64') return 'x64'; - if (arch === 'arm') return 'arm'; - if (arch === 'aarch64' || arch === 'arm64') return 'arm64'; - if (arch) return `other:${arch}`; - return 'unknown'; -}; - -const normalizePlatform = (platform: string): PlatformName => { - // Node platforms: - // - https://nodejs.org/api/process.html#processplatform - // Deno platforms: - // - https://doc.deno.land/deno/stable/~/Deno.build - // - https://github.com/denoland/deno/issues/14799 - - platform = platform.toLowerCase(); - - // NOTE: this iOS check is untested and may not work - // Node does not work natively on IOS, there is a fork at - // https://github.com/nodejs-mobile/nodejs-mobile - // however it is unknown at the time of writing how to detect if it is running - if (platform.includes('ios')) return 'iOS'; - if (platform === 'android') return 'Android'; - if (platform === 'darwin') return 'MacOS'; - if (platform === 'win32') return 'Windows'; - if (platform === 'freebsd') return 'FreeBSD'; - if (platform === 'openbsd') return 'OpenBSD'; - if (platform === 'linux') return 'Linux'; - if (platform) return `Other:${platform}`; - return 'Unknown'; -}; - -let _platformHeaders: PlatformProperties; -const getPlatformHeaders = () => { - return (_platformHeaders ??= getPlatformProperties()); -}; - -export const safeJSON = (text: string) => { - try { - return JSON.parse(text); - } catch (err) { - return undefined; - } -}; - -// https://url.spec.whatwg.org/#url-scheme-string -const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; -const isAbsoluteURL = (url: string): boolean => { - return startsWithSchemeRegexp.test(url); -}; - -export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); - -const validatePositiveInteger = (name: string, n: unknown): number => { - if (typeof n !== 'number' || !Number.isInteger(n)) { - throw new OpenAIError(`${name} must be an integer`); - } - if (n < 0) { - throw new OpenAIError(`${name} must be a positive integer`); - } - return n; -}; - -export const castToError = (err: any): Error => { - if (err instanceof Error) return err; - if (typeof err === 'object' && err !== null) { - try { - return new Error(JSON.stringify(err)); - } catch {} - } - return new Error(err); -}; - -export const ensurePresent = (value: T | null | undefined): T => { - if (value == null) throw new OpenAIError(`Expected a value to be given but received ${value} instead.`); - return value; -}; - -/** - * Read an environment variable. - * - * Trims beginning and trailing whitespace. - * - * Will return undefined if the environment variable doesn't exist or cannot be accessed. - */ -export const readEnv = (env: string): string | undefined => { - if (typeof process !== 'undefined') { - return process.env?.[env]?.trim() ?? undefined; - } - if (typeof Deno !== 'undefined') { - return Deno.env?.get?.(env)?.trim(); - } - return undefined; -}; - -export const coerceInteger = (value: unknown): number => { - if (typeof value === 'number') return Math.round(value); - if (typeof value === 'string') return parseInt(value, 10); - - throw new OpenAIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); -}; - -export const coerceFloat = (value: unknown): number => { - if (typeof value === 'number') return value; - if (typeof value === 'string') return parseFloat(value); - - throw new OpenAIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); -}; - -export const coerceBoolean = (value: unknown): boolean => { - if (typeof value === 'boolean') return value; - if (typeof value === 'string') return value === 'true'; - return Boolean(value); -}; - -export const maybeCoerceInteger = (value: unknown): number | undefined => { - if (value === undefined) { - return undefined; - } - return coerceInteger(value); -}; - -export const maybeCoerceFloat = (value: unknown): number | undefined => { - if (value === undefined) { - return undefined; - } - return coerceFloat(value); -}; - -export const maybeCoerceBoolean = (value: unknown): boolean | undefined => { - if (value === undefined) { - return undefined; - } - return coerceBoolean(value); -}; - -// https://stackoverflow.com/a/34491287 -export function isEmptyObj(obj: Object | null | undefined): boolean { - if (!obj) return true; - for (const _k in obj) return false; - return true; -} - -// https://eslint.org/docs/latest/rules/no-prototype-builtins -export function hasOwn(obj: Object, key: string): boolean { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -/** - * Copies headers from "newHeaders" onto "targetHeaders", - * using lower-case for all properties, - * ignoring any keys with undefined values, - * and deleting any keys with null values. - */ -function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { - for (const k in newHeaders) { - if (!hasOwn(newHeaders, k)) continue; - const lowerKey = k.toLowerCase(); - if (!lowerKey) continue; - - const val = newHeaders[k]; - - if (val === null) { - delete targetHeaders[lowerKey]; - } else if (val !== undefined) { - targetHeaders[lowerKey] = val; - } - } -} - -export function debug(action: string, ...args: any[]) { - if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { - console.log(`OpenAI:DEBUG:${action}`, ...args); - } -} - -/** - * https://stackoverflow.com/a/2117523 - */ -const uuid4 = () => { - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { - const r = (Math.random() * 16) | 0; - const v = c === 'x' ? r : (r & 0x3) | 0x8; - return v.toString(16); - }); -}; - -export const isRunningInBrowser = () => { - return ( - // @ts-ignore - typeof window !== 'undefined' && - // @ts-ignore - typeof window.document !== 'undefined' && - // @ts-ignore - typeof navigator !== 'undefined' - ); -}; - -export interface HeadersProtocol { - get: (header: string) => string | null | undefined; -} -export type HeadersLike = Record | HeadersProtocol; - -export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => { - return typeof headers?.get === 'function'; -}; - -export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => { - const foundHeader = getHeader(headers, header); - if (foundHeader === undefined) { - throw new Error(`Could not find ${header} header`); - } - return foundHeader; -}; - -export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => { - const lowerCasedHeader = header.toLowerCase(); - if (isHeadersProtocol(headers)) { - // to deal with the case where the header looks like Stainless-Event-Id - const intercapsHeader = - header[0]?.toUpperCase() + - header.substring(1).replace(/([^\w])(\w)/g, (_m, g1, g2) => g1 + g2.toUpperCase()); - for (const key of [header, lowerCasedHeader, header.toUpperCase(), intercapsHeader]) { - const value = headers.get(key); - if (value) { - return value; - } - } - } - - for (const [key, value] of Object.entries(headers)) { - if (key.toLowerCase() === lowerCasedHeader) { - if (Array.isArray(value)) { - if (value.length <= 1) return value[0]; - console.warn(`Received ${value.length} entries for the ${header} header, using the first entry.`); - return value[0]; - } - return value; - } - } - - return undefined; -}; - -/** - * Encodes a string to Base64 format. - */ -export const toBase64 = (str: string | null | undefined): string => { - if (!str) return ''; - if (typeof Buffer !== 'undefined') { - return Buffer.from(str).toString('base64'); - } - - if (typeof btoa !== 'undefined') { - return btoa(str); - } - - throw new OpenAIError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined'); -}; - -export function isObj(obj: unknown): obj is Record { - return obj != null && typeof obj === 'object' && !Array.isArray(obj); -} diff --git a/src/error.ts b/src/error.ts index f3dc57610..74251d51f 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { castToError, Headers } from './core'; +import { castToError } from './internal/errors'; export class OpenAIError extends Error {} @@ -20,13 +20,13 @@ export class APIError< readonly param: string | null | undefined; readonly type: string | undefined; - readonly request_id: string | null | undefined; + readonly requestID: string | null | undefined; constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { super(`${APIError.makeMessage(status, error, message)}`); this.status = status; this.headers = headers; - this.request_id = headers?.['x-request-id']; + this.requestID = headers?.get('x-request-id'); this.error = error; const data = error as Record; diff --git a/src/index.ts b/src/index.ts index 2320850fb..44de17c6a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,654 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { type Agent, type RequestInit } from './_shims/index'; -import * as qs from './internal/qs'; -import * as Core from './core'; -import * as Errors from './error'; -import * as Pagination from './pagination'; -import { type CursorPageParams, CursorPageResponse, PageResponse } from './pagination'; -import * as Uploads from './uploads'; -import * as API from './resources/index'; -import { - Batch, - BatchCreateParams, - BatchError, - BatchListParams, - BatchRequestCounts, - Batches, - BatchesPage, -} from './resources/batches'; -import { - Completion, - CompletionChoice, - CompletionCreateParams, - CompletionCreateParamsNonStreaming, - CompletionCreateParamsStreaming, - CompletionUsage, - Completions, -} from './resources/completions'; -import { - CreateEmbeddingResponse, - Embedding, - EmbeddingCreateParams, - EmbeddingModel, - Embeddings, -} from './resources/embeddings'; -import { - FileContent, - FileCreateParams, - FileDeleted, - FileListParams, - FileObject, - FileObjectsPage, - FilePurpose, - Files, -} from './resources/files'; -import { - Image, - ImageCreateVariationParams, - ImageEditParams, - ImageGenerateParams, - ImageModel, - Images, - ImagesResponse, -} from './resources/images'; -import { Model, ModelDeleted, Models, ModelsPage } from './resources/models'; -import { - Moderation, - ModerationCreateParams, - ModerationCreateResponse, - ModerationImageURLInput, - ModerationModel, - ModerationMultiModalInput, - ModerationTextInput, - Moderations, -} from './resources/moderations'; -import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; -import { Beta } from './resources/beta/beta'; -import { Chat, ChatModel } from './resources/chat/chat'; -import { - ChatCompletion, - ChatCompletionAssistantMessageParam, - ChatCompletionAudio, - ChatCompletionAudioParam, - ChatCompletionChunk, - ChatCompletionContentPart, - ChatCompletionContentPartImage, - ChatCompletionContentPartInputAudio, - ChatCompletionContentPartRefusal, - ChatCompletionContentPartText, - ChatCompletionCreateParams, - ChatCompletionCreateParamsNonStreaming, - ChatCompletionCreateParamsStreaming, - ChatCompletionDeveloperMessageParam, - ChatCompletionFunctionCallOption, - ChatCompletionFunctionMessageParam, - ChatCompletionMessage, - ChatCompletionMessageParam, - ChatCompletionMessageToolCall, - ChatCompletionModality, - ChatCompletionNamedToolChoice, - ChatCompletionPredictionContent, - ChatCompletionReasoningEffort, - ChatCompletionRole, - ChatCompletionStreamOptions, - ChatCompletionSystemMessageParam, - ChatCompletionTokenLogprob, - ChatCompletionTool, - ChatCompletionToolChoiceOption, - ChatCompletionToolMessageParam, - ChatCompletionUserMessageParam, -} from './resources/chat/completions'; -import { FineTuning } from './resources/fine-tuning/fine-tuning'; -import { - Upload, - UploadCompleteParams, - UploadCreateParams, - Uploads as UploadsAPIUploads, -} from './resources/uploads/uploads'; +export { OpenAI as default } from './client'; -export interface ClientOptions { - /** - * Defaults to process.env['OPENAI_API_KEY']. - */ - apiKey?: string | undefined; - - /** - * Defaults to process.env['OPENAI_ORG_ID']. - */ - organization?: string | null | undefined; - - /** - * Defaults to process.env['OPENAI_PROJECT_ID']. - */ - project?: string | null | undefined; - - /** - * Override the default base URL for the API, e.g., "https://api.example.com/v2/" - * - * Defaults to process.env['OPENAI_BASE_URL']. - */ - baseURL?: string | null | undefined; - - /** - * The maximum amount of time (in milliseconds) that the client should wait for a response - * from the server before timing out a single request. - * - * Note that request timeouts are retried by default, so in a worst-case scenario you may wait - * much longer than this timeout before the promise succeeds or fails. - */ - timeout?: number; - - /** - * An HTTP agent used to manage HTTP(S) connections. - * - * If not provided, an agent will be constructed by default in the Node.js environment, - * otherwise no agent is used. - */ - httpAgent?: Agent; - - /** - * Specify a custom `fetch` function implementation. - * - * If not provided, we use `node-fetch` on Node.js and otherwise expect that `fetch` is - * defined globally. - */ - fetch?: Core.Fetch | undefined; - - /** - * The maximum number of times that the client will retry a request in case of a - * temporary failure, like a network error or a 5XX error from the server. - * - * @default 2 - */ - maxRetries?: number; - - /** - * Default headers to include with every request to the API. - * - * These can be removed in individual requests by explicitly setting the - * header to `undefined` or `null` in request options. - */ - defaultHeaders?: Core.Headers; - - /** - * Default query parameters to include with every request to the API. - * - * These can be removed in individual requests by explicitly setting the - * param to `undefined` in request options. - */ - defaultQuery?: Core.DefaultQuery; - - /** - * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. - * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. - */ - dangerouslyAllowBrowser?: boolean; -} - -/** - * API Client for interfacing with the OpenAI API. - */ -export class OpenAI extends Core.APIClient { - apiKey: string; - organization: string | null; - project: string | null; - - private _options: ClientOptions; - - /** - * API Client for interfacing with the OpenAI API. - * - * @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? undefined] - * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] - * @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null] - * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL'] ?? https://api.openai.com/v1] - Override the default base URL for the API. - * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. - * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. - * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. - * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. - * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API. - * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API. - * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. - */ - constructor({ - baseURL = Core.readEnv('OPENAI_BASE_URL'), - apiKey = Core.readEnv('OPENAI_API_KEY'), - organization = Core.readEnv('OPENAI_ORG_ID') ?? null, - project = Core.readEnv('OPENAI_PROJECT_ID') ?? null, - ...opts - }: ClientOptions = {}) { - if (apiKey === undefined) { - throw new Errors.OpenAIError( - "The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).", - ); - } - - const options: ClientOptions = { - apiKey, - organization, - project, - ...opts, - baseURL: baseURL || `https://api.openai.com/v1`, - }; - - if (!options.dangerouslyAllowBrowser && Core.isRunningInBrowser()) { - throw new Errors.OpenAIError( - "It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n", - ); - } - - super({ - baseURL: options.baseURL!, - timeout: options.timeout ?? 600000 /* 10 minutes */, - httpAgent: options.httpAgent, - maxRetries: options.maxRetries, - fetch: options.fetch, - }); - - this._options = options; - - this.apiKey = apiKey; - this.organization = organization; - this.project = project; - } - - completions: API.Completions = new API.Completions(this); - chat: API.Chat = new API.Chat(this); - embeddings: API.Embeddings = new API.Embeddings(this); - files: API.Files = new API.Files(this); - images: API.Images = new API.Images(this); - audio: API.Audio = new API.Audio(this); - moderations: API.Moderations = new API.Moderations(this); - models: API.Models = new API.Models(this); - fineTuning: API.FineTuning = new API.FineTuning(this); - beta: API.Beta = new API.Beta(this); - batches: API.Batches = new API.Batches(this); - uploads: API.Uploads = new API.Uploads(this); - - protected override defaultQuery(): Core.DefaultQuery | undefined { - return this._options.defaultQuery; - } - - protected override defaultHeaders(opts: Core.FinalRequestOptions): Core.Headers { - return { - ...super.defaultHeaders(opts), - 'OpenAI-Organization': this.organization, - 'OpenAI-Project': this.project, - ...this._options.defaultHeaders, - }; - } - - protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers { - return { Authorization: `Bearer ${this.apiKey}` }; - } - - protected override stringifyQuery(query: Record): string { - return qs.stringify(query, { arrayFormat: 'brackets' }); - } - - static OpenAI = this; - static DEFAULT_TIMEOUT = 600000; // 10 minutes - - static OpenAIError = Errors.OpenAIError; - static APIError = Errors.APIError; - static APIConnectionError = Errors.APIConnectionError; - static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; - static APIUserAbortError = Errors.APIUserAbortError; - static NotFoundError = Errors.NotFoundError; - static ConflictError = Errors.ConflictError; - static RateLimitError = Errors.RateLimitError; - static BadRequestError = Errors.BadRequestError; - static AuthenticationError = Errors.AuthenticationError; - static InternalServerError = Errors.InternalServerError; - static PermissionDeniedError = Errors.PermissionDeniedError; - static UnprocessableEntityError = Errors.UnprocessableEntityError; - - static toFile = Uploads.toFile; - static fileFromPath = Uploads.fileFromPath; -} - -OpenAI.Completions = Completions; -OpenAI.Chat = Chat; -OpenAI.Embeddings = Embeddings; -OpenAI.Files = Files; -OpenAI.FileObjectsPage = FileObjectsPage; -OpenAI.Images = Images; -OpenAI.Audio = Audio; -OpenAI.Moderations = Moderations; -OpenAI.Models = Models; -OpenAI.ModelsPage = ModelsPage; -OpenAI.FineTuning = FineTuning; -OpenAI.Beta = Beta; -OpenAI.Batches = Batches; -OpenAI.BatchesPage = BatchesPage; -OpenAI.Uploads = UploadsAPIUploads; -export declare namespace OpenAI { - export type RequestOptions = Core.RequestOptions; - - export import Page = Pagination.Page; - export { type PageResponse as PageResponse }; - - export import CursorPage = Pagination.CursorPage; - export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; - - export { - Completions as Completions, - type Completion as Completion, - type CompletionChoice as CompletionChoice, - type CompletionUsage as CompletionUsage, - type CompletionCreateParams as CompletionCreateParams, - type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, - type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, - }; - - export { - Chat as Chat, - type ChatModel as ChatModel, - type ChatCompletion as ChatCompletion, - type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, - type ChatCompletionAudio as ChatCompletionAudio, - type ChatCompletionAudioParam as ChatCompletionAudioParam, - type ChatCompletionChunk as ChatCompletionChunk, - type ChatCompletionContentPart as ChatCompletionContentPart, - type ChatCompletionContentPartImage as ChatCompletionContentPartImage, - type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, - type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, - type ChatCompletionContentPartText as ChatCompletionContentPartText, - type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, - type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, - type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, - type ChatCompletionMessage as ChatCompletionMessage, - type ChatCompletionMessageParam as ChatCompletionMessageParam, - type ChatCompletionMessageToolCall as ChatCompletionMessageToolCall, - type ChatCompletionModality as ChatCompletionModality, - type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, - type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, - type ChatCompletionRole as ChatCompletionRole, - type ChatCompletionStreamOptions as ChatCompletionStreamOptions, - type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, - type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, - type ChatCompletionTool as ChatCompletionTool, - type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, - type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, - type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, - type ChatCompletionCreateParams as ChatCompletionCreateParams, - type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, - type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, - }; - - export { - Embeddings as Embeddings, - type CreateEmbeddingResponse as CreateEmbeddingResponse, - type Embedding as Embedding, - type EmbeddingModel as EmbeddingModel, - type EmbeddingCreateParams as EmbeddingCreateParams, - }; - - export { - Files as Files, - type FileContent as FileContent, - type FileDeleted as FileDeleted, - type FileObject as FileObject, - type FilePurpose as FilePurpose, - FileObjectsPage as FileObjectsPage, - type FileCreateParams as FileCreateParams, - type FileListParams as FileListParams, - }; - - export { - Images as Images, - type Image as Image, - type ImageModel as ImageModel, - type ImagesResponse as ImagesResponse, - type ImageCreateVariationParams as ImageCreateVariationParams, - type ImageEditParams as ImageEditParams, - type ImageGenerateParams as ImageGenerateParams, - }; - - export { Audio as Audio, type AudioModel as AudioModel, type AudioResponseFormat as AudioResponseFormat }; - - export { - Moderations as Moderations, - type Moderation as Moderation, - type ModerationImageURLInput as ModerationImageURLInput, - type ModerationModel as ModerationModel, - type ModerationMultiModalInput as ModerationMultiModalInput, - type ModerationTextInput as ModerationTextInput, - type ModerationCreateResponse as ModerationCreateResponse, - type ModerationCreateParams as ModerationCreateParams, - }; - - export { - Models as Models, - type Model as Model, - type ModelDeleted as ModelDeleted, - ModelsPage as ModelsPage, - }; - - export { FineTuning as FineTuning }; - - export { Beta as Beta }; - - export { - Batches as Batches, - type Batch as Batch, - type BatchError as BatchError, - type BatchRequestCounts as BatchRequestCounts, - BatchesPage as BatchesPage, - type BatchCreateParams as BatchCreateParams, - type BatchListParams as BatchListParams, - }; - - export { - UploadsAPIUploads as Uploads, - type Upload as Upload, - type UploadCreateParams as UploadCreateParams, - type UploadCompleteParams as UploadCompleteParams, - }; - - export type ErrorObject = API.ErrorObject; - export type FunctionDefinition = API.FunctionDefinition; - export type FunctionParameters = API.FunctionParameters; - export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; - export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; - export type ResponseFormatText = API.ResponseFormatText; -} - -// ---------------------- Azure ---------------------- - -/** API Client for interfacing with the Azure OpenAI API. */ -export interface AzureClientOptions extends ClientOptions { - /** - * Defaults to process.env['OPENAI_API_VERSION']. - */ - apiVersion?: string | undefined; - - /** - * Your Azure endpoint, including the resource, e.g. `https://example-resource.azure.openai.com/` - */ - endpoint?: string | undefined; - - /** - * A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`. - * Note: this means you won't be able to use non-deployment endpoints. Not supported with Assistants APIs. - */ - deployment?: string | undefined; - - /** - * Defaults to process.env['AZURE_OPENAI_API_KEY']. - */ - apiKey?: string | undefined; - - /** - * A function that returns an access token for Microsoft Entra (formerly known as Azure Active Directory), - * which will be invoked on every request. - */ - azureADTokenProvider?: (() => Promise) | undefined; -} - -/** API Client for interfacing with the Azure OpenAI API. */ -export class AzureOpenAI extends OpenAI { - private _azureADTokenProvider: (() => Promise) | undefined; - private _deployment: string | undefined; - apiVersion: string = ''; - /** - * API Client for interfacing with the Azure OpenAI API. - * - * @param {string | undefined} [opts.apiVersion=process.env['OPENAI_API_VERSION'] ?? undefined] - * @param {string | undefined} [opts.endpoint=process.env['AZURE_OPENAI_ENDPOINT'] ?? undefined] - Your Azure endpoint, including the resource, e.g. `https://example-resource.azure.openai.com/` - * @param {string | undefined} [opts.apiKey=process.env['AZURE_OPENAI_API_KEY'] ?? undefined] - * @param {string | undefined} opts.deployment - A model deployment, if given, sets the base client URL to include `/deployments/{deployment}`. - * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] - * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL']] - Sets the base URL for the API, e.g. `https://example-resource.azure.openai.com/openai/`. - * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. - * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. - * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. - * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. - * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API. - * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API. - * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. - */ - constructor({ - baseURL = Core.readEnv('OPENAI_BASE_URL'), - apiKey = Core.readEnv('AZURE_OPENAI_API_KEY'), - apiVersion = Core.readEnv('OPENAI_API_VERSION'), - endpoint, - deployment, - azureADTokenProvider, - dangerouslyAllowBrowser, - ...opts - }: AzureClientOptions = {}) { - if (!apiVersion) { - throw new Errors.OpenAIError( - "The OPENAI_API_VERSION environment variable is missing or empty; either provide it, or instantiate the AzureOpenAI client with an apiVersion option, like new AzureOpenAI({ apiVersion: 'My API Version' }).", - ); - } - - if (typeof azureADTokenProvider === 'function') { - dangerouslyAllowBrowser = true; - } - - if (!azureADTokenProvider && !apiKey) { - throw new Errors.OpenAIError( - 'Missing credentials. Please pass one of `apiKey` and `azureADTokenProvider`, or set the `AZURE_OPENAI_API_KEY` environment variable.', - ); - } - - if (azureADTokenProvider && apiKey) { - throw new Errors.OpenAIError( - 'The `apiKey` and `azureADTokenProvider` arguments are mutually exclusive; only one can be passed at a time.', - ); - } - - // define a sentinel value to avoid any typing issues - apiKey ??= API_KEY_SENTINEL; - - opts.defaultQuery = { ...opts.defaultQuery, 'api-version': apiVersion }; - - if (!baseURL) { - if (!endpoint) { - endpoint = process.env['AZURE_OPENAI_ENDPOINT']; - } - - if (!endpoint) { - throw new Errors.OpenAIError( - 'Must provide one of the `baseURL` or `endpoint` arguments, or the `AZURE_OPENAI_ENDPOINT` environment variable', - ); - } - - baseURL = `${endpoint}/openai`; - } else { - if (endpoint) { - throw new Errors.OpenAIError('baseURL and endpoint are mutually exclusive'); - } - } - - super({ - apiKey, - baseURL, - ...opts, - ...(dangerouslyAllowBrowser !== undefined ? { dangerouslyAllowBrowser } : {}), - }); - - this._azureADTokenProvider = azureADTokenProvider; - this.apiVersion = apiVersion; - this._deployment = deployment; - } - - override buildRequest(options: Core.FinalRequestOptions): { - req: RequestInit; - url: string; - timeout: number; - } { - if (_deployments_endpoints.has(options.path) && options.method === 'post' && options.body !== undefined) { - if (!Core.isObj(options.body)) { - throw new Error('Expected request body to be an object'); - } - const model = this._deployment || options.body['model']; - if (model !== undefined && !this.baseURL.includes('/deployments')) { - options.path = `/deployments/${model}${options.path}`; - } - } - return super.buildRequest(options); - } - - private async _getAzureADToken(): Promise { - if (typeof this._azureADTokenProvider === 'function') { - const token = await this._azureADTokenProvider(); - if (!token || typeof token !== 'string') { - throw new Errors.OpenAIError( - `Expected 'azureADTokenProvider' argument to return a string but it returned ${token}`, - ); - } - return token; - } - return undefined; - } - - protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers { - return {}; - } - - protected override async prepareOptions(opts: Core.FinalRequestOptions): Promise { - /** - * The user should provide a bearer token provider if they want - * to use Azure AD authentication. The user shouldn't set the - * Authorization header manually because the header is overwritten - * with the Azure AD token if a bearer token provider is provided. - */ - if (opts.headers?.['api-key']) { - return super.prepareOptions(opts); - } - const token = await this._getAzureADToken(); - opts.headers ??= {}; - if (token) { - opts.headers['Authorization'] = `Bearer ${token}`; - } else if (this.apiKey !== API_KEY_SENTINEL) { - opts.headers['api-key'] = this.apiKey; - } else { - throw new Errors.OpenAIError('Unable to handle auth'); - } - return super.prepareOptions(opts); - } -} - -const _deployments_endpoints = new Set([ - '/completions', - '/chat/completions', - '/embeddings', - '/audio/transcriptions', - '/audio/translations', - '/audio/speech', - '/images/generations', -]); - -const API_KEY_SENTINEL = ''; - -// ---------------------- End Azure ---------------------- - -export { toFile, fileFromPath } from './uploads'; +export { + multipartFormRequestOptions, + maybeMultipartFormRequestOptions, + type Uploadable, + createForm, + toFile, +} from './uploads'; +export { APIPromise } from './api-promise'; +export { OpenAI, type ClientOptions } from './client'; +export { PagePromise } from './pagination'; export { OpenAIError, APIError, @@ -664,5 +27,3 @@ export { PermissionDeniedError, UnprocessableEntityError, } from './error'; - -export default OpenAI; diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts new file mode 100644 index 000000000..ca1be792c --- /dev/null +++ b/src/internal/builtin-types.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export type Fetch = typeof fetch; + +/** + * An alias to the builtin `RequestInit` type so we can + * easily alias it in import statements if there are name clashes. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit + */ +type _RequestInit = RequestInit; + +/** + * An alias to the builtin `Response` type so we can + * easily alias it in import statements if there are name clashes. + * + * https://developer.mozilla.org/docs/Web/API/Response + */ +type _Response = Response; + +/** + * The type for the first argument to `fetch`. + * + * https://developer.mozilla.org/docs/Web/API/Window/fetch#resource + */ +type _RequestInfo = Request | URL | string; + +/** + * The type for constructing `RequestInit` Headers. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit#setting_headers + */ +type _HeadersInit = RequestInit['headers']; + +/** + * The type for constructing `RequestInit` body. + * + * https://developer.mozilla.org/docs/Web/API/RequestInit#body + */ +type _BodyInit = RequestInit['body']; + +export type { + _BodyInit as BodyInit, + _HeadersInit as HeadersInit, + _RequestInfo as RequestInfo, + _RequestInit as RequestInit, + _Response as Response, +}; + +/** + * A copy of the builtin `EndingType` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L27941 + */ +type EndingType = 'native' | 'transparent'; + +/** + * A copy of the builtin `BlobPropertyBag` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L154 + * https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#options + */ +export interface BlobPropertyBag { + endings?: EndingType; + type?: string; +} + +/** + * A copy of the builtin `FilePropertyBag` type as it isn't fully supported in certain + * environments and attempting to reference the global version will error. + * + * https://github.com/microsoft/TypeScript/blob/49ad1a3917a0ea57f5ff248159256e12bb1cb705/src/lib/dom.generated.d.ts#L503 + * https://developer.mozilla.org/en-US/docs/Web/API/File/File#options + */ +export interface FilePropertyBag extends BlobPropertyBag { + lastModified?: number; +} diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts new file mode 100644 index 000000000..24eec519e --- /dev/null +++ b/src/internal/detect-platform.ts @@ -0,0 +1,192 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { VERSION } from '../version'; + +export const isRunningInBrowser = () => { + return ( + // @ts-ignore + typeof window !== 'undefined' && + // @ts-ignore + typeof window.document !== 'undefined' && + // @ts-ignore + typeof navigator !== 'undefined' + ); +}; + +type DetectedPlatform = 'deno' | 'node' | 'edge' | 'unknown'; + +/** + * Note this does not detect 'browser'; for that, use getBrowserInfo(). + */ +function getDetectedPlatform(): DetectedPlatform { + if (typeof Deno !== 'undefined' && Deno.build != null) { + return 'deno'; + } + if (typeof EdgeRuntime !== 'undefined') { + return 'edge'; + } + if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') { + return 'node'; + } + return 'unknown'; +} + +declare const Deno: any; +declare const EdgeRuntime: any; +type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown'; +type PlatformName = + | 'MacOS' + | 'Linux' + | 'Windows' + | 'FreeBSD' + | 'OpenBSD' + | 'iOS' + | 'Android' + | `Other:${string}` + | 'Unknown'; +type Browser = 'ie' | 'edge' | 'chrome' | 'firefox' | 'safari'; +type PlatformProperties = { + 'X-Stainless-Lang': 'js'; + 'X-Stainless-Package-Version': string; + 'X-Stainless-OS': PlatformName; + 'X-Stainless-Arch': Arch; + 'X-Stainless-Runtime': 'node' | 'deno' | 'edge' | `browser:${Browser}` | 'unknown'; + 'X-Stainless-Runtime-Version': string; +}; +const getPlatformProperties = (): PlatformProperties => { + const detectedPlatform = getDetectedPlatform(); + if (detectedPlatform === 'deno') { + return { + 'X-Stainless-Lang': 'js', + 'X-Stainless-Package-Version': VERSION, + 'X-Stainless-OS': normalizePlatform(Deno.build.os), + 'X-Stainless-Arch': normalizeArch(Deno.build.arch), + 'X-Stainless-Runtime': 'deno', + 'X-Stainless-Runtime-Version': + typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown', + }; + } + if (typeof EdgeRuntime !== 'undefined') { + return { + 'X-Stainless-Lang': 'js', + 'X-Stainless-Package-Version': VERSION, + 'X-Stainless-OS': 'Unknown', + 'X-Stainless-Arch': `other:${EdgeRuntime}`, + 'X-Stainless-Runtime': 'edge', + 'X-Stainless-Runtime-Version': process.version, + }; + } + // Check if Node.js + if (detectedPlatform === 'node') { + return { + 'X-Stainless-Lang': 'js', + 'X-Stainless-Package-Version': VERSION, + 'X-Stainless-OS': normalizePlatform(process.platform), + 'X-Stainless-Arch': normalizeArch(process.arch), + 'X-Stainless-Runtime': 'node', + 'X-Stainless-Runtime-Version': process.version, + }; + } + + const browserInfo = getBrowserInfo(); + if (browserInfo) { + return { + 'X-Stainless-Lang': 'js', + 'X-Stainless-Package-Version': VERSION, + 'X-Stainless-OS': 'Unknown', + 'X-Stainless-Arch': 'unknown', + 'X-Stainless-Runtime': `browser:${browserInfo.browser}`, + 'X-Stainless-Runtime-Version': browserInfo.version, + }; + } + + // TODO add support for Cloudflare workers, etc. + return { + 'X-Stainless-Lang': 'js', + 'X-Stainless-Package-Version': VERSION, + 'X-Stainless-OS': 'Unknown', + 'X-Stainless-Arch': 'unknown', + 'X-Stainless-Runtime': 'unknown', + 'X-Stainless-Runtime-Version': 'unknown', + }; +}; + +type BrowserInfo = { + browser: Browser; + version: string; +}; + +declare const navigator: { userAgent: string } | undefined; + +// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts +function getBrowserInfo(): BrowserInfo | null { + if (typeof navigator === 'undefined' || !navigator) { + return null; + } + + // NOTE: The order matters here! + const browserPatterns = [ + { key: 'edge' as const, pattern: /Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'ie' as const, pattern: /MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'ie' as const, pattern: /Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'chrome' as const, pattern: /Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'firefox' as const, pattern: /Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/ }, + { key: 'safari' as const, pattern: /(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/ }, + ]; + + // Find the FIRST matching browser + for (const { key, pattern } of browserPatterns) { + const match = pattern.exec(navigator.userAgent); + if (match) { + const major = match[1] || 0; + const minor = match[2] || 0; + const patch = match[3] || 0; + + return { browser: key, version: `${major}.${minor}.${patch}` }; + } + } + + return null; +} + +const normalizeArch = (arch: string): Arch => { + // Node docs: + // - https://nodejs.org/api/process.html#processarch + // Deno docs: + // - https://doc.deno.land/deno/stable/~/Deno.build + if (arch === 'x32') return 'x32'; + if (arch === 'x86_64' || arch === 'x64') return 'x64'; + if (arch === 'arm') return 'arm'; + if (arch === 'aarch64' || arch === 'arm64') return 'arm64'; + if (arch) return `other:${arch}`; + return 'unknown'; +}; + +const normalizePlatform = (platform: string): PlatformName => { + // Node platforms: + // - https://nodejs.org/api/process.html#processplatform + // Deno platforms: + // - https://doc.deno.land/deno/stable/~/Deno.build + // - https://github.com/denoland/deno/issues/14799 + + platform = platform.toLowerCase(); + + // NOTE: this iOS check is untested and may not work + // Node does not work natively on IOS, there is a fork at + // https://github.com/nodejs-mobile/nodejs-mobile + // however it is unknown at the time of writing how to detect if it is running + if (platform.includes('ios')) return 'iOS'; + if (platform === 'android') return 'Android'; + if (platform === 'darwin') return 'MacOS'; + if (platform === 'win32') return 'Windows'; + if (platform === 'freebsd') return 'FreeBSD'; + if (platform === 'openbsd') return 'OpenBSD'; + if (platform === 'linux') return 'Linux'; + if (platform) return `Other:${platform}`; + return 'Unknown'; +}; + +let _platformHeaders: PlatformProperties; +export const getPlatformHeaders = () => { + return (_platformHeaders ??= getPlatformProperties()); +}; diff --git a/src/internal/errors.ts b/src/internal/errors.ts new file mode 100644 index 000000000..08321f317 --- /dev/null +++ b/src/internal/errors.ts @@ -0,0 +1,18 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export function isAbortError(err: unknown) { + return ( + (err instanceof Error && err.name === 'AbortError') || + (typeof err === 'object' && err && 'name' in err && (err as any).name === 'AbortError') + ); +} + +export const castToError = (err: any): Error => { + if (err instanceof Error) return err; + if (typeof err === 'object' && err !== null) { + try { + return new Error(JSON.stringify(err)); + } catch {} + } + return new Error(err); +}; diff --git a/src/internal/headers.ts b/src/internal/headers.ts new file mode 100644 index 000000000..a110a1204 --- /dev/null +++ b/src/internal/headers.ts @@ -0,0 +1,96 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +type HeaderValue = string | undefined | null; +export type HeadersLike = + | Headers + | readonly [string, HeaderValue][] + | Record + | undefined + | null + | NullableHeaders; + +const brand_privateNullableHeaders = Symbol('brand.privateNullableHeaders'); + +/** + * @internal + * Users can pass explicit nulls to unset default headers. When we parse them + * into a standard headers type we need to preserve that information. + */ +export type NullableHeaders = { + /** Brand check, prevent users from creating a NullableHeaders. */ + [brand_privateNullableHeaders]: true; + /** Parsed headers. */ + values: Headers; + /** Set of lowercase header names explicitly set to null. */ + nulls: Set; +}; + +const isArray = Array.isArray as (val: unknown) => val is readonly unknown[]; + +function* iterateHeaders(headers: HeadersLike): IterableIterator { + if (!headers) return; + + if (brand_privateNullableHeaders in headers) { + const { values, nulls } = headers; + yield* values.entries(); + for (const name of nulls) { + yield [name, null]; + } + return; + } + + let shouldClear = false; + let iter: Iterable; + if (headers instanceof Headers) { + iter = headers.entries(); + } else if (isArray(headers)) { + iter = headers; + } else { + shouldClear = true; + iter = Object.entries(headers ?? {}); + } + for (let row of iter) { + const name = row[0]; + const values = isArray(row[1]) ? row[1] : [row[1]]; + let didClear = false; + for (const value of values) { + if (value === undefined) continue; + + // Objects keys always overwrite older headers, they never append. + // Yield a null to clear the header before adding the new values. + if (shouldClear && !didClear) { + didClear = true; + yield [name, null]; + } + yield [name, value]; + } + } +} + +export const buildHeaders = (newHeaders: HeadersLike[]): NullableHeaders => { + const targetHeaders = new Headers(); + const nullHeaders = new Set(); + const seenHeaders = new Set(); + for (const headers of newHeaders) { + for (const [name, value] of iterateHeaders(headers)) { + const lowerName = name.toLowerCase(); + if (!seenHeaders.has(lowerName)) { + targetHeaders.delete(name); + seenHeaders.add(lowerName); + } + if (value === null) { + targetHeaders.delete(name); + nullHeaders.add(lowerName); + } else { + targetHeaders.append(name, value); + nullHeaders.delete(lowerName); + } + } + } + return { [brand_privateNullableHeaders]: true, values: targetHeaders, nulls: nullHeaders }; +}; + +export const isEmptyHeaders = (headers: HeadersLike) => { + for (const _ of iterateHeaders(headers)) return false; + return true; +}; diff --git a/src/internal/parse.ts b/src/internal/parse.ts new file mode 100644 index 000000000..cf431e4a6 --- /dev/null +++ b/src/internal/parse.ts @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { debug } from './utils/log'; +import { FinalRequestOptions } from './request-options'; +import { Stream } from '../streaming'; +import type { AbstractPage } from '../pagination'; + +export type APIResponseProps = { + response: Response; + options: FinalRequestOptions; + controller: AbortController; +}; + +export async function defaultParseResponse(props: APIResponseProps): Promise> { + const { response } = props; + if (props.options.stream) { + debug('response', response.status, response.url, response.headers, response.body); + + // Note: there is an invariant here that isn't represented in the type system + // that if you set `stream: true` the response type must also be `Stream` + + if (props.options.__streamClass) { + return props.options.__streamClass.fromSSEResponse(response, props.controller) as any; + } + + return Stream.fromSSEResponse(response, props.controller) as any; + } + + // fetch refuses to read the body when the status code is 204. + if (response.status === 204) { + return null as WithRequestID; + } + + if (props.options.__binaryResponse) { + return response as unknown as WithRequestID; + } + + const contentType = response.headers.get('content-type'); + const isJSON = + contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); + if (isJSON) { + const json = await response.json(); + + debug('response', response.status, response.url, response.headers, json); + + return addRequestID(json as T, response); + } + + const text = await response.text(); + debug('response', response.status, response.url, response.headers, text); + + // TODO handle blob, arraybuffer, other content types, etc. + return text as unknown as WithRequestID; +} + +export type WithRequestID = + T extends Array | Response | AbstractPage ? T + : T extends Record ? T & { _request_id?: string | null } + : T; + +export function addRequestID(value: T, response: Response): WithRequestID { + if (!value || typeof value !== 'object' || Array.isArray(value)) { + return value as WithRequestID; + } + + return Object.defineProperty(value, '_request_id', { + value: response.headers.get('x-request-id'), + enumerable: false, + }) as WithRequestID; +} diff --git a/src/internal/polyfill/crypto.node.d.ts b/src/internal/polyfill/crypto.node.d.ts new file mode 100644 index 000000000..dc7caac8d --- /dev/null +++ b/src/internal/polyfill/crypto.node.d.ts @@ -0,0 +1,10 @@ +export declare const crypto: { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ + getRandomValues(array: T): T; + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) + */ + randomUUID?: () => string; +}; diff --git a/src/internal/polyfill/crypto.node.js b/src/internal/polyfill/crypto.node.js new file mode 100644 index 000000000..83062a3d7 --- /dev/null +++ b/src/internal/polyfill/crypto.node.js @@ -0,0 +1,11 @@ +if (typeof require !== 'undefined') { + if (globalThis.crypto) { + exports.crypto = globalThis.crypto; + } else { + try { + // Use [require][0](...) and not require(...) so bundlers don't try to bundle the + // crypto module. + exports.crypto = [require][0]('node:crypto').webcrypto; + } catch (e) {} + } +} diff --git a/src/internal/polyfill/crypto.node.mjs b/src/internal/polyfill/crypto.node.mjs new file mode 100644 index 000000000..24c6f3b9e --- /dev/null +++ b/src/internal/polyfill/crypto.node.mjs @@ -0,0 +1,2 @@ +import * as mod from './crypto.node.js'; +export const crypto = globalThis.crypto || mod.crypto; diff --git a/src/internal/polyfill/file.node.d.ts b/src/internal/polyfill/file.node.d.ts new file mode 100644 index 000000000..b2a59bfd5 --- /dev/null +++ b/src/internal/polyfill/file.node.d.ts @@ -0,0 +1,9 @@ +/** + * This file polyfills the global `File` object for you if it's not already defined + * when running on Node.js + * + * This is only needed on Node.js v18 & v19. Newer versions already define `File` + * as a global. + */ + +export {}; diff --git a/src/internal/polyfill/file.node.js b/src/internal/polyfill/file.node.js new file mode 100644 index 000000000..eba997e1d --- /dev/null +++ b/src/internal/polyfill/file.node.js @@ -0,0 +1,17 @@ +/** + * This file polyfills the global `File` object for you if it's not already defined + * when running on Node.js + * + * This is only needed on Node.js v18 & v19. Newer versions already define `File` + * as a global. + */ + +if (typeof require !== 'undefined') { + if (!globalThis.File) { + try { + // Use [require][0](...) and not require(...) so bundlers don't try to bundle the + // buffer module. + globalThis.File = [require][0]('node:buffer').File; + } catch (e) {} + } +} diff --git a/src/internal/polyfill/file.node.mjs b/src/internal/polyfill/file.node.mjs new file mode 100644 index 000000000..520dcb84c --- /dev/null +++ b/src/internal/polyfill/file.node.mjs @@ -0,0 +1,9 @@ +/** + * This file polyfills the global `File` object for you if it's not already defined + * when running on Node.js + * + * This is only needed on Node.js v18 & v19. Newer versions already define `File` + * as a global. + */ + +import './file.node.js'; diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts new file mode 100644 index 000000000..d4a5c66d8 --- /dev/null +++ b/src/internal/request-options.ts @@ -0,0 +1,71 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { NullableHeaders } from './headers'; + +import type { Agent } from './shims'; +import type { BodyInit } from './builtin-types'; +import { isEmptyObj, hasOwn } from './utils/values'; +import { Stream } from '../streaming'; +import type { HTTPMethod, KeysEnum } from './types'; +import { type HeadersLike } from './headers'; + +export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string }; + +export type RequestOptions = { + method?: HTTPMethod; + path?: string; + query?: object | undefined | null; + body?: unknown; + headers?: HeadersLike; + maxRetries?: number; + stream?: boolean | undefined; + timeout?: number; + httpAgent?: Agent; + signal?: AbortSignal | undefined | null; + idempotencyKey?: string; + + __binaryResponse?: boolean | undefined; + __streamClass?: typeof Stream; +}; + +// This is required so that we can determine if a given object matches the RequestOptions +// type at runtime. While this requires duplication, it is enforced by the TypeScript +// compiler such that any missing / extraneous keys will cause an error. +const requestOptionsKeys: KeysEnum = { + method: true, + path: true, + query: true, + body: true, + headers: true, + + maxRetries: true, + stream: true, + timeout: true, + httpAgent: true, + signal: true, + idempotencyKey: true, + + __binaryResponse: true, + __streamClass: true, +}; + +export const isRequestOptions = (obj: unknown): obj is RequestOptions => { + return ( + typeof obj === 'object' && + obj !== null && + !isEmptyObj(obj) && + Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k)) + ); +}; + +export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit }; +export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent; + +export const FallbackEncoder: RequestEncoder = ({ headers, body }) => { + return { + bodyHeaders: { + 'content-type': 'application/json', + }, + body: JSON.stringify(body), + }; +}; diff --git a/src/internal/shim-types.d.ts b/src/internal/shim-types.d.ts new file mode 100644 index 000000000..fe48144fa --- /dev/null +++ b/src/internal/shim-types.d.ts @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +/** + * Shims for types that we can't always rely on being available globally. + * + * Note: these only exist at the type-level, there is no corresponding runtime + * version for any of these symbols. + */ + +/** + * In order to properly access the global `NodeJS` type, if it's available, we + * need to make use of declaration shadowing. Without this, any checks for the + * presence of `NodeJS.ReadableStream` will fail. + */ +declare namespace NodeJS { + interface ReadableStream {} +} + +type HasProperties = keyof T extends never ? false : true; + +// @ts-ignore +type _ReadableStream = + // @ts-ignore + HasProperties extends true ? NodeJS.ReadableStream : ReadableStream; + +// @ts-ignore +declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream; +export { _ReadableStream as ReadableStream }; diff --git a/src/internal/shims.ts b/src/internal/shims.ts new file mode 100644 index 000000000..4edbafe41 --- /dev/null +++ b/src/internal/shims.ts @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +/** + * This module provides internal shims and utility functions for environments where certain Node.js or global types may not be available. + * + * These are used to ensure we can provide a consistent behaviour between different JavaScript environments and good error + * messages in cases where an environment isn't fully supported. + */ + +import { type Fetch } from './builtin-types'; +import { type ReadableStream } from './shim-types'; + +/** + * A minimal copy of the `Agent` type from `undici-types` so we can + * use it in the `ClientOptions` type. + * + * https://nodejs.org/api/http.html#class-httpagent + */ +export interface Agent { + dispatch(options: any, handler: any): boolean; + closed: boolean; + destroyed: boolean; +} + +export function getDefaultFetch(): Fetch { + if (typeof fetch !== 'undefined') { + return fetch; + } + + throw new Error( + '`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`', + ); +} + +/** + * A minimal copy of the NodeJS `stream.Readable` class so that we can + * accept the NodeJS types in certain places, e.g. file uploads + * + * https://nodejs.org/api/stream.html#class-streamreadable + */ +export interface ReadableLike { + readable: boolean; + readonly readableEnded: boolean; + readonly readableFlowing: boolean | null; + readonly readableHighWaterMark: number; + readonly readableLength: number; + readonly readableObjectMode: boolean; + destroyed: boolean; + read(size?: number): any; + pause(): this; + resume(): this; + isPaused(): boolean; + destroy(error?: Error): this; + [Symbol.asyncIterator](): AsyncIterableIterator; +} + +/** + * Determines if the given value looks like a NodeJS `stream.Readable` + * object and that it is readable, i.e. has not been consumed. + * + * https://nodejs.org/api/stream.html#class-streamreadable + */ +export function isReadableLike(value: any) { + // We declare our own class of Readable here, so it's not feasible to + // do an 'instanceof' check. Instead, check for Readable-like properties. + return !!value && value.readable === true && typeof value.read === 'function'; +} + +/** + * A minimal copy of the NodeJS `fs.ReadStream` class for usage within file uploads. + * + * https://nodejs.org/api/fs.html#class-fsreadstream + */ +export interface FsReadStreamLike extends ReadableLike { + path: {}; // real type is string | Buffer but we can't reference `Buffer` here +} + +/** + * Determines if the given value looks like a NodeJS `fs.ReadStream` + * object. + * + * This just checks if the object matches our `Readable` interface + * and defines a `path` property, there may be false positives. + * + * https://nodejs.org/api/fs.html#class-fsreadstream + */ +export function isFsReadStreamLike(value: any): value is FsReadStreamLike { + return isReadableLike(value) && 'path' in value; +} + +type ReadableStreamArgs = ConstructorParameters; + +export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream { + const ReadableStream = (globalThis as any).ReadableStream; + if (typeof ReadableStream === 'undefined') { + // Note: All of the platforms / runtimes we officially support already define + // `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes. + throw new Error( + '`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`', + ); + } + + return new ReadableStream(...args); +} + +export function ReadableStreamFrom(iterable: Iterable | AsyncIterable): ReadableStream { + let iter: AsyncIterator | Iterator = + Symbol.asyncIterator in iterable ? iterable[Symbol.asyncIterator]() : iterable[Symbol.iterator](); + + return makeReadableStream({ + start() {}, + async pull(controller) { + const { done, value } = await iter.next(); + if (done) { + controller.close(); + } else { + controller.enqueue(value); + } + }, + async cancel() { + await iter.return?.(); + }, + }); +} diff --git a/src/internal/types.ts b/src/internal/types.ts new file mode 100644 index 000000000..99740c34f --- /dev/null +++ b/src/internal/types.ts @@ -0,0 +1,6 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export type PromiseOrValue = T | Promise; +export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; + +export type KeysEnum = { [P in keyof Required]: true }; diff --git a/src/internal/utils.ts b/src/internal/utils.ts new file mode 100644 index 000000000..3cbfacce2 --- /dev/null +++ b/src/internal/utils.ts @@ -0,0 +1,8 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './utils/values'; +export * from './utils/base64'; +export * from './utils/env'; +export * from './utils/log'; +export * from './utils/uuid'; +export * from './utils/sleep'; diff --git a/src/internal/utils/base64.ts b/src/internal/utils/base64.ts new file mode 100644 index 000000000..b45c3b074 --- /dev/null +++ b/src/internal/utils/base64.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { OpenAIError } from '../../error'; + +// @ts-ignore +declare const Buffer: typeof import('node:buffer').Buffer; + +export const toBase64 = (data: string | Uint8Array | null | undefined): string => { + if (!data) return ''; + + if (typeof data === 'string') { + data = new TextEncoder().encode(data); + } + + if (typeof Buffer !== 'undefined') { + return Buffer.from(data).toString('base64'); + } + + if (typeof btoa !== 'undefined') { + return btoa(String.fromCharCode.apply(null, data as any)); + } + + throw new OpenAIError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined'); +}; + +export const fromBase64 = (str: string): Uint8Array => { + if (typeof Buffer !== 'undefined') { + return new Uint8Array(Buffer.from(str, 'base64')); + } + + if (typeof atob !== 'undefined') { + return new Uint8Array( + atob(str) + .split('') + .map((c) => c.charCodeAt(0)), + ); + } + + throw new OpenAIError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined'); +}; diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts new file mode 100644 index 000000000..d9b1dc4a8 --- /dev/null +++ b/src/internal/utils/env.ts @@ -0,0 +1,20 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +declare const Deno: any; + +/** + * Read an environment variable. + * + * Trims beginning and trailing whitespace. + * + * Will return undefined if the environment variable doesn't exist or cannot be accessed. + */ +export const readEnv = (env: string): string | undefined => { + if (typeof process !== 'undefined') { + return process.env?.[env]?.trim() ?? undefined; + } + if (typeof Deno !== 'undefined') { + return Deno.env?.get?.(env)?.trim(); + } + return undefined; +}; diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts new file mode 100644 index 000000000..39b826eb1 --- /dev/null +++ b/src/internal/utils/log.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { readEnv } from './env'; + +export function debug(action: string, ...args: any[]) { + if (readEnv('DEBUG') === 'true') { + console.log(`OpenAI:DEBUG:${action}`, ...args); + } +} diff --git a/src/internal/utils/sleep.ts b/src/internal/utils/sleep.ts new file mode 100644 index 000000000..fcf4e0833 --- /dev/null +++ b/src/internal/utils/sleep.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts new file mode 100644 index 000000000..6c43f81dd --- /dev/null +++ b/src/internal/utils/uuid.ts @@ -0,0 +1,13 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { crypto } from '../polyfill/crypto.node'; + +/** + * https://stackoverflow.com/a/2117523 + */ +export function uuid4() { + if (crypto.randomUUID) return crypto.randomUUID(); + return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => + (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0]! & (15 >> (+c / 4)))).toString(16), + ); +} diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts new file mode 100644 index 000000000..25decb1f8 --- /dev/null +++ b/src/internal/utils/values.ts @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { OpenAIError } from '../../error'; + +// https://url.spec.whatwg.org/#url-scheme-string +const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; + +export const isAbsoluteURL = (url: string): boolean => { + return startsWithSchemeRegexp.test(url); +}; + +/** Returns an object if the given value isn't an object, otherwise returns as-is */ +export function maybeObj(x: unknown): object { + if (typeof x !== 'object') { + return {}; + } + + return x ?? {}; +} + +// https://stackoverflow.com/a/34491287 +export function isEmptyObj(obj: Object | null | undefined): boolean { + if (!obj) return true; + for (const _k in obj) return false; + return true; +} + +// https://eslint.org/docs/latest/rules/no-prototype-builtins +export function hasOwn(obj: Object, key: string): boolean { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +export function isObj(obj: unknown): obj is Record { + return obj != null && typeof obj === 'object' && !Array.isArray(obj); +} + +export const ensurePresent = (value: T | null | undefined): T => { + if (value == null) { + throw new OpenAIError(`Expected a value to be given but received ${value} instead.`); + } + + return value; +}; + +export const validatePositiveInteger = (name: string, n: unknown): number => { + if (typeof n !== 'number' || !Number.isInteger(n)) { + throw new OpenAIError(`${name} must be an integer`); + } + if (n < 0) { + throw new OpenAIError(`${name} must be a positive integer`); + } + return n; +}; + +export const coerceInteger = (value: unknown): number => { + if (typeof value === 'number') return Math.round(value); + if (typeof value === 'string') return parseInt(value, 10); + + throw new OpenAIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); +}; + +export const coerceFloat = (value: unknown): number => { + if (typeof value === 'number') return value; + if (typeof value === 'string') return parseFloat(value); + + throw new OpenAIError(`Could not coerce ${value} (type: ${typeof value}) into a number`); +}; + +export const coerceBoolean = (value: unknown): boolean => { + if (typeof value === 'boolean') return value; + if (typeof value === 'string') return value === 'true'; + return Boolean(value); +}; + +export const maybeCoerceInteger = (value: unknown): number | undefined => { + if (value === undefined) { + return undefined; + } + return coerceInteger(value); +}; + +export const maybeCoerceFloat = (value: unknown): number | undefined => { + if (value === undefined) { + return undefined; + } + return coerceFloat(value); +}; + +export const maybeCoerceBoolean = (value: unknown): boolean | undefined => { + if (value === undefined) { + return undefined; + } + return coerceBoolean(value); +}; diff --git a/src/pagination.ts b/src/pagination.ts index 63644e333..068c82490 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -1,6 +1,110 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core'; +import type { OpenAI } from './client'; +import { OpenAIError } from './error'; +import { FinalRequestOptions } from './internal/request-options'; +import { defaultParseResponse } from './internal/parse'; +import { APIPromise } from './api-promise'; +import { type APIResponseProps } from './internal/parse'; +import { maybeObj } from './internal/utils/values'; + +export type PageRequestOptions = Pick; + +export abstract class AbstractPage implements AsyncIterable { + #client: OpenAI; + protected options: FinalRequestOptions; + + protected response: Response; + protected body: unknown; + + constructor(client: OpenAI, response: Response, body: unknown, options: FinalRequestOptions) { + this.#client = client; + this.options = options; + this.response = response; + this.body = body; + } + + abstract nextPageRequestOptions(): PageRequestOptions | null; + + abstract getPaginatedItems(): Item[]; + + hasNextPage(): boolean { + const items = this.getPaginatedItems(); + if (!items.length) return false; + return this.nextPageRequestOptions() != null; + } + + async getNextPage(): Promise { + const nextOptions = this.nextPageRequestOptions(); + if (!nextOptions) { + throw new OpenAIError( + 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.', + ); + } + + return await this.#client.requestAPIList(this.constructor as any, nextOptions); + } + + async *iterPages(): AsyncGenerator { + // eslint-disable-next-line @typescript-eslint/no-this-alias + let page: this = this; + yield page; + while (page.hasNextPage()) { + page = await page.getNextPage(); + yield page; + } + } + + async *[Symbol.asyncIterator](): AsyncGenerator { + for await (const page of this.iterPages()) { + for (const item of page.getPaginatedItems()) { + yield item; + } + } + } +} + +/** + * This subclass of Promise will resolve to an instantiated Page once the request completes. + * + * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: + * + * for await (const item of client.items.list()) { + * console.log(item) + * } + */ +export class PagePromise< + PageClass extends AbstractPage, + Item = ReturnType[number], + > + extends APIPromise + implements AsyncIterable +{ + constructor( + client: OpenAI, + request: Promise, + Page: new (...args: ConstructorParameters) => PageClass, + ) { + super( + request, + async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options), + ); + } + + /** + * Allow auto-paginating iteration on an unawaited list call, eg: + * + * for await (const item of client.items.list()) { + * console.log(item) + * } + */ + async *[Symbol.asyncIterator]() { + const page = await this; + for await (const item of page) { + yield item; + } + } +} export interface PageResponse { data: Array; @@ -16,7 +120,7 @@ export class Page extends AbstractPage implements PageResponse object: string; - constructor(client: APIClient, response: Response, body: PageResponse, options: FinalRequestOptions) { + constructor(client: OpenAI, response: Response, body: PageResponse, options: FinalRequestOptions) { super(client, response, body, options); this.data = body.data || []; @@ -27,16 +131,7 @@ export class Page extends AbstractPage implements PageResponse return this.data ?? []; } - // @deprecated Please use `nextPageInfo()` instead - /** - * This page represents a response that isn't actually paginated at the API level - * so there will never be any next page params. - */ - nextPageParams(): null { - return null; - } - - nextPageInfo(): null { + nextPageRequestOptions(): PageRequestOptions | null { return null; } } @@ -58,7 +153,7 @@ export class CursorPage data: Array; constructor( - client: APIClient, + client: OpenAI, response: Response, body: CursorPageResponse, options: FinalRequestOptions, @@ -72,27 +167,19 @@ export class CursorPage return this.data ?? []; } - // @deprecated Please use `nextPageInfo()` instead - nextPageParams(): Partial | null { - const info = this.nextPageInfo(); - if (!info) return null; - if ('params' in info) return info.params; - const params = Object.fromEntries(info.url.searchParams); - if (!Object.keys(params).length) return null; - return params; - } - - nextPageInfo(): PageInfo | null { + nextPageRequestOptions(): PageRequestOptions | null { const data = this.getPaginatedItems(); - if (!data.length) { - return null; - } - const id = data[data.length - 1]?.id; if (!id) { return null; } - return { params: { after: id } }; + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + after: id, + }, + }; } } diff --git a/src/resource.ts b/src/resource.ts index 87847c879..ea299e176 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import type { OpenAI } from './index'; +import type { OpenAI } from './client'; export class APIResource { protected _client: OpenAI; diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 1cda80f79..c65cea1c8 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import { type Response } from '../../_shims/index'; +import { APIPromise } from '../../api-promise'; +import { RequestOptions } from '../../internal/request-options'; export class Speech extends APIResource { /** * Generates audio from the input text. */ - create(body: SpeechCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: SpeechCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/audio/speech', { body, ...options, __binaryResponse: true }); } } diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 0b6da4620..648ee7655 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -1,8 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; import * as AudioAPI from './audio'; +import { APIPromise } from '../../api-promise'; +import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { RequestOptions } from '../../internal/request-options'; export class Transcriptions extends APIResource { /** @@ -10,22 +12,22 @@ export class Transcriptions extends APIResource { */ create( body: TranscriptionCreateParams<'json' | undefined>, - options?: Core.RequestOptions, - ): Core.APIPromise; + options?: RequestOptions, + ): APIPromise; create( body: TranscriptionCreateParams<'verbose_json'>, - options?: Core.RequestOptions, - ): Core.APIPromise; + options?: RequestOptions, + ): APIPromise; create( body: TranscriptionCreateParams<'srt' | 'vtt' | 'text'>, - options?: Core.RequestOptions, - ): Core.APIPromise; - create(body: TranscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise; + options?: RequestOptions, + ): APIPromise; + create(body: TranscriptionCreateParams, options?: RequestOptions): APIPromise; create( body: TranscriptionCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/audio/transcriptions', Core.multipartFormRequestOptions({ body, ...options })); + options?: RequestOptions, + ): APIPromise { + return this._client.post('/audio/transcriptions', multipartFormRequestOptions({ body, ...options })); } } @@ -156,7 +158,7 @@ export interface TranscriptionCreateParams< * The audio file object (not file name) to transcribe, in one of these formats: * flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ - file: Core.Uploadable; + file: Uploadable; /** * ID of the model to use. Only `whisper-1` (which is powered by our open source diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index c6bf7c870..71c192ce6 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -1,9 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; import * as AudioAPI from './audio'; import * as TranscriptionsAPI from './transcriptions'; +import { APIPromise } from '../../api-promise'; +import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { RequestOptions } from '../../internal/request-options'; export class Translations extends APIResource { /** @@ -11,22 +13,19 @@ export class Translations extends APIResource { */ create( body: TranslationCreateParams<'json' | undefined>, - options?: Core.RequestOptions, - ): Core.APIPromise; + options?: RequestOptions, + ): APIPromise; create( body: TranslationCreateParams<'verbose_json'>, - options?: Core.RequestOptions, - ): Core.APIPromise; - create( - body: TranslationCreateParams<'text' | 'srt' | 'vtt'>, - options?: Core.RequestOptions, - ): Core.APIPromise; - create(body: TranslationCreateParams, options?: Core.RequestOptions): Core.APIPromise; + options?: RequestOptions, + ): APIPromise; + create(body: TranslationCreateParams<'text' | 'srt' | 'vtt'>, options?: RequestOptions): APIPromise; + create(body: TranslationCreateParams, options?: RequestOptions): APIPromise; create( body: TranslationCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/audio/translations', Core.multipartFormRequestOptions({ body, ...options })); + options?: RequestOptions, + ): APIPromise { + return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options })); } } @@ -65,7 +64,7 @@ export interface TranslationCreateParams< * The audio file object (not file name) translate, in one of these formats: flac, * mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ - file: Core.Uploadable; + file: Uploadable; /** * ID of the model to use. Only `whisper-1` (which is powered by our open source diff --git a/src/resources/batches.ts b/src/resources/batches.ts index ec5ca6331..b69189d0a 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -1,39 +1,34 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import { isRequestOptions } from '../core'; -import * as Core from '../core'; import * as BatchesAPI from './batches'; -import { CursorPage, type CursorPageParams } from '../pagination'; +import { APIPromise } from '../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; +import { RequestOptions } from '../internal/request-options'; export class Batches extends APIResource { /** * Creates and executes a batch from an uploaded file of requests */ - create(body: BatchCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: BatchCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/batches', { body, ...options }); } /** * Retrieves a batch. */ - retrieve(batchId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/batches/${batchId}`, options); + retrieve(batchID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/batches/${batchID}`, options); } /** * List your organization's batches. */ - list(query?: BatchListParams, options?: Core.RequestOptions): Core.PagePromise; - list(options?: Core.RequestOptions): Core.PagePromise; list( - query: BatchListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.getAPIList('/batches', BatchesPage, { query, ...options }); + query: BatchListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/batches', CursorPage, { query, ...options }); } /** @@ -41,12 +36,12 @@ export class Batches extends APIResource { * 10 minutes, before changing to `cancelled`, where it will have partial results * (if any) available in the output file. */ - cancel(batchId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/batches/${batchId}/cancel`, options); + cancel(batchID: string, options?: RequestOptions): APIPromise { + return this._client.post(`/batches/${batchID}/cancel`, options); } } -export class BatchesPage extends CursorPage {} +export type BatchesPage = CursorPage; export interface Batch { id: string; @@ -244,14 +239,12 @@ export interface BatchCreateParams { export interface BatchListParams extends CursorPageParams {} -Batches.BatchesPage = BatchesPage; - export declare namespace Batches { export { type Batch as Batch, type BatchError as BatchError, type BatchRequestCounts as BatchRequestCounts, - BatchesPage as BatchesPage, + type BatchesPage as BatchesPage, type BatchCreateParams as BatchCreateParams, type BatchListParams as BatchListParams, }; diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0e657b1d4..8ee717fd7 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1,8 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; -import * as Core from '../../core'; import * as Shared from '../shared'; import * as ChatAPI from '../chat/chat'; import * as MessagesAPI from './threads/messages'; @@ -10,13 +8,15 @@ import * as ThreadsAPI from './threads/threads'; import * as VectorStoresAPI from './vector-stores/vector-stores'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; -import { CursorPage, type CursorPageParams } from '../../pagination'; +import { APIPromise } from '../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { RequestOptions } from '../../internal/request-options'; export class Assistants extends APIResource { /** * Create an assistant with a model and instructions. */ - create(body: AssistantCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: AssistantCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/assistants', { body, ...options, @@ -27,8 +27,8 @@ export class Assistants extends APIResource { /** * Retrieves an assistant. */ - retrieve(assistantId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/assistants/${assistantId}`, { + retrieve(assistantID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/assistants/${assistantID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -37,12 +37,8 @@ export class Assistants extends APIResource { /** * Modifies an assistant. */ - update( - assistantId: string, - body: AssistantUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/assistants/${assistantId}`, { + update(assistantID: string, body: AssistantUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post(`/assistants/${assistantID}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -53,18 +49,10 @@ export class Assistants extends APIResource { * Returns a list of assistants. */ list( - query?: AssistantListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list(options?: Core.RequestOptions): Core.PagePromise; - list( - query: AssistantListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.getAPIList('/assistants', AssistantsPage, { + query: AssistantListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/assistants', CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -74,15 +62,15 @@ export class Assistants extends APIResource { /** * Delete an assistant. */ - del(assistantId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/assistants/${assistantId}`, { + delete(assistantID: string, options?: RequestOptions): APIPromise { + return this._client.delete(`/assistants/${assistantID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); } } -export class AssistantsPage extends CursorPage {} +export type AssistantsPage = CursorPage; /** * Represents an `assistant` that can call the model and use tools. @@ -1395,8 +1383,6 @@ export interface AssistantListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -Assistants.AssistantsPage = AssistantsPage; - export declare namespace Assistants { export { type Assistant as Assistant, @@ -1410,7 +1396,7 @@ export declare namespace Assistants { type RunStepStreamEvent as RunStepStreamEvent, type RunStreamEvent as RunStreamEvent, type ThreadStreamEvent as ThreadStreamEvent, - AssistantsPage as AssistantsPage, + type AssistantsPage as AssistantsPage, type AssistantCreateParams as AssistantCreateParams, type AssistantUpdateParams as AssistantUpdateParams, type AssistantListParams as AssistantListParams, diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index b904abe4a..1d1f8e255 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -65,9 +65,7 @@ export class Beta extends APIResource { } Beta.VectorStores = VectorStores; -Beta.VectorStoresPage = VectorStoresPage; Beta.Assistants = Assistants; -Beta.AssistantsPage = AssistantsPage; Beta.Threads = Threads; export declare namespace Beta { @@ -82,7 +80,7 @@ export declare namespace Beta { type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - VectorStoresPage as VectorStoresPage, + type VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, @@ -103,7 +101,7 @@ export declare namespace Beta { type RunStepStreamEvent as RunStepStreamEvent, type RunStreamEvent as RunStreamEvent, type ThreadStreamEvent as ThreadStreamEvent, - AssistantsPage as AssistantsPage, + type AssistantsPage as AssistantsPage, type AssistantCreateParams as AssistantCreateParams, type AssistantUpdateParams as AssistantUpdateParams, type AssistantListParams as AssistantListParams, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index d7111288f..633df5e82 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AssistantsPage, Assistants, type Assistant, type AssistantDeleted, @@ -17,6 +16,7 @@ export { type AssistantCreateParams, type AssistantUpdateParams, type AssistantListParams, + type AssistantsPage, } from './assistants'; export { Beta } from './beta'; export { Chat } from './chat/index'; @@ -37,7 +37,6 @@ export { type ThreadCreateAndRunStreamParams, } from './threads/index'; export { - VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, @@ -51,4 +50,5 @@ export { type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, + type VectorStoresPage, } from './vector-stores/index'; diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index f67a1edde..7eefa6553 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - MessagesPage, Messages, type Annotation, type AnnotationDelta, @@ -32,11 +31,13 @@ export { type TextDelta, type TextDeltaBlock, type MessageCreateParams, + type MessageRetrieveParams, type MessageUpdateParams, type MessageListParams, + type MessageDeleteParams, + type MessagesPage, } from './messages'; export { - RunsPage, Runs, type RequiredActionFunctionToolCall, type Run, @@ -44,11 +45,14 @@ export { type RunCreateParams, type RunCreateParamsNonStreaming, type RunCreateParamsStreaming, + type RunRetrieveParams, type RunUpdateParams, type RunListParams, + type RunCancelParams, type RunSubmitToolOutputsParams, type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, + type RunsPage, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 8124f56cd..2c613b49d 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -1,21 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; import * as AssistantsAPI from '../assistants'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; export class Messages extends APIResource { /** * Create a message. */ - create( - threadId: string, - body: MessageCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/threads/${threadId}/messages`, { + create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise { + return this._client.post(`/threads/${threadID}/messages`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -25,8 +21,9 @@ export class Messages extends APIResource { /** * Retrieve a message. */ - retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/threads/${threadId}/messages/${messageId}`, { + retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise { + const { thread_id } = params; + return this._client.get(`/threads/${thread_id}/messages/${messageID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -35,13 +32,9 @@ export class Messages extends APIResource { /** * Modifies a message. */ - update( - threadId: string, - messageId: string, - body: MessageUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/threads/${threadId}/messages/${messageId}`, { + update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise { + const { thread_id, ...body } = params; + return this._client.post(`/threads/${thread_id}/messages/${messageID}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -52,20 +45,11 @@ export class Messages extends APIResource { * Returns a list of messages for a given thread. */ list( - threadId: string, - query?: MessageListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list(threadId: string, options?: Core.RequestOptions): Core.PagePromise; - list( - threadId: string, - query: MessageListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(threadId, {}, query); - } - return this._client.getAPIList(`/threads/${threadId}/messages`, MessagesPage, { + threadID: string, + query: MessageListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(`/threads/${threadID}/messages`, CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -75,15 +59,20 @@ export class Messages extends APIResource { /** * Deletes a message. */ - del(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/threads/${threadId}/messages/${messageId}`, { + delete( + messageID: string, + params: MessageDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { thread_id } = params; + return this._client.delete(`/threads/${thread_id}/messages/${messageID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); } } -export class MessagesPage extends CursorPage {} +export type MessagesPage = CursorPage; /** * A citation within the message that points to a specific quote from a specific @@ -690,12 +679,25 @@ export namespace MessageCreateParams { } } +export interface MessageRetrieveParams { + /** + * The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) + * to which this message belongs. + */ + thread_id: string; +} + 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. + * Path param: The ID of the thread to which this message belongs. + */ + thread_id: string; + + /** + * 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 maximum of 512 characters long. */ metadata?: unknown | null; } @@ -721,7 +723,12 @@ export interface MessageListParams extends CursorPageParams { run_id?: string; } -Messages.MessagesPage = MessagesPage; +export interface MessageDeleteParams { + /** + * The ID of the thread to which this message belongs. + */ + thread_id: string; +} export declare namespace Messages { export { @@ -753,9 +760,11 @@ export declare namespace Messages { type TextContentBlockParam as TextContentBlockParam, type TextDelta as TextDelta, type TextDeltaBlock as TextDeltaBlock, - MessagesPage as MessagesPage, + type MessagesPage as MessagesPage, type MessageCreateParams as MessageCreateParams, + type MessageRetrieveParams as MessageRetrieveParams, type MessageUpdateParams as MessageUpdateParams, type MessageListParams as MessageListParams, + type MessageDeleteParams as MessageDeleteParams, }; } diff --git a/src/resources/beta/threads/runs/index.ts b/src/resources/beta/threads/runs/index.ts index 9dbe575bc..5cee3e75b 100644 --- a/src/resources/beta/threads/runs/index.ts +++ b/src/resources/beta/threads/runs/index.ts @@ -1,7 +1,32 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - RunStepsPage, + Runs, + type RequiredActionFunctionToolCall, + type Run, + type RunStatus, + type RunCreateParams, + type RunCreateParamsNonStreaming, + type RunCreateParamsStreaming, + type RunRetrieveParams, + type RunUpdateParams, + type RunListParams, + type RunCancelParams, + type RunSubmitToolOutputsParams, + type RunSubmitToolOutputsParamsNonStreaming, + type RunSubmitToolOutputsParamsStreaming, + type RunsPage, + type RunStepInclude, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, + type RunSubmitToolOutputsAndPollParams, + type RunSubmitToolOutputsStreamParams, + type RunCreateAndPollParams, + type RunCreateAndStreamParams, + type RunStreamParams, +} from './runs'; +export { Steps, type CodeInterpreterLogs, type CodeInterpreterOutputImage, @@ -16,31 +41,11 @@ export { type RunStepDelta, type RunStepDeltaEvent, type RunStepDeltaMessageDelta, - type RunStepInclude, type ToolCall, type ToolCallDelta, type ToolCallDeltaObject, type ToolCallsStepDetails, type StepRetrieveParams, type StepListParams, -} from './steps'; -export { - RunsPage, - Runs, - type RequiredActionFunctionToolCall, - type Run, - type RunStatus, - type RunCreateParams, - type RunCreateParamsNonStreaming, - type RunCreateParamsStreaming, - type RunUpdateParams, - type RunListParams, - type RunCreateAndPollParams, - type RunCreateAndStreamParams, - type RunStreamParams, - type RunSubmitToolOutputsParams, - type RunSubmitToolOutputsParamsNonStreaming, - type RunSubmitToolOutputsParamsStreaming, - type RunSubmitToolOutputsAndPollParams, - type RunSubmitToolOutputsStreamParams, -} from './runs'; + type RunStepsPage, +} from './steps'; \ No newline at end of file diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 814ad3e89..bbcc5b6c1 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -1,12 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; -import { APIPromise } from '../../../../core'; -import * as Core from '../../../../core'; -import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; -import { sleep } from '../../../../core'; -import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; import * as RunsAPI from './runs'; import * as AssistantsAPI from '../../assistants'; import * as ChatAPI from '../../../chat/chat'; @@ -37,8 +31,13 @@ import { ToolCallDeltaObject, ToolCallsStepDetails, } from './steps'; -import { CursorPage, type CursorPageParams } from '../../../../pagination'; +import { APIPromise } from '../../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; import { Stream } from '../../../../streaming'; +import { RequestOptions } from '../../../../internal/request-options'; +import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; +import { sleep } from '../../../../core'; +import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); @@ -46,28 +45,24 @@ export class Runs extends APIResource { /** * Create a run. */ + create(threadID: string, params: RunCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( - threadId: string, - params: RunCreateParamsNonStreaming, - options?: Core.RequestOptions, - ): APIPromise; - create( - threadId: string, + threadID: string, params: RunCreateParamsStreaming, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise>; create( - threadId: string, + threadID: string, params: RunCreateParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | Run>; create( - threadId: string, + threadID: string, params: RunCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | APIPromise> { const { include, ...body } = params; - return this._client.post(`/threads/${threadId}/runs`, { + return this._client.post(`/threads/${threadID}/runs`, { query: { include }, body, ...options, @@ -79,8 +74,9 @@ export class Runs extends APIResource { /** * Retrieves a run. */ - retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/threads/${threadId}/runs/${runId}`, { + retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise { + const { thread_id } = params; + return this._client.get(`/threads/${thread_id}/runs/${runID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -89,13 +85,9 @@ export class Runs extends APIResource { /** * Modifies a run. */ - update( - threadId: string, - runId: string, - body: RunUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/threads/${threadId}/runs/${runId}`, { + update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise { + const { thread_id, ...body } = params; + return this._client.post(`/threads/${thread_id}/runs/${runID}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -106,20 +98,11 @@ export class Runs extends APIResource { * Returns a list of runs belonging to a thread. */ list( - threadId: string, - query?: RunListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list(threadId: string, options?: Core.RequestOptions): Core.PagePromise; - list( - threadId: string, - query: RunListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(threadId, {}, query); - } - return this._client.getAPIList(`/threads/${threadId}/runs`, RunsPage, { + threadID: string, + query: RunListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(`/threads/${threadID}/runs`, CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -129,8 +112,9 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. */ - cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, { + cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise { + const { thread_id } = params; + return this._client.post(`/threads/${thread_id}/runs/${runID}/cancel`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -231,34 +215,31 @@ export class Runs extends APIResource { * request. */ submitToolOutputs( - threadId: string, - runId: string, - body: RunSubmitToolOutputsParamsNonStreaming, - options?: Core.RequestOptions, + runID: string, + params: RunSubmitToolOutputsParamsNonStreaming, + options?: RequestOptions, ): APIPromise; submitToolOutputs( - threadId: string, - runId: string, - body: RunSubmitToolOutputsParamsStreaming, - options?: Core.RequestOptions, + runID: string, + params: RunSubmitToolOutputsParamsStreaming, + options?: RequestOptions, ): APIPromise>; submitToolOutputs( - threadId: string, - runId: string, - body: RunSubmitToolOutputsParamsBase, - options?: Core.RequestOptions, + runID: string, + params: RunSubmitToolOutputsParamsBase, + options?: RequestOptions, ): APIPromise | Run>; submitToolOutputs( - threadId: string, - runId: string, - body: RunSubmitToolOutputsParams, - options?: Core.RequestOptions, + runID: string, + params: RunSubmitToolOutputsParams, + options?: RequestOptions, ): APIPromise | APIPromise> { - return this._client.post(`/threads/${threadId}/runs/${runId}/submit_tool_outputs`, { + const { thread_id, ...body } = params; + return this._client.post(`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, - stream: body.stream ?? false, + stream: params.stream ?? false, }) as APIPromise | APIPromise>; } @@ -298,7 +279,7 @@ export class Runs extends APIResource { } } -export class RunsPage extends CursorPage {} +export type RunsPage = CursorPage; /** * Tool call objects @@ -895,12 +876,26 @@ export interface RunCreateParamsStreaming extends RunCreateParamsBase { stream: true; } +export interface RunRetrieveParams { + /** + * The ID of the [thread](https://platform.openai.com/docs/api-reference/threads) + * that was run. + */ + thread_id: string; +} + 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. + * Path param: The ID of the + * [thread](https://platform.openai.com/docs/api-reference/threads) that was run. + */ + thread_id: string; + + /** + * 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 maximum of 512 characters long. */ metadata?: unknown | null; } @@ -921,23 +916,37 @@ export interface RunListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -export interface RunCreateAndPollParams { +export interface RunCancelParams { /** - * The ID of the - * [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to - * execute this run. + * The ID of the thread to which this run belongs. */ - assistant_id: string; + thread_id: string; +} + +export type RunSubmitToolOutputsParams = + | RunSubmitToolOutputsParamsNonStreaming + | RunSubmitToolOutputsParamsStreaming; + +// TODO +// RunCreateAndPollParams +export interface RunSubmitToolOutputsParamsBase { /** - * Appends additional instructions at the end of the instructions for the run. This - * is useful for modifying the behavior on a per-run basis without overriding other - * instructions. + * Path param: The ID of the + * [thread](https://platform.openai.com/docs/api-reference/threads) to which this + * run belongs. + */ + thread_id: string; + + /** + * Body param: A list of tools for which the outputs are being submitted. */ additional_instructions?: string | null; /** - * Adds additional messages to the thread before creating the run. + * Body param: If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. */ additional_messages?: Array | null; @@ -1109,8 +1118,9 @@ export namespace RunCreateAndPollParams { } /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. + * Body param: If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. */ export interface TruncationStrategy { /** @@ -1136,7 +1146,6 @@ export interface RunCreateAndStreamParams { * execute this run. */ assistant_id: string; - /** * Appends additional instructions at the end of the instructions for the run. This * is useful for modifying the behavior on a per-run basis without overriding other @@ -1643,19 +1652,18 @@ export namespace RunSubmitToolOutputsStreamParams { } } -Runs.RunsPage = RunsPage; Runs.Steps = Steps; -Runs.RunStepsPage = RunStepsPage; export declare namespace Runs { export { type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, type Run as Run, type RunStatus as RunStatus, - RunsPage as RunsPage, + type RunsPage as RunsPage, type RunCreateParams as RunCreateParams, type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, type RunCreateParamsStreaming as RunCreateParamsStreaming, + type RunRetrieveParams as RunRetrieveParams, type RunUpdateParams as RunUpdateParams, type RunListParams as RunListParams, type RunCreateAndPollParams, @@ -1688,7 +1696,7 @@ export declare namespace Runs { type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, - RunStepsPage as RunStepsPage, + type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, }; diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 6c6722b62..444488b41 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -1,39 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; -import * as Core from '../../../../core'; import * as StepsAPI from './steps'; -import { CursorPage, type CursorPageParams } from '../../../../pagination'; +import { APIPromise } from '../../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; +import { RequestOptions } from '../../../../internal/request-options'; export class Steps extends APIResource { /** * Retrieves a run step. */ - retrieve( - threadId: string, - runId: string, - stepId: string, - query?: StepRetrieveParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - retrieve( - threadId: string, - runId: string, - stepId: string, - options?: Core.RequestOptions, - ): Core.APIPromise; - retrieve( - threadId: string, - runId: string, - stepId: string, - query: StepRetrieveParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.retrieve(threadId, runId, stepId, {}, query); - } - return this._client.get(`/threads/${threadId}/runs/${runId}/steps/${stepId}`, { + retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise { + const { thread_id, run_id, ...query } = params; + return this._client.get(`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -43,27 +22,9 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. */ - list( - threadId: string, - runId: string, - query?: StepListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - threadId: string, - runId: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - threadId: string, - runId: string, - query: StepListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(threadId, runId, {}, query); - } - return this._client.getAPIList(`/threads/${threadId}/runs/${runId}/steps`, RunStepsPage, { + list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise { + const { thread_id, ...query } = params; + return this._client.getAPIList(`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -71,7 +32,7 @@ export class Steps extends APIResource { } } -export class RunStepsPage extends CursorPage {} +export type RunStepsPage = CursorPage; /** * Text output from the Code Interpreter tool call as part of a run step. @@ -700,9 +661,20 @@ export interface ToolCallsStepDetails { export interface StepRetrieveParams { /** - * A list of additional fields to include in the response. Currently the only - * supported value is `step_details.tool_calls[*].file_search.results[*].content` - * to fetch the file search result content. + * Path param: The ID of the thread to which the run and run step belongs. + */ + thread_id: string; + + /** + * Path param: The ID of the run to which the run step belongs. + */ + run_id: string; + + /** + * Query param: A list of additional fields to include in the response. Currently + * the only supported value is + * `step_details.tool_calls[*].file_search.results[*].content` to fetch the file + * search result content. * * See the * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) @@ -713,17 +685,23 @@ export interface StepRetrieveParams { export interface StepListParams extends CursorPageParams { /** - * A cursor for use in pagination. `before` is an object ID that defines your place - * in the list. For instance, if you make a list request and receive 100 objects, - * starting with obj_foo, your subsequent call can include before=obj_foo in order - * to fetch the previous page of the list. + * Path param: The ID of the thread the run and run steps belong to. + */ + thread_id: string; + + /** + * Query param: A cursor for use in pagination. `before` is an object ID that + * defines your place in the list. For instance, if you make a list request and + * receive 100 objects, starting with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list. */ before?: string; /** - * A list of additional fields to include in the response. Currently the only - * supported value is `step_details.tool_calls[*].file_search.results[*].content` - * to fetch the file search result content. + * Query param: A list of additional fields to include in the response. Currently + * the only supported value is + * `step_details.tool_calls[*].file_search.results[*].content` to fetch the file + * search result content. * * See the * [file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search#customizing-file-search-settings) @@ -732,14 +710,12 @@ export interface StepListParams extends CursorPageParams { include?: Array; /** - * Sort order by the `created_at` timestamp of the objects. `asc` for ascending - * order and `desc` for descending order. + * Query param: Sort order by the `created_at` timestamp of the objects. `asc` for + * ascending order and `desc` for descending order. */ order?: 'asc' | 'desc'; } -Steps.RunStepsPage = RunStepsPage; - export declare namespace Steps { export { type CodeInterpreterLogs as CodeInterpreterLogs, @@ -760,7 +736,7 @@ export declare namespace Steps { type ToolCallDelta as ToolCallDelta, type ToolCallDeltaObject as ToolCallDeltaObject, type ToolCallsStepDetails as ToolCallsStepDetails, - RunStepsPage as RunStepsPage, + type RunStepsPage as RunStepsPage, type StepRetrieveParams as StepRetrieveParams, type StepListParams as StepListParams, }; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 453d8fa10..a4ee863a0 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -1,10 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; -import { APIPromise } from '../../../core'; -import * as Core from '../../../core'; import * as ThreadsAPI from './threads'; import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; @@ -30,10 +26,12 @@ import { MessageContentDelta, MessageContentPartParam, MessageCreateParams, + MessageDeleteParams, MessageDeleted, MessageDelta, MessageDeltaEvent, MessageListParams, + MessageRetrieveParams, MessageUpdateParams, Messages, MessagesPage, @@ -52,10 +50,12 @@ import { Run, RunCreateAndPollParams, RunCreateAndStreamParams, + RunCancelParams, RunCreateParams, RunCreateParamsNonStreaming, RunCreateParamsStreaming, RunListParams, + RunRetrieveParams, RunStatus, RunStreamParams, RunSubmitToolOutputsAndPollParams, @@ -67,7 +67,12 @@ import { Runs, RunsPage, } from './runs/runs'; +import { APIPromise } from '../../../api-promise'; import { Stream } from '../../../streaming'; +import { RequestOptions } from '../../../internal/request-options'; +import { isRequestOptions } from '../../../core'; +import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; +import { APIPromise } from '../../../core'; export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); @@ -76,15 +81,7 @@ export class Threads extends APIResource { /** * Create a thread. */ - create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise; - create(options?: Core.RequestOptions): Core.APIPromise; - create( - body: ThreadCreateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.create({}, body); - } + create(body: ThreadCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.post('/threads', { body, ...options, @@ -95,8 +92,8 @@ export class Threads extends APIResource { /** * Retrieves a thread. */ - retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/threads/${threadId}`, { + retrieve(threadID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/threads/${threadID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -105,8 +102,8 @@ export class Threads extends APIResource { /** * Modifies a thread. */ - update(threadId: string, body: ThreadUpdateParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/threads/${threadId}`, { + update(threadID: string, body: ThreadUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post(`/threads/${threadID}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -116,8 +113,8 @@ export class Threads extends APIResource { /** * Delete a thread. */ - del(threadId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/threads/${threadId}`, { + delete(threadID: string, options?: RequestOptions): APIPromise { + return this._client.delete(`/threads/${threadID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -126,21 +123,18 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. */ - createAndRun( - body: ThreadCreateAndRunParamsNonStreaming, - options?: Core.RequestOptions, - ): APIPromise; + createAndRun(body: ThreadCreateAndRunParamsNonStreaming, options?: RequestOptions): APIPromise; createAndRun( body: ThreadCreateAndRunParamsStreaming, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise>; createAndRun( body: ThreadCreateAndRunParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | RunsAPI.Run>; createAndRun( body: ThreadCreateAndRunParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | APIPromise> { return this._client.post('/threads/runs', { body, @@ -1545,9 +1539,7 @@ export namespace ThreadCreateAndRunStreamParams { } Threads.Runs = Runs; -Threads.RunsPage = RunsPage; Threads.Messages = Messages; -Threads.MessagesPage = MessagesPage; export declare namespace Threads { export { @@ -1571,12 +1563,14 @@ export declare namespace Threads { type RequiredActionFunctionToolCall as RequiredActionFunctionToolCall, type Run as Run, type RunStatus as RunStatus, - RunsPage as RunsPage, + type RunsPage as RunsPage, type RunCreateParams as RunCreateParams, type RunCreateParamsNonStreaming as RunCreateParamsNonStreaming, type RunCreateParamsStreaming as RunCreateParamsStreaming, + type RunRetrieveParams as RunRetrieveParams, type RunUpdateParams as RunUpdateParams, type RunListParams as RunListParams, + type RunCancelParams as RunCancelParams, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, @@ -1617,9 +1611,11 @@ export declare namespace Threads { type TextContentBlockParam as TextContentBlockParam, type TextDelta as TextDelta, type TextDeltaBlock as TextDeltaBlock, - MessagesPage as MessagesPage, + type MessagesPage as MessagesPage, type MessageCreateParams as MessageCreateParams, + type MessageRetrieveParams as MessageRetrieveParams, type MessageUpdateParams as MessageUpdateParams, type MessageListParams as MessageListParams, + type MessageDeleteParams as MessageDeleteParams, }; } diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index 2c47cb9c2..f6c933053 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -1,26 +1,26 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import { sleep } from '../../../core'; -import { Uploadable } from '../../../core'; -import { allSettledWithThrow } from '../../../lib/Util'; -import * as Core from '../../../core'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; -import { type CursorPageParams } from '../../../pagination'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { sleep } from '../../../core'; +import { Uploadable } from '../../../core'; +import { allSettledWithThrow } from '../../../lib/Util'; export class FileBatches extends APIResource { /** * Create a vector store file batch. */ create( - vectorStoreId: string, + vectorStoreID: string, body: FileBatchCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/vector_stores/${vectorStoreId}/file_batches`, { + options?: RequestOptions, + ): APIPromise { + return this._client.post(`/vector_stores/${vectorStoreID}/file_batches`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -31,11 +31,12 @@ export class FileBatches extends APIResource { * Retrieves a vector store file batch. */ retrieve( - vectorStoreId: string, - batchId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.get(`/vector_stores/${vectorStoreId}/file_batches/${batchId}`, { + batchID: string, + params: FileBatchRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { vector_store_id } = params; + return this._client.get(`/vector_stores/${vector_store_id}/file_batches/${batchID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -46,11 +47,12 @@ export class FileBatches extends APIResource { * files in this batch as soon as possible. */ cancel( - vectorStoreId: string, - batchId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/vector_stores/${vectorStoreId}/file_batches/${batchId}/cancel`, { + batchID: string, + params: FileBatchCancelParams, + options?: RequestOptions, + ): APIPromise { + const { vector_store_id } = params; + return this._client.post(`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -72,28 +74,14 @@ export class FileBatches extends APIResource { * Returns a list of vector store files in a batch. */ listFiles( - vectorStoreId: string, - batchId: string, - query?: FileBatchListFilesParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - listFiles( - vectorStoreId: string, - batchId: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - listFiles( - vectorStoreId: string, - batchId: string, - query: FileBatchListFilesParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.listFiles(vectorStoreId, batchId, {}, query); - } + batchID: string, + params: FileBatchListFilesParams, + options?: RequestOptions, + ): PagePromise { + const { vector_store_id, ...query } = params; return this._client.getAPIList( - `/vector_stores/${vectorStoreId}/file_batches/${batchId}/files`, - VectorStoreFilesPage, + `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, + CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } }, ); } @@ -272,23 +260,43 @@ export interface FileBatchCreateParams { chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; } +export interface FileBatchRetrieveParams { + /** + * The ID of the vector store that the file batch belongs to. + */ + vector_store_id: string; +} + +export interface FileBatchCancelParams { + /** + * The ID of the vector store that the file batch belongs to. + */ + vector_store_id: string; +} + export interface FileBatchListFilesParams extends CursorPageParams { /** - * A cursor for use in pagination. `before` is an object ID that defines your place - * in the list. For instance, if you make a list request and receive 100 objects, - * starting with obj_foo, your subsequent call can include before=obj_foo in order - * to fetch the previous page of the list. + * Path param: The ID of the vector store that the files belong to. + */ + vector_store_id: string; + + /** + * Query param: A cursor for use in pagination. `before` is an object ID that + * defines your place in the list. For instance, if you make a list request and + * receive 100 objects, starting with obj_foo, your subsequent call can include + * before=obj_foo in order to fetch the previous page of the list. */ before?: string; /** - * Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. + * Query param: Filter by file status. One of `in_progress`, `completed`, `failed`, + * `cancelled`. */ filter?: 'in_progress' | 'completed' | 'failed' | 'cancelled'; /** - * Sort order by the `created_at` timestamp of the objects. `asc` for ascending - * order and `desc` for descending order. + * Query param: Sort order by the `created_at` timestamp of the objects. `asc` for + * ascending order and `desc` for descending order. */ order?: 'asc' | 'desc'; } @@ -297,8 +305,10 @@ export declare namespace FileBatches { export { type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, + type FileBatchRetrieveParams as FileBatchRetrieveParams, + type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, }; } -export { VectorStoreFilesPage }; +export { type VectorStoreFilesPage }; diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index 1fda9a99b..de20e6f45 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { sleep, Uploadable, isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; import * as VectorStoresAPI from './vector-stores'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; export class Files extends APIResource { /** @@ -13,11 +13,11 @@ export class Files extends APIResource { * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object). */ create( - vectorStoreId: string, + vectorStoreID: string, body: FileCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/vector_stores/${vectorStoreId}/files`, { + options?: RequestOptions, + ): APIPromise { + return this._client.post(`/vector_stores/${vectorStoreID}/files`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -28,11 +28,12 @@ export class Files extends APIResource { * Retrieves a vector store file. */ retrieve( - vectorStoreId: string, - fileId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.get(`/vector_stores/${vectorStoreId}/files/${fileId}`, { + fileID: string, + params: FileRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { vector_store_id } = params; + return this._client.get(`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -42,23 +43,11 @@ export class Files extends APIResource { * Returns a list of vector store files. */ list( - vectorStoreId: string, - query?: FileListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - vectorStoreId: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - vectorStoreId: string, - query: FileListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(vectorStoreId, {}, query); - } - return this._client.getAPIList(`/vector_stores/${vectorStoreId}/files`, VectorStoreFilesPage, { + vectorStoreID: string, + query: FileListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(`/vector_stores/${vectorStoreID}/files`, CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -71,12 +60,13 @@ export class Files extends APIResource { * [delete file](https://platform.openai.com/docs/api-reference/files/delete) * endpoint. */ - del( - vectorStoreId: string, - fileId: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.delete(`/vector_stores/${vectorStoreId}/files/${fileId}`, { + delete( + fileID: string, + params: FileDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { vector_store_id } = params; + return this._client.delete(`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -169,7 +159,7 @@ export class Files extends APIResource { } } -export class VectorStoreFilesPage extends CursorPage {} +export type VectorStoreFilesPage = CursorPage; /** * A list of files attached to a vector store. @@ -264,6 +254,13 @@ export interface FileCreateParams { chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; } +export interface FileRetrieveParams { + /** + * The ID of the vector store that the file belongs to. + */ + vector_store_id: string; +} + export interface FileListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -285,14 +282,21 @@ export interface FileListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -Files.VectorStoreFilesPage = VectorStoreFilesPage; +export interface FileDeleteParams { + /** + * The ID of the vector store that the file belongs to. + */ + vector_store_id: string; +} export declare namespace Files { export { type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, - VectorStoreFilesPage as VectorStoreFilesPage, + type VectorStoreFilesPage as VectorStoreFilesPage, type FileCreateParams as FileCreateParams, + type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, + type FileDeleteParams as FileDeleteParams, }; } diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/beta/vector-stores/index.ts index 89fc0cde0..d41fce089 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/beta/vector-stores/index.ts @@ -4,18 +4,21 @@ export { FileBatches, type VectorStoreFileBatch, type FileBatchCreateParams, + type FileBatchRetrieveParams, + type FileBatchCancelParams, type FileBatchListFilesParams, } from './file-batches'; export { - VectorStoreFilesPage, Files, type VectorStoreFile, type VectorStoreFileDeleted, type FileCreateParams, + type FileRetrieveParams, type FileListParams, + type FileDeleteParams, + type VectorStoreFilesPage, } from './files'; export { - VectorStoresPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, @@ -29,4 +32,5 @@ export { type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, + type VectorStoresPage, } from './vector-stores'; diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index 35ad8c369..c1a98c87d 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -1,25 +1,29 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; import * as FileBatchesAPI from './file-batches'; import { + FileBatchCancelParams, FileBatchCreateParams, FileBatchListFilesParams, + FileBatchRetrieveParams, FileBatches, VectorStoreFileBatch, } from './file-batches'; import * as FilesAPI from './files'; import { FileCreateParams, + FileDeleteParams, FileListParams, + FileRetrieveParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage, } from './files'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; export class VectorStores extends APIResource { files: FilesAPI.Files = new FilesAPI.Files(this._client); @@ -28,7 +32,7 @@ export class VectorStores extends APIResource { /** * Create a vector store. */ - create(body: VectorStoreCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: VectorStoreCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/vector_stores', { body, ...options, @@ -39,8 +43,8 @@ export class VectorStores extends APIResource { /** * Retrieves a vector store. */ - retrieve(vectorStoreId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/vector_stores/${vectorStoreId}`, { + retrieve(vectorStoreID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/vector_stores/${vectorStoreID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); @@ -50,11 +54,11 @@ export class VectorStores extends APIResource { * Modifies a vector store. */ update( - vectorStoreId: string, + vectorStoreID: string, body: VectorStoreUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/vector_stores/${vectorStoreId}`, { + options?: RequestOptions, + ): APIPromise { + return this._client.post(`/vector_stores/${vectorStoreID}`, { body, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -65,18 +69,10 @@ export class VectorStores extends APIResource { * Returns a list of vector stores. */ list( - query?: VectorStoreListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list(options?: Core.RequestOptions): Core.PagePromise; - list( - query: VectorStoreListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.getAPIList('/vector_stores', VectorStoresPage, { + query: VectorStoreListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/vector_stores', CursorPage, { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, @@ -86,15 +82,15 @@ export class VectorStores extends APIResource { /** * Delete a vector store. */ - del(vectorStoreId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/vector_stores/${vectorStoreId}`, { + delete(vectorStoreID: string, options?: RequestOptions): APIPromise { + return this._client.delete(`/vector_stores/${vectorStoreID}`, { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); } } -export class VectorStoresPage extends CursorPage {} +export type VectorStoresPage = CursorPage; /** * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of @@ -384,9 +380,7 @@ export interface VectorStoreListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -VectorStores.VectorStoresPage = VectorStoresPage; VectorStores.Files = Files; -VectorStores.VectorStoreFilesPage = VectorStoreFilesPage; VectorStores.FileBatches = FileBatches; export declare namespace VectorStores { @@ -400,7 +394,7 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - VectorStoresPage as VectorStoresPage, + type VectorStoresPage as VectorStoresPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, @@ -410,15 +404,19 @@ export declare namespace VectorStores { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, - VectorStoreFilesPage as VectorStoreFilesPage, + type VectorStoreFilesPage as VectorStoreFilesPage, type FileCreateParams as FileCreateParams, + type FileRetrieveParams as FileRetrieveParams, type FileListParams as FileListParams, + type FileDeleteParams as FileDeleteParams, }; export { FileBatches as FileBatches, type VectorStoreFileBatch as VectorStoreFileBatch, type FileBatchCreateParams as FileBatchCreateParams, + type FileBatchRetrieveParams as FileBatchRetrieveParams, + type FileBatchCancelParams as FileBatchCancelParams, type FileBatchListFilesParams as FileBatchListFilesParams, }; } diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 2230b19bd..57d246067 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -38,7 +38,6 @@ import { CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, Completions, - CreateChatCompletionRequestMessage, } from './completions'; export class Chat extends APIResource { @@ -119,7 +118,6 @@ export declare namespace Chat { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, - type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 31f5814cb..ecb69099f 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { APIPromise } from '../../core'; -import * as Core from '../../core'; import * as ChatCompletionsAPI from './completions'; import * as CompletionsAPI from '../completions'; import * as Shared from '../shared'; import * as ChatAPI from './chat'; +import { APIPromise } from '../../api-promise'; import { Stream } from '../../streaming'; +import { RequestOptions } from '../../internal/request-options'; export class Completions extends APIResource { /** @@ -22,21 +22,18 @@ export class Completions extends APIResource { * unsupported parameters in reasoning models, * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning). */ - create( - body: ChatCompletionCreateParamsNonStreaming, - options?: Core.RequestOptions, - ): APIPromise; + create(body: ChatCompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( body: ChatCompletionCreateParamsStreaming, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise>; create( body: ChatCompletionCreateParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | ChatCompletion>; create( body: ChatCompletionCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | APIPromise> { return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false }) as | APIPromise @@ -910,11 +907,6 @@ export interface ChatCompletionUserMessageParam { name?: string; } -/** - * @deprecated ChatCompletionMessageParam should be used instead - */ -export type CreateChatCompletionRequestMessage = ChatCompletionMessageParam; - export type ChatCompletionCreateParams = | ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming; @@ -1303,7 +1295,6 @@ export declare namespace Completions { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, - type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index c3be19402..ea7371d9f 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -31,7 +31,6 @@ export { type ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam, - type CreateChatCompletionRequestMessage, type ChatCompletionCreateParams, type CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming, diff --git a/src/resources/completions.ts b/src/resources/completions.ts index be75a46f0..be9cc6051 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -1,28 +1,25 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import { APIPromise } from '../core'; -import * as Core from '../core'; import * as CompletionsAPI from './completions'; import * as ChatCompletionsAPI from './chat/completions'; +import { APIPromise } from '../api-promise'; import { Stream } from '../streaming'; +import { RequestOptions } from '../internal/request-options'; export class Completions extends APIResource { /** * Creates a completion for the provided prompt and parameters. */ - create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise; - create( - body: CompletionCreateParamsStreaming, - options?: Core.RequestOptions, - ): APIPromise>; + create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; + create(body: CompletionCreateParamsStreaming, options?: RequestOptions): APIPromise>; create( body: CompletionCreateParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | Completion>; create( body: CompletionCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): APIPromise | APIPromise> { return this._client.post('/completions', { body, ...options, stream: body.stream ?? false }) as | APIPromise diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 4b1644a68..65d328725 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -1,16 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import * as Core from '../core'; +import { APIPromise } from '../api-promise'; +import { RequestOptions } from '../internal/request-options'; export class Embeddings extends APIResource { /** * Creates an embedding vector representing the input text. */ - create( - body: EmbeddingCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(body: EmbeddingCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/embeddings', { body, ...options }); } } diff --git a/src/resources/files.ts b/src/resources/files.ts index 42a7bdfba..39ad3f4c9 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import { isRequestOptions } from '../core'; -import { sleep } from '../core'; +import { APIPromise } from '../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; +import { type Uploadable, multipartFormRequestOptions } from '../uploads'; +import { RequestOptions } from '../internal/request-options'; +import { sleep } from '../internal/utils/sleep'; import { APIConnectionTimeoutError } from '../error'; -import * as Core from '../core'; -import { CursorPage, type CursorPageParams } from '../pagination'; -import { type Response } from '../_shims/index'; export class Files extends APIResource { /** @@ -32,44 +32,39 @@ export class Files extends APIResource { * Please [contact us](https://help.openai.com/) if you need to increase these * storage limits. */ - create(body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/files', Core.multipartFormRequestOptions({ body, ...options })); + create(body: FileCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/files', multipartFormRequestOptions({ body, ...options })); } /** * Returns information about a specific file. */ - retrieve(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/files/${fileId}`, options); + retrieve(fileID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/files/${fileID}`, options); } /** * Returns a list of files. */ - list(query?: FileListParams, options?: Core.RequestOptions): Core.PagePromise; - list(options?: Core.RequestOptions): Core.PagePromise; list( - query: FileListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.getAPIList('/files', FileObjectsPage, { query, ...options }); + query: FileListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/files', CursorPage, { query, ...options }); } /** * Delete a file. */ - del(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.delete(`/files/${fileId}`, options); + delete(fileID: string, options?: RequestOptions): APIPromise { + return this._client.delete(`/files/${fileID}`, options); } /** * Returns the contents of the specified file. */ - content(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true }); + content(fileID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/files/${fileID}/content`, { ...options, __binaryResponse: true }); } /** @@ -77,8 +72,8 @@ export class Files extends APIResource { * * @deprecated The `.content()` method should be used instead */ - retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/files/${fileId}/content`, { + retrieveContent(fileID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/files/${fileID}/content`, { ...options, headers: { Accept: 'application/json', ...options?.headers }, }); @@ -111,7 +106,7 @@ export class Files extends APIResource { } } -export class FileObjectsPage extends CursorPage {} +export type FileObjectsPage = CursorPage; export type FileContent = string; @@ -195,7 +190,7 @@ export interface FileCreateParams { /** * The File object (not file name) to be uploaded. */ - file: Core.Uploadable; + file: Uploadable; /** * The intended purpose of the uploaded file. @@ -223,15 +218,13 @@ export interface FileListParams extends CursorPageParams { purpose?: string; } -Files.FileObjectsPage = FileObjectsPage; - export declare namespace Files { export { type FileContent as FileContent, type FileDeleted as FileDeleted, type FileObject as FileObject, type FilePurpose as FilePurpose, - FileObjectsPage as FileObjectsPage, + type FileObjectsPage as FileObjectsPage, type FileCreateParams as FileCreateParams, type FileListParams as FileListParams, }; diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index df013c8ec..9d027b72d 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -21,8 +21,6 @@ export class FineTuning extends APIResource { } FineTuning.Jobs = Jobs; -FineTuning.FineTuningJobsPage = FineTuningJobsPage; -FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage; export declare namespace FineTuning { export { @@ -32,8 +30,8 @@ export declare namespace FineTuning { type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, - FineTuningJobsPage as FineTuningJobsPage, - FineTuningJobEventsPage as FineTuningJobEventsPage, + type FineTuningJobsPage as FineTuningJobsPage, + type FineTuningJobEventsPage as FineTuningJobEventsPage, type JobCreateParams as JobCreateParams, type JobListParams as JobListParams, type JobListEventsParams as JobListEventsParams, diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 4954406b8..898f2fc89 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -2,8 +2,6 @@ export { FineTuning } from './fine-tuning'; export { - FineTuningJobsPage, - FineTuningJobEventsPage, Jobs, type FineTuningJob, type FineTuningJobEvent, @@ -13,4 +11,6 @@ export { type JobCreateParams, type JobListParams, type JobListEventsParams, + type FineTuningJobsPage, + type FineTuningJobEventsPage, } from './jobs/index'; diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index b3018ac5f..2b7ea0e95 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -1,40 +1,27 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; export class Checkpoints extends APIResource { /** * List checkpoints for a fine-tuning job. */ list( - fineTuningJobId: string, - query?: CheckpointListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - fineTuningJobId: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - fineTuningJobId: string, - query: CheckpointListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(fineTuningJobId, {}, query); - } + fineTuningJobID: string, + query: CheckpointListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { return this._client.getAPIList( - `/fine_tuning/jobs/${fineTuningJobId}/checkpoints`, - FineTuningJobCheckpointsPage, + `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, + CursorPage, { query, ...options }, ); } } -export class FineTuningJobCheckpointsPage extends CursorPage {} +export type FineTuningJobCheckpointsPage = CursorPage; /** * The `fine_tuning.job.checkpoint` object represents a model checkpoint for a @@ -100,12 +87,10 @@ export namespace FineTuningJobCheckpoint { export interface CheckpointListParams extends CursorPageParams {} -Checkpoints.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage; - export declare namespace Checkpoints { export { type FineTuningJobCheckpoint as FineTuningJobCheckpoint, - FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, + type FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, type CheckpointListParams as CheckpointListParams, }; } diff --git a/src/resources/fine-tuning/jobs/index.ts b/src/resources/fine-tuning/jobs/index.ts index 7a05b48b2..4e397aea7 100644 --- a/src/resources/fine-tuning/jobs/index.ts +++ b/src/resources/fine-tuning/jobs/index.ts @@ -1,14 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - FineTuningJobCheckpointsPage, Checkpoints, type FineTuningJobCheckpoint, type CheckpointListParams, + type FineTuningJobCheckpointsPage, } from './checkpoints'; export { - FineTuningJobsPage, - FineTuningJobEventsPage, Jobs, type FineTuningJob, type FineTuningJobEvent, @@ -18,4 +16,6 @@ export { type JobCreateParams, type JobListParams, type JobListEventsParams, + type FineTuningJobsPage, + type FineTuningJobEventsPage, } from './jobs'; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 44dd011aa..3c842de34 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -1,8 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; import * as CheckpointsAPI from './checkpoints'; import { CheckpointListParams, @@ -10,7 +8,9 @@ import { FineTuningJobCheckpoint, FineTuningJobCheckpointsPage, } from './checkpoints'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; export class Jobs extends APIResource { checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); @@ -24,7 +24,7 @@ export class Jobs extends APIResource { * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) */ - create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: JobCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/fine_tuning/jobs', { body, ...options }); } @@ -33,65 +33,46 @@ export class Jobs extends APIResource { * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) */ - retrieve(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/fine_tuning/jobs/${fineTuningJobId}`, options); + retrieve(fineTuningJobID: string, options?: RequestOptions): APIPromise { + return this._client.get(`/fine_tuning/jobs/${fineTuningJobID}`, options); } /** * List your organization's fine-tuning jobs */ list( - query?: JobListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list(options?: Core.RequestOptions): Core.PagePromise; - list( - query: JobListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } - return this._client.getAPIList('/fine_tuning/jobs', FineTuningJobsPage, { query, ...options }); + query: JobListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/fine_tuning/jobs', CursorPage, { query, ...options }); } /** * Immediately cancel a fine-tune job. */ - cancel(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`, options); + cancel(fineTuningJobID: string, options?: RequestOptions): APIPromise { + return this._client.post(`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options); } /** * Get status updates for a fine-tuning job. */ listEvents( - fineTuningJobId: string, - query?: JobListEventsParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - listEvents( - fineTuningJobId: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - listEvents( - fineTuningJobId: string, - query: JobListEventsParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.listEvents(fineTuningJobId, {}, query); - } - return this._client.getAPIList(`/fine_tuning/jobs/${fineTuningJobId}/events`, FineTuningJobEventsPage, { - query, - ...options, - }); + fineTuningJobID: string, + query: JobListEventsParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + `/fine_tuning/jobs/${fineTuningJobID}/events`, + CursorPage, + { query, ...options }, + ); } } -export class FineTuningJobsPage extends CursorPage {} +export type FineTuningJobsPage = CursorPage; -export class FineTuningJobEventsPage extends CursorPage {} +export type FineTuningJobEventsPage = CursorPage; /** * The `fine_tuning.job` object represents a fine-tuning job that has been created @@ -694,10 +675,7 @@ export interface JobListParams extends CursorPageParams {} export interface JobListEventsParams extends CursorPageParams {} -Jobs.FineTuningJobsPage = FineTuningJobsPage; -Jobs.FineTuningJobEventsPage = FineTuningJobEventsPage; Jobs.Checkpoints = Checkpoints; -Jobs.FineTuningJobCheckpointsPage = FineTuningJobCheckpointsPage; export declare namespace Jobs { export { @@ -706,8 +684,8 @@ export declare namespace Jobs { type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, - FineTuningJobsPage as FineTuningJobsPage, - FineTuningJobEventsPage as FineTuningJobEventsPage, + type FineTuningJobsPage as FineTuningJobsPage, + type FineTuningJobEventsPage as FineTuningJobEventsPage, type JobCreateParams as JobCreateParams, type JobListParams as JobListParams, type JobListEventsParams as JobListEventsParams, @@ -716,7 +694,7 @@ export declare namespace Jobs { export { Checkpoints as Checkpoints, type FineTuningJobCheckpoint as FineTuningJobCheckpoint, - FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, + type FineTuningJobCheckpointsPage as FineTuningJobCheckpointsPage, type CheckpointListParams as CheckpointListParams, }; } diff --git a/src/resources/images.ts b/src/resources/images.ts index 8e1c6d92e..ca3578d24 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -1,30 +1,29 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import * as Core from '../core'; +import { APIPromise } from '../api-promise'; +import { type Uploadable, multipartFormRequestOptions } from '../uploads'; +import { RequestOptions } from '../internal/request-options'; export class Images extends APIResource { /** * Creates a variation of a given image. */ - createVariation( - body: ImageCreateVariationParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post('/images/variations', Core.multipartFormRequestOptions({ body, ...options })); + createVariation(body: ImageCreateVariationParams, options?: RequestOptions): APIPromise { + return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options })); } /** * Creates an edited or extended image given an original image and a prompt. */ - edit(body: ImageEditParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/images/edits', Core.multipartFormRequestOptions({ body, ...options })); + edit(body: ImageEditParams, options?: RequestOptions): APIPromise { + return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options })); } /** * Creates an image given a prompt. */ - generate(body: ImageGenerateParams, options?: Core.RequestOptions): Core.APIPromise { + generate(body: ImageGenerateParams, options?: RequestOptions): APIPromise { return this._client.post('/images/generations', { body, ...options }); } } @@ -64,7 +63,7 @@ export interface ImageCreateVariationParams { * The image to use as the basis for the variation(s). Must be a valid PNG file, * less than 4MB, and square. */ - image: Core.Uploadable; + image: Uploadable; /** * The model to use for image generation. Only `dall-e-2` is supported at this @@ -104,7 +103,7 @@ export interface ImageEditParams { * The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask * is not provided, image must have transparency, which will be used as the mask. */ - image: Core.Uploadable; + image: Uploadable; /** * A text description of the desired image(s). The maximum length is 1000 @@ -117,7 +116,7 @@ export interface ImageEditParams { * indicate where `image` should be edited. Must be a valid PNG file, less than * 4MB, and have the same dimensions as `image`. */ - mask?: Core.Uploadable; + mask?: Uploadable; /** * The model to use for image generation. Only `dall-e-2` is supported at this diff --git a/src/resources/index.ts b/src/resources/index.ts index ad0302357..c1d06d8ce 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -4,13 +4,13 @@ export * from './chat/index'; export * from './shared'; export { Audio, type AudioModel, type AudioResponseFormat } from './audio/audio'; export { - BatchesPage, Batches, type Batch, type BatchError, type BatchRequestCounts, type BatchCreateParams, type BatchListParams, + type BatchesPage, } from './batches'; export { Beta } from './beta/beta'; export { @@ -30,7 +30,6 @@ export { type EmbeddingCreateParams, } from './embeddings'; export { - FileObjectsPage, Files, type FileContent, type FileDeleted, @@ -38,6 +37,7 @@ export { type FilePurpose, type FileCreateParams, type FileListParams, + type FileObjectsPage, } from './files'; export { FineTuning } from './fine-tuning/fine-tuning'; export { @@ -49,7 +49,7 @@ export { type ImageEditParams, type ImageGenerateParams, } from './images'; -export { ModelsPage, Models, type Model, type ModelDeleted } from './models'; +export { Models, type Model, type ModelDeleted, type ModelsPage } from './models'; export { Moderations, type Moderation, diff --git a/src/resources/models.ts b/src/resources/models.ts index 6d8cd5296..f6ec034ec 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -1,15 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import * as Core from '../core'; -import { Page } from '../pagination'; +import { APIPromise } from '../api-promise'; +import { Page, PagePromise } from '../pagination'; +import { RequestOptions } from '../internal/request-options'; export class Models extends APIResource { /** * Retrieves a model instance, providing basic information about the model such as * the owner and permissioning. */ - retrieve(model: string, options?: Core.RequestOptions): Core.APIPromise { + retrieve(model: string, options?: RequestOptions): APIPromise { return this._client.get(`/models/${model}`, options); } @@ -17,23 +18,21 @@ export class Models extends APIResource { * Lists the currently available models, and provides basic information about each * one such as the owner and availability. */ - list(options?: Core.RequestOptions): Core.PagePromise { - return this._client.getAPIList('/models', ModelsPage, options); + list(options?: RequestOptions): PagePromise { + return this._client.getAPIList('/models', Page, options); } /** * Delete a fine-tuned model. You must have the Owner role in your organization to * delete a model. */ - del(model: string, options?: Core.RequestOptions): Core.APIPromise { + delete(model: string, options?: RequestOptions): APIPromise { return this._client.delete(`/models/${model}`, options); } } -/** - * Note: no pagination actually occurs yet, this is for forwards-compatibility. - */ -export class ModelsPage extends Page {} +// Note: no pagination actually occurs yet, this is for forwards-compatibility. +export type ModelsPage = Page; /** * Describes an OpenAI model offering that can be used with the API. @@ -68,8 +67,6 @@ export interface ModelDeleted { object: string; } -Models.ModelsPage = ModelsPage; - export declare namespace Models { - export { type Model as Model, type ModelDeleted as ModelDeleted, ModelsPage as ModelsPage }; + export { type Model as Model, type ModelDeleted as ModelDeleted, type ModelsPage as ModelsPage }; } diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index f7b16166d..63ae59d39 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -1,17 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import * as Core from '../core'; +import { APIPromise } from '../api-promise'; +import { RequestOptions } from '../internal/request-options'; export class Moderations extends APIResource { /** * Classifies if text and/or image inputs are potentially harmful. Learn more in * the [moderation guide](https://platform.openai.com/docs/guides/moderation). */ - create( - body: ModerationCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(body: ModerationCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/moderations', { body, ...options }); } } diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index 9b54c99e6..2bdd6bb4f 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -1,7 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; +import { APIPromise } from '../../api-promise'; +import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { RequestOptions } from '../../internal/request-options'; export class Parts extends APIResource { /** @@ -17,15 +19,8 @@ export class Parts extends APIResource { * order of the Parts when you * [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete). */ - create( - uploadId: string, - body: PartCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post( - `/uploads/${uploadId}/parts`, - Core.multipartFormRequestOptions({ body, ...options }), - ); + create(uploadID: string, body: PartCreateParams, options?: RequestOptions): APIPromise { + return this._client.post(`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options })); } } @@ -58,7 +53,7 @@ export interface PartCreateParams { /** * The chunk of bytes for this Part. */ - data: Core.Uploadable; + data: Uploadable; } export declare namespace Parts { diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 8491d0fe2..ff72798b0 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -1,10 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; import * as FilesAPI from '../files'; import * as PartsAPI from './parts'; import { PartCreateParams, Parts, UploadPart } from './parts'; +import { APIPromise } from '../../api-promise'; +import { RequestOptions } from '../../internal/request-options'; export class Uploads extends APIResource { parts: PartsAPI.Parts = new PartsAPI.Parts(this._client); @@ -31,15 +32,15 @@ export class Uploads extends APIResource { * the documentation on * [creating a File](https://platform.openai.com/docs/api-reference/files/create). */ - create(body: UploadCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(body: UploadCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/uploads', { body, ...options }); } /** * Cancels the Upload. No Parts may be added after an Upload is cancelled. */ - cancel(uploadId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post(`/uploads/${uploadId}/cancel`, options); + cancel(uploadID: string, options?: RequestOptions): APIPromise { + return this._client.post(`/uploads/${uploadID}/cancel`, options); } /** @@ -57,12 +58,8 @@ export class Uploads extends APIResource { * initially specified when creating the Upload object. No Parts may be added after * an Upload is completed. */ - complete( - uploadId: string, - body: UploadCompleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.post(`/uploads/${uploadId}/complete`, { body, ...options }); + complete(uploadID: string, body: UploadCompleteParams, options?: RequestOptions): APIPromise { + return this._client.post(`/uploads/${uploadID}/complete`, { body, ...options }); } } diff --git a/src/shims/node.ts b/src/shims/node.ts deleted file mode 100644 index 73df5600c..000000000 --- a/src/shims/node.ts +++ /dev/null @@ -1,50 +0,0 @@ -// @ts-ignore -import * as types from '../_shims/node-types'; -import { setShims } from '../_shims/registry'; -import { getRuntime } from '../_shims/node-runtime'; -setShims(getRuntime()); - -declare module '../_shims/manual-types' { - export namespace manual { - // @ts-ignore - export type Agent = types.Agent; - // @ts-ignore - export import fetch = types.fetch; - // @ts-ignore - export type Request = types.Request; - // @ts-ignore - export type RequestInfo = types.RequestInfo; - // @ts-ignore - export type RequestInit = types.RequestInit; - // @ts-ignore - export type Response = types.Response; - // @ts-ignore - export type ResponseInit = types.ResponseInit; - // @ts-ignore - export type ResponseType = types.ResponseType; - // @ts-ignore - export type BodyInit = types.BodyInit; - // @ts-ignore - export type Headers = types.Headers; - // @ts-ignore - export type HeadersInit = types.HeadersInit; - // @ts-ignore - export type BlobPropertyBag = types.BlobPropertyBag; - // @ts-ignore - export type FilePropertyBag = types.FilePropertyBag; - // @ts-ignore - export type FileFromPathOptions = types.FileFromPathOptions; - // @ts-ignore - export import FormData = types.FormData; - // @ts-ignore - export import File = types.File; - // @ts-ignore - export import Blob = types.Blob; - // @ts-ignore - export type Readable = types.Readable; - // @ts-ignore - export type FsReadStream = types.FsReadStream; - // @ts-ignore - export import ReadableStream = types.ReadableStream; - } -} diff --git a/src/shims/web.ts b/src/shims/web.ts deleted file mode 100644 index f72d78444..000000000 --- a/src/shims/web.ts +++ /dev/null @@ -1,50 +0,0 @@ -// @ts-ignore -import * as types from '../_shims/web-types'; -import { setShims } from '../_shims/registry'; -import { getRuntime } from '../_shims/web-runtime'; -setShims(getRuntime({ manuallyImported: true })); - -declare module '../_shims/manual-types' { - export namespace manual { - // @ts-ignore - export type Agent = types.Agent; - // @ts-ignore - export import fetch = types.fetch; - // @ts-ignore - export type Request = types.Request; - // @ts-ignore - export type RequestInfo = types.RequestInfo; - // @ts-ignore - export type RequestInit = types.RequestInit; - // @ts-ignore - export type Response = types.Response; - // @ts-ignore - export type ResponseInit = types.ResponseInit; - // @ts-ignore - export type ResponseType = types.ResponseType; - // @ts-ignore - export type BodyInit = types.BodyInit; - // @ts-ignore - export type Headers = types.Headers; - // @ts-ignore - export type HeadersInit = types.HeadersInit; - // @ts-ignore - export type BlobPropertyBag = types.BlobPropertyBag; - // @ts-ignore - export type FilePropertyBag = types.FilePropertyBag; - // @ts-ignore - export type FileFromPathOptions = types.FileFromPathOptions; - // @ts-ignore - export import FormData = types.FormData; - // @ts-ignore - export import File = types.File; - // @ts-ignore - export import Blob = types.Blob; - // @ts-ignore - export type Readable = types.Readable; - // @ts-ignore - export type FsReadStream = types.FsReadStream; - // @ts-ignore - export import ReadableStream = types.ReadableStream; - } -} diff --git a/src/streaming.ts b/src/streaming.ts index 2891e6ac3..841a748a9 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -1,5 +1,6 @@ -import { ReadableStream, type Response } from './_shims/index'; import { OpenAIError } from './error'; +import { type ReadableStream } from './internal/shim-types'; +import { makeReadableStream } from './internal/shims'; import { LineDecoder } from './internal/decoders/line'; import { APIError } from './error'; @@ -175,7 +176,7 @@ export class Stream implements AsyncIterable { let iter: AsyncIterator; const encoder = new TextEncoder(); - return new ReadableStream({ + return makeReadableStream({ async start() { iter = self[Symbol.asyncIterator](); }, diff --git a/src/uploads.ts b/src/uploads.ts index 8fd2154d4..58f3782be 100644 --- a/src/uploads.ts +++ b/src/uploads.ts @@ -1,15 +1,7 @@ -import { type RequestOptions } from './core'; -import { - FormData, - File, - type Blob, - type FilePropertyBag, - getMultipartRequestOptions, - type FsReadStream, - isFsReadStream, -} from './_shims/index'; -import { MultipartBody } from './_shims/MultipartBody'; -export { fileFromPath } from './_shims/index'; +import { type RequestOptions } from './internal/request-options'; +import { type FilePropertyBag } from './internal/builtin-types'; +import { isFsReadStreamLike, type FsReadStreamLike } from './internal/shims'; +import './internal/polyfill/file.node.js'; type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView; export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView; @@ -23,10 +15,10 @@ export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Arra * For convenience, you can also pass a fetch Response, or in Node, * the result of fs.createReadStream(). */ -export type Uploadable = FileLike | ResponseLike | FsReadStream; +export type Uploadable = FileLike | ResponseLike | FsReadStreamLike; /** - * Intended to match web.Blob, node.Blob, node-fetch.Blob, etc. + * Intended to match web.Blob, node.Blob, undici.Blob, etc. */ export interface BlobLike { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ @@ -37,11 +29,22 @@ export interface BlobLike { text(): Promise; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ slice(start?: number, end?: number): BlobLike; - // unfortunately @types/node-fetch@^2.6.4 doesn't type the arrayBuffer method } /** - * Intended to match web.File, node.File, node-fetch.File, etc. + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.size === 'number' && + typeof value.type === 'string' && + typeof value.text === 'function' && + typeof value.slice === 'function' && + typeof value.arrayBuffer === 'function'; + +/** + * Intended to match web.File, node.File, undici.File, etc. */ export interface FileLike extends BlobLike { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ @@ -49,9 +52,20 @@ export interface FileLike extends BlobLike { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ readonly name: string; } +declare var FileClass: { + prototype: FileLike; + new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike; +}; + +export const isFileLike = (value: any): value is FileLike => + value != null && + typeof value === 'object' && + typeof value.name === 'string' && + typeof value.lastModified === 'number' && + isBlobLike(value); /** - * Intended to match web.Response, node.Response, node-fetch.Response, etc. + * Intended to match web.Response, node.Response, undici.Response, etc. */ export interface ResponseLike { url: string; @@ -64,32 +78,26 @@ export const isResponseLike = (value: any): value is ResponseLike => typeof value.url === 'string' && typeof value.blob === 'function'; -export const isFileLike = (value: any): value is FileLike => - value != null && - typeof value === 'object' && - typeof value.name === 'string' && - typeof value.lastModified === 'number' && - isBlobLike(value); - -/** - * The BlobLike type omits arrayBuffer() because @types/node-fetch@^2.6.4 lacks it; but this check - * adds the arrayBuffer() method type because it is available and used at runtime - */ -export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => - value != null && - typeof value === 'object' && - typeof value.size === 'number' && - typeof value.type === 'string' && - typeof value.text === 'function' && - typeof value.slice === 'function' && - typeof value.arrayBuffer === 'function'; - export const isUploadable = (value: any): value is Uploadable => { - return isFileLike(value) || isResponseLike(value) || isFsReadStream(value); + return isFileLike(value) || isResponseLike(value) || isFsReadStreamLike(value); }; export type ToFileInput = Uploadable | Exclude | AsyncIterable; +/** + * Construct a `File` instance. This is used to ensure a helpful error is thrown + * for environments that don't define a global `File` yet and so that we don't + * accidentally rely on a global `File` type in our annotations. + */ +function makeFile(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike { + const File = (globalThis as any).File as typeof FileClass | undefined; + if (typeof File === 'undefined') { + throw new Error('`File` is not defined as a global which is required for file uploads'); + } + + return new File(fileBits, fileName, options); +} + /** * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s @@ -121,7 +129,7 @@ export async function toFile( // in `new File` interpreting it as a string instead of binary data. const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob]; - return new File(data, name, options); + return makeFile(data, name, options); } const bits = await getBytes(value); @@ -135,7 +143,7 @@ export async function toFile( } } - return new File(bits, name, options); + return makeFile(bits, name, options); } async function getBytes(value: ToFileInput): Promise> { @@ -187,27 +195,22 @@ const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefi const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator => value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'; -export const isMultipartBody = (body: any): body is MultipartBody => - body && typeof body === 'object' && body.body && body[Symbol.toStringTag] === 'MultipartBody'; - /** * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value. * Otherwise returns the request as is. */ -export const maybeMultipartFormRequestOptions = async >( - opts: RequestOptions, -): Promise> => { +export const maybeMultipartFormRequestOptions = async (opts: RequestOptions): Promise => { if (!hasUploadableValue(opts.body)) return opts; - const form = await createForm(opts.body); - return getMultipartRequestOptions(form, opts); + return { ...opts, body: await createForm(opts.body) }; }; -export const multipartFormRequestOptions = async >( - opts: RequestOptions, -): Promise> => { - const form = await createForm(opts.body); - return getMultipartRequestOptions(form, opts); +type MultipartFormRequestOptions = Omit & { body: unknown }; + +export const multipartFormRequestOptions = async ( + opts: MultipartFormRequestOptions, +): Promise => { + return { ...opts, body: await createForm(opts.body) }; }; export const createForm = async >(body: T | undefined): Promise => { @@ -240,7 +243,7 @@ const addFormValue = async (form: FormData, key: string, value: unknown): Promis form.append(key, String(value)); } else if (isUploadable(value)) { const file = await toFile(value); - form.append(key, file as File); + form.append(key, file as any); } else if (Array.isArray(value)) { await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry))); } else if (typeof value === 'object') { diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 86ef5e576..6e5d560d0 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI, { toFile } from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/audio/translations.test.ts b/tests/api-resources/audio/translations.test.ts index 7966ff49a..940e4f38e 100644 --- a/tests/api-resources/audio/translations.test.ts +++ b/tests/api-resources/audio/translations.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI, { toFile } from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/batches.test.ts b/tests/api-resources/batches.test.ts index 96e200fb9..870fbec9d 100644 --- a/tests/api-resources/batches.test.ts +++ b/tests/api-resources/batches.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -44,13 +43,6 @@ describe('resource batches', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.batches.retrieve('batch_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('list', async () => { const responsePromise = client.batches.list(); const rawResponse = await responsePromise.asResponse(); @@ -62,13 +54,6 @@ describe('resource batches', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.batches.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - 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( @@ -86,11 +71,4 @@ describe('resource batches', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('cancel: request options instead of 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.batches.cancel('batch_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); }); diff --git a/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index a64465c77..8d04127e1 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -52,13 +51,6 @@ describe('resource assistants', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.assistants.retrieve('assistant_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('update', async () => { const responsePromise = client.beta.assistants.update('assistant_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -81,13 +73,6 @@ describe('resource assistants', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.assistants.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - 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( @@ -98,8 +83,8 @@ describe('resource assistants', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { - const responsePromise = client.beta.assistants.del('assistant_id'); + test('delete', async () => { + const responsePromise = client.beta.assistants.delete('assistant_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -108,11 +93,4 @@ describe('resource assistants', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('del: request options instead of 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.beta.assistants.del('assistant_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); }); diff --git a/tests/api-resources/beta/threads/messages.test.ts b/tests/api-resources/beta/threads/messages.test.ts index c1f5f7b6e..98f607b18 100644 --- a/tests/api-resources/beta/threads/messages.test.ts +++ b/tests/api-resources/beta/threads/messages.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -32,8 +31,8 @@ describe('resource messages', () => { }); }); - test('retrieve', async () => { - const responsePromise = client.beta.threads.messages.retrieve('thread_id', 'message_id'); + test('retrieve: only required params', async () => { + const responsePromise = client.beta.threads.messages.retrieve('message_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -43,15 +42,12 @@ describe('resource messages', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.threads.messages.retrieve('thread_id', 'message_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('retrieve: required and optional params', async () => { + const response = await client.beta.threads.messages.retrieve('message_id', { thread_id: 'thread_id' }); }); - test('update', async () => { - const responsePromise = client.beta.threads.messages.update('thread_id', 'message_id', {}); + test('update: only required params', async () => { + const responsePromise = client.beta.threads.messages.update('message_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -61,6 +57,13 @@ describe('resource messages', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + test('update: required and optional params', async () => { + const response = await client.beta.threads.messages.update('message_id', { + thread_id: 'thread_id', + metadata: {}, + }); + }); + test('list', async () => { const responsePromise = client.beta.threads.messages.list('thread_id'); const rawResponse = await responsePromise.asResponse(); @@ -72,13 +75,6 @@ describe('resource messages', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.threads.messages.list('thread_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - 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( @@ -90,8 +86,8 @@ describe('resource messages', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { - const responsePromise = client.beta.threads.messages.del('thread_id', 'message_id'); + test('delete: only required params', async () => { + const responsePromise = client.beta.threads.messages.delete('message_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -101,10 +97,7 @@ describe('resource messages', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del: request options instead of 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.beta.threads.messages.del('thread_id', 'message_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('delete: required and optional params', async () => { + const response = await client.beta.threads.messages.delete('message_id', { thread_id: 'thread_id' }); }); }); diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 4fd8261ac..18474bd94 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -49,8 +48,8 @@ describe('resource runs', () => { }); }); - test('retrieve', async () => { - const responsePromise = client.beta.threads.runs.retrieve('thread_id', 'run_id'); + test('retrieve: only required params', async () => { + const responsePromise = client.beta.threads.runs.retrieve('run_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -60,15 +59,12 @@ describe('resource runs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.threads.runs.retrieve('thread_id', 'run_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('retrieve: required and optional params', async () => { + const response = await client.beta.threads.runs.retrieve('run_id', { thread_id: 'thread_id' }); }); - test('update', async () => { - const responsePromise = client.beta.threads.runs.update('thread_id', 'run_id', {}); + test('update: only required params', async () => { + const responsePromise = client.beta.threads.runs.update('run_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -78,6 +74,13 @@ describe('resource runs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); + test('update: required and optional params', async () => { + const response = await client.beta.threads.runs.update('run_id', { + thread_id: 'thread_id', + metadata: {}, + }); + }); + test('list', async () => { const responsePromise = client.beta.threads.runs.list('thread_id'); const rawResponse = await responsePromise.asResponse(); @@ -89,13 +92,6 @@ describe('resource runs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.threads.runs.list('thread_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - 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( @@ -107,8 +103,8 @@ describe('resource runs', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('cancel', async () => { - const responsePromise = client.beta.threads.runs.cancel('thread_id', 'run_id'); + test('cancel: only required params', async () => { + const responsePromise = client.beta.threads.runs.cancel('run_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -118,15 +114,13 @@ describe('resource runs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('cancel: request options instead of 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.beta.threads.runs.cancel('thread_id', 'run_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('cancel: required and optional params', async () => { + const response = await client.beta.threads.runs.cancel('run_id', { thread_id: 'thread_id' }); }); test('submitToolOutputs: only required params', async () => { - const responsePromise = client.beta.threads.runs.submitToolOutputs('thread_id', 'run_id', { + const responsePromise = client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', tool_outputs: [{}], }); const rawResponse = await responsePromise.asResponse(); @@ -139,7 +133,8 @@ describe('resource runs', () => { }); test('submitToolOutputs: required and optional params', async () => { - const response = await client.beta.threads.runs.submitToolOutputs('thread_id', 'run_id', { + const response = await client.beta.threads.runs.submitToolOutputs('run_id', { + thread_id: 'thread_id', tool_outputs: [{ output: 'output', tool_call_id: 'tool_call_id' }], stream: false, }); diff --git a/tests/api-resources/beta/threads/runs/steps.test.ts b/tests/api-resources/beta/threads/runs/steps.test.ts index 64cd228ae..cad671c5c 100644 --- a/tests/api-resources/beta/threads/runs/steps.test.ts +++ b/tests/api-resources/beta/threads/runs/steps.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -9,8 +8,11 @@ const client = new OpenAI({ }); describe('resource steps', () => { - test('retrieve', async () => { - const responsePromise = client.beta.threads.runs.steps.retrieve('thread_id', 'run_id', 'step_id'); + test('retrieve: only required params', async () => { + const responsePromise = client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,30 +22,16 @@ describe('resource steps', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.threads.runs.steps.retrieve('thread_id', 'run_id', 'step_id', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('retrieve: required and optional params', async () => { + const response = await client.beta.threads.runs.steps.retrieve('step_id', { + thread_id: 'thread_id', + run_id: 'run_id', + include: ['step_details.tool_calls[*].file_search.results[*].content'], + }); }); - test('retrieve: 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.beta.threads.runs.steps.retrieve( - 'thread_id', - 'run_id', - 'step_id', - { include: ['step_details.tool_calls[*].file_search.results[*].content'] }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - - test('list', async () => { - const responsePromise = client.beta.threads.runs.steps.list('thread_id', 'run_id'); + test('list: only required params', async () => { + const responsePromise = client.beta.threads.runs.steps.list('run_id', { thread_id: 'thread_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -53,28 +41,14 @@ describe('resource steps', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.threads.runs.steps.list('thread_id', 'run_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - - 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.beta.threads.runs.steps.list( - 'thread_id', - 'run_id', - { - after: 'after', - before: 'before', - include: ['step_details.tool_calls[*].file_search.results[*].content'], - limit: 0, - order: 'asc', - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(OpenAI.NotFoundError); + test('list: required and optional params', async () => { + const response = await client.beta.threads.runs.steps.list('run_id', { + thread_id: 'thread_id', + after: 'after', + before: 'before', + include: ['step_details.tool_calls[*].file_search.results[*].content'], + limit: 0, + order: 'asc', + }); }); }); diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index aba266316..67e015ef1 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -20,13 +19,6 @@ describe('resource threads', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: request options instead of 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.beta.threads.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('create: 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( @@ -65,13 +57,6 @@ describe('resource threads', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.threads.retrieve('thread_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('update', async () => { const responsePromise = client.beta.threads.update('thread_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -83,8 +68,8 @@ describe('resource threads', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del', async () => { - const responsePromise = client.beta.threads.del('thread_id'); + test('delete', async () => { + const responsePromise = client.beta.threads.delete('thread_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -94,13 +79,6 @@ describe('resource threads', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del: request options instead of 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.beta.threads.del('thread_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('createAndRun: only required params', async () => { const responsePromise = client.beta.threads.createAndRun({ assistant_id: 'assistant_id' }); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/beta/vector-stores/file-batches.test.ts b/tests/api-resources/beta/vector-stores/file-batches.test.ts index b714049b4..783801214 100644 --- a/tests/api-resources/beta/vector-stores/file-batches.test.ts +++ b/tests/api-resources/beta/vector-stores/file-batches.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -29,8 +28,10 @@ describe('resource fileBatches', () => { }); }); - test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123'); + test('retrieve: only required params', async () => { + const responsePromise = client.beta.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -40,17 +41,16 @@ describe('resource fileBatches', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('retrieve: required and optional params', async () => { + const response = await client.beta.vectorStores.fileBatches.retrieve('vsfb_abc123', { + vector_store_id: 'vs_abc123', + }); }); - test('cancel', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id'); + test('cancel: only required params', async () => { + const responsePromise = client.beta.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -60,17 +60,16 @@ describe('resource fileBatches', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('cancel: request options instead of 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.beta.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('cancel: required and optional params', async () => { + const response = await client.beta.vectorStores.fileBatches.cancel('batch_id', { + vector_store_id: 'vector_store_id', + }); }); - test('listFiles', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id'); + test('listFiles: only required params', async () => { + const responsePromise = client.beta.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -80,24 +79,14 @@ describe('resource fileBatches', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('listFiles: request options instead of 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.beta.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - - test('listFiles: 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.beta.vectorStores.fileBatches.listFiles( - 'vector_store_id', - 'batch_id', - { after: 'after', before: 'before', filter: 'in_progress', limit: 0, order: 'asc' }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(OpenAI.NotFoundError); + test('listFiles: required and optional params', async () => { + const response = await client.beta.vectorStores.fileBatches.listFiles('batch_id', { + vector_store_id: 'vector_store_id', + after: 'after', + before: 'before', + filter: 'in_progress', + limit: 0, + order: 'asc', + }); }); }); diff --git a/tests/api-resources/beta/vector-stores/files.test.ts b/tests/api-resources/beta/vector-stores/files.test.ts index 7c14d4de3..c32cb6408 100644 --- a/tests/api-resources/beta/vector-stores/files.test.ts +++ b/tests/api-resources/beta/vector-stores/files.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -27,8 +26,10 @@ describe('resource files', () => { }); }); - test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.files.retrieve('vs_abc123', 'file-abc123'); + test('retrieve: only required params', async () => { + const responsePromise = client.beta.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -38,13 +39,10 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.vectorStores.files.retrieve('vs_abc123', 'file-abc123', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('retrieve: required and optional params', async () => { + const response = await client.beta.vectorStores.files.retrieve('file-abc123', { + vector_store_id: 'vs_abc123', + }); }); test('list', async () => { @@ -58,13 +56,6 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.vectorStores.files.list('vector_store_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - 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( @@ -76,8 +67,10 @@ describe('resource files', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { - const responsePromise = client.beta.vectorStores.files.del('vector_store_id', 'file_id'); + test('delete: only required params', async () => { + const responsePromise = client.beta.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -87,10 +80,9 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del: request options instead of 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.beta.vectorStores.files.del('vector_store_id', 'file_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); + test('delete: required and optional params', async () => { + const response = await client.beta.vectorStores.files.delete('file_id', { + vector_store_id: 'vector_store_id', + }); }); }); diff --git a/tests/api-resources/beta/vector-stores/vector-stores.test.ts b/tests/api-resources/beta/vector-stores/vector-stores.test.ts index 806098de8..ecb8d33a1 100644 --- a/tests/api-resources/beta/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/beta/vector-stores/vector-stores.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -31,13 +30,6 @@ describe('resource vectorStores', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.beta.vectorStores.retrieve('vector_store_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('update', async () => { const responsePromise = client.beta.vectorStores.update('vector_store_id', {}); const rawResponse = await responsePromise.asResponse(); @@ -60,13 +52,6 @@ describe('resource vectorStores', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.beta.vectorStores.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - 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( @@ -77,8 +62,8 @@ describe('resource vectorStores', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { - const responsePromise = client.beta.vectorStores.del('vector_store_id'); + test('delete', async () => { + const responsePromise = client.beta.vectorStores.delete('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -87,11 +72,4 @@ describe('resource vectorStores', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('del: request options instead of 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.beta.vectorStores.del('vector_store_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); }); diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index dfc09f69b..7aa8c5d99 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/completions.test.ts b/tests/api-resources/completions.test.ts index 82322dc3a..96a2262ae 100644 --- a/tests/api-resources/completions.test.ts +++ b/tests/api-resources/completions.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/embeddings.test.ts b/tests/api-resources/embeddings.test.ts index 46dd1b2a3..c449f9825 100644 --- a/tests/api-resources/embeddings.test.ts +++ b/tests/api-resources/embeddings.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/files.test.ts b/tests/api-resources/files.test.ts index c907c4987..647742af2 100644 --- a/tests/api-resources/files.test.ts +++ b/tests/api-resources/files.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI, { toFile } from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -41,13 +40,6 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.files.retrieve('file_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('list', async () => { const responsePromise = client.files.list(); const rawResponse = await responsePromise.asResponse(); @@ -59,13 +51,6 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.files.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - 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( @@ -76,8 +61,8 @@ describe('resource files', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { - const responsePromise = client.files.del('file_id'); + test('delete', async () => { + const responsePromise = client.files.delete('file_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -87,20 +72,6 @@ describe('resource files', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del: request options instead of 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.files.del('file_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - - test('content: request options instead of 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.files.content('file_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('retrieveContent', async () => { const responsePromise = client.files.retrieveContent('file_id'); const rawResponse = await responsePromise.asResponse(); @@ -111,11 +82,4 @@ describe('resource files', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('retrieveContent: request options instead of 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.files.retrieveContent('file_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); }); diff --git a/tests/api-resources/fine-tuning/jobs/checkpoints.test.ts b/tests/api-resources/fine-tuning/jobs/checkpoints.test.ts index d211a9b10..6177aee9b 100644 --- a/tests/api-resources/fine-tuning/jobs/checkpoints.test.ts +++ b/tests/api-resources/fine-tuning/jobs/checkpoints.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -20,15 +19,6 @@ describe('resource checkpoints', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.jobs.checkpoints.list('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - 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( diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index 4de83a8b7..b194ac234 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -65,13 +64,6 @@ describe('resource jobs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.jobs.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('list', async () => { const responsePromise = client.fineTuning.jobs.list(); const rawResponse = await responsePromise.asResponse(); @@ -83,13 +75,6 @@ describe('resource jobs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.jobs.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - 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( @@ -108,13 +93,6 @@ describe('resource jobs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('cancel: request options instead of 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.jobs.cancel('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('listEvents', async () => { const responsePromise = client.fineTuning.jobs.listEvents('ft-AF1WoRqd3aJAHsqc9NY7iL8F'); const rawResponse = await responsePromise.asResponse(); @@ -126,13 +104,6 @@ describe('resource jobs', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('listEvents: request options instead of 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.jobs.listEvents('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('listEvents: 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( diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 88eb97a93..9f00da3b3 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI, { toFile } from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/models.test.ts b/tests/api-resources/models.test.ts index 23ebd1bb6..9bf5fbd64 100644 --- a/tests/api-resources/models.test.ts +++ b/tests/api-resources/models.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -20,13 +19,6 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.models.retrieve('gpt-4o-mini', { path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - test('list', async () => { const responsePromise = client.models.list(); const rawResponse = await responsePromise.asResponse(); @@ -38,15 +30,8 @@ describe('resource models', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of 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.models.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - OpenAI.NotFoundError, - ); - }); - - test('del', async () => { - const responsePromise = client.models.del('ft:gpt-4o-mini:acemeco:suffix:abc123'); + test('delete', async () => { + const responsePromise = client.models.delete('ft:gpt-4o-mini:acemeco:suffix:abc123'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -55,11 +40,4 @@ describe('resource models', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('del: request options instead of 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.models.del('ft:gpt-4o-mini:acemeco:suffix:abc123', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); }); diff --git a/tests/api-resources/moderations.test.ts b/tests/api-resources/moderations.test.ts index 64f9acf3c..d50175b2d 100644 --- a/tests/api-resources/moderations.test.ts +++ b/tests/api-resources/moderations.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/uploads/parts.test.ts b/tests/api-resources/uploads/parts.test.ts index e584bab8e..06079e31c 100644 --- a/tests/api-resources/uploads/parts.test.ts +++ b/tests/api-resources/uploads/parts.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI, { toFile } from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', diff --git a/tests/api-resources/uploads/uploads.test.ts b/tests/api-resources/uploads/uploads.test.ts index c9ea4ddd7..19fed99ea 100644 --- a/tests/api-resources/uploads/uploads.test.ts +++ b/tests/api-resources/uploads/uploads.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -45,13 +44,6 @@ describe('resource uploads', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('cancel: request options instead of 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.uploads.cancel('upload_abc123', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('complete: only required params', async () => { const responsePromise = client.uploads.complete('upload_abc123', { part_ids: ['string'] }); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/base64.test.ts b/tests/base64.test.ts new file mode 100644 index 000000000..1cb120c2d --- /dev/null +++ b/tests/base64.test.ts @@ -0,0 +1,80 @@ +import { fromBase64, toBase64 } from 'openai/internal/utils/base64'; + +describe.each(['Buffer', 'atob'])('with %s', (mode) => { + let originalBuffer: BufferConstructor; + beforeAll(() => { + if (mode === 'atob') { + originalBuffer = globalThis.Buffer; + // @ts-expect-error Can't assign undefined to BufferConstructor + delete globalThis.Buffer; + } + }); + afterAll(() => { + if (mode === 'atob') { + globalThis.Buffer = originalBuffer; + } + }); + test('toBase64', () => { + const testCases = [ + { + input: 'hello world', + expected: 'aGVsbG8gd29ybGQ=', + }, + { + input: new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]), + expected: 'aGVsbG8gd29ybGQ=', + }, + { + input: undefined, + expected: '', + }, + { + input: new Uint8Array([ + 229, 102, 215, 230, 65, 22, 46, 87, 243, 176, 99, 99, 31, 174, 8, 242, 83, 142, 169, 64, 122, 123, + 193, 71, + ]), + expected: '5WbX5kEWLlfzsGNjH64I8lOOqUB6e8FH', + }, + { + input: '✓', + expected: '4pyT', + }, + { + input: new Uint8Array([226, 156, 147]), + expected: '4pyT', + }, + ]; + + testCases.forEach(({ input, expected }) => { + expect(toBase64(input)).toBe(expected); + }); + }); + + test('fromBase64', () => { + const testCases = [ + { + input: 'aGVsbG8gd29ybGQ=', + expected: new Uint8Array([104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]), + }, + { + input: '', + expected: new Uint8Array([]), + }, + { + input: '5WbX5kEWLlfzsGNjH64I8lOOqUB6e8FH', + expected: new Uint8Array([ + 229, 102, 215, 230, 65, 22, 46, 87, 243, 176, 99, 99, 31, 174, 8, 242, 83, 142, 169, 64, 122, 123, + 193, 71, + ]), + }, + { + input: '4pyT', + expected: new Uint8Array([226, 156, 147]), + }, + ]; + + testCases.forEach(({ input, expected }) => { + expect(fromBase64(input)).toEqual(expected); + }); + }); +}); diff --git a/tests/buildHeaders.test.ts b/tests/buildHeaders.test.ts new file mode 100644 index 000000000..3f8e4d28e --- /dev/null +++ b/tests/buildHeaders.test.ts @@ -0,0 +1,88 @@ +import { inspect } from 'node:util'; +import { buildHeaders, type HeadersLike, type NullableHeaders } from 'openai/internal/headers'; + +function inspectNullableHeaders(headers: NullableHeaders) { + return `NullableHeaders {${[ + ...[...headers.values.entries()].map(([name, value]) => ` ${inspect(name)}: ${inspect(value)}`), + ...[...headers.nulls].map((name) => ` ${inspect(name)}: null`), + ].join(', ')} }`; +} + +describe('buildHeaders', () => { + const cases: [HeadersLike[], string][] = [ + [[new Headers({ 'content-type': 'text/plain' })], `NullableHeaders { 'content-type': 'text/plain' }`], + [ + [ + { + 'content-type': 'text/plain', + }, + { + 'Content-Type': undefined, + }, + ], + `NullableHeaders { 'content-type': 'text/plain' }`, + ], + [ + [ + { + 'content-type': 'text/plain', + }, + { + 'Content-Type': null, + }, + ], + `NullableHeaders { 'content-type': null }`, + ], + [ + [ + { + cookie: 'name1=value1', + Cookie: 'name2=value2', + }, + ], + `NullableHeaders { 'cookie': 'name2=value2' }`, + ], + [ + [ + { + cookie: 'name1=value1', + Cookie: undefined, + }, + ], + `NullableHeaders { 'cookie': 'name1=value1' }`, + ], + [ + [ + { + cookie: ['name1=value1', 'name2=value2'], + }, + ], + `NullableHeaders { 'cookie': 'name1=value1; name2=value2' }`, + ], + [ + [ + { + 'x-foo': ['name1=value1', 'name2=value2'], + }, + ], + `NullableHeaders { 'x-foo': 'name1=value1, name2=value2' }`, + ], + [ + [ + [ + ['cookie', 'name1=value1'], + ['cookie', 'name2=value2'], + ['Cookie', 'name3=value3'], + ], + ], + `NullableHeaders { 'cookie': 'name1=value1; name2=value2; name3=value3' }`, + ], + [[undefined], `NullableHeaders { }`], + [[null], `NullableHeaders { }`], + ]; + for (const [input, expected] of cases) { + test(expected, () => { + expect(inspectNullableHeaders(buildHeaders(input))).toEqual(expected); + }); + } +}); diff --git a/tests/form.test.ts b/tests/form.test.ts index 3a143852c..0bd22c549 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -1,6 +1,4 @@ -import { multipartFormRequestOptions, createForm } from 'openai/core'; -import { Blob } from 'openai/_shims/index'; -import { toFile } from 'openai'; +import { multipartFormRequestOptions, createForm, toFile } from 'openai'; describe('form data validation', () => { test('valid values do not error', async () => { diff --git a/tests/index.test.ts b/tests/index.test.ts index a6f0040a4..34b7f5860 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import util from 'node:util'; import OpenAI from 'openai'; import { APIUserAbortError } from 'openai'; -import { Headers } from 'openai/core'; -import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch'; +const defaultFetch = fetch; describe('instantiate client', () => { const env = process.env; @@ -28,7 +28,7 @@ describe('instantiate client', () => { test('they are used in the request', () => { const { req } = client.buildRequest({ path: '/foo', method: 'post' }); - expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); + expect(req.headers.get('x-my-default-header')).toEqual('2'); }); test('can ignore `undefined` and leave the default', () => { @@ -37,7 +37,7 @@ describe('instantiate client', () => { method: 'post', headers: { 'X-My-Default-Header': undefined }, }); - expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); + expect(req.headers.get('x-my-default-header')).toEqual('2'); }); test('can be removed with `null`', () => { @@ -46,7 +46,7 @@ describe('instantiate client', () => { method: 'post', headers: { 'X-My-Default-Header': null }, }); - expect(req.headers as Headers).not.toHaveProperty('x-my-default-header'); + expect(req.headers.has('x-my-default-header')).toBe(false); }); }); @@ -124,7 +124,7 @@ describe('instantiate client', () => { test('normalized method', async () => { let capturedRequest: RequestInit | undefined; - const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + const testFetch = async (url: string | URL | Request, init: RequestInit = {}): Promise => { capturedRequest = init; return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); }; @@ -201,18 +201,6 @@ describe('instantiate client', () => { describe('request building', () => { const client = new OpenAI({ apiKey: 'My API Key' }); - describe('Content-Length', () => { - test('handles multi-byte characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: '—' } }); - expect((req.headers as Record)['content-length']).toEqual('20'); - }); - - test('handles standard characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' } }); - expect((req.headers as Record)['content-length']).toEqual('22'); - }); - }); - describe('custom headers', () => { test('handles undefined', () => { const { req } = client.buildRequest({ @@ -221,18 +209,92 @@ describe('request building', () => { body: { value: 'hello' }, headers: { 'X-Foo': 'baz', 'x-foo': 'bar', 'x-Foo': undefined, 'x-baz': 'bam', 'X-Baz': null }, }); - expect((req.headers as Record)['x-foo']).toEqual('bar'); - expect((req.headers as Record)['x-Foo']).toEqual(undefined); - expect((req.headers as Record)['X-Foo']).toEqual(undefined); - expect((req.headers as Record)['x-baz']).toEqual(undefined); + expect(req.headers.get('x-foo')).toEqual('bar'); + expect(req.headers.get('x-Foo')).toEqual('bar'); + expect(req.headers.get('X-Foo')).toEqual('bar'); + expect(req.headers.get('x-baz')).toEqual(null); + }); + }); +}); + +describe('default encoder', () => { + const client = new OpenAI({ apiKey: 'My API Key' }); + + class Serializable { + toJSON() { + return { $type: 'Serializable' }; + } + } + class Collection { + #things: T[]; + constructor(things: T[]) { + this.#things = Array.from(things); + } + toJSON() { + return Array.from(this.#things); + } + [Symbol.iterator]() { + return this.#things[Symbol.iterator]; + } + } + for (const jsonValue of [{}, [], { __proto__: null }, new Serializable(), new Collection(['item'])]) { + test(`serializes ${util.inspect(jsonValue)} as json`, () => { + const { req } = client.buildRequest({ + path: '/foo', + method: 'post', + body: jsonValue, + }); + expect(req.headers).toBeInstanceOf(Headers); + expect(req.headers.get('content-type')).toEqual('application/json'); + expect(req.body).toBe(JSON.stringify(jsonValue)); }); + } + + const encoder = new TextEncoder(); + const asyncIterable = (async function* () { + yield encoder.encode('a\n'); + yield encoder.encode('b\n'); + yield encoder.encode('c\n'); + })(); + for (const streamValue of [ + [encoder.encode('a\nb\nc\n')][Symbol.iterator](), + new Response('a\nb\nc\n').body, + asyncIterable, + ]) { + test(`converts ${util.inspect(streamValue)} to ReadableStream`, async () => { + const { req } = client.buildRequest({ + path: '/foo', + method: 'post', + body: streamValue, + }); + expect(req.headers).toBeInstanceOf(Headers); + expect(req.headers.get('content-type')).toEqual(null); + expect(req.body).toBeInstanceOf(ReadableStream); + expect(await new Response(req.body).text()).toBe('a\nb\nc\n'); + }); + } + + test(`can set content-type for ReadableStream`, async () => { + const { req } = client.buildRequest({ + path: '/foo', + method: 'post', + body: new Response('a\nb\nc\n').body, + headers: { 'Content-Type': 'text/plain' }, + }); + expect(req.headers).toBeInstanceOf(Headers); + expect(req.headers.get('content-type')).toEqual('text/plain'); + expect(req.body).toBeInstanceOf(ReadableStream); + expect(await new Response(req.body).text()).toBe('a\nb\nc\n'); }); }); describe('retries', () => { test('retry on timeout', async () => { let count = 0; - const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise => { + const testFetch = async ( + url: string | URL | Request, + { signal }: RequestInit = {}, + ): Promise => { if (count++ === 0) { return new Promise( (resolve, reject) => signal?.addEventListener('abort', () => reject(new Error('timed out'))), @@ -257,7 +319,7 @@ describe('retries', () => { test('retry count header', async () => { let count = 0; let capturedRequest: RequestInit | undefined; - const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + const testFetch = async (url: string | URL | Request, init: RequestInit = {}): Promise => { count++; if (count <= 2) { return new Response(undefined, { @@ -275,14 +337,14 @@ describe('retries', () => { expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 }); - expect((capturedRequest!.headers as Headers)['x-stainless-retry-count']).toEqual('2'); + expect((capturedRequest!.headers as Headers).get('x-stainless-retry-count')).toEqual('2'); expect(count).toEqual(3); }); test('omit retry count header', async () => { let count = 0; let capturedRequest: RequestInit | undefined; - const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + const testFetch = async (url: string | URL | Request, init: RequestInit = {}): Promise => { count++; if (count <= 2) { return new Response(undefined, { @@ -305,13 +367,13 @@ describe('retries', () => { }), ).toEqual({ a: 1 }); - expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count'); + expect((capturedRequest!.headers as Headers).has('x-stainless-retry-count')).toBe(false); }); test('omit retry count header by default', async () => { let count = 0; let capturedRequest: RequestInit | undefined; - const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + const testFetch = async (url: string | URL | Request, init: RequestInit = {}): Promise => { count++; if (count <= 2) { return new Response(undefined, { @@ -344,7 +406,7 @@ describe('retries', () => { test('overwrite retry count header', async () => { let count = 0; let capturedRequest: RequestInit | undefined; - const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + const testFetch = async (url: string | URL | Request, init: RequestInit = {}): Promise => { count++; if (count <= 2) { return new Response(undefined, { @@ -367,12 +429,15 @@ describe('retries', () => { }), ).toEqual({ a: 1 }); - expect((capturedRequest!.headers as Headers)['x-stainless-retry-count']).toBe('42'); + expect((capturedRequest!.headers as Headers).get('x-stainless-retry-count')).toEqual('42'); }); test('retry on 429 with retry-after', async () => { let count = 0; - const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise => { + const testFetch = async ( + url: string | URL | Request, + { signal }: RequestInit = {}, + ): Promise => { if (count++ === 0) { return new Response(undefined, { status: 429, @@ -399,7 +464,10 @@ describe('retries', () => { test('retry on 429 with retry-after-ms', async () => { let count = 0; - const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise => { + const testFetch = async ( + url: string | URL | Request, + { signal }: RequestInit = {}, + ): Promise => { if (count++ === 0) { return new Response(undefined, { status: 429, diff --git a/tests/responses.test.ts b/tests/responses.test.ts index 527763465..bf3457bbd 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -4,29 +4,6 @@ import { Headers } from 'openai/_shims/index'; import { Response } from 'node-fetch'; import { compareType } from './utils/typing'; -describe('response parsing', () => { - // TODO: test unicode characters - test('headers are case agnostic', async () => { - const headers = createResponseHeaders(new Headers({ 'Content-Type': 'foo', Accept: 'text/plain' })); - expect(headers['content-type']).toEqual('foo'); - expect(headers['Content-type']).toEqual('foo'); - expect(headers['Content-Type']).toEqual('foo'); - expect(headers['accept']).toEqual('text/plain'); - expect(headers['Accept']).toEqual('text/plain'); - expect(headers['Hello-World']).toBeUndefined(); - }); - - test('duplicate headers are concatenated', () => { - const headers = createResponseHeaders( - new Headers([ - ['Content-Type', 'text/xml'], - ['Content-Type', 'application/json'], - ]), - ); - expect(headers['content-type']).toBe('text/xml, application/json'); - }); -}); - describe('request id', () => { test('types', () => { compareType>, string>(true); diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 6fe9a5781..1bbdc861d 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,4 +1,3 @@ -import { Response } from 'node-fetch'; import { PassThrough } from 'stream'; import assert from 'assert'; import { _iterSSEMessages, _decodeChunks as decodeChunks } from 'openai/streaming'; diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index b64b80285..16456daf6 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,6 +1,5 @@ import fs from 'fs'; import { toFile, type ResponseLike } from 'openai/uploads'; -import { File } from 'openai/_shims/index'; class MyClass { name: string = 'foo'; @@ -63,3 +62,14 @@ describe('toFile', () => { expect(file.type).toBe('jsonl'); }); }); + +test('missing File error message', async () => { + // @ts-ignore + globalThis.File = undefined; + + await expect( + toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })), + ).rejects.toMatchInlineSnapshot( + `[Error: \`File\` is not defined as a global which is required for file uploads]`, + ); +}); diff --git a/tsconfig.build.json b/tsconfig.build.json index 45811cb8b..664392bed 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "include": ["dist/src"], - "exclude": ["dist/src/_shims/*-deno.ts"], + "exclude": [], "compilerOptions": { "rootDir": "./dist/src", "paths": { diff --git a/tsconfig.dist-src.json b/tsconfig.dist-src.json index e9f2d70b0..0f6aba91b 100644 --- a/tsconfig.dist-src.json +++ b/tsconfig.dist-src.json @@ -5,7 +5,7 @@ "include": ["index.ts"], "compilerOptions": { "target": "es2015", - "lib": ["DOM"], + "lib": ["DOM", "DOM.Iterable"], "moduleResolution": "node" } } diff --git a/tsconfig.json b/tsconfig.json index 33767f7b1..02c80162e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "include": ["src", "tests", "examples"], - "exclude": ["src/_shims/**/*-deno.ts"], + "exclude": [], "compilerOptions": { "target": "es2020", "lib": ["es2020"], @@ -9,7 +9,6 @@ "esModuleInterop": true, "baseUrl": "./", "paths": { - "openai/_shims/auto/*": ["src/_shims/auto/*-node"], "openai/*": ["src/*"], "openai": ["src/index.ts"] }, diff --git a/yarn.lock b/yarn.lock index c0220f984..de41e5502 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15,6 +15,37 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@andrewbranch/untar.js@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@andrewbranch/untar.js/-/untar.js-1.0.3.tgz#ba9494f85eb83017c5c855763969caf1d0adea00" + integrity sha512-Jh15/qVmrLGhkKJBdXlK1+9tY4lZruYjsgkDFj08ZmDiWVBLJcqkok7Z0/R0In+i1rScBpJlSvrTS2Lm41Pbnw== + +"@arethetypeswrong/cli@^0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@arethetypeswrong/cli/-/cli-0.17.0.tgz#f97f10926b3f9f9eb5117550242d2e06c25cadac" + integrity sha512-xSMW7bfzVWpYw5JFgZqBXqr6PdR0/REmn3DkxCES5N0JTcB0CVgbIynJCvKBFmXaPc3hzmmTrb7+yPDRoOSZdA== + dependencies: + "@arethetypeswrong/core" "0.17.0" + chalk "^4.1.2" + cli-table3 "^0.6.3" + commander "^10.0.1" + marked "^9.1.2" + marked-terminal "^7.1.0" + semver "^7.5.4" + +"@arethetypeswrong/core@0.17.0": + version "0.17.0" + resolved "https://registry.yarnpkg.com/@arethetypeswrong/core/-/core-0.17.0.tgz#abb3b5f425056d37193644c2a2de4aecf866b76b" + integrity sha512-FHyhFizXNetigTVsIhqXKGYLpazPS5YNojEPpZEUcBPt9wVvoEbNIvG+hybuBR+pjlRcbyuqhukHZm1fr+bDgA== + dependencies: + "@andrewbranch/untar.js" "^1.0.3" + cjs-module-lexer "^1.2.3" + fflate "^0.8.2" + lru-cache "^10.4.3" + semver "^7.5.4" + typescript "5.6.1-rc" + validate-npm-package-name "^5.0.0" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": version "7.23.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" @@ -302,6 +333,11 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@colors/colors@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" + integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ== + "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" @@ -655,6 +691,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== +"@sindresorhus/is@^4.6.0": + version "4.6.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" + integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== + "@sinonjs/commons@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" @@ -851,14 +892,6 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/node-fetch@^2.6.4": - version "2.6.4" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660" - integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node@*": version "20.10.5" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" @@ -866,10 +899,12 @@ dependencies: undici-types "~5.26.4" -"@types/node@^18.11.18": - version "18.11.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" - integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== +"@types/node@^20.17.6": + version "20.17.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.6.tgz#6e4073230c180d3579e8c60141f99efdf5df0081" + integrity sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ== + dependencies: + undici-types "~6.19.2" "@types/semver@^7.5.0": version "7.5.8" @@ -910,7 +945,7 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/parser@^6.7.0": +"@typescript-eslint/parser@^6.0.0": version "6.21.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== @@ -979,13 +1014,6 @@ "@typescript-eslint/types" "6.21.0" eslint-visitor-keys "^3.4.1" -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1006,15 +1034,6 @@ acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -agentkeepalive@^4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" - integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA== - dependencies: - debug "^4.1.0" - depd "^1.1.2" - humanize-ms "^1.2.1" - aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1040,11 +1059,23 @@ ansi-escapes@^4.2.1: dependencies: type-fest "^0.21.3" +ansi-escapes@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-7.0.0.tgz#00fc19f491bbb18e1d481b97868204f92109bfe7" + integrity sha512-GdYO7a61mR0fOlAsvC9/rIHf7L96sBc6dEWzeOu+KAea5bZyQRPIpojrVoI4AXGJS/ycu/fBTdLrUkA4ODrvjw== + dependencies: + environment "^1.0.0" + ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-regex@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" + integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -1064,6 +1095,11 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + anymatch@^3.0.3: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -1094,11 +1130,6 @@ array-union@^2.1.0: resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -asynckit@^0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" - integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= - babel-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" @@ -1169,13 +1200,6 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== -bindings@^1.2.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== - dependencies: - file-uri-to-path "1.0.0" - bplist-parser@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" @@ -1270,7 +1294,7 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0: +chalk@^4.0.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1278,6 +1302,11 @@ chalk@^4.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== + char-regex@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" @@ -1293,11 +1322,46 @@ cjs-module-lexer@^1.0.0: resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== +cjs-module-lexer@^1.2.3: + version "1.4.1" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz#707413784dbb3a72aa11c2f2b042a0bef4004170" + integrity sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA== + clean-stack@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== +cli-highlight@^2.1.11: + version "2.1.11" + resolved "https://registry.yarnpkg.com/cli-highlight/-/cli-highlight-2.1.11.tgz#49736fa452f0aaf4fae580e30acb26828d2dc1bf" + integrity sha512-9KDcoEVwyUXrjcJNvHD0NFc/hiwe/WPVYIleQh2O1N2Zro5gWJZ/K+3DGn8w8P/F6FxOgzyC5bxDyHIgCSPhGg== + dependencies: + chalk "^4.0.0" + highlight.js "^10.7.1" + mz "^2.4.0" + parse5 "^5.1.1" + parse5-htmlparser2-tree-adapter "^6.0.0" + yargs "^16.0.0" + +cli-table3@^0.6.3, cli-table3@^0.6.5: + version "0.6.5" + resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.5.tgz#013b91351762739c16a9567c21a04632e449bf2f" + integrity sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ== + dependencies: + string-width "^4.2.0" + optionalDependencies: + "@colors/colors" "1.5.0" + +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + cliui@^8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" @@ -1341,12 +1405,10 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -combined-stream@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" - integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== - dependencies: - delayed-stream "~1.0.0" +commander@^10.0.1: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== concat-map@0.0.1: version "0.0.1" @@ -1392,7 +1454,7 @@ debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: dependencies: ms "2.1.2" -debug@^4.3.4: +debug@^4.3.4, debug@^4.3.7: version "4.3.7" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== @@ -1437,16 +1499,6 @@ define-lazy-prop@^3.0.0: resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== -delayed-stream@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" - integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= - -depd@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -1491,6 +1543,16 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emojilib@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/emojilib/-/emojilib-2.4.0.tgz#ac518a8bb0d5f76dda57289ccb2fdf9d39ae721e" + integrity sha512-5U0rVMU5Y2n2+ykNLQqMoqklN9ICBT/KsvC1Gz6vqHbz2AXXGkG+Pm5rMWk/8Vjrr/mY9985Hi8DYzn1F09Nyw== + +environment@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/environment/-/environment-1.1.0.tgz#8e86c66b180f363c7ab311787e0259665f45a9f1" + integrity sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -1632,11 +1694,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - execa@^5.0.0: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" @@ -1684,9 +1741,9 @@ expect@^29.0.0, expect@^29.7.0: jest-util "^29.7.0" fast-check@^3.22.0: - version "3.22.0" - resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-3.22.0.tgz#1a8153e9d6fbdcc60b818f447cbb9cac1fdd8fb6" - integrity sha512-8HKz3qXqnHYp/VCNn2qfjHdAdcI8zcSqOyX64GOMukp7SL2bfzfeDKjSd+UyECtejccaZv3LcvZTm9YDD22iCQ== + version "3.23.2" + resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-3.23.2.tgz#0129f1eb7e4f500f58e8290edc83c670e4a574a2" + integrity sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A== dependencies: pure-rand "^6.1.0" @@ -1700,18 +1757,7 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.12: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.2.9, fast-glob@^3.3.0: +fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1746,6 +1792,11 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fflate@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea" + integrity sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A== + file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -1753,11 +1804,6 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -1794,28 +1840,6 @@ flatted@^3.1.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== -form-data-encoder@1.7.2: - version "1.7.2" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" - integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== - -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - -formdata-node@^4.3.2: - version "4.3.3" - resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.3.3.tgz#21415225be66e2c87a917bfc0fedab30a119c23c" - integrity sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA== - dependencies: - node-domexception "1.0.0" - web-streams-polyfill "4.0.0-beta.1" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -1882,6 +1906,17 @@ glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.0.1: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" @@ -1933,6 +1968,11 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" +highlight.js@^10.7.1: + version "10.7.3" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.7.3.tgz#697272e3991356e40c3cac566a74eef681756531" + integrity sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A== + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" @@ -1948,13 +1988,6 @@ human-signals@^4.3.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== -humanize-ms@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" - integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= - dependencies: - ms "^2.0.0" - iconv-lite@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" @@ -1962,6 +1995,13 @@ iconv-lite@^0.6.3: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +ignore-walk@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-5.0.1.tgz#5f199e23e1288f518d90358d461387788a154776" + integrity sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw== + dependencies: + minimatch "^5.0.1" + ignore@^5.2.0, ignore@^5.2.4: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" @@ -2597,6 +2637,11 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lru-cache@^10.4.3: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -2630,6 +2675,24 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +marked-terminal@^7.1.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/marked-terminal/-/marked-terminal-7.2.1.tgz#9c1ae073a245a03c6a13e3eeac6f586f29856068" + integrity sha512-rQ1MoMFXZICWNsKMiiHwP/Z+92PLKskTPXj+e7uwXmuMPkNn7iTqC+IvDekVm1MPeC9wYQeLxeFaOvudRR/XbQ== + dependencies: + ansi-escapes "^7.0.0" + ansi-regex "^6.1.0" + chalk "^5.3.0" + cli-highlight "^2.1.11" + cli-table3 "^0.6.5" + node-emoji "^2.1.3" + supports-hyperlinks "^3.1.0" + +marked@^9.1.2: + version "9.1.6" + resolved "https://registry.yarnpkg.com/marked/-/marked-9.1.6.tgz#5d2a3f8180abfbc5d62e3258a38a1c19c0381695" + integrity sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q== + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" @@ -2648,18 +2711,6 @@ micromatch@^4.0.4: braces "^3.0.3" picomatch "^2.3.1" -mime-db@1.51.0: - version "1.51.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" - integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== - -mime-types@^2.1.12: - version "2.1.34" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" - integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== - dependencies: - mime-db "1.51.0" - mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" @@ -2684,42 +2735,56 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +mri@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" + integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== + ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@^2.0.0, ms@^2.1.3: +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -nan@^2.14.0: - version "2.22.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.0.tgz#31bc433fc33213c97bad36404bb68063de604de3" - integrity sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw== +mz@^2.4.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -node-domexception@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - -node-fetch@^2.6.7: - version "2.6.11" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" - integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== +node-emoji@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/node-emoji/-/node-emoji-2.1.3.tgz#93cfabb5cc7c3653aa52f29d6ffb7927d8047c06" + integrity sha512-E2WEOVsgs7O16zsURJ/eH8BqhF029wGpEOnv7Urwdo2wmQanOACwJQh0devF9D9RhoZru0+9JXIS0dBXIAz+lA== dependencies: - whatwg-url "^5.0.0" + "@sindresorhus/is" "^4.6.0" + char-regex "^1.0.2" + emojilib "^2.4.0" + skin-tone "^2.0.0" node-int64@^0.4.0: version "0.4.0" @@ -2736,6 +2801,28 @@ normalize-path@^3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +npm-bundled@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-2.0.1.tgz#94113f7eb342cd7a67de1e789f896b04d2c600f4" + integrity sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw== + dependencies: + npm-normalize-package-bin "^2.0.0" + +npm-normalize-package-bin@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-2.0.0.tgz#9447a1adaaf89d8ad0abe24c6c84ad614a675fff" + integrity sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ== + +npm-packlist@^5.1.3: + version "5.1.3" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.3.tgz#69d253e6fd664b9058b85005905012e00e69274b" + integrity sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg== + dependencies: + glob "^8.0.1" + ignore-walk "^5.0.1" + npm-bundled "^2.0.0" + npm-normalize-package-bin "^2.0.0" + npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" @@ -2750,6 +2837,11 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -2857,6 +2949,23 @@ parse-json@^5.2.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse5-htmlparser2-tree-adapter@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + +parse5@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178" + integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug== + +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" @@ -2892,6 +3001,11 @@ picocolors@^1.0.0: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -2914,11 +3028,6 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -"prettier-2@npm:prettier@^2": - version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" - integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== - prettier-linter-helpers@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" @@ -2948,6 +3057,15 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +publint@^0.2.12: + version "0.2.12" + resolved "https://registry.yarnpkg.com/publint/-/publint-0.2.12.tgz#d25cd6bd243d5bdd640344ecdddb3eeafdcc4059" + integrity sha512-YNeUtCVeM4j9nDiTT2OPczmlyzOkIXNtdDZnSuajAxS/nZ6j3t7Vs9SUB4euQNddiltIwu7Tdd3s+hr08fAsMw== + dependencies: + npm-packlist "^5.1.3" + picocolors "^1.1.1" + sade "^1.8.1" + punycode@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" @@ -3044,6 +3162,13 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +sade@^1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.8.1.tgz#0a78e81d658d394887be57d2a409bf703a3b2701" + integrity sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A== + dependencies: + mri "^1.1.0" + safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -3054,14 +3179,6 @@ safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -segfault-handler@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/segfault-handler/-/segfault-handler-1.3.0.tgz#054bc847832fa14f218ba6a79e42877501c8870e" - integrity sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg== - dependencies: - bindings "^1.2.1" - nan "^2.14.0" - semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" @@ -3101,6 +3218,13 @@ sisteransi@^1.0.5: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== +skin-tone@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/skin-tone/-/skin-tone-2.0.0.tgz#4e3933ab45c0d4f4f781745d64b9f4c208e41237" + integrity sha512-kUMbT1oBJCpgrnKoSr0o6wPtvRWT9W9UKvGLwfJYO2WuahZRHOpEyL1ckyMGgMWh0UdpmaoFqKKD29WTomNEGA== + dependencies: + unicode-emoji-modifier-base "^1.0.0" + slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" @@ -3194,10 +3318,10 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -superstruct@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" - integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== +superstruct@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.4.tgz#0adb99a7578bd2f1c526220da6571b2d485d91ca" + integrity sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ== supports-color@^5.3.0: version "5.5.0" @@ -3206,7 +3330,7 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.1.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -3220,6 +3344,14 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" +supports-hyperlinks@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-3.1.0.tgz#b56150ff0173baacc15f21956450b61f2b18d3ac" + integrity sha512-2rn0BZ+/f7puLOHZm1HOJfwBggfaHXUpPUSSG/SWM4TWp5KCfmNYwnC3hruy2rZlMnmWZ+QAGpZfchu3f3695A== + dependencies: + has-flag "^4.0.0" + supports-color "^7.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -3247,6 +3379,20 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + titleize@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" @@ -3269,11 +3415,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tr46@~0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" - integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= - ts-api-utils@^1.0.1: version "1.3.0" resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" @@ -3312,21 +3453,20 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -tsc-multi@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/tsc-multi/-/tsc-multi-1.1.0.tgz#0e2b03c0ed0ac58ecb556f11709441102d202680" - integrity sha512-THE6X+sse7EZ2qMhqXvBhd2HMTvXyWwYnx+2T/ijqdp/6Rf7rUc2uPRzPdrrljZCNcYDeL0qP2P7tqm2IwayTg== +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz": + version "1.1.3" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz#8fc21fc95b247b86721b95fabfb10c6a436134c3" dependencies: - debug "^4.3.4" - fast-glob "^3.2.12" + debug "^4.3.7" + fast-glob "^3.3.2" get-stdin "^8.0.0" p-all "^3.0.0" - picocolors "^1.0.0" + picocolors "^1.1.1" signal-exit "^3.0.7" string-to-stream "^3.0.1" - superstruct "^1.0.3" - tslib "^2.5.0" - yargs "^17.7.1" + superstruct "^1.0.4" + tslib "^2.8.1" + yargs "^17.7.2" tsconfig-paths@^4.0.0: version "4.2.0" @@ -3337,16 +3477,16 @@ tsconfig-paths@^4.0.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" - integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== - tslib@^2.6.0, tslib@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== +tslib@^2.8.1: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -3369,6 +3509,11 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +typescript@5.6.1-rc: + version "5.6.1-rc" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.1-rc.tgz#d5e4d7d8170174fed607b74cc32aba3d77018e02" + integrity sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ== + typescript@^4.8.2: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" @@ -3379,6 +3524,16 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@~6.19.2: + version "6.19.8" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + +unicode-emoji-modifier-base@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz#dbbd5b54ba30f287e2a8d5a249da6c0cef369459" + integrity sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g== + untildify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" @@ -3418,6 +3573,11 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^2.0.0" +validate-npm-package-name@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz#a316573e9b49f3ccd90dbb6eb52b3f06c6d604e8" + integrity sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ== + walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" @@ -3425,24 +3585,6 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" -web-streams-polyfill@4.0.0-beta.1: - version "4.0.0-beta.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz#3b19b9817374b7cee06d374ba7eeb3aeb80e8c95" - integrity sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ== - -webidl-conversions@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" - integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= - -whatwg-url@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" - integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= - dependencies: - tr46 "~0.0.3" - webidl-conversions "^3.0.0" - which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -3487,12 +3629,30 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yargs-parser@^20.2.2: + version "20.2.9" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== + yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^17.3.1, yargs@^17.7.1: +yargs@^16.0.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + +yargs@^17.3.1, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== @@ -3516,6 +3676,6 @@ yocto-queue@^0.1.0: integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== zod@^3.23.8: - version "3.23.8" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" - integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== + version "3.24.1" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.24.1.tgz#27445c912738c8ad1e9de1bea0359fa44d9d35ee" + integrity sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A== From 0edf7d232ed152d314266778e4490914e93cc9b5 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:18:11 +0000 Subject: [PATCH 070/509] fixes --- .eslintrc.js | 2 +- src/api-promise.ts | 2 +- src/azure.ts | 22 ++++---- src/lib/AbstractChatCompletionRunner.ts | 8 +-- src/lib/AssistantStream.ts | 33 +++++------ src/lib/ChatCompletionStream.ts | 10 ++-- src/lib/ChatCompletionStreamingRunner.ts | 2 +- src/pagination.ts | 10 +++- src/resources/beta/chat/completions.ts | 48 +++------------- src/resources/beta/threads/runs/index.ts | 7 +-- src/resources/beta/threads/runs/runs.ts | 55 ++++++++----------- src/resources/beta/threads/threads.ts | 11 +--- .../beta/vector-stores/file-batches.ts | 38 ++++++++----- src/resources/beta/vector-stores/files.ts | 42 ++++++++------ tests/responses.test.ts | 3 +- 15 files changed, 130 insertions(+), 163 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c12fdc463..64ffc67b1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -19,7 +19,7 @@ module.exports = { }, overrides: [ { - files: ['tests/**', 'examples/**'], + files: ['tests/**', 'examples/**', 'ecosystem-tests/**'], rules: { 'no-restricted-imports': 'off', }, diff --git a/src/api-promise.ts b/src/api-promise.ts index fd39a6364..5786070a6 100644 --- a/src/api-promise.ts +++ b/src/api-promise.ts @@ -62,7 +62,7 @@ export class APIPromise extends Promise> { * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` * to your `tsconfig.json`. */ - async withResponse(): Promise<{ data: T; response: Response }> { + async withResponse(): Promise<{ data: T; response: Response; request_id: string | null }> { const [data, response] = await Promise.all([this.parse(), this.asResponse()]); return { data, response, request_id: response.headers.get('x-request-id') }; } diff --git a/src/azure.ts b/src/azure.ts index 5fd30d40f..72924707d 100644 --- a/src/azure.ts +++ b/src/azure.ts @@ -124,11 +124,10 @@ export class AzureOpenAI extends OpenAI { this._deployment = deployment; } - override buildRequest(options: FinalRequestOptions): { - req: RequestInit; - url: string; - timeout: number; - } { + override buildRequest( + options: FinalRequestOptions, + props: { retryCount?: number } = {}, + ): { req: RequestInit & { headers: Headers }; url: string; timeout: number } { if (_deployments_endpoints.has(options.path) && options.method === 'post' && options.body !== undefined) { if (!isObj(options.body)) { throw new Error('Expected request body to be an object'); @@ -138,7 +137,7 @@ export class AzureOpenAI extends OpenAI { options.path = `/deployments/${model}${options.path}`; } } - return super.buildRequest(options); + return super.buildRequest(options, props); } private async _getAzureADToken(): Promise { @@ -159,21 +158,23 @@ export class AzureOpenAI extends OpenAI { } protected override async prepareOptions(opts: FinalRequestOptions): Promise { + opts.headers = buildHeaders([opts.headers]); + /** * The user should provide a bearer token provider if they want * to use Azure AD authentication. The user shouldn't set the * Authorization header manually because the header is overwritten * with the Azure AD token if a bearer token provider is provided. */ - if (opts.headers?.['api-key']) { + if (opts.headers.values.get('Authorization') || opts.headers.values.get('api-key')) { return super.prepareOptions(opts); } + const token = await this._getAzureADToken(); - opts.headers ??= {}; if (token) { - opts.headers['Authorization'] = `Bearer ${token}`; + opts.headers.values.set('Authorization', `Bearer ${token}`); } else if (this.apiKey !== API_KEY_SENTINEL) { - opts.headers['api-key'] = this.apiKey; + opts.headers.values.set('api-key', this.apiKey); } else { throw new Errors.OpenAIError('Unable to handle auth'); } @@ -189,6 +190,7 @@ const _deployments_endpoints = new Set([ '/audio/translations', '/audio/speech', '/images/generations', + '/batches', ]); const API_KEY_SENTINEL = ''; diff --git a/src/lib/AbstractChatCompletionRunner.ts b/src/lib/AbstractChatCompletionRunner.ts index 406f5a431..144196aae 100644 --- a/src/lib/AbstractChatCompletionRunner.ts +++ b/src/lib/AbstractChatCompletionRunner.ts @@ -1,4 +1,3 @@ -import * as Core from '../core'; import { type CompletionUsage } from '../resources/completions'; import { type ChatCompletion, @@ -24,9 +23,10 @@ import { BaseEvents, EventStream } from './EventStream'; import { ParsedChatCompletion } from '../resources/beta/chat/completions'; import OpenAI from '../index'; import { isAutoParsableTool, parseChatCompletion } from '../lib/parser'; +import { RequestOptions } from '../internal/request-options'; const DEFAULT_MAX_CHAT_COMPLETIONS = 10; -export interface RunnerOptions extends Core.RequestOptions { +export interface RunnerOptions extends RequestOptions { /** How many requests to make before canceling. Default 10. */ maxChatCompletions?: number; } @@ -238,7 +238,7 @@ export class AbstractChatCompletionRunner< protected async _createChatCompletion( client: OpenAI, params: ChatCompletionCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise> { const signal = options?.signal; if (signal) { @@ -258,7 +258,7 @@ export class AbstractChatCompletionRunner< protected async _runChatCompletion( client: OpenAI, params: ChatCompletionCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { for (const message of params.messages) { this._addMessage(message, false); diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index caf68e7dd..df7dc419d 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -9,8 +9,7 @@ import { MessageDelta, MessageContent, } from '../resources/beta/threads/messages'; -import * as Core from '../core'; -import { RequestOptions } from '../core'; +import { RequestOptions } from '../internal/request-options'; import { Run, RunCreateParamsBase, @@ -19,7 +18,7 @@ import { RunSubmitToolOutputsParamsBase, RunSubmitToolOutputsParamsStreaming, } from '../resources/beta/threads/runs/runs'; -import { type ReadableStream } from '../_shims/index'; +import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import { APIUserAbortError, OpenAIError } from '../error'; import { @@ -31,6 +30,7 @@ import { import { RunStep, RunStepDelta, ToolCall, ToolCallDelta } from '../resources/beta/threads/runs/steps'; import { ThreadCreateAndRunParamsBase, Threads } from '../resources/beta/threads/threads'; import { BaseEvents, EventStream } from './EventStream'; +import { isObj } from '../internal/utils'; export interface AssistantStreamEvents extends BaseEvents { run: (run: Run) => void; @@ -163,7 +163,7 @@ export class AssistantStream protected async _fromReadableStream( readableStream: ReadableStream, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { const signal = options?.signal; if (signal) { @@ -187,7 +187,6 @@ export class AssistantStream } static createToolAssistantStream( - threadId: string, runId: string, runs: Runs, params: RunSubmitToolOutputsParamsStream, @@ -195,7 +194,7 @@ export class AssistantStream ): AssistantStream { const runner = new AssistantStream(); runner._run(() => - runner._runToolAssistantStream(threadId, runId, runs, params, { + runner._runToolAssistantStream(runId, runs, params, { ...options, headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'stream' }, }), @@ -205,10 +204,9 @@ export class AssistantStream protected async _createToolAssistantStream( run: Runs, - threadId: string, runId: string, params: RunSubmitToolOutputsParamsStream, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { const signal = options?.signal; if (signal) { @@ -217,7 +215,7 @@ export class AssistantStream } const body: RunSubmitToolOutputsParamsStreaming = { ...params, stream: true }; - const stream = await run.submitToolOutputs(threadId, runId, body, { + const stream = await run.submitToolOutputs(runId, body, { ...options, signal: this.controller.signal, }); @@ -303,7 +301,7 @@ export class AssistantStream protected async _createThreadAssistantStream( thread: Threads, params: ThreadCreateAndRunParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { const signal = options?.signal; if (signal) { @@ -330,7 +328,7 @@ export class AssistantStream run: Runs, threadId: string, params: RunCreateParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { const signal = options?.signal; if (signal) { @@ -676,7 +674,7 @@ export class AssistantStream accValue += deltaValue; } else if (typeof accValue === 'number' && typeof deltaValue === 'number') { accValue += deltaValue; - } else if (Core.isObj(accValue) && Core.isObj(deltaValue)) { + } else if (isObj(accValue) && isObj(deltaValue)) { accValue = this.accumulateDelta(accValue as Record, deltaValue as Record); } else if (Array.isArray(accValue) && Array.isArray(deltaValue)) { if (accValue.every((x) => typeof x === 'string' || typeof x === 'number')) { @@ -685,7 +683,7 @@ export class AssistantStream } for (const deltaEntry of deltaValue) { - if (!Core.isObj(deltaEntry)) { + if (!isObj(deltaEntry)) { throw new Error(`Expected array delta entry to be an object but got: ${deltaEntry}`); } @@ -748,7 +746,7 @@ export class AssistantStream protected async _threadAssistantStream( params: ThreadCreateAndRunParamsBase, thread: Threads, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { return await this._createThreadAssistantStream(thread, params, options); } @@ -757,18 +755,17 @@ export class AssistantStream threadId: string, runs: Runs, params: RunCreateParamsBase, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { return await this._createAssistantStream(runs, threadId, params, options); } protected async _runToolAssistantStream( - threadId: string, runId: string, runs: Runs, params: RunSubmitToolOutputsParamsStream, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { - return await this._createToolAssistantStream(runs, threadId, runId, params, options); + return await this._createToolAssistantStream(runs, runId, params, options); } } diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index a88f8a23b..a6747aeb1 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -1,4 +1,3 @@ -import * as Core from '../core'; import { OpenAIError, APIUserAbortError, @@ -17,7 +16,7 @@ import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from '../_shims/index'; +import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import OpenAI from '../index'; import { ParsedChatCompletion } from '../resources/beta/chat/completions'; @@ -30,6 +29,7 @@ import { shouldParseToolCall, } from '../lib/parser'; import { partialParse } from '../_vendor/partial-json-parser/parser'; +import { RequestOptions } from '../internal/request-options'; export interface ContentDeltaEvent { delta: string; @@ -158,7 +158,7 @@ export class ChatCompletionStream static createChatCompletion( client: OpenAI, params: ChatCompletionStreamParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): ChatCompletionStream { const runner = new ChatCompletionStream(params as ChatCompletionCreateParamsStreaming); runner._run(() => @@ -368,7 +368,7 @@ export class ChatCompletionStream protected override async _createChatCompletion( client: OpenAI, params: ChatCompletionCreateParams, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise> { super._createChatCompletion; const signal = options?.signal; @@ -394,7 +394,7 @@ export class ChatCompletionStream protected async _fromReadableStream( readableStream: ReadableStream, - options?: Core.RequestOptions, + options?: RequestOptions, ): Promise { const signal = options?.signal; if (signal) { diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index ba0c6496f..32b66b006 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -3,7 +3,7 @@ import { type ChatCompletionCreateParamsStreaming, } from '../resources/chat/completions'; import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from '../_shims/index'; +import { type ReadableStream } from '../internal/shim-types'; import { RunnableTools, type BaseFunctionsArgs, type RunnableFunctions } from './RunnableFunction'; import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream'; import OpenAI from '../index'; diff --git a/src/pagination.ts b/src/pagination.ts index 068c82490..b45b64eae 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -3,7 +3,7 @@ import type { OpenAI } from './client'; import { OpenAIError } from './error'; import { FinalRequestOptions } from './internal/request-options'; -import { defaultParseResponse } from './internal/parse'; +import { defaultParseResponse, WithRequestID } from './internal/parse'; import { APIPromise } from './api-promise'; import { type APIResponseProps } from './internal/parse'; import { maybeObj } from './internal/utils/values'; @@ -87,7 +87,13 @@ export class PagePromise< ) { super( request, - async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options), + async (props) => + new Page( + client, + props.response, + await defaultParseResponse(props), + props.options, + ) as WithRequestID, ); } diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index c9360a95c..e2423d553 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -1,13 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Core from '../../../core'; import { APIResource } from '../../../resource'; -import { ChatCompletionRunner, ChatCompletionFunctionRunnerParams } from '../../../lib/ChatCompletionRunner'; -import { - ChatCompletionStreamingRunner, - ChatCompletionStreamingFunctionRunnerParams, -} from '../../../lib/ChatCompletionStreamingRunner'; -import { BaseFunctionsArgs } from '../../../lib/RunnableFunction'; +import { ChatCompletionRunner } from '../../../lib/ChatCompletionRunner'; +import { ChatCompletionStreamingRunner } from '../../../lib/ChatCompletionStreamingRunner'; import { RunnerOptions } from '../../../lib/AbstractChatCompletionRunner'; import { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; import { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; @@ -39,6 +34,8 @@ export { ChatCompletionRunner, type ChatCompletionFunctionRunnerParams, } from '../../../lib/ChatCompletionRunner'; +import { RequestOptions } from '../../../internal/request-options'; +import { type APIPromise } from '../../../index'; export interface ParsedFunction extends ChatCompletionMessageToolCall.Function { parsed_arguments?: unknown; @@ -66,8 +63,8 @@ export type ChatCompletionParseParams = ChatCompletionCreateParamsNonStreaming; export class Completions extends APIResource { parse>( body: Params, - options?: Core.RequestOptions, - ): Core.APIPromise> { + options?: RequestOptions, + ): APIPromise> { validateInputTools(body.tools); return this._client.chat.completions @@ -81,37 +78,6 @@ export class Completions extends APIResource { ._thenUnwrap((completion) => parseChatCompletion(completion, body)); } - /** - * @deprecated - use `runTools` instead. - */ - runFunctions( - body: ChatCompletionFunctionRunnerParams, - options?: Core.RequestOptions, - ): ChatCompletionRunner; - runFunctions( - body: ChatCompletionStreamingFunctionRunnerParams, - options?: Core.RequestOptions, - ): ChatCompletionStreamingRunner; - runFunctions( - body: - | ChatCompletionFunctionRunnerParams - | ChatCompletionStreamingFunctionRunnerParams, - options?: Core.RequestOptions, - ): ChatCompletionRunner | ChatCompletionStreamingRunner { - if (body.stream) { - return ChatCompletionStreamingRunner.runFunctions( - this._client, - body as ChatCompletionStreamingFunctionRunnerParams, - options, - ); - } - return ChatCompletionRunner.runFunctions( - this._client, - body as ChatCompletionFunctionRunnerParams, - options, - ); - } - /** * A convenience helper for using tool calls with the /chat/completions endpoint * which automatically calls the JavaScript functions you provide and sends their @@ -154,7 +120,7 @@ export class Completions extends APIResource { */ stream>( body: Params, - options?: Core.RequestOptions, + options?: RequestOptions, ): ChatCompletionStream { return ChatCompletionStream.createChatCompletion(this._client, body, options); } diff --git a/src/resources/beta/threads/runs/index.ts b/src/resources/beta/threads/runs/index.ts index 5cee3e75b..59c6a186c 100644 --- a/src/resources/beta/threads/runs/index.ts +++ b/src/resources/beta/threads/runs/index.ts @@ -16,15 +16,11 @@ export { type RunSubmitToolOutputsParamsNonStreaming, type RunSubmitToolOutputsParamsStreaming, type RunsPage, - type RunStepInclude, type RunCreateAndPollParams, type RunCreateAndStreamParams, type RunStreamParams, type RunSubmitToolOutputsAndPollParams, type RunSubmitToolOutputsStreamParams, - type RunCreateAndPollParams, - type RunCreateAndStreamParams, - type RunStreamParams, } from './runs'; export { Steps, @@ -38,6 +34,7 @@ export { type FunctionToolCallDelta, type MessageCreationStepDetails, type RunStep, + type RunStepInclude, type RunStepDelta, type RunStepDeltaEvent, type RunStepDeltaMessageDelta, @@ -48,4 +45,4 @@ export { type StepRetrieveParams, type StepListParams, type RunStepsPage, -} from './steps'; \ No newline at end of file +} from './steps'; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index bbcc5b6c1..1cbf7dde6 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -36,8 +36,9 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagi import { Stream } from '../../../../streaming'; import { RequestOptions } from '../../../../internal/request-options'; import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; -import { sleep } from '../../../../core'; +import { sleep } from '../../../../internal/utils/sleep'; import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; +import { buildHeaders } from '../../../../internal/headers'; export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); @@ -128,10 +129,10 @@ export class Runs extends APIResource { async createAndPoll( threadId: string, body: RunCreateParamsNonStreaming, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { const run = await this.create(threadId, body, options); - return await this.poll(threadId, run.id, options); + return await this.poll(run.id, { thread_id: threadId }, options); } /** @@ -142,7 +143,7 @@ export class Runs extends APIResource { createAndStream( threadId: string, body: RunCreateParamsBaseStream, - options?: Core.RequestOptions, + options?: RequestOptions, ): AssistantStream { return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options); } @@ -153,18 +154,20 @@ export class Runs extends APIResource { * https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps */ async poll( - threadId: string, runId: string, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + params: RunRetrieveParams, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { - const headers: { [key: string]: string } = { ...options?.headers, 'X-Stainless-Poll-Helper': 'true' }; - - if (options?.pollIntervalMs) { - headers['X-Stainless-Custom-Poll-Interval'] = options.pollIntervalMs.toString(); - } + const headers = buildHeaders([ + options?.headers, + { + 'X-Stainless-Poll-Helper': 'true', + 'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined, + }, + ]); while (true) { - const { data: run, response } = await this.retrieve(threadId, runId, { + const { data: run, response } = await this.retrieve(runId, params, { ...options, headers: { ...options?.headers, ...headers }, }).withResponse(); @@ -204,7 +207,7 @@ export class Runs extends APIResource { /** * Create a Run stream */ - stream(threadId: string, body: RunCreateParamsBaseStream, options?: Core.RequestOptions): AssistantStream { + stream(threadId: string, body: RunCreateParamsBaseStream, options?: RequestOptions): AssistantStream { return AssistantStream.createAssistantStream(threadId, this._client.beta.threads.runs, body, options); } @@ -249,13 +252,12 @@ export class Runs extends APIResource { * https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps */ async submitToolOutputsAndPoll( - threadId: string, runId: string, - body: RunSubmitToolOutputsParamsNonStreaming, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + params: RunSubmitToolOutputsParamsNonStreaming, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { - const run = await this.submitToolOutputs(threadId, runId, body, options); - return await this.poll(threadId, run.id, options); + const run = await this.submitToolOutputs(runId, params, options); + return await this.poll(run.id, params, options); } /** @@ -264,18 +266,11 @@ export class Runs extends APIResource { * https://platform.openai.com/docs/assistants/how-it-works/runs-and-run-steps */ submitToolOutputsStream( - threadId: string, runId: string, - body: RunSubmitToolOutputsParamsStream, - options?: Core.RequestOptions, + params: RunSubmitToolOutputsParamsStream, + options?: RequestOptions, ): AssistantStream { - return AssistantStream.createToolAssistantStream( - threadId, - runId, - this._client.beta.threads.runs, - body, - options, - ); + return AssistantStream.createToolAssistantStream(runId, this._client.beta.threads.runs, params, options); } } @@ -1554,10 +1549,6 @@ export namespace RunStreamParams { } } -export type RunSubmitToolOutputsParams = - | RunSubmitToolOutputsParamsNonStreaming - | RunSubmitToolOutputsParamsStreaming; - export interface RunSubmitToolOutputsParamsBase { /** * A list of tools for which the outputs are being submitted. diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index a4ee863a0..ece8234d6 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -70,9 +70,7 @@ import { import { APIPromise } from '../../../api-promise'; import { Stream } from '../../../streaming'; import { RequestOptions } from '../../../internal/request-options'; -import { isRequestOptions } from '../../../core'; import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; -import { APIPromise } from '../../../core'; export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); @@ -151,19 +149,16 @@ export class Threads extends APIResource { */ async createAndRunPoll( body: ThreadCreateAndRunParamsNonStreaming, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { const run = await this.createAndRun(body, options); - return await this.runs.poll(run.thread_id, run.id, options); + return await this.runs.poll(run.id, { thread_id: run.thread_id }, options); } /** * Create a thread and stream the run back */ - createAndRunStream( - body: ThreadCreateAndRunParamsBaseStream, - options?: Core.RequestOptions, - ): AssistantStream { + createAndRunStream(body: ThreadCreateAndRunParamsBaseStream, options?: RequestOptions): AssistantStream { return AssistantStream.createThreadAssistantStream(body, this._client.beta.threads, options); } } diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index f6c933053..845903e24 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -7,9 +7,10 @@ import * as VectorStoresAPI from './vector-stores'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { RequestOptions } from '../../../internal/request-options'; -import { sleep } from '../../../core'; -import { Uploadable } from '../../../core'; +import { sleep } from '../../../internal/utils/sleep'; +import { type Uploadable } from '../../../uploads'; import { allSettledWithThrow } from '../../../lib/Util'; +import { buildHeaders } from '../../../internal/headers'; export class FileBatches extends APIResource { /** @@ -64,7 +65,7 @@ export class FileBatches extends APIResource { async createAndPoll( vectorStoreId: string, body: FileBatchCreateParams, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { const batch = await this.create(vectorStoreId, body); return await this.poll(vectorStoreId, batch.id, options); @@ -93,20 +94,27 @@ export class FileBatches extends APIResource { * check batch.file_counts.failed_count to handle this case. */ async poll( - vectorStoreId: string, - batchId: string, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + vectorStoreID: string, + batchID: string, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { - const headers: { [key: string]: string } = { ...options?.headers, 'X-Stainless-Poll-Helper': 'true' }; - if (options?.pollIntervalMs) { - headers['X-Stainless-Custom-Poll-Interval'] = options.pollIntervalMs.toString(); - } + const headers = buildHeaders([ + options?.headers, + { + 'X-Stainless-Poll-Helper': 'true', + 'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined, + }, + ]); while (true) { - const { data: batch, response } = await this.retrieve(vectorStoreId, batchId, { - ...options, - headers, - }).withResponse(); + const { data: batch, response } = await this.retrieve( + batchID, + { vector_store_id: vectorStoreID }, + { + ...options, + headers, + }, + ).withResponse(); switch (batch.status) { case 'in_progress': @@ -141,7 +149,7 @@ export class FileBatches extends APIResource { async uploadAndPoll( vectorStoreId: string, { files, fileIds = [] }: { files: Uploadable[]; fileIds?: string[] }, - options?: Core.RequestOptions & { pollIntervalMs?: number; maxConcurrency?: number }, + options?: RequestOptions & { pollIntervalMs?: number; maxConcurrency?: number }, ): Promise { if (files == null || files.length == 0) { throw new Error( diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index de20e6f45..5561b6a2b 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -5,6 +5,9 @@ import * as VectorStoresAPI from './vector-stores'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { RequestOptions } from '../../../internal/request-options'; +import { sleep } from '../../../internal/utils'; +import { Uploadable } from '../../../uploads'; +import { buildHeaders } from '../../../internal/headers'; export class Files extends APIResource { /** @@ -78,7 +81,7 @@ export class Files extends APIResource { async createAndPoll( vectorStoreId: string, body: FileCreateParams, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { const file = await this.create(vectorStoreId, body, options); return await this.poll(vectorStoreId, file.id, options); @@ -91,19 +94,26 @@ export class Files extends APIResource { * file.last_error and file.status to handle these cases */ async poll( - vectorStoreId: string, - fileId: string, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + vectorStoreID: string, + fileID: string, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { - const headers: { [key: string]: string } = { ...options?.headers, 'X-Stainless-Poll-Helper': 'true' }; - if (options?.pollIntervalMs) { - headers['X-Stainless-Custom-Poll-Interval'] = options.pollIntervalMs.toString(); - } + const headers = buildHeaders([ + options?.headers, + { + 'X-Stainless-Poll-Helper': 'true', + 'X-Stainless-Custom-Poll-Interval': options?.pollIntervalMs?.toString() ?? undefined, + }, + ]); + while (true) { - const fileResponse = await this.retrieve(vectorStoreId, fileId, { - ...options, - headers, - }).withResponse(); + const fileResponse = await this.retrieve( + fileID, + { + vector_store_id: vectorStoreID, + }, + { ...options, headers }, + ).withResponse(); const file = fileResponse.data; @@ -137,11 +147,7 @@ export class Files extends APIResource { * Note the file will be asynchronously processed (you can use the alternative * polling helper method to wait for processing to complete). */ - async upload( - vectorStoreId: string, - file: Uploadable, - options?: Core.RequestOptions, - ): Promise { + async upload(vectorStoreId: string, file: Uploadable, options?: RequestOptions): Promise { const fileInfo = await this._client.files.create({ file: file, purpose: 'assistants' }, options); return this.create(vectorStoreId, { file_id: fileInfo.id }, options); } @@ -152,7 +158,7 @@ export class Files extends APIResource { async uploadAndPoll( vectorStoreId: string, file: Uploadable, - options?: Core.RequestOptions & { pollIntervalMs?: number }, + options?: RequestOptions & { pollIntervalMs?: number }, ): Promise { const fileInfo = await this.upload(vectorStoreId, file, options); return await this.poll(vectorStoreId, fileInfo.id, options); diff --git a/tests/responses.test.ts b/tests/responses.test.ts index bf3457bbd..2aa4c80d6 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -1,6 +1,5 @@ -import { APIPromise, createResponseHeaders } from 'openai/core'; +import { APIPromise } from 'openai/core'; import OpenAI from 'openai/index'; -import { Headers } from 'openai/_shims/index'; import { Response } from 'node-fetch'; import { compareType } from './utils/typing'; From b917aafa03af38fe99b747f8df200d19d5ddd1b1 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:21:10 +0000 Subject: [PATCH 071/509] update ecosystem tests --- .../browser-direct-import/.gitignore | 2 + .../browser-direct-import/package-lock.json | 2194 ++++++++++++++ .../browser-direct-import/package.json | 19 + .../browser-direct-import/public/index.html | 11 + .../browser-direct-import/public/index.js | 227 ++ .../browser-direct-import/src/test.ts | 75 + .../browser-direct-import/tsconfig.json | 22 + ecosystem-tests/cli.ts | 45 +- .../cloudflare-worker/package-lock.json | 128 +- .../cloudflare-worker/package.json | 2 +- ecosystem-tests/deno/deno.jsonc | 7 +- ecosystem-tests/node-js/test.js | 37 +- .../moduleResolution/nodenext/type-tests.ts | 7 +- .../node-ts-cjs-auto/tests/shims.ts | 7 - .../node-ts-cjs-auto/tests/test.ts | 69 +- .../node-ts-cjs-web/package-lock.json | 21 +- ecosystem-tests/node-ts-cjs-web/package.json | 2 +- .../node-ts-cjs-web/tests/shims.ts | 11 - .../tests/test-jsdom-unpolyfilled.ts | 11 - .../node-ts-cjs-web/tests/test-jsdom.ts | 10 - .../node-ts-cjs-web/tests/test-node.ts | 11 +- ecosystem-tests/node-ts-cjs-web/types-test.ts | 8 + ecosystem-tests/node-ts-cjs/package.json | 2 +- .../node-ts-cjs/tests/late-shim-errors.ts | 8 - .../node-ts-cjs/tests/multiple-shim-errors.ts | 8 - ecosystem-tests/node-ts-cjs/tests/shims.ts | 12 - .../tests/test-jsdom-compat-error.ts | 11 - .../node-ts-cjs/tests/test-jsdom.ts | 42 +- .../node-ts-cjs/tests/test-node.ts | 85 +- ecosystem-tests/node-ts-es2020/index.ts | 36 - .../node-ts-es2020/package-lock.json | 193 -- ecosystem-tests/node-ts-es2020/package.json | 16 - .../node-ts-es2020/tsconfig.base.json | 37 - ecosystem-tests/node-ts-es2020/tsconfig.json | 18 - .../node-ts-es2020/tsconfig.nodenext.json | 55 - .../node-ts-esm-auto/esnext-type-tests.ts | 7 +- .../node-ts-esm-auto/tests/shims.ts | 5 - .../node-ts-esm-auto/tests/test.ts | 83 +- .../node-ts-esm-web/tests/shims.ts | 12 - ecosystem-tests/node-ts-esm-web/tests/test.ts | 22 +- ecosystem-tests/node-ts-esm-web/types-test.ts | 8 + ecosystem-tests/node-ts-esm/iitm.js | 2 + ecosystem-tests/node-ts-esm/package-lock.json | 32 +- ecosystem-tests/node-ts-esm/package.json | 3 +- ecosystem-tests/node-ts-esm/tests/shims.ts | 7 - .../node-ts-esm/tests/test-esnext.ts | 31 +- ecosystem-tests/node-ts-esm/tests/test.ts | 57 +- .../jest.config.cjs | 0 .../package-lock.json | 2676 ++++++++--------- .../package.json | 4 +- .../sample1.mp3 | Bin .../tests/test.ts | 81 +- .../tsconfig.json | 0 ecosystem-tests/nodenext-tsup/index.ts | 41 - .../nodenext-tsup/package-lock.json | 2078 ------------- ecosystem-tests/nodenext-tsup/package.json | 16 - ecosystem-tests/nodenext-tsup/tsconfig.json | 18 - ecosystem-tests/nodenext-tsup/tsup.config.ts | 7 - .../ts-browser-webpack/package-lock.json | 49 +- .../ts-browser-webpack/src/index.ts | 10 - .../vercel-edge/src/uploadWebApiTestCases.ts | 34 +- 61 files changed, 4189 insertions(+), 4543 deletions(-) create mode 100644 ecosystem-tests/browser-direct-import/.gitignore create mode 100644 ecosystem-tests/browser-direct-import/package-lock.json create mode 100644 ecosystem-tests/browser-direct-import/package.json create mode 100644 ecosystem-tests/browser-direct-import/public/index.html create mode 100644 ecosystem-tests/browser-direct-import/public/index.js create mode 100644 ecosystem-tests/browser-direct-import/src/test.ts create mode 100644 ecosystem-tests/browser-direct-import/tsconfig.json delete mode 100644 ecosystem-tests/node-ts-cjs-auto/tests/shims.ts delete mode 100644 ecosystem-tests/node-ts-cjs-web/tests/shims.ts delete mode 100644 ecosystem-tests/node-ts-cjs-web/tests/test-jsdom-unpolyfilled.ts create mode 100644 ecosystem-tests/node-ts-cjs-web/types-test.ts delete mode 100644 ecosystem-tests/node-ts-cjs/tests/late-shim-errors.ts delete mode 100644 ecosystem-tests/node-ts-cjs/tests/multiple-shim-errors.ts delete mode 100644 ecosystem-tests/node-ts-cjs/tests/shims.ts delete mode 100644 ecosystem-tests/node-ts-cjs/tests/test-jsdom-compat-error.ts delete mode 100644 ecosystem-tests/node-ts-es2020/index.ts delete mode 100644 ecosystem-tests/node-ts-es2020/package-lock.json delete mode 100644 ecosystem-tests/node-ts-es2020/package.json delete mode 100644 ecosystem-tests/node-ts-es2020/tsconfig.base.json delete mode 100644 ecosystem-tests/node-ts-es2020/tsconfig.json delete mode 100644 ecosystem-tests/node-ts-es2020/tsconfig.nodenext.json delete mode 100644 ecosystem-tests/node-ts-esm-auto/tests/shims.ts delete mode 100644 ecosystem-tests/node-ts-esm-web/tests/shims.ts create mode 100644 ecosystem-tests/node-ts-esm-web/types-test.ts create mode 100644 ecosystem-tests/node-ts-esm/iitm.js delete mode 100644 ecosystem-tests/node-ts-esm/tests/shims.ts rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/jest.config.cjs (100%) rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/package-lock.json (66%) rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/package.json (90%) rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/sample1.mp3 (100%) rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/tests/test.ts (70%) rename ecosystem-tests/{node-ts4.5-jest27 => node-ts4.5-jest28}/tsconfig.json (100%) delete mode 100644 ecosystem-tests/nodenext-tsup/index.ts delete mode 100644 ecosystem-tests/nodenext-tsup/package-lock.json delete mode 100644 ecosystem-tests/nodenext-tsup/package.json delete mode 100644 ecosystem-tests/nodenext-tsup/tsconfig.json delete mode 100644 ecosystem-tests/nodenext-tsup/tsup.config.ts diff --git a/ecosystem-tests/browser-direct-import/.gitignore b/ecosystem-tests/browser-direct-import/.gitignore new file mode 100644 index 000000000..8225baa4a --- /dev/null +++ b/ecosystem-tests/browser-direct-import/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/dist diff --git a/ecosystem-tests/browser-direct-import/package-lock.json b/ecosystem-tests/browser-direct-import/package-lock.json new file mode 100644 index 000000000..de1f65654 --- /dev/null +++ b/ecosystem-tests/browser-direct-import/package-lock.json @@ -0,0 +1,2194 @@ +{ + "name": "browser-direct-import", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "browser-direct-import", + "version": "0.0.1", + "devDependencies": { + "fastest-levenshtein": "^1.0.16", + "puppeteer": "^23.4.0", + "sirv-cli": "^3.0.0", + "start-server-and-test": "^2.0.0", + "ts-node": "^10.9.1", + "typescript": "^4.7.4" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "dev": true + }, + "node_modules/@hapi/topo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.1.0.tgz", + "integrity": "sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@polka/url": { + "version": "1.0.0-next.28", + "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@puppeteer/browsers": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.0.tgz", + "integrity": "sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g==", + "dev": true, + "dependencies": { + "debug": "^4.3.6", + "extract-zip": "^2.0.1", + "progress": "^2.0.3", + "proxy-agent": "^6.4.0", + "semver": "^7.6.3", + "tar-fs": "^3.0.6", + "unbzip2-stream": "^1.4.3", + "yargs": "^17.7.2" + }, + "bin": { + "browsers": "lib/cjs/main-cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@puppeteer/browsers/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@puppeteer/browsers/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/@puppeteer/browsers/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@sideway/address": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", + "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0" + } + }, + "node_modules/@sideway/formula": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==", + "dev": true + }, + "node_modules/@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, + "node_modules/@tootallnate/quickjs-emscripten": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", + "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", + "dev": true + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.5.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.7.tgz", + "integrity": "sha512-dP7f3LdZIysZnmvP3ANJYTSwg+wLLl8p7RqniVlV7j+oXSXAbt9h0WIBFmJy5inWZoX9wZN6eXx+YXd9Rh3RBA==", + "dev": true + }, + "node_modules/@types/yauzl": { + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", + "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", + "dev": true, + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", + "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", + "dev": true, + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/ast-types": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", + "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", + "dev": true, + "dependencies": { + "tslib": "^2.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/axios": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.8.tgz", + "integrity": "sha512-Uu0wb7KNqK2t5K+YQyVCLM76prD5sRFjKHbJYCP1J7JFGEQ6nN7HWn9+04LAeiJ3ji54lgS/gZCH1oxyrf1SPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/b4a": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", + "integrity": "sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==", + "dev": true + }, + "node_modules/bare-events": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.4.2.tgz", + "integrity": "sha512-qMKFd2qG/36aA4GwvKq8MxnPgCQAmBWmSyLWsJcbn8v03wvIPQ/hG1Ms8bPzndZxMDoHpxez5VOS+gC9Yi24/Q==", + "dev": true, + "optional": true + }, + "node_modules/bare-fs": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-2.3.5.tgz", + "integrity": "sha512-SlE9eTxifPDJrT6YgemQ1WGFleevzwY+XAP1Xqgl56HtcrisC2CHCZ2tq6dBpcH2TnNxwUEUGhweo+lrQtYuiw==", + "dev": true, + "optional": true, + "dependencies": { + "bare-events": "^2.0.0", + "bare-path": "^2.0.0", + "bare-stream": "^2.0.0" + } + }, + "node_modules/bare-os": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-2.4.4.tgz", + "integrity": "sha512-z3UiI2yi1mK0sXeRdc4O1Kk8aOa/e+FNWZcTiPB/dfTWyLypuE99LibgRaQki914Jq//yAWylcAt+mknKdixRQ==", + "dev": true, + "optional": true + }, + "node_modules/bare-path": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-2.1.3.tgz", + "integrity": "sha512-lh/eITfU8hrj9Ru5quUp0Io1kJWIk1bTjzo7JH1P5dWmQ2EL4hFUlfI8FonAhSlgIfhn63p84CDY/x+PisgcXA==", + "dev": true, + "optional": true, + "dependencies": { + "bare-os": "^2.1.0" + } + }, + "node_modules/bare-stream": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.3.0.tgz", + "integrity": "sha512-pVRWciewGUeCyKEuRxwv06M079r+fRjAQjBEK2P6OYGrO43O+Z0LrPZZEjlc4mB6C2RpZ9AxJ1s7NLEtOHO6eA==", + "dev": true, + "optional": true, + "dependencies": { + "b4a": "^1.6.6", + "streamx": "^2.20.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/basic-ftp": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.0.5.tgz", + "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-more-types": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", + "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/chromium-bidi": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.5.tgz", + "integrity": "sha512-RuLrmzYrxSb0s9SgpB+QN5jJucPduZQ/9SIe76MDxYJuecPW5mxMdacJ1f4EtgiV+R0p3sCkznTMvH0MPGFqjA==", + "dev": true, + "dependencies": { + "mitt": "3.0.1", + "urlpattern-polyfill": "10.0.0", + "zod": "3.23.8" + }, + "peerDependencies": { + "devtools-protocol": "*" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/console-clear": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/console-clear/-/console-clear-1.1.1.tgz", + "integrity": "sha512-pMD+MVR538ipqkG5JXeOEbKWS5um1H4LUUccUQG68qpeqBYbzYy79Gh55jkd2TtPdRfUaLWdv6LPP//5Zt0aPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", + "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", + "dev": true, + "engines": { + "node": ">= 14" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/degenerator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", + "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", + "dev": true, + "dependencies": { + "ast-types": "^0.13.4", + "escodegen": "^2.1.0", + "esprima": "^4.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/devtools-protocol": { + "version": "0.0.1342118", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1342118.tgz", + "integrity": "sha512-75fMas7PkYNDTmDyb6PRJCH7ILmHLp+BhrZGeMsa4bCh40DTxgCz2NRy5UDzII4C5KuD0oBMZ9vXKhEl6UD/3w==", + "dev": true + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha512-QHpkERcGsR0T7Qm3HNJSyXKEEj8AHNxkY3PK8TS2KJvQ7NiSHe3DDpwVKKtoYprL/AreyzFBeIkBIWChAqn60g==", + "dev": true, + "dependencies": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "dev": true, + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha512-twe20eF1OxVxp/ML/kq2p1uc6KvFK/+vs8WjEbeKmV2He22MKm7YF2ANIt+EOqhJ5L3K/SuuPhk0hWQDjOM23g==", + "dev": true + }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-port": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", + "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-uri": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.3.tgz", + "integrity": "sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==", + "dev": true, + "dependencies": { + "basic-ftp": "^5.0.2", + "data-uri-to-buffer": "^6.0.2", + "debug": "^4.3.4", + "fs-extra": "^11.2.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", + "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", + "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ip-address": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", + "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "dev": true, + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/ip-address/node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/joi": { + "version": "17.11.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.11.0.tgz", + "integrity": "sha512-NgB+lZLNoqISVy1rZocE9PZI36bL/77ie924Ri43yEvi9GUUMPeyVIr8KdFTMUlby1p0PBYMk9spIxEUQYqrJQ==", + "dev": true, + "dependencies": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.3", + "@sideway/formula": "^3.0.1", + "@sideway/pinpoint": "^2.0.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lazy-ass": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", + "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", + "dev": true, + "engines": { + "node": "> 0.8" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/local-access": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/local-access/-/local-access-1.1.0.tgz", + "integrity": "sha512-XfegD5pyTAfb+GY6chk283Ox5z8WexG56OvM06RWLpAc/UHozO8X6xAxEkIitZOtsSMM1Yr3DkHgW5W+onLhCw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha512-CkYQrPYZfWnu/DAmVCpTSX/xHpKZ80eKh2lAkyA6AJTef6bW+6JpbQZN5rofum7da+SyN1bi5ctTm+lTfcCW3g==", + "dev": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "dev": true + }, + "node_modules/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/mrmime": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/netmask": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", + "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pac-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.0.2.tgz", + "integrity": "sha512-BFi3vZnO9X5Qt6NRz7ZOaPja3ic0PhlsmCRYLOpN11+mWBCR6XJDqW5RF3j8jm4WGGQZtBA+bTfxYzeKW73eHg==", + "dev": true, + "dependencies": { + "@tootallnate/quickjs-emscripten": "^0.23.0", + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "get-uri": "^6.0.1", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.5", + "pac-resolver": "^7.0.1", + "socks-proxy-agent": "^8.0.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/pac-resolver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", + "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", + "dev": true, + "dependencies": { + "degenerator": "^5.0.0", + "netmask": "^2.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha512-e3FBlXLmN/D1S+zHzanP4E/4Z60oFAa3O051qt1pxa7DEJWKAyil6upYVXCWadEnuoqa4Pkc9oUx9zsxYeRv8A==", + "dev": true, + "dependencies": { + "through": "~2.3" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", + "dev": true + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/proxy-agent": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", + "integrity": "sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==", + "dev": true, + "dependencies": { + "agent-base": "^7.0.2", + "debug": "^4.3.4", + "http-proxy-agent": "^7.0.1", + "https-proxy-agent": "^7.0.3", + "lru-cache": "^7.14.1", + "pac-proxy-agent": "^7.0.1", + "proxy-from-env": "^1.1.0", + "socks-proxy-agent": "^8.0.2" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/proxy-agent/node_modules/lru-cache": { + "version": "7.18.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", + "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "node_modules/ps-tree": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", + "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", + "dev": true, + "dependencies": { + "event-stream": "=3.3.4" + }, + "bin": { + "ps-tree": "bin/ps-tree.js" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/pump": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/puppeteer": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.4.0.tgz", + "integrity": "sha512-FxgFFJI7NAsX8uebiEDSjS86vufz9TaqERQHShQT0lCbSRI3jUPEcz/0HdwLiYvfYNsc1zGjqY3NsGZya4PvUA==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "@puppeteer/browsers": "2.4.0", + "chromium-bidi": "0.6.5", + "cosmiconfig": "^9.0.0", + "devtools-protocol": "0.0.1342118", + "puppeteer-core": "23.4.0", + "typed-query-selector": "^2.12.0" + }, + "bin": { + "puppeteer": "lib/cjs/puppeteer/node/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core": { + "version": "23.4.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.4.0.tgz", + "integrity": "sha512-fqkIP5FOcb38jfBj/OcBz1wFaI9nk40uQKSORvnXws6wCbep2dg8yxZ3ddJxBIfQsxoiEOvnrykFinUScrB/ew==", + "dev": true, + "dependencies": { + "@puppeteer/browsers": "2.4.0", + "chromium-bidi": "0.6.5", + "debug": "^4.3.7", + "devtools-protocol": "0.0.1342118", + "typed-query-selector": "^2.12.0", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/puppeteer-core/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer-core/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/puppeteer/node_modules/cosmiconfig": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", + "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "dev": true, + "dependencies": { + "env-paths": "^2.2.1", + "import-fresh": "^3.3.0", + "js-yaml": "^4.1.0", + "parse-json": "^5.2.0" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/d-fischer" + }, + "peerDependencies": { + "typescript": ">=4.9.5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/typescript": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", + "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "dev": true, + "optional": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/queue-tick": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", + "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/semiver": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/semiver/-/semiver-1.1.0.tgz", + "integrity": "sha512-QNI2ChmuioGC1/xjyYwyZYADILWyW6AmS1UH6gDj/SFUUUS4MBAWs/7mxnkRPc/F4iHezDP+O8t0dO8WHiEOdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sirv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.0.tgz", + "integrity": "sha512-BPwJGUeDaDCHihkORDchNyyTvWFhcusy1XMmhEVTQTwGeybFbp8YEmB+njbPnth1FibULBSBVwCQni25XlCUDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/sirv-cli": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/sirv-cli/-/sirv-cli-3.0.0.tgz", + "integrity": "sha512-p88yHl8DmTOUJroRiW2o9ezJc/YRLxphBydX2NGQc3naKBA09B3EM4Q/yaN8FYF0e50fRSZP7dyatr72b1u5Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "console-clear": "^1.1.0", + "get-port": "^5.1.1", + "kleur": "^4.1.4", + "local-access": "^1.0.1", + "sade": "^1.6.0", + "semiver": "^1.0.0", + "sirv": "^3.0.0", + "tinydate": "^1.0.0" + }, + "bin": { + "sirv": "bin.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/smart-buffer": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", + "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", + "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", + "dev": true, + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/socks-proxy-agent": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.4.tgz", + "integrity": "sha512-GNAq/eg8Udq2x0eNiFkr9gRg5bA7PXEWagQdeRX4cPSG+X/8V38v637gim9bjFptMk1QWsCTr0ttrJEiXbNnRw==", + "dev": true, + "dependencies": { + "agent-base": "^7.1.1", + "debug": "^4.3.4", + "socks": "^2.8.3" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha512-wD2AeVmxXRBoX44wAycgjVpMhvbwdI2aZjCkvfNcH1YqHQvJVa1duWc73OyVGJUc05fhFaTZeQ/PYsrmyH0JVA==", + "dev": true, + "dependencies": { + "through": "2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", + "dev": true + }, + "node_modules/start-server-and-test": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.3.tgz", + "integrity": "sha512-QsVObjfjFZKJE6CS6bSKNwWZCKBG6975/jKRPPGFfFh+yOQglSeGXiNWjzgQNXdphcBI9nXbyso9tPfX4YAUhg==", + "dev": true, + "dependencies": { + "arg": "^5.0.2", + "bluebird": "3.7.2", + "check-more-types": "2.24.0", + "debug": "4.3.4", + "execa": "5.1.1", + "lazy-ass": "1.6.0", + "ps-tree": "1.2.0", + "wait-on": "7.2.0" + }, + "bin": { + "server-test": "src/bin/start.js", + "start-server-and-test": "src/bin/start.js", + "start-test": "src/bin/start.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha512-rT00SPnTVyRsaSz5zgSPma/aHSOic5U1prhYdRy5HS2kTZviFpmDgzilbtsJsxiroqACmayynDN/9VzIbX5DOw==", + "dev": true, + "dependencies": { + "duplexer": "~0.1.1" + } + }, + "node_modules/streamx": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", + "integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", + "dev": true, + "dependencies": { + "fast-fifo": "^1.3.2", + "queue-tick": "^1.0.1", + "text-decoder": "^1.1.0" + }, + "optionalDependencies": { + "bare-events": "^2.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tar-fs": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.0.6.tgz", + "integrity": "sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0", + "tar-stream": "^3.1.5" + }, + "optionalDependencies": { + "bare-fs": "^2.1.1", + "bare-path": "^2.1.0" + } + }, + "node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "dev": true, + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/text-decoder": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.0.tgz", + "integrity": "sha512-n1yg1mOj9DNpk3NeZOx7T6jchTbyJS3i3cucbNN6FcdPriMZx7NsgrGpWWdWZZGxD7ES1XB+3uoqHMgOKaN+fg==", + "dev": true, + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "dev": true + }, + "node_modules/tinydate": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/tinydate/-/tinydate-1.3.0.tgz", + "integrity": "sha512-7cR8rLy2QhYHpsBDBVYnnWXm8uRTr38RoZakFSW7Bs7PzfMPNZthuMLkwqZv7MTu8lhQ91cOFYS5a7iFj2oR3w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/totalist": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/typed-query-selector": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz", + "integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==", + "dev": true + }, + "node_modules/typescript": { + "version": "4.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", + "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", + "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "dev": true, + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/urlpattern-polyfill": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", + "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", + "dev": true + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "node_modules/wait-on": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", + "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", + "dev": true, + "dependencies": { + "axios": "^1.6.1", + "joi": "^17.11.0", + "lodash": "^4.17.21", + "minimist": "^1.2.8", + "rxjs": "^7.8.1" + }, + "bin": { + "wait-on": "bin/wait-on" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "dev": true, + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/ecosystem-tests/browser-direct-import/package.json b/ecosystem-tests/browser-direct-import/package.json new file mode 100644 index 000000000..579eef370 --- /dev/null +++ b/ecosystem-tests/browser-direct-import/package.json @@ -0,0 +1,19 @@ +{ + "name": "browser-direct-import", + "version": "0.0.1", + "private": true, + "scripts": { + "tsc": "tsc --noEmit", + "test": "ts-node src/test.ts", + "test:ci": "start-server-and-test serve http://localhost:8081 test", + "serve": "sirv -q public --port 8081" + }, + "devDependencies": { + "fastest-levenshtein": "^1.0.16", + "puppeteer": "^23.4.0", + "sirv-cli": "^3.0.0", + "start-server-and-test": "^2.0.0", + "ts-node": "^10.9.1", + "typescript": "^4.7.4" + } +} diff --git a/ecosystem-tests/browser-direct-import/public/index.html b/ecosystem-tests/browser-direct-import/public/index.html new file mode 100644 index 000000000..1e121c30c --- /dev/null +++ b/ecosystem-tests/browser-direct-import/public/index.html @@ -0,0 +1,11 @@ + + + + + Package in the Browser + + +
Running tests...
+ + + diff --git a/ecosystem-tests/browser-direct-import/public/index.js b/ecosystem-tests/browser-direct-import/public/index.js new file mode 100644 index 000000000..eb3b924bf --- /dev/null +++ b/ecosystem-tests/browser-direct-import/public/index.js @@ -0,0 +1,227 @@ +// @ts-check +import OpenAI, { toFile } from './node_modules/openai/index.mjs'; +import { distance } from './node_modules/fastest-levenshtein/esm/mod.js'; + +/** @typedef {{ path: string[]; run: () => any; timeout?: number; }} TestCase */ + +/** @type {TestCase[]} */ +const tests = []; + +/** @typedef {{ path: string[]; passed: boolean; error?: string }} TestResult */ + +async function runTests() { + /** @type {TestResult[]} */ + const results = []; + function displayResults() { + let pre = document.getElementById('results'); + if (!pre) { + pre = document.createElement('pre'); + pre.id = 'results'; + document.body.appendChild(pre); + } + pre.innerText = JSON.stringify(results, null, 2); + } + for (const { path, run, timeout } of tests) { + console.log('running', ...path); + try { + await Promise.race([ + run(), + new Promise((_, reject) => + setTimeout(() => reject(new Error(`Test timed out after ${timeout} ms`)), timeout), + ), + ]); + console.log('passed ', ...path); + results.push({ path, passed: true }); + } catch (error) { + console.log('error ', ...path); + console.error(error); + results.push({ path, passed: false, error: error instanceof Error ? error.stack : String(error) }); + } + displayResults(); + } + const runningEl = document.getElementById('running'); + if (runningEl) runningEl.remove(); +} + +/** @type {string[]} */ +const testPath = []; + +/** + * @param {string} description + * @param {() => void} handler + */ +function describe(description, handler) { + testPath.push(description); + try { + handler(); + } finally { + testPath.pop(); + } +} + +/** + * @param {string} description + * @param {() => any} run + * @param {number} [timeout=60000] + */ +function it(description, run, timeout = 60000) { + tests.push({ path: [...testPath, description], run, timeout }); +} + +/** + * @param {any} received + * @returns {{ + * toEqual: (expected: any) => void; + * toBeSimilarTo: (comparedTo: string, expectedDistance: number) => void; + * }} + */ +function expect(received) { + return { + toEqual(expected) { + if (!Object.is(received, expected)) { + throw new Error( + [`Received: ${JSON.stringify(received)}`, `Expected: ${JSON.stringify(expected)}`].join('\n'), + ); + } + }, + toBeSimilarTo(comparedTo, expectedDistance) { + const actualDistance = distance(received, comparedTo); + if (actualDistance < expectedDistance) return; + + throw new Error( + [ + `Received: ${JSON.stringify(received)}`, + `Expected: ${JSON.stringify(comparedTo)}`, + `Expected distance: ${expectedDistance}`, + `Received distance: ${actualDistance}`, + ].join('\n'), + ); + }, + }; +} + +const url = 'https://audio-samples.github.io/samples/mp3/blizzard_biased/sample-1.mp3'; +const filename = 'sample-1.mp3'; + +const correctAnswer = + 'It was anxious to find him no one that expectation of a man who were giving his father enjoyment. But he was avoided in sight in the minister to which indeed,'; +const model = 'whisper-1'; + +const params = new URLSearchParams(location.search); + +const client = new OpenAI({ apiKey: params.get('apiKey') ?? undefined, dangerouslyAllowBrowser: true }); + +async function typeTests() { + // @ts-expect-error this should error if the `Uploadable` type was resolved correctly + await client.audio.transcriptions.create({ file: { foo: true }, model: 'whisper-1' }); + // @ts-expect-error this should error if the `Uploadable` type was resolved correctly + await client.audio.transcriptions.create({ file: null, model: 'whisper-1' }); + // @ts-expect-error this should error if the `Uploadable` type was resolved correctly + await client.audio.transcriptions.create({ file: 'test', model: 'whisper-1' }); +} + +it(`raw response`, async function () { + const response = await client.chat.completions + .create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + }) + .asResponse(); + + // test that we can use web Response API + const { body } = response; + if (!body) throw new Error('expected response.body to be defined'); + + const reader = body.getReader(); + /** @type {Uint8Array[]} */ + const chunks = []; + let result; + do { + result = await reader.read(); + if (!result.done) chunks.push(result.value); + } while (!result.done); + + reader.releaseLock(); + + let offset = 0; + const merged = new Uint8Array(chunks.reduce((total, chunk) => total + chunk.length, 0)); + for (const chunk of chunks) { + merged.set(chunk, offset); + offset += chunk.length; + } + + const json = /** @type {OpenAI.ChatCompletion} */ (JSON.parse(new TextDecoder().decode(merged))); + expect(json.choices[0]?.message.content || '').toBeSimilarTo('This is a test', 10); +}); + +it(`streaming works`, async function () { + const stream = await client.chat.completions.create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + stream: true, + }); + const chunks = []; + for await (const part of stream) { + chunks.push(part); + } + expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); +}); + +if (typeof File !== 'undefined') { + it('handles builtinFile', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => new File([x], filename)); + + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); +} + +it('handles Response', async function () { + const file = await fetch(url); + + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); +}); + +const fineTune = `{"prompt": "", "completion": ""}`; + +describe('toFile', () => { + if (typeof Blob !== 'undefined') { + it('handles builtin Blob', async function () { + const result = await client.files.create({ + file: await toFile( + // @ts-ignore avoid DOM lib for testing purposes + new Blob([new TextEncoder().encode(fineTune)]), + 'finetune.jsonl', + ), + purpose: 'fine-tune', + }); + expect(result.filename).toEqual('finetune.jsonl'); + }); + } + it('handles Uint8Array', async function () { + const result = await client.files.create({ + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), + purpose: 'fine-tune', + }); + expect(result.filename).toEqual('finetune.jsonl'); + }); + it('handles ArrayBuffer', async function () { + const result = await client.files.create({ + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), + purpose: 'fine-tune', + }); + expect(result.filename).toEqual('finetune.jsonl'); + }); + it('handles DataView', async function () { + const result = await client.files.create({ + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), + purpose: 'fine-tune', + }); + expect(result.filename).toEqual('finetune.jsonl'); + }); +}); + +runTests(); \ No newline at end of file diff --git a/ecosystem-tests/browser-direct-import/src/test.ts b/ecosystem-tests/browser-direct-import/src/test.ts new file mode 100644 index 000000000..ba26ea165 --- /dev/null +++ b/ecosystem-tests/browser-direct-import/src/test.ts @@ -0,0 +1,75 @@ +import puppeteer from 'puppeteer'; + +(async () => { + const browser = await puppeteer.launch({ + args: ['--no-sandbox'], + }); + let page; + try { + page = await browser.newPage(); + function debugEvent(subj: string) { + return subj.padEnd('requestfailed'.length); + } + page + .on('console', (message) => + console.error( + `${debugEvent('console')} ${message + .type() + .substr(0, 'warning'.length) + .toUpperCase() + .padEnd('warning'.length)} ${message.text()}`, + ), + ) + .on('pageerror', ({ message }) => console.error(`${debugEvent('pageerror')} ${message}`)) + .on('response', (response) => + console.error(`${debugEvent('response')} ${response.status()} ${response.url()}`), + ) + .on('requestfailed', (request) => + console.error(`${debugEvent('requestfailed')} ${request.failure()?.errorText} ${request.url()}`), + ); + + const apiKey = process.env.OPENAI_API_KEY; + + if (!apiKey) throw new Error('missing process.env.OPENAI_API_KEY'); + + // Navigate the page to a URL + await page.goto(`http://localhost:8081/index.html?apiKey=${apiKey}`); + + await page.waitForSelector('#running', { timeout: 15000 }); + + let start = Date.now(); + while ((await page.$('#running')) != null && Date.now() - start < 3 * 60000) { + await new Promise((r) => setTimeout(r, 1000)); + } + + let results; + const resultsEl = await page.$('#results'); + if (resultsEl) { + const text = await page.evaluate((el) => el.textContent, resultsEl); + results = text ? JSON.parse(text) : undefined; + } + + if (!Array.isArray(results)) { + throw new Error(`failed to get test results from page`); + } + const failed = results.filter((r) => !r.passed); + if (failed.length) { + throw new Error( + `${failed.length} of ${results.length} tests failed: ${JSON.stringify(failed, null, 2)}`, + ); + } + console.log(`${results.length} tests passed!`); + } catch (error) { + if (page) { + try { + const html = await page.evaluate(() => document.body.innerHTML); + console.error(`\n====================\nBODY HTML\n====================\n\n${html}\n\n`); + } catch (error) { + console.error(`failed to get body HTML for debugging`, error); + } + } + throw error; + } finally { + await browser.close(); + } +})(); diff --git a/ecosystem-tests/browser-direct-import/tsconfig.json b/ecosystem-tests/browser-direct-import/tsconfig.json new file mode 100644 index 000000000..8a1b55791 --- /dev/null +++ b/ecosystem-tests/browser-direct-import/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "strict": true, + "noImplicitReturns": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": true, + "declaration": true, + "skipLibCheck": false, + "target": "es2015", + "lib": ["es2017", "dom"], + "outDir": "dist", + "rootDir": "./", + "baseUrl": ".", + "paths": { + "*": ["types/*"] + } + }, + "include": ["src/**/*", "public/index.js"], + "exclude": ["node_modules/*"] +} diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 00120e5f9..39361ae2e 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -4,9 +4,11 @@ import yargs from 'yargs'; import assert from 'assert'; import path from 'path'; -// @ts-ignore -var SegfaultHandler = require('segfault-handler'); -SegfaultHandler.registerHandler('crash.log'); +try { + // @ts-ignore + var SegfaultHandler = require('segfault-handler'); + SegfaultHandler.registerHandler('crash.log'); +} catch (_) {} const TAR_NAME = 'openai.tgz'; const PACK_FOLDER = '.pack'; @@ -25,32 +27,31 @@ const projectRunners = { 'node-ts-cjs': defaultNodeRunner, 'node-ts-cjs-web': defaultNodeRunner, 'node-ts-cjs-auto': defaultNodeRunner, - 'node-ts4.5-jest27': defaultNodeRunner, + 'node-ts4.5-jest28': defaultNodeRunner, 'node-ts-esm': defaultNodeRunner, 'node-ts-esm-web': defaultNodeRunner, 'node-ts-esm-auto': defaultNodeRunner, - 'node-ts-es2020': async () => { - await installPackage(); - await run('npm', ['run', 'tsc']); - await run('npm', ['run', 'main']); - }, 'node-js': async () => { await installPackage(); await run('node', ['test.js']); }, - 'nodenext-tsup': async () => { + 'ts-browser-webpack': async () => { await installPackage(); + + await run('npm', ['run', 'tsc']); await run('npm', ['run', 'build']); if (state.live) { - await run('npm', ['run', 'main']); + await run('npm', ['run', 'test:ci']); } }, - 'ts-browser-webpack': async () => { + 'browser-direct-import': async () => { await installPackage(); + await fs.rm('public/node_modules', { force: true }); + await fs.symlink('../node_modules', 'public/node_modules'); + await run('npm', ['run', 'tsc']); - await run('npm', ['run', 'build']); if (state.live) { await run('npm', ['run', 'test:ci']); @@ -74,6 +75,7 @@ const projectRunners = { 'cloudflare-worker': async () => { await installPackage(); + await fs.writeFile('.dev.vars', `OPENAI_API_KEY='${process.env['OPENAI_API_KEY']}'`); await run('npm', ['run', 'tsc']); if (state.live) { @@ -99,14 +101,15 @@ const projectRunners = { await run('bun', ['test']); } }, - deno: async () => { - // we don't need to explicitly install the package here - // because our deno setup relies on `rootDir/dist-deno` to exist - // which is an artifact produced from our build process - await run('deno', ['task', 'install', '--unstable-sloppy-imports']); - - if (state.live) await run('deno', ['task', 'test']); - }, + // deno: async () => { + // // we don't need to explicitly install the package here + // // because our deno setup relies on `rootDir/deno` to exist + // // which is an artifact produced from our build process + // await run('deno', ['task', 'install']); + // await run('deno', ['task', 'check']); + // + // if (state.live) await run('deno', ['task', 'test']); + // }, }; let projectNames = Object.keys(projectRunners) as Array; diff --git a/ecosystem-tests/cloudflare-worker/package-lock.json b/ecosystem-tests/cloudflare-worker/package-lock.json index 99d787f75..e359caaf0 100644 --- a/ecosystem-tests/cloudflare-worker/package-lock.json +++ b/ecosystem-tests/cloudflare-worker/package-lock.json @@ -17,7 +17,7 @@ "start-server-and-test": "^2.0.0", "ts-jest": "^29.1.0", "typescript": "5.0.4", - "wrangler": "^3.85.0" + "wrangler": "^3.74.0" } }, "node_modules/@ampproject/remapping": { @@ -674,9 +674,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241022.0.tgz", - "integrity": "sha512-1NNYun37myMTgCUiPQEJ0cMal4mKZVTpkD0b2tx9hV70xji+frVJcSK8YVLeUm1P+Rw1d/ct8DMgQuCpsz3Fsw==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240909.0.tgz", + "integrity": "sha512-nJ8jm/6PR8DPzVb4QifNAfSdrFZXNblwIdOhLTU5FpSvFFocmzFX5WgzQagvtmcC9/ZAQyxuf7WynDNyBcoe0Q==", "cpu": [ "x64" ], @@ -690,9 +690,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241022.0.tgz", - "integrity": "sha512-FOO/0P0U82EsTLTdweNVgw+4VOk5nghExLPLSppdOziq6IR5HVgP44Kmq5LdsUeHUhwUmfOh9hzaTpkNzUqKvw==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240909.0.tgz", + "integrity": "sha512-gJqKa811oSsoxy9xuoQn7bS0Hr1sY+o3EUORTcEnulG6Kz9NQ6nd8QNdp2Hrk2jmmSqwrNkn+a6PZkWzk6Q0Gw==", "cpu": [ "arm64" ], @@ -706,9 +706,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241022.0.tgz", - "integrity": "sha512-RsNc19BQJG9yd+ngnjuDeG9ywZG+7t1L4JeglgceyY5ViMNMKVO7Zpbsu69kXslU9h6xyQG+lrmclg3cBpnhYA==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240909.0.tgz", + "integrity": "sha512-sJrmtccfMg73sZljiBpe4R+lhF58TqzqhF2pQG8HRjyxkzkM1sjpZqfEFaIkNUDqd3/Ibji49fklhPCGXljKSg==", "cpu": [ "x64" ], @@ -722,9 +722,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241022.0.tgz", - "integrity": "sha512-x5mUXpKxfsosxcFmcq5DaqLs37PejHYVRsNz1cWI59ma7aC4y4Qn6Tf3i0r9MwQTF/MccP4SjVslMU6m4W7IaA==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240909.0.tgz", + "integrity": "sha512-dTbSdceyRXPOSER+18AwYRbPQG0e/Dwl2trmfMMCETkfJhNLv1fU3FFMJPjfILijKnhTZHSnHCx0+xwHdon2fg==", "cpu": [ "arm64" ], @@ -738,9 +738,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241022.0.tgz", - "integrity": "sha512-eBCClx4szCOgKqOlxxbdNszMqQf3MRG1B9BRIqEM/diDfdR9IrZ8l3FaEm+l9gXgPmS6m1NBn40aWuGBl8UTSw==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240909.0.tgz", + "integrity": "sha512-/d4BT0kcWFa7Qc0K4K9+cwVQ1qyPNKiO42JZUijlDlco+TYTPkLO3qGEohmwbfMq+BieK7JTMSgjO81ZHpA0HQ==", "cpu": [ "x64" ], @@ -754,9 +754,9 @@ } }, "node_modules/@cloudflare/workers-shared": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.7.0.tgz", - "integrity": "sha512-LLQRTqx7lKC7o2eCYMpyc5FXV8d0pUX6r3A+agzhqS9aoR5A6zCPefwQGcvbKx83ozX22ATZcemwxQXn12UofQ==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.5.4.tgz", + "integrity": "sha512-PNL/0TjKRdUHa1kwgVdqUNJVZ9ez4kacsi8omz+gv859EvJmsVuGiMAClY2YfJnC9LVKhKCcjqmFgKNXG9/IXA==", "dev": true, "dependencies": { "mime": "^3.0.0", @@ -767,9 +767,9 @@ } }, "node_modules/@cloudflare/workers-types": { - "version": "4.20241106.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241106.0.tgz", - "integrity": "sha512-pI4ivacmp+vgNO/siHDsZ6BdITR0LC4Mh/1+yzVLcl9U75pt5DUDCOWOiqIRFXRq6H65DPnJbEPFo3x9UfgofQ==", + "version": "4.20240924.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240924.0.tgz", + "integrity": "sha512-AnoHY0B5rgMv4Lg34mdwfp4+Z9ZZRli8AFO7uY8Q9UchR+HPEMEdaAQ0EswTYQqcVBdarRuYyM0Oeo4hM8Jqog==", "dev": true }, "node_modules/@cspotcode/source-map-support": { @@ -1702,9 +1702,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -2236,9 +2236,9 @@ "dev": true }, "node_modules/cookie": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", - "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "dev": true, "engines": { "node": ">= 0.6" @@ -2287,16 +2287,6 @@ "node": ">= 12" } }, - "node_modules/date-fns": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", - "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/kossnocorp" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -3092,12 +3082,6 @@ "node": ">=8" } }, - "node_modules/itty-time": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/itty-time/-/itty-time-1.0.6.tgz", - "integrity": "sha512-+P8IZaLLBtFv8hCkIjcymZOp4UJ+xW6bSlQsXGqrkmJh7vSiMFSlNne0mCYagEE0N7HDNR5jJBRxwN0oYv61Rw==", - "dev": true - }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -3954,9 +3938,9 @@ } }, "node_modules/miniflare": { - "version": "3.20241022.0", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241022.0.tgz", - "integrity": "sha512-x9Fbq1Hmz1f0osIT9Qmj78iX4UpCP2EqlZnA/tzj/3+I49vc3Kq0fNqSSKplcdf6HlCHdL3fOBicmreQF4BUUQ==", + "version": "3.20240909.5", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240909.5.tgz", + "integrity": "sha512-3Am3D9LGDljEKWnylSy6hFg3LFnNCo9DlWqZFcL7QkuIhQwN6Sqz1d6xQCkgft7FVXnykG6VNpz0NrjdW+mBjg==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.8.1", @@ -3967,7 +3951,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20241022.0", + "workerd": "1.20240909.0", "ws": "^8.17.1", "youch": "^3.2.2", "zod": "^3.22.3" @@ -4951,9 +4935,9 @@ }, "node_modules/unenv": { "name": "unenv-nightly", - "version": "2.0.0-20241024-111401-d4156ac", - "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20241024-111401-d4156ac.tgz", - "integrity": "sha512-xJO1hfY+Te+/XnfCYrCbFbRcgu6XEODND1s5wnVbaBCkuQX7JXF7fHEXPrukFE2j8EOH848P8QN19VO47XN8hw==", + "version": "2.0.0-20240919-125358-9a64854", + "resolved": "https://registry.npmjs.org/unenv-nightly/-/unenv-nightly-2.0.0-20240919-125358-9a64854.tgz", + "integrity": "sha512-XjsgUTrTHR7iw+k/SRTNjh6EQgwpC9voygnoCJo5kh4hKqsSDHUW84MhL9EsHTNfLctvVBHaSw8e2k3R2fKXsQ==", "dev": true, "dependencies": { "defu": "^6.1.4", @@ -5058,9 +5042,9 @@ } }, "node_modules/workerd": { - "version": "1.20241022.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241022.0.tgz", - "integrity": "sha512-jyGXsgO9DRcJyx6Ovv7gUyDPc3UYC2i/E0p9GFUg6GUzpldw4Y93y9kOmdfsOnKZ3+lY53veSiUniiBPE6Q2NQ==", + "version": "1.20240909.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240909.0.tgz", + "integrity": "sha512-NwuYh/Fgr/MK0H+Ht687sHl/f8tumwT5CWzYR0MZMHri8m3CIYu2IaY4tBFWoKE/tOU1Z5XjEXECa9zXY4+lwg==", "dev": true, "hasInstallScript": true, "bin": { @@ -5070,37 +5054,35 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20241022.0", - "@cloudflare/workerd-darwin-arm64": "1.20241022.0", - "@cloudflare/workerd-linux-64": "1.20241022.0", - "@cloudflare/workerd-linux-arm64": "1.20241022.0", - "@cloudflare/workerd-windows-64": "1.20241022.0" + "@cloudflare/workerd-darwin-64": "1.20240909.0", + "@cloudflare/workerd-darwin-arm64": "1.20240909.0", + "@cloudflare/workerd-linux-64": "1.20240909.0", + "@cloudflare/workerd-linux-arm64": "1.20240909.0", + "@cloudflare/workerd-windows-64": "1.20240909.0" } }, "node_modules/wrangler": { - "version": "3.85.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.85.0.tgz", - "integrity": "sha512-r5YCWUaF4ApLnloNE6jHHgRYdFzYHoajTlC1tns42UzQ2Ls63VAqD3b0cxOqzDUfmlSb3skpmu0B0Ssi3QWPAg==", + "version": "3.78.9", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.78.9.tgz", + "integrity": "sha512-4Z+KBai+xVU59EN8eyDyRXh+f0om3zKwIf2x9YZa9NCuw3bLF77n7wSoghjInTTYfPrKhsZqkPwlcDfVt/yK7g==", "dev": true, "dependencies": { "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.7.0", + "@cloudflare/workers-shared": "0.5.4", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", "chokidar": "^3.5.3", - "date-fns": "^4.1.0", "esbuild": "0.17.19", - "itty-time": "^1.0.6", - "miniflare": "3.20241022.0", + "miniflare": "3.20240909.5", "nanoid": "^3.3.3", "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "^0.6.1", - "unenv": "npm:unenv-nightly@2.0.0-20241024-111401-d4156ac", - "workerd": "1.20241022.0", + "unenv": "npm:unenv-nightly@2.0.0-20240919-125358-9a64854", + "workerd": "1.20240909.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -5114,7 +5096,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20241022.0" + "@cloudflare/workers-types": "^4.20240909.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { @@ -5240,12 +5222,12 @@ } }, "node_modules/youch": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz", - "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.3.tgz", + "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==", "dev": true, "dependencies": { - "cookie": "^0.7.1", + "cookie": "^0.5.0", "mustache": "^4.2.0", "stacktracey": "^2.1.8" } diff --git a/ecosystem-tests/cloudflare-worker/package.json b/ecosystem-tests/cloudflare-worker/package.json index 3034e97f7..64fa0ad25 100644 --- a/ecosystem-tests/cloudflare-worker/package.json +++ b/ecosystem-tests/cloudflare-worker/package.json @@ -17,7 +17,7 @@ "start-server-and-test": "^2.0.0", "ts-jest": "^29.1.0", "typescript": "5.0.4", - "wrangler": "^3.85.0" + "wrangler": "^3.74.0" }, "dependencies": { "node-fetch": "^3.3.1" diff --git a/ecosystem-tests/deno/deno.jsonc b/ecosystem-tests/deno/deno.jsonc index 46d7ee486..7de05f2ba 100644 --- a/ecosystem-tests/deno/deno.jsonc +++ b/ecosystem-tests/deno/deno.jsonc @@ -1,10 +1,11 @@ { "tasks": { "install": "deno install --node-modules-dir main_test.ts -f", - "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir --unstable-sloppy-imports --no-check" + "check": "deno lint && deno check main_test.ts", + "test": "deno test --allow-env --allow-net --allow-read --node-modules-dir" }, "imports": { - "openai": "../../dist-deno/index.ts", - "openai/": "../../dist-deno/" + "openai": "../../deno/mod.ts", + "openai/": "../../deno/" } } diff --git a/ecosystem-tests/node-js/test.js b/ecosystem-tests/node-js/test.js index e2a26f856..7f9f21736 100644 --- a/ecosystem-tests/node-js/test.js +++ b/ecosystem-tests/node-js/test.js @@ -1,35 +1,8 @@ +const openaiKey = "a valid OpenAI key" const OpenAI = require('openai'); -const openai = new OpenAI(); +console.log(OpenAI) -function assertEqual(actual, expected) { - if (actual === expected) { - return; - } - - console.error('expected', expected); - console.error('actual ', actual); - throw new Error('expected values to be equal'); -} - -async function main() { - const completion = await openai.chat.completions.create({ - model: 'gpt-4', - messages: [{ role: 'user', content: 'Say this is a test' }], - }); - if (!completion.choices[0].message.content) { - console.dir(completion, { depth: 4 }); - throw new Error('no response content!'); - } - - assertEqual( - decodeURIComponent(openai.stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - 'foo[nested][a]=true&foo[nested][b]=foo', - ); - assertEqual( - decodeURIComponent(openai.stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - 'foo[nested][a][]=hello&foo[nested][a][]=world', - ); -} - -main(); +const openai = new OpenAI({ + apiKey: openaiKey, +}); diff --git a/ecosystem-tests/node-ts-cjs-auto/moduleResolution/nodenext/type-tests.ts b/ecosystem-tests/node-ts-cjs-auto/moduleResolution/nodenext/type-tests.ts index c47ddc2a5..e70cad642 100644 --- a/ecosystem-tests/node-ts-cjs-auto/moduleResolution/nodenext/type-tests.ts +++ b/ecosystem-tests/node-ts-cjs-auto/moduleResolution/nodenext/type-tests.ts @@ -1,5 +1,6 @@ -import * as shims from 'openai/_shims/index'; +import OpenAI from 'openai'; -function typeTests(x: shims.Request) { - const url: string = x.url; +async function typeTests(client: OpenAI) { + const response = await client.chat.completions.create({ model: 'gpt-4o', messages: [] }).asResponse(); + const url: string = response.url; } diff --git a/ecosystem-tests/node-ts-cjs-auto/tests/shims.ts b/ecosystem-tests/node-ts-cjs-auto/tests/shims.ts deleted file mode 100644 index d34211578..000000000 --- a/ecosystem-tests/node-ts-cjs-auto/tests/shims.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as shims from 'openai/_shims/index'; -import * as fd from 'formdata-node'; - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('node'); - expect(shims.File).toBe(fd.File); -}); diff --git a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts index 203afba5a..e99ca56b6 100644 --- a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts +++ b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts @@ -165,18 +165,23 @@ it('handles formdata-node File', async function () { expect(result.text).toBeSimilarTo(correctAnswer, 12); }); -// @ts-ignore avoid DOM lib for testing purposes -if (typeof File !== 'undefined') { - it('handles builtinFile', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes - .then((x) => new File([x], filename)); +it('handles builtinFile', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level + x, + ], + filename, + ), + ); - const result = await client.audio.transcriptions.create({ file, model }); - expect(result.text).toBeSimilarTo(correctAnswer, 12); - }); -} + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); +}); it('handles Response', async function () { const file = await fetch(url); @@ -198,26 +203,15 @@ const fineTune = `{"prompt": "", "completion": " { it('handles form-data Blob', async function () { const result = await client.files.create({ - file: await toFile( - new FormDataBlob([ - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - ]), - 'finetune.jsonl', - ), + file: await toFile(new FormDataBlob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); - // @ts-ignore avoid DOM lib for testing purposes if (typeof Blob !== 'undefined') { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); @@ -225,44 +219,23 @@ describe('toFile', () => { } it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-cjs-web/package-lock.json b/ecosystem-tests/node-ts-cjs-web/package-lock.json index ff6fb3bac..b1624036b 100644 --- a/ecosystem-tests/node-ts-cjs-web/package-lock.json +++ b/ecosystem-tests/node-ts-cjs-web/package-lock.json @@ -13,7 +13,7 @@ "tsconfig-paths": "^4.0.0" }, "devDependencies": { - "@types/node": "^17.0.9", + "@types/node": "^18.0.0", "@types/node-fetch": "^2.6.1", "fastest-levenshtein": "^1.0.16", "formdata-polyfill": "^4.0.10", @@ -1137,10 +1137,14 @@ } }, "node_modules/@types/node": { - "version": "17.0.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", - "dev": true + "version": "18.19.64", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.64.tgz", + "integrity": "sha512-955mDqvO2vFf/oL7V3WiUtiz+BugyX8uVbaT2H8oj3+8dRyH2FLiNdowe7eNqRM7IOIZvzDH76EoAT+gwm6aIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/node-fetch": { "version": "2.6.11", @@ -4266,6 +4270,13 @@ "node": ">=4.2.0" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", diff --git a/ecosystem-tests/node-ts-cjs-web/package.json b/ecosystem-tests/node-ts-cjs-web/package.json index 8a50fcb43..3673778bc 100644 --- a/ecosystem-tests/node-ts-cjs-web/package.json +++ b/ecosystem-tests/node-ts-cjs-web/package.json @@ -13,7 +13,7 @@ "tsconfig-paths": "^4.0.0" }, "devDependencies": { - "@types/node": "^17.0.9", + "@types/node": "^18.0.0", "@types/node-fetch": "^2.6.1", "fastest-levenshtein": "^1.0.16", "formdata-polyfill": "^4.0.10", diff --git a/ecosystem-tests/node-ts-cjs-web/tests/shims.ts b/ecosystem-tests/node-ts-cjs-web/tests/shims.ts deleted file mode 100644 index 07279b9eb..000000000 --- a/ecosystem-tests/node-ts-cjs-web/tests/shims.ts +++ /dev/null @@ -1,11 +0,0 @@ -import 'openai/shims/web'; -import * as shims from 'openai/_shims/index'; - -function typeTests(x: shims.Request) { - const url: string = x.url; -} - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('web'); - expect(shims.File).toBe(File); -}); diff --git a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom-unpolyfilled.ts b/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom-unpolyfilled.ts deleted file mode 100644 index e536f3047..000000000 --- a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom-unpolyfilled.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @jest-environment jsdom - */ - -export {}; - -test('openai/shims/web throws if globals are missing', async () => { - await expect(() => import('openai/shims/web')).rejects.toThrow( - `this environment is missing the following Web Fetch API type: fetch is not defined. You may need to use polyfills`, - ); -}); diff --git a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts b/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts index e7b6be07d..d4619ab0c 100644 --- a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts +++ b/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts @@ -2,7 +2,6 @@ * @jest-environment jsdom */ import 'whatwg-fetch'; -import 'openai/shims/web'; import OpenAI, { toFile } from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; @@ -164,12 +163,3 @@ describe.skip('toFile', () => { expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-cjs-web/tests/test-node.ts b/ecosystem-tests/node-ts-cjs-web/tests/test-node.ts index 668e65332..c357d7070 100644 --- a/ecosystem-tests/node-ts-cjs-web/tests/test-node.ts +++ b/ecosystem-tests/node-ts-cjs-web/tests/test-node.ts @@ -1,4 +1,3 @@ -import 'openai/shims/web'; import OpenAI, { toFile } from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; @@ -103,6 +102,7 @@ if (typeof File !== 'undefined') { it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) + // @ts-ignore .then((x) => new File([x], filename)); const result = await client.audio.transcriptions.create({ file, model }); @@ -151,12 +151,3 @@ describe('toFile', () => { expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-cjs-web/types-test.ts b/ecosystem-tests/node-ts-cjs-web/types-test.ts new file mode 100644 index 000000000..bff3349c5 --- /dev/null +++ b/ecosystem-tests/node-ts-cjs-web/types-test.ts @@ -0,0 +1,8 @@ +import OpenAI from 'openai'; + +async function typeTests(client: OpenAI) { + const response = await client.chat.completions.create({ model: 'gpt-4o', messages: [] }).asResponse(); + const url: string = response.url; +} + +export {}; diff --git a/ecosystem-tests/node-ts-cjs/package.json b/ecosystem-tests/node-ts-cjs/package.json index 039b37a3d..c675b8f31 100644 --- a/ecosystem-tests/node-ts-cjs/package.json +++ b/ecosystem-tests/node-ts-cjs/package.json @@ -4,7 +4,7 @@ "main": "index.js", "private": true, "scripts": { - "tsc": "tsc && tsc -p tsconfig.nodenext.json && tsc -p node_modules/openai/src/tsconfig.json", + "tsc": "tsc && tsc -p tsconfig.nodenext.json", "test": "jest" }, "dependencies": { diff --git a/ecosystem-tests/node-ts-cjs/tests/late-shim-errors.ts b/ecosystem-tests/node-ts-cjs/tests/late-shim-errors.ts deleted file mode 100644 index 6b9c4d95c..000000000 --- a/ecosystem-tests/node-ts-cjs/tests/late-shim-errors.ts +++ /dev/null @@ -1,8 +0,0 @@ -export {}; - -test('throws if shims are imported after openai', async () => { - await import('openai'); - await expect(() => import('openai/shims/web')).rejects.toThrow( - `you must \`import 'openai/shims/web'\` before importing anything else from openai`, - ); -}); diff --git a/ecosystem-tests/node-ts-cjs/tests/multiple-shim-errors.ts b/ecosystem-tests/node-ts-cjs/tests/multiple-shim-errors.ts deleted file mode 100644 index 92261fd58..000000000 --- a/ecosystem-tests/node-ts-cjs/tests/multiple-shim-errors.ts +++ /dev/null @@ -1,8 +0,0 @@ -export {}; - -test('throws if multiple shims are imported', async () => { - await import('openai/shims/node'); - await expect(() => import('openai/shims/web')).rejects.toThrow( - `can't \`import 'openai/shims/web'\` after \`import 'openai/shims/node'\``, - ); -}); diff --git a/ecosystem-tests/node-ts-cjs/tests/shims.ts b/ecosystem-tests/node-ts-cjs/tests/shims.ts deleted file mode 100644 index d0b04bac5..000000000 --- a/ecosystem-tests/node-ts-cjs/tests/shims.ts +++ /dev/null @@ -1,12 +0,0 @@ -import 'openai/shims/node'; -import * as shims from 'openai/_shims/index'; -import * as fd from 'formdata-node'; - -function typeTests(x: shims.Request) { - const url: string = x.url; -} - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('node'); - expect(shims.File).toBe(fd.File); -}); diff --git a/ecosystem-tests/node-ts-cjs/tests/test-jsdom-compat-error.ts b/ecosystem-tests/node-ts-cjs/tests/test-jsdom-compat-error.ts deleted file mode 100644 index 066fc3dc2..000000000 --- a/ecosystem-tests/node-ts-cjs/tests/test-jsdom-compat-error.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @jest-environment jsdom - */ - -export {}; - -it(`throws when fetch API types are missing`, async () => { - await expect(() => import('openai')).rejects.toThrow( - 'this environment is missing the following Web Fetch API type', - ); -}); diff --git a/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts b/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts index 15b9df7c9..ddf782aee 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts @@ -1,7 +1,6 @@ /** * @jest-environment jsdom */ -import 'openai/shims/node'; import OpenAI, { toFile } from 'openai'; import fetch from 'node-fetch'; import { distance } from 'fastest-levenshtein'; @@ -15,7 +14,12 @@ const correctAnswer = 'It was anxious to find him no one that expectation of a man who were giving his father enjoyment. But he was avoided in sight in the minister to which indeed,'; const model = 'whisper-1'; -const client = new OpenAI({ apiKey: process.env['OPENAI_API_KEY'], dangerouslyAllowBrowser: true }); +const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], + dangerouslyAllowBrowser: true, + // @ts-expect-error node-fetch types are not compatible + fetch, +}); async function typeTests() { // @ts-expect-error this should error if the `Uploadable` type was resolved correctly @@ -82,7 +86,6 @@ it(`streaming works`, async function () { it.skip('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes .then((x) => new File([x], filename)); const result = await client.audio.transcriptions.create({ file, model }); @@ -101,55 +104,30 @@ const fineTune = `{"prompt": "", "completion": " { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-cjs/tests/test-node.ts b/ecosystem-tests/node-ts-cjs/tests/test-node.ts index 3f6e5d572..2e27de0f3 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-node.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-node.ts @@ -1,4 +1,3 @@ -import 'openai/shims/node'; import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; import fetch from 'node-fetch'; @@ -6,6 +5,7 @@ import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; +import type { ReadableStream as WebReadableStream } from 'node:stream/web'; const url = 'https://audio-samples.github.io/samples/mp3/blizzard_biased/sample-1.mp3'; const filename = 'sample-1.mp3'; @@ -65,13 +65,15 @@ it(`raw response`, async function () { }) .asResponse(); - // test that we can use node-fetch Response API + // As far as I can tell, we need to cast because the jest-jsdom types + const body = response.body as WebReadableStream; + + const decoder = new TextDecoder(); const chunks: string[] = []; - response.body.on('data', (chunk) => chunks.push(chunk)); - await new Promise((resolve, reject) => { - response.body.once('end', resolve); - response.body.once('error', reject); - }); + for await (const chunk of body) { + chunks.push(decoder.decode(chunk)); + } + const json: ChatCompletion = JSON.parse(chunks.join('')); expect(json.choices[0]?.message.content || '').toBeSimilarTo('This is a test', 10); }); @@ -100,18 +102,23 @@ it('handles formdata-node File', async function () { expect(result.text).toBeSimilarTo(correctAnswer, 12); }); -// @ts-ignore avoid DOM lib for testing purposes -if (typeof File !== 'undefined') { - it('handles builtinFile', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes - .then((x) => new File([x], filename)); +it('handles builtinFile', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level + x, + ], + filename, + ), + ); - const result = await client.audio.transcriptions.create({ file, model }); - expect(result.text).toBeSimilarTo(correctAnswer, 12); - }); -} + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); +}); it('handles Response', async function () { const file = await fetch(url); @@ -133,26 +140,15 @@ const fineTune = `{"prompt": "", "completion": " { it('handles form-data Blob', async function () { const result = await client.files.create({ - file: await toFile( - new FormDataBlob([ - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - ]), - 'finetune.jsonl', - ), + file: await toFile(new FormDataBlob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); - // @ts-ignore avoid DOM lib for testing purposes if (typeof Blob !== 'undefined') { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); @@ -160,44 +156,23 @@ describe('toFile', () => { } it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-es2020/index.ts b/ecosystem-tests/node-ts-es2020/index.ts deleted file mode 100644 index d92cc2720..000000000 --- a/ecosystem-tests/node-ts-es2020/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { zodResponseFormat } from 'openai/helpers/zod'; -import OpenAI from 'openai/index'; -import { z } from 'zod'; - -const Step = z.object({ - explanation: z.string(), - output: z.string(), -}); - -const MathResponse = z.object({ - steps: z.array(Step), - final_answer: z.string(), -}); - -async function main() { - const client = new OpenAI(); - - const completion = await client.beta.chat.completions.parse({ - model: 'gpt-4o-2024-08-06', - messages: [ - { role: 'system', content: 'You are a helpful math tutor.' }, - { role: 'user', content: 'solve 8x + 31 = 2' }, - ], - response_format: zodResponseFormat(MathResponse, 'math_response'), - }); - - console.dir(completion, { depth: 5 }); - - const message = completion.choices[0]?.message; - if (message?.parsed) { - console.log(message.parsed.steps); - console.log(`answer: ${message.parsed.final_answer}`); - } -} - -main(); diff --git a/ecosystem-tests/node-ts-es2020/package-lock.json b/ecosystem-tests/node-ts-es2020/package-lock.json deleted file mode 100644 index 5ae1d5aa0..000000000 --- a/ecosystem-tests/node-ts-es2020/package-lock.json +++ /dev/null @@ -1,193 +0,0 @@ -{ - "name": "node-ts-es2020", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "node-ts-es2020", - "version": "1.0.0", - "dependencies": { - "ts-node": "^10.9.2", - "zod": "^3.23.8" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" - }, - "node_modules/@types/node": { - "version": "20.4.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", - "peer": true - }, - "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" - }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "engines": { - "node": ">=6" - } - }, - "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - } -} diff --git a/ecosystem-tests/node-ts-es2020/package.json b/ecosystem-tests/node-ts-es2020/package.json deleted file mode 100644 index ea7e488f5..000000000 --- a/ecosystem-tests/node-ts-es2020/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "node-ts-es2020", - "version": "1.0.0", - "main": "index.js", - "scripts": { - "tsc": "tsc && tsc -p tsconfig.nodenext.json && tsc -p node_modules/openai/src/tsconfig.json", - "main": "ts-node index.ts" - }, - "dependencies": { - "ts-node": "^10.9.2", - "zod": "^3.23.8" - }, - "overrides": { - "@types/node": "20.4.2" - } -} diff --git a/ecosystem-tests/node-ts-es2020/tsconfig.base.json b/ecosystem-tests/node-ts-es2020/tsconfig.base.json deleted file mode 100644 index 8edad9422..000000000 --- a/ecosystem-tests/node-ts-es2020/tsconfig.base.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "compilerOptions": { - "target": "es2020", - "module": "commonjs", - "lib": ["es2020", "dom"], - "allowJs": false, - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "removeComments": true, - "forceConsistentCasingInFileNames": true, - "downlevelIteration": true, - "strict": true, - "moduleResolution": "node", - "paths": {}, - "typeRoots": ["node_modules/@types"], - "types": ["node"], - "allowSyntheticDefaultImports": false, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "resolveJsonModule": true, - "incremental": true, - "strictBindCallApply": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "noImplicitAny": true, - "noImplicitThis": true, - "noImplicitReturns": true, - "noUnusedParameters": true, - "noUnusedLocals": true, - "noFallthroughCasesInSwitch": true, - "preserveSymlinks": true, - "suppressImplicitAnyIndexErrors": true - }, - "exclude": ["node_modules"] -} diff --git a/ecosystem-tests/node-ts-es2020/tsconfig.json b/ecosystem-tests/node-ts-es2020/tsconfig.json deleted file mode 100644 index aa3b68f53..000000000 --- a/ecosystem-tests/node-ts-es2020/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "ts-node": { - "swc": true, - "transpileOnly": true - }, - "compilerOptions": { - "declaration": false, - "declarationMap": false, - "allowJs": true, - "checkJs": false, - "outDir": "./dist", - "baseUrl": "./", - "types": ["node", "jest"], - "paths": {} - }, - "include": ["index.ts", "tsconfig.json", "jest.config.ts", ".eslintrc.js"] -} diff --git a/ecosystem-tests/node-ts-es2020/tsconfig.nodenext.json b/ecosystem-tests/node-ts-es2020/tsconfig.nodenext.json deleted file mode 100644 index 97df071fb..000000000 --- a/ecosystem-tests/node-ts-es2020/tsconfig.nodenext.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "include": ["tests/*.ts", "index.ts"], - "exclude": ["tests/*-shim-errors.ts"], - - "compilerOptions": { - /* Visit https://aka.ms/tsconfig.json to read more about this file */ - /* Projects */ - "incremental": true, - - /* Language and Environment */ - "target": "ES2015", - "lib": ["ES2015"], - "jsx": "react", - - /* Modules */ - "module": "commonjs", - "rootDir": "./", - "moduleResolution": "NodeNext", - "baseUrl": "./", - "paths": { - "~/*": ["*"] - }, - "resolveJsonModule": true, - "composite": true, - - /* Emit */ - "outDir": "node_modules", - "noEmit": true, - - /* Interop Constraints */ - "isolatedModules": true, - "allowSyntheticDefaultImports": true, - /* "esModuleInterop": true, */ - "forceConsistentCasingInFileNames": true, - "allowJs": true, - "checkJs": true, - - /* Experimental Features */ - "experimentalDecorators": true, - - /* Type Checking */ - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "strictBindCallApply": true, - "strictPropertyInitialization": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - "noPropertyAccessFromIndexSignature": true, - "skipLibCheck": false - } -} diff --git a/ecosystem-tests/node-ts-esm-auto/esnext-type-tests.ts b/ecosystem-tests/node-ts-esm-auto/esnext-type-tests.ts index c47ddc2a5..e70cad642 100644 --- a/ecosystem-tests/node-ts-esm-auto/esnext-type-tests.ts +++ b/ecosystem-tests/node-ts-esm-auto/esnext-type-tests.ts @@ -1,5 +1,6 @@ -import * as shims from 'openai/_shims/index'; +import OpenAI from 'openai'; -function typeTests(x: shims.Request) { - const url: string = x.url; +async function typeTests(client: OpenAI) { + const response = await client.chat.completions.create({ model: 'gpt-4o', messages: [] }).asResponse(); + const url: string = response.url; } diff --git a/ecosystem-tests/node-ts-esm-auto/tests/shims.ts b/ecosystem-tests/node-ts-esm-auto/tests/shims.ts deleted file mode 100644 index aed8e6497..000000000 --- a/ecosystem-tests/node-ts-esm-auto/tests/shims.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as shims from 'openai/_shims/index'; - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('node'); -}); diff --git a/ecosystem-tests/node-ts-esm-auto/tests/test.ts b/ecosystem-tests/node-ts-esm-auto/tests/test.ts index 88beb2f54..ae5db37e6 100644 --- a/ecosystem-tests/node-ts-esm-auto/tests/test.ts +++ b/ecosystem-tests/node-ts-esm-auto/tests/test.ts @@ -1,4 +1,3 @@ -import 'openai/shims/node'; import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; import fetch from 'node-fetch'; @@ -65,15 +64,12 @@ it(`raw response`, async function () { }) .asResponse(); - // test that we can use node-fetch Response API + const decoder = new TextDecoder(); const chunks: string[] = []; - const { body } = response; - if (!body) throw new Error(`expected response.body to be defined`); - body.on('data', (chunk) => chunks.push(chunk)); - await new Promise((resolve, reject) => { - body.once('end', resolve); - body.once('error', reject); - }); + for await (const chunk of response.body!) { + chunks.push(decoder.decode(chunk)); + } + const json: ChatCompletion = JSON.parse(chunks.join('')); expect(json.choices[0]?.message.content || '').toBeSimilarTo('This is a test', 10); }); @@ -102,18 +98,23 @@ it('handles formdata-node File', async function () { expect(result.text).toBeSimilarTo(correctAnswer, 12); }); -// @ts-ignore avoid DOM lib for testing purposes -if (typeof File !== 'undefined') { - it('handles builtinFile', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes - .then((x) => new File([x], filename)); +it('handles builtinFile', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level + x, + ], + filename, + ), + ); - const result = await client.audio.transcriptions.create({ file, model }); - expect(result.text).toBeSimilarTo(correctAnswer, 12); - }); -} + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); +}); it('handles Response', async function () { const file = await fetch(url); @@ -135,26 +136,15 @@ const fineTune = `{"prompt": "", "completion": " { it('handles form-data Blob', async function () { const result = await client.files.create({ - file: await toFile( - new FormDataBlob([ - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - ]), - 'finetune.jsonl', - ), + file: await toFile(new FormDataBlob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); - // @ts-ignore avoid DOM lib for testing purposes if (typeof Blob !== 'undefined') { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); @@ -162,44 +152,23 @@ describe('toFile', () => { } it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-esm-web/tests/shims.ts b/ecosystem-tests/node-ts-esm-web/tests/shims.ts deleted file mode 100644 index ea219ffb4..000000000 --- a/ecosystem-tests/node-ts-esm-web/tests/shims.ts +++ /dev/null @@ -1,12 +0,0 @@ -// shouldn't need extension, but Jest's ESM module resolution is broken -import 'openai/shims/web.mjs'; -import * as shims from 'openai/_shims/index'; - -function typeTests(x: shims.Request) { - const url: string = x.url; -} - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('web'); - expect(shims.File).toEqual(File); -}); diff --git a/ecosystem-tests/node-ts-esm-web/tests/test.ts b/ecosystem-tests/node-ts-esm-web/tests/test.ts index 675fb9a73..520fe64b3 100644 --- a/ecosystem-tests/node-ts-esm-web/tests/test.ts +++ b/ecosystem-tests/node-ts-esm-web/tests/test.ts @@ -1,5 +1,3 @@ -// shouldn't need extension, but Jest's ESM module resolution is broken -import 'openai/shims/web.mjs'; import OpenAI, { toFile } from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; @@ -104,7 +102,16 @@ if (typeof File !== 'undefined') { it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) - .then((x) => new File([x], filename)); + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level + x, + ], + filename, + ), + ); const result = await client.audio.transcriptions.create({ file, model }); expect(result.text).toBeSimilarTo(correctAnswer, 12); @@ -152,12 +159,3 @@ describe('toFile', () => { expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-esm-web/types-test.ts b/ecosystem-tests/node-ts-esm-web/types-test.ts new file mode 100644 index 000000000..bff3349c5 --- /dev/null +++ b/ecosystem-tests/node-ts-esm-web/types-test.ts @@ -0,0 +1,8 @@ +import OpenAI from 'openai'; + +async function typeTests(client: OpenAI) { + const response = await client.chat.completions.create({ model: 'gpt-4o', messages: [] }).asResponse(); + const url: string = response.url; +} + +export {}; diff --git a/ecosystem-tests/node-ts-esm/iitm.js b/ecosystem-tests/node-ts-esm/iitm.js new file mode 100644 index 000000000..1f818d617 --- /dev/null +++ b/ecosystem-tests/node-ts-esm/iitm.js @@ -0,0 +1,2 @@ +import {register} from 'node:module' +register('import-in-the-middle/hook.mjs', import.meta.url) \ No newline at end of file diff --git a/ecosystem-tests/node-ts-esm/package-lock.json b/ecosystem-tests/node-ts-esm/package-lock.json index cb5b8eaa8..dd1b7d3c3 100644 --- a/ecosystem-tests/node-ts-esm/package-lock.json +++ b/ecosystem-tests/node-ts-esm/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^5.0.1", + "import-in-the-middle": "^1.11.2", "node-fetch": "^3.0.0" }, "devDependencies": { @@ -1190,7 +1191,6 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true, "bin": { "acorn": "bin/acorn" }, @@ -1198,6 +1198,15 @@ "node": ">=0.4.0" } }, + "node_modules/acorn-import-attributes": { + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz", + "integrity": "sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ==", + "license": "MIT", + "peerDependencies": { + "acorn": "^8" + } + }, "node_modules/acorn-walk": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", @@ -1549,8 +1558,7 @@ "node_modules/cjs-module-lexer": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", - "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", - "dev": true + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==" }, "node_modules/cliui": { "version": "8.0.1", @@ -2081,6 +2089,18 @@ "node": ">=10.17.0" } }, + "node_modules/import-in-the-middle": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.11.2.tgz", + "integrity": "sha512-gK6Rr6EykBcc6cVWRSBR5TWf8nn6hZMYSRYqCcHa0l0d1fPK7JSYo6+Mlmck76jIX9aL/IZ71c06U2VpFwl1zA==", + "license": "Apache-2.0", + "dependencies": { + "acorn": "^8.8.2", + "acorn-import-attributes": "^1.9.5", + "cjs-module-lexer": "^1.2.2", + "module-details-from-path": "^1.0.3" + } + }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -3078,6 +3098,12 @@ "node": "*" } }, + "node_modules/module-details-from-path": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz", + "integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A==", + "license": "MIT" + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/ecosystem-tests/node-ts-esm/package.json b/ecosystem-tests/node-ts-esm/package.json index a4f42790f..68239e747 100644 --- a/ecosystem-tests/node-ts-esm/package.json +++ b/ecosystem-tests/node-ts-esm/package.json @@ -6,10 +6,11 @@ "private": true, "scripts": { "tsc": "tsc && tsc -p tsconfig.noderesolution.json", - "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js" + "test": "node --import=./iitm.js --experimental-vm-modules node_modules/jest/bin/jest.js" }, "dependencies": { "formdata-node": "^5.0.1", + "import-in-the-middle": "^1.11.2", "node-fetch": "^3.0.0" }, "devDependencies": { diff --git a/ecosystem-tests/node-ts-esm/tests/shims.ts b/ecosystem-tests/node-ts-esm/tests/shims.ts deleted file mode 100644 index a7a22ddb4..000000000 --- a/ecosystem-tests/node-ts-esm/tests/shims.ts +++ /dev/null @@ -1,7 +0,0 @@ -// shouldn't need extension, but Jest's ESM module resolution is broken -import 'openai/shims/node.mjs'; -import * as shims from 'openai/_shims/index'; - -test('openai/shims/node', () => { - expect(shims.kind).toEqual('node'); -}); diff --git a/ecosystem-tests/node-ts-esm/tests/test-esnext.ts b/ecosystem-tests/node-ts-esm/tests/test-esnext.ts index 05cdd1047..a9a7c21f5 100644 --- a/ecosystem-tests/node-ts-esm/tests/test-esnext.ts +++ b/ecosystem-tests/node-ts-esm/tests/test-esnext.ts @@ -1,13 +1,12 @@ -import 'openai/shims/node.mjs'; import OpenAI from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; -import * as shims from 'openai/_shims/index'; // The tests in this file don't typecheck with "moduleResolution": "node" -function typeTests(x: shims.Request) { - const url: string = x.url; +async function typeTests(client: OpenAI) { + const response = await client.chat.completions.create({ model: 'gpt-4o', messages: [] }).asResponse(); + const url: string = response.url; } const client = new OpenAI(); @@ -54,22 +53,14 @@ it(`raw response`, async function () { // test that we can use node-fetch Response API const chunks: string[] = []; - const { body } = response; - if (!body) throw new Error(`expected response.body to be defined`); - body.on('data', (chunk) => chunks.push(chunk)); - await new Promise((resolve, reject) => { - body.once('end', resolve); - body.once('error', reject); - }); + if (!response.body) throw new Error(`expected response.body to be defined`); + + const decoder = new TextDecoder(); + + for await (const chunk of response.body) { + chunks.push(decoder.decode(chunk)); + } + const json: ChatCompletion = JSON.parse(chunks.join('')); expect(json.choices[0]?.message.content || '').toBeSimilarTo('This is a test', 10); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts-esm/tests/test.ts b/ecosystem-tests/node-ts-esm/tests/test.ts index 7694a9874..d3f15f9fb 100644 --- a/ecosystem-tests/node-ts-esm/tests/test.ts +++ b/ecosystem-tests/node-ts-esm/tests/test.ts @@ -1,5 +1,3 @@ -// shouldn't need extension, but Jest's ESM module resolution is broken -import 'openai/shims/node.mjs'; import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; import fetch from 'node-fetch'; @@ -81,13 +79,20 @@ it('handles formdata-node File', async function () { expect(result.text).toBeSimilarTo(correctAnswer, 12); }); -// @ts-ignore avoid DOM lib for testing purposes if (typeof File !== 'undefined') { it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes - .then((x) => new File([x], filename)); + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level with certain tsconfigs + x, + ], + filename, + ), + ); const result = await client.audio.transcriptions.create({ file, model }); expect(result.text).toBeSimilarTo(correctAnswer, 12); @@ -114,26 +119,15 @@ const fineTune = `{"prompt": "", "completion": " { it('handles form-data Blob', async function () { const result = await client.files.create({ - file: await toFile( - new FormDataBlob([ - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - ]), - 'finetune.jsonl', - ), + file: await toFile(new FormDataBlob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); - // @ts-ignore avoid DOM lib for testing purposes if (typeof Blob !== 'undefined') { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); @@ -141,44 +135,23 @@ describe('toFile', () => { } it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts4.5-jest27/jest.config.cjs b/ecosystem-tests/node-ts4.5-jest28/jest.config.cjs similarity index 100% rename from ecosystem-tests/node-ts4.5-jest27/jest.config.cjs rename to ecosystem-tests/node-ts4.5-jest28/jest.config.cjs diff --git a/ecosystem-tests/node-ts4.5-jest27/package-lock.json b/ecosystem-tests/node-ts4.5-jest28/package-lock.json similarity index 66% rename from ecosystem-tests/node-ts4.5-jest27/package-lock.json rename to ecosystem-tests/node-ts4.5-jest28/package-lock.json index bedd114f8..4b98e5836 100644 --- a/ecosystem-tests/node-ts4.5-jest27/package-lock.json +++ b/ecosystem-tests/node-ts4.5-jest28/package-lock.json @@ -18,134 +18,63 @@ "@types/node-fetch": "^2.6.1", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", - "jest": "27.5.1", - "ts-jest": "27.1.5", + "jest": "28.1.3", + "ts-jest": "^28.0.0", "typescript": "4.5.5" } }, "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@babel/code-frame": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", - "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.13", - "chalk": "^2.4.2" + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/code-frame/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/code-frame/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/code-frame/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/@babel/compat-data": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", - "integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.25.4.tgz", + "integrity": "sha512-+LGRog6RAsCJrrrg/IO6LGmpphNe5DiK30dGjCoxxeGv49B10/3XYGxPsAwrDlMFcFEvdAUavDT8r9k/hSyQqQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.22.17", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.17.tgz", - "integrity": "sha512-2EENLmhpwplDux5PSsZnSbnSkB3tZ6QTksgO25xwEL7pIDcNOMhF5v/s6RzwjMZzZzw9Ofc30gHv5ChCC8pifQ==", + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.25.2.tgz", + "integrity": "sha512-BBt3opiCOxUr9euZ5/ro/Xv8/V7yJ5bjYMqG/C1YAo8MIKAnumZalCN+msbci3Pigy4lIQfPUpfMM27HMGaYEA==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-module-transforms": "^7.22.17", - "@babel/helpers": "^7.22.15", - "@babel/parser": "^7.22.16", - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.17", - "@babel/types": "^7.22.17", - "convert-source-map": "^1.7.0", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.25.0", + "@babel/helper-compilation-targets": "^7.25.2", + "@babel/helper-module-transforms": "^7.25.2", + "@babel/helpers": "^7.25.0", + "@babel/parser": "^7.25.0", + "@babel/template": "^7.25.0", + "@babel/traverse": "^7.25.2", + "@babel/types": "^7.25.2", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", "json5": "^2.2.3", @@ -159,15 +88,21 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, "node_modules/@babel/generator": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", - "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.25.6.tgz", + "integrity": "sha512-VPC82gr1seXOpkjAAKoLhP50vx4vGNlF4msF64dSFq1P8RfB+QAuJWGHPXXPc8QyfVWwwB/TNNU4+ayZmHNbZw==", "dev": true, "dependencies": { - "@babel/types": "^7.22.15", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", + "@babel/types": "^7.25.6", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^2.5.1" }, "engines": { @@ -175,14 +110,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", - "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.2.tgz", + "integrity": "sha512-U2U5LsSaZ7TAt3cfaymQ8WHh0pxvdHoEk6HVpaexxixjyEquMh0L0YNJNM6CTGKMXV1iksi0iZkGw4AcFkPaaw==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.15", - "browserslist": "^4.21.9", + "@babel/compat-data": "^7.25.2", + "@babel/helper-validator-option": "^7.24.8", + "browserslist": "^4.23.1", "lru-cache": "^5.1.1", "semver": "^6.3.1" }, @@ -190,63 +125,29 @@ "node": ">=6.9.0" } }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", - "dev": true, - "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", "dev": true, "dependencies": { - "@babel/types": "^7.22.15" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.22.17", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.17.tgz", - "integrity": "sha512-XouDDhQESrLHTpnBtCKExJdyY4gJCdrvH2Pyv8r8kovX2U8G0dRUOT45T9XlbLtuu9CLXP15eusnkprhoPV5iQ==", + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.25.2.tgz", + "integrity": "sha512-BjyRAbix6j/wv83ftcVJmBt72QtHI56C7JXZoG2xATiLpmoC7dpd8WnkikExHDVPpi/3qCmO6WY1EaXOluiecQ==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-simple-access": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.15" + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", + "@babel/traverse": "^7.25.2" }, "engines": { "node": ">=6.9.0" @@ -256,88 +157,77 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", - "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", "dev": true, "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", - "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.22.5" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz", - "integrity": "sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", - "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", + "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz", - "integrity": "sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.25.6.tgz", + "integrity": "sha512-Xg0tn4HcfTijTwfDwYlvVCl43V6h4KyVVX2aEm4qdO/PC6L2YvzLHFdmxhoeSA3eslcE6+ZVXHgWwopXYLNq4Q==", "dev": true, "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.6" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.13.tgz", - "integrity": "sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.24.7", "chalk": "^2.4.2", - "js-tokens": "^4.0.0" + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -415,10 +305,13 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.16", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", - "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", + "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", "dev": true, + "dependencies": { + "@babel/types": "^7.25.6" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -462,6 +355,36 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.25.6.tgz", + "integrity": "sha512-sXaDXaJN9SNLymBdlWFA+bjzBhFD617ZaFiY13dGt7TVslVvVgA6fkZOP7Ki3IGElC45lwHdOTrCtKZGVAWeLQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", @@ -558,6 +481,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", @@ -574,12 +512,12 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", - "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "version": "7.25.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.25.4.tgz", + "integrity": "sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" + "@babel/helper-plugin-utils": "^7.24.8" }, "engines": { "node": ">=6.9.0" @@ -589,34 +527,31 @@ } }, "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "version": "7.25.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.0.tgz", + "integrity": "sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.25.0", + "@babel/types": "^7.25.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.17", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.17.tgz", - "integrity": "sha512-xK4Uwm0JnAMvxYZxOVecss85WxTEIbTa7bnGyf/+EgCL5Zt3U7htUpEOWv9detPlamGKuRzCqw74xVglDWpPdg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/generator": "^7.22.15", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.16", - "@babel/types": "^7.22.17", - "debug": "^4.1.0", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.25.6.tgz", + "integrity": "sha512-9Vrcx5ZW6UwK5tvqsj0nGpp/XzqthkT0dqIc9g1AdtygFToNtTF67XzYS//dm+SAK9cp3B9R4ZO/46p63SCjlQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.25.6", + "@babel/parser": "^7.25.6", + "@babel/template": "^7.25.0", + "@babel/types": "^7.25.6", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -624,13 +559,13 @@ } }, "node_modules/@babel/types": { - "version": "7.22.17", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.17.tgz", - "integrity": "sha512-YSQPHLFtQNE5xN9tHuZnzu8vPr61wVTBZdfv1meex1NBosa4iT05k/Jw06ddJugi4bk7The/oSwQGFcksmEJQg==", + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", + "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.15", + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -669,59 +604,60 @@ } }, "node_modules/@jest/console": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-27.5.1.tgz", - "integrity": "sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-28.1.3.tgz", + "integrity": "sha512-QPAkP5EwKdK/bxIr6C1I4Vs0rm2nHiANzj/Z5X2JQkrZo6IqvC4ldZ9K95tF0HdidhA8Bo6egxSzUFPYKcEXLw==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "@types/node": "*", "chalk": "^4.0.0", - "jest-message-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-message-util": "^28.1.3", + "jest-util": "^28.1.3", "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/core": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-27.5.1.tgz", - "integrity": "sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-28.1.3.tgz", + "integrity": "sha512-CIKBrlaKOzA7YG19BEqCw3SLIsEwjZkeJzf5bdooVnW4bH5cktqe3JX+G2YV1aK5vP8N9na1IGWFzYaTp6k6NA==", "dev": true, "dependencies": { - "@jest/console": "^27.5.1", - "@jest/reporters": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.1.3", + "@jest/reporters": "^28.1.3", + "@jest/test-result": "^28.1.3", + "@jest/transform": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "emittery": "^0.8.1", + "ci-info": "^3.2.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", - "jest-changed-files": "^27.5.1", - "jest-config": "^27.5.1", - "jest-haste-map": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-resolve-dependencies": "^27.5.1", - "jest-runner": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", - "jest-validate": "^27.5.1", - "jest-watcher": "^27.5.1", + "jest-changed-files": "^28.1.3", + "jest-config": "^28.1.3", + "jest-haste-map": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-regex-util": "^28.0.2", + "jest-resolve": "^28.1.3", + "jest-resolve-dependencies": "^28.1.3", + "jest-runner": "^28.1.3", + "jest-runtime": "^28.1.3", + "jest-snapshot": "^28.1.3", + "jest-util": "^28.1.3", + "jest-validate": "^28.1.3", + "jest-watcher": "^28.1.3", "micromatch": "^4.0.4", + "pretty-format": "^28.1.3", "rimraf": "^3.0.0", "slash": "^3.0.0", "strip-ansi": "^6.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -732,86 +668,153 @@ } } }, + "node_modules/@jest/core/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/core/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@jest/core/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/@jest/environment": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-27.5.1.tgz", - "integrity": "sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-28.1.3.tgz", + "integrity": "sha512-1bf40cMFTEkKyEf585R9Iz1WayDjHoHqvts0XFYEqyKM3cFWDpeMoqKKTAF9LSYQModPUlh8FKptoM2YcMWAXA==", "dev": true, "dependencies": { - "@jest/fake-timers": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/fake-timers": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", - "jest-mock": "^27.5.1" + "jest-mock": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-28.1.3.tgz", + "integrity": "sha512-lzc8CpUbSoE4dqT0U+g1qODQjBRHPpCPXissXD4mS9+sWQdmmpeJ9zSH1rS1HEkrsMN0fb7nKrJ9giAR1d3wBw==", + "dev": true, + "dependencies": { + "expect": "^28.1.3", + "jest-snapshot": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-28.1.3.tgz", + "integrity": "sha512-wvbi9LUrHJLn3NlDW6wF2hvIMtd4JUl2QNVrjq+IBSHirgfrR3o9RnVtxzdEGO2n9JyIWwHnLfby5KzqBGg2YA==", + "dev": true, + "dependencies": { + "jest-get-type": "^28.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/@jest/expect-utils/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/fake-timers": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-27.5.1.tgz", - "integrity": "sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-28.1.3.tgz", + "integrity": "sha512-D/wOkL2POHv52h+ok5Oj/1gOG9HSywdoPtFsRCUmlCILXNn5eIWmcnd3DIiWlJnpGvQtmajqBP95Ei0EimxfLw==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "@sinonjs/fake-timers": "^8.0.1", + "@jest/types": "^28.1.3", + "@sinonjs/fake-timers": "^9.1.2", "@types/node": "*", - "jest-message-util": "^27.5.1", - "jest-mock": "^27.5.1", - "jest-util": "^27.5.1" + "jest-message-util": "^28.1.3", + "jest-mock": "^28.1.3", + "jest-util": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/globals": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-27.5.1.tgz", - "integrity": "sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-28.1.3.tgz", + "integrity": "sha512-XFU4P4phyryCXu1pbcqMO0GSQcYe1IsalYCDzRNyhetyeyxMcIxa11qPNDpVNLeretItNqEmYYQn1UYz/5x1NA==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/types": "^27.5.1", - "expect": "^27.5.1" + "@jest/environment": "^28.1.3", + "@jest/expect": "^28.1.3", + "@jest/types": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/reporters": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-27.5.1.tgz", - "integrity": "sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-28.1.3.tgz", + "integrity": "sha512-JuAy7wkxQZVNU/V6g9xKzCGC5LVXx9FDcABKsSXp5MiKPEE2144a/vXTEDoyzjUpZKfVwp08Wqg5A4WfTMAzjg==", "dev": true, "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.1.3", + "@jest/test-result": "^28.1.3", + "@jest/transform": "^28.1.3", + "@jest/types": "^28.1.3", + "@jridgewell/trace-mapping": "^0.3.13", "@types/node": "*", "chalk": "^4.0.0", "collect-v8-coverage": "^1.0.0", "exit": "^0.1.2", - "glob": "^7.1.2", + "glob": "^7.1.3", "graceful-fs": "^4.2.9", "istanbul-lib-coverage": "^3.0.0", "istanbul-lib-instrument": "^5.1.0", "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^4.0.0", "istanbul-reports": "^3.1.3", - "jest-haste-map": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-util": "^27.5.1", - "jest-worker": "^27.5.1", + "jest-message-util": "^28.1.3", + "jest-util": "^28.1.3", + "jest-worker": "^28.1.3", "slash": "^3.0.0", - "source-map": "^0.6.0", "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", "terminal-link": "^2.0.0", - "v8-to-istanbul": "^8.1.0" + "v8-to-istanbul": "^9.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -822,140 +825,159 @@ } } }, + "node_modules/@jest/schemas": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-28.1.3.tgz", + "integrity": "sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.24.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, "node_modules/@jest/source-map": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-27.5.1.tgz", - "integrity": "sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg==", + "version": "28.1.2", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-28.1.2.tgz", + "integrity": "sha512-cV8Lx3BeStJb8ipPHnqVw/IM2VCMWO3crWZzYodSIkxXnRcXJipCdx1JCK0K5MsJJouZQTH73mzf4vgxRaH9ww==", "dev": true, "dependencies": { + "@jridgewell/trace-mapping": "^0.3.13", "callsites": "^3.0.0", - "graceful-fs": "^4.2.9", - "source-map": "^0.6.0" + "graceful-fs": "^4.2.9" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/test-result": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-27.5.1.tgz", - "integrity": "sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-28.1.3.tgz", + "integrity": "sha512-kZAkxnSE+FqE8YjW8gNuoVkkC9I7S1qmenl8sGcDOLropASP+BkcGKwhXoyqQuGOGeYY0y/ixjrd/iERpEXHNg==", "dev": true, "dependencies": { - "@jest/console": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.1.3", + "@jest/types": "^28.1.3", "@types/istanbul-lib-coverage": "^2.0.0", "collect-v8-coverage": "^1.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/test-sequencer": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz", - "integrity": "sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-28.1.3.tgz", + "integrity": "sha512-NIMPEqqa59MWnDi1kvXXpYbqsfQmSJsIbnd85mdVGkiDfQ9WQQTXOLsvISUfonmnBT+w85WEgneCigEEdHDFxw==", "dev": true, "dependencies": { - "@jest/test-result": "^27.5.1", + "@jest/test-result": "^28.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-runtime": "^27.5.1" + "jest-haste-map": "^28.1.3", + "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/transform": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-27.5.1.tgz", - "integrity": "sha512-ipON6WtYgl/1329g5AIJVbUuEh0wZVbdpGwC99Jw4LwuoBNS95MVphU6zOeD9pDkon+LLbFL7lOQRapbB8SCHw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-28.1.3.tgz", + "integrity": "sha512-u5dT5di+oFI6hfcLOHGTAfmUxFRrjK+vnaP0kkVow9Md/M7V/MxqQMOz/VV25UZO8pzeA9PjfTpOu6BDuwSPQA==", "dev": true, "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^27.5.1", + "@babel/core": "^7.11.6", + "@jest/types": "^28.1.3", + "@jridgewell/trace-mapping": "^0.3.13", "babel-plugin-istanbul": "^6.1.1", "chalk": "^4.0.0", "convert-source-map": "^1.4.0", "fast-json-stable-stringify": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-haste-map": "^28.1.3", + "jest-regex-util": "^28.0.2", + "jest-util": "^28.1.3", "micromatch": "^4.0.4", "pirates": "^4.0.4", "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" + "write-file-atomic": "^4.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jest/types": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-27.5.1.tgz", - "integrity": "sha512-Cx46iJ9QpwQTjIdq5VJu2QTMMs3QlEjI0x1QbBP5W1+nMzyc2XmimiRR/CbX9TO0cPTeUlxWMOu8mslYsJ8DEw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-28.1.3.tgz", + "integrity": "sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ==", "dev": true, "dependencies": { + "@jest/schemas": "^28.1.3", "@types/istanbul-lib-coverage": "^2.0.0", "@types/istanbul-reports": "^3.0.0", "@types/node": "*", - "@types/yargs": "^16.0.0", + "@types/yargs": "^17.0.8", "chalk": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", "dev": true, "dependencies": { - "@jridgewell/set-array": "^1.0.1", + "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" + "@jridgewell/trace-mapping": "^0.3.24" }, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", - "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@sinclair/typebox": { + "version": "0.24.51", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.24.51.tgz", + "integrity": "sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==", + "dev": true + }, "node_modules/@sinonjs/commons": { "version": "1.8.6", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", @@ -966,27 +988,18 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz", - "integrity": "sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg==", + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", "dev": true, "dependencies": { "@sinonjs/commons": "^1.7.0" } }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/@types/babel__core": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", - "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", "dev": true, "dependencies": { "@babel/parser": "^7.20.7", @@ -997,18 +1010,18 @@ } }, "node_modules/@types/babel__generator": { - "version": "7.6.4", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", - "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", "dev": true, "dependencies": { "@babel/types": "^7.0.0" } }, "node_modules/@types/babel__template": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", - "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", "dev": true, "dependencies": { "@babel/parser": "^7.1.0", @@ -1016,42 +1029,42 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", - "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz", + "integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==", "dev": true, "dependencies": { "@babel/types": "^7.20.7" } }, "node_modules/@types/graceful-fs": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", - "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", "dev": true, "dependencies": { "@types/node": "*" } }, "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", - "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", "dev": true, "dependencies": { "@types/istanbul-lib-coverage": "*" } }, "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", - "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", "dev": true, "dependencies": { "@types/istanbul-lib-report": "*" @@ -1093,9 +1106,9 @@ "dev": true }, "node_modules/@types/stack-utils": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", - "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, "node_modules/@types/ws": { @@ -1108,112 +1121,51 @@ } }, "node_modules/@types/yargs": { - "version": "16.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-16.0.5.tgz", - "integrity": "sha512-AxO/ADJOBFJScHbWhq2xAhlWP24rY4aCEG/NFaMvbT3X2MgRsLjhjQwsn0Zi5zn0LG9jUhCCZMeX9Dkuw6k+vQ==", + "version": "17.0.33", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz", + "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==", "dev": true, "dependencies": { "@types/yargs-parser": "*" } }, "node_modules/@types/yargs-parser": { - "version": "21.0.0", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", - "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", - "dev": true - }, - "node_modules/abab": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", - "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, - "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, - "bin": { - "acorn": "bin/acorn" + "dependencies": { + "type-fest": "^0.21.3" }, "engines": { - "node": ">=0.4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/acorn-globals": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-6.0.0.tgz", - "integrity": "sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg==", + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "dependencies": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" + "engines": { + "node": ">=8" } }, - "node_modules/acorn-globals/node_modules/acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" + "dependencies": { + "color-convert": "^2.0.1" }, "engines": { "node": ">=8" @@ -1251,22 +1203,21 @@ "dev": true }, "node_modules/babel-jest": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", - "integrity": "sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-28.1.3.tgz", + "integrity": "sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q==", "dev": true, "dependencies": { - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/transform": "^28.1.3", "@types/babel__core": "^7.1.14", "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^27.5.1", + "babel-preset-jest": "^28.1.3", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "@babel/core": "^7.8.0" @@ -1289,54 +1240,57 @@ } }, "node_modules/babel-plugin-jest-hoist": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-27.5.1.tgz", - "integrity": "sha512-50wCwD5EMNW4aRpOwtqzyZHIewTYNxLA4nhB+09d8BIssfNfzBRhkBIHiaPv1Si226TQSvp8gxAJm2iY2qs2hQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz", + "integrity": "sha512-Ys3tUKAmfnkRUpPdpa98eYrAR0nV+sSFUZZEGuQ2EbFd1y4SOLtD5QDNHAq+bb9a+bbXvYQC4b+ID/THIMcU6Q==", "dev": true, "dependencies": { "@babel/template": "^7.3.3", "@babel/types": "^7.3.3", - "@types/babel__core": "^7.0.0", + "@types/babel__core": "^7.1.14", "@types/babel__traverse": "^7.0.6" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz", + "integrity": "sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw==", "dev": true, "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" }, "peerDependencies": { "@babel/core": "^7.0.0" } }, "node_modules/babel-preset-jest": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz", - "integrity": "sha512-Nptf2FzlPCWYuJg41HBqXVT8ym6bXOevuCTbhxlUpjwtysGaIWFvDEjp4y+G7fl13FgOdjs7P/DmErqH7da0Ag==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz", + "integrity": "sha512-L+fupJvlWAHbQfn74coNX3zf60LXMJsezNvvx8eIh7iOR1luJ1poxYgQk1F8PYtNq/6QODDHCqsSnTFSWC491A==", "dev": true, "dependencies": { - "babel-plugin-jest-hoist": "^27.5.1", + "babel-plugin-jest-hoist": "^28.1.3", "babel-preset-current-node-syntax": "^1.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "@babel/core": "^7.0.0" @@ -1359,27 +1313,21 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" } }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", - "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==", - "dev": true - }, "node_modules/browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.0.tgz", + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", "dev": true, "funding": [ { @@ -1396,10 +1344,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", - "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" }, "bin": { "browserslist": "cli.js" @@ -1454,9 +1402,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001534", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz", - "integrity": "sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==", + "version": "1.0.30001663", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001663.tgz", + "integrity": "sha512-o9C3X27GLKbLeTYZ6HBOLU1tsAcBZsLis28wrVzddShCS16RujjHp9GDHKZqrB3meE0YjhawvMFsGb/igqiPzA==", "dev": true, "funding": [ { @@ -1499,9 +1447,9 @@ } }, "node_modules/ci-info": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", - "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", "dev": true, "funding": [ { @@ -1514,20 +1462,23 @@ } }, "node_modules/cjs-module-lexer": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", - "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", + "integrity": "sha512-cuSVIHi9/9E/+821Qjdvngor+xpnlwnuwIyZOaLmHBVdXL+gP+I6QQB9VkO7RI77YIcTV+S1W9AreJ5eN63JBA==", "dev": true }, "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "dependencies": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/co": { @@ -1602,51 +1553,13 @@ "node": ">= 8" } }, - "node_modules/cssom": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", - "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==", - "dev": true - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", - "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", - "dev": true, - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true - }, - "node_modules/data-urls": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-2.0.0.tgz", - "integrity": "sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==", - "dev": true, - "dependencies": { - "abab": "^2.0.3", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, "dependencies": { - "ms": "2.1.2" + "ms": "^2.1.3" }, "engines": { "node": ">=6.0" @@ -1657,12 +1570,6 @@ } } }, - "node_modules/decimal.js": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true - }, "node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -1705,40 +1612,19 @@ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" } }, - "node_modules/domexception": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/domexception/-/domexception-2.0.1.tgz", - "integrity": "sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==", - "dev": true, - "dependencies": { - "webidl-conversions": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/domexception/node_modules/webidl-conversions": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", - "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/electron-to-chromium": { - "version": "1.4.520", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.520.tgz", - "integrity": "sha512-Frfus2VpYADsrh1lB3v/ft/WVFlVzOIm+Q0p7U7VqHI6qr7NWHYKe+Wif3W50n7JAFoBsWVsoU0+qDks6WQ60g==", + "version": "1.5.28", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.28.tgz", + "integrity": "sha512-VufdJl+rzaKZoYVUijN13QcXVF5dWPZANeFTLNy+OSpHdDL5ynXTF35+60RSBbaQYB1ae723lQXHCrf4pyLsMw==", "dev": true }, "node_modules/emittery": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz", - "integrity": "sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.2.tgz", + "integrity": "sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw==", "dev": true, "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { "url": "https://github.com/sindresorhus/emittery?sponsor=1" @@ -1760,9 +1646,9 @@ } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, "engines": { "node": ">=6" @@ -1777,27 +1663,6 @@ "node": ">=8" } }, - "node_modules/escodegen": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", - "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", - "dev": true, - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -1811,24 +1676,6 @@ "node": ">=4" } }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -1862,20 +1709,102 @@ } }, "node_modules/expect": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.5.1.tgz", - "integrity": "sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/expect/-/expect-28.1.3.tgz", + "integrity": "sha512-eEh0xn8HlsuOBxFgIss+2mX85VAS4Qy3OSkjV7rlBWljtA4oWH37glVGyOZSZvErDT/yBywZdPGwCXuTvSG85g==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1" + "@jest/expect-utils": "^28.1.3", + "jest-get-type": "^28.0.2", + "jest-matcher-utils": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-util": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/expect/node_modules/diff-sequences": { + "version": "28.1.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", + "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/expect/node_modules/jest-diff": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.3.tgz", + "integrity": "sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.1.1", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/jest-matcher-utils": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz", + "integrity": "sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.1.3", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/expect/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1901,9 +1830,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -1972,10 +1901,13 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/gensync": { "version": "1.0.0-beta.2", @@ -2020,6 +1952,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -2051,18 +1984,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2072,16 +1993,16 @@ "node": ">=8" } }, - "node_modules/html-encoding-sniffer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz", - "integrity": "sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==", + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, "dependencies": { - "whatwg-encoding": "^1.0.5" + "function-bind": "^1.1.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" } }, "node_modules/html-escaper": { @@ -2090,33 +2011,6 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -2126,22 +2020,10 @@ "node": ">=10.17.0" } }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", "dev": true, "dependencies": { "pkg-dir": "^4.2.0", @@ -2170,6 +2052,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, "dependencies": { "once": "^1.3.0", @@ -2189,12 +2072,15 @@ "dev": true }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz", + "integrity": "sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==", "dev": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -2227,12 +2113,6 @@ "node": ">=0.12.0" } }, - "node_modules/is-potential-custom-element-name": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", - "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true - }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -2245,12 +2125,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "dev": true - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2258,9 +2132,9 @@ "dev": true }, "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", - "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", "dev": true, "engines": { "node": ">=8" @@ -2311,9 +2185,9 @@ } }, "node_modules/istanbul-reports": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", - "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -2324,20 +2198,21 @@ } }, "node_modules/jest": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz", - "integrity": "sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest/-/jest-28.1.3.tgz", + "integrity": "sha512-N4GT5on8UkZgH0O5LUavMRV1EDEhNTL0KEfRmDIeZHSV7p2XgLoY9t9VDUgL6o+yfdgYHVxuz81G8oB9VG5uyA==", "dev": true, "dependencies": { - "@jest/core": "^27.5.1", + "@jest/core": "^28.1.3", + "@jest/types": "^28.1.3", "import-local": "^3.0.2", - "jest-cli": "^27.5.1" + "jest-cli": "^28.1.3" }, "bin": { "jest": "bin/jest.js" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -2349,73 +2224,153 @@ } }, "node_modules/jest-changed-files": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-27.5.1.tgz", - "integrity": "sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-28.1.3.tgz", + "integrity": "sha512-esaOfUWJXk2nfZt9SPyC8gA1kNfdKLkQWyzsMlqq8msYSlNKfmZxfRgZn4Cd4MGVUF+7v6dBs0d5TOAKa7iIiA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", "execa": "^5.0.0", - "throat": "^6.0.1" + "p-limit": "^3.1.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-circus": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-27.5.1.tgz", - "integrity": "sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-28.1.3.tgz", + "integrity": "sha512-cZ+eS5zc79MBwt+IhQhiEp0OeBddpc1n8MBo1nMB8A7oPMKEO+Sre+wHaLJexQUj9Ya/8NOBY0RESUgYjB6fow==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/environment": "^28.1.3", + "@jest/expect": "^28.1.3", + "@jest/test-result": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", "chalk": "^4.0.0", "co": "^4.6.0", "dedent": "^0.7.0", - "expect": "^27.5.1", "is-generator-fn": "^2.0.0", - "jest-each": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1", + "jest-each": "^28.1.3", + "jest-matcher-utils": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-runtime": "^28.1.3", + "jest-snapshot": "^28.1.3", + "jest-util": "^28.1.3", + "p-limit": "^3.1.0", + "pretty-format": "^28.1.3", "slash": "^3.0.0", - "stack-utils": "^2.0.3", - "throat": "^6.0.1" + "stack-utils": "^2.0.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-circus/node_modules/diff-sequences": { + "version": "28.1.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", + "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/jest-diff": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.3.tgz", + "integrity": "sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.1.1", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/jest-circus/node_modules/jest-matcher-utils": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz", + "integrity": "sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.1.3", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-circus/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-cli": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-27.5.1.tgz", - "integrity": "sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-28.1.3.tgz", + "integrity": "sha512-roY3kvrv57Azn1yPgdTebPAXvdR2xfezaKKYzVxZ6It/5NCxzJym6tUI5P1zkdWhfUYkxEI9uZWcQdaFLo8mJQ==", "dev": true, "dependencies": { - "@jest/core": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/core": "^28.1.3", + "@jest/test-result": "^28.1.3", + "@jest/types": "^28.1.3", "chalk": "^4.0.0", "exit": "^0.1.2", "graceful-fs": "^4.2.9", "import-local": "^3.0.2", - "jest-config": "^27.5.1", - "jest-util": "^27.5.1", - "jest-validate": "^27.5.1", + "jest-config": "^28.1.3", + "jest-util": "^28.1.3", + "jest-validate": "^28.1.3", "prompts": "^2.0.1", - "yargs": "^16.2.0" + "yargs": "^17.3.1" }, "bin": { "jest": "bin/jest.js" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" @@ -2427,48 +2382,92 @@ } }, "node_modules/jest-config": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-27.5.1.tgz", - "integrity": "sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-28.1.3.tgz", + "integrity": "sha512-MG3INjByJ0J4AsNBm7T3hsuxKQqFIiRo/AUqb1q9LRKI5UU6Aar9JHbr9Ivn1TVwfUD9KirRoM/T6u8XlcQPHQ==", "dev": true, "dependencies": { - "@babel/core": "^7.8.0", - "@jest/test-sequencer": "^27.5.1", - "@jest/types": "^27.5.1", - "babel-jest": "^27.5.1", + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^28.1.3", + "@jest/types": "^28.1.3", + "babel-jest": "^28.1.3", "chalk": "^4.0.0", "ci-info": "^3.2.0", "deepmerge": "^4.2.2", - "glob": "^7.1.1", + "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-circus": "^27.5.1", - "jest-environment-jsdom": "^27.5.1", - "jest-environment-node": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-jasmine2": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-runner": "^27.5.1", - "jest-util": "^27.5.1", - "jest-validate": "^27.5.1", + "jest-circus": "^28.1.3", + "jest-environment-node": "^28.1.3", + "jest-get-type": "^28.0.2", + "jest-regex-util": "^28.0.2", + "jest-resolve": "^28.1.3", + "jest-runner": "^28.1.3", + "jest-util": "^28.1.3", + "jest-validate": "^28.1.3", "micromatch": "^4.0.4", "parse-json": "^5.2.0", - "pretty-format": "^27.5.1", + "pretty-format": "^28.1.3", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { + "@types/node": "*", "ts-node": ">=9.0.0" }, "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, "ts-node": { "optional": true } } }, + "node_modules/jest-config/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-config/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-config/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-config/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-diff": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.5.1.tgz", @@ -2485,66 +2484,90 @@ } }, "node_modules/jest-docblock": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-27.5.1.tgz", - "integrity": "sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ==", + "version": "28.1.1", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-28.1.1.tgz", + "integrity": "sha512-3wayBVNiOYx0cwAbl9rwm5kKFP8yHH3d/fkEaL02NPTkDojPtheGB7HZSFY4wzX+DxyrvhXz0KSCVksmCknCuA==", "dev": true, "dependencies": { "detect-newline": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-each": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-27.5.1.tgz", - "integrity": "sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-28.1.3.tgz", + "integrity": "sha512-arT1z4sg2yABU5uogObVPvSlSMQlDA48owx07BDPAiasW0yYpYHYOo4HHLz9q0BVzDVU4hILFjzJw0So9aCL/g==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "chalk": "^4.0.0", - "jest-get-type": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1" + "jest-get-type": "^28.0.2", + "jest-util": "^28.1.3", + "pretty-format": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-environment-jsdom": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz", - "integrity": "sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw==", + "node_modules/jest-each/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-each/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-each/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/fake-timers": "^27.5.1", - "@jest/types": "^27.5.1", - "@types/node": "*", - "jest-mock": "^27.5.1", - "jest-util": "^27.5.1", - "jsdom": "^16.6.0" + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/jest-each/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-environment-node": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-27.5.1.tgz", - "integrity": "sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-28.1.3.tgz", + "integrity": "sha512-ugP6XOhEpjAEhGYvp5Xj989ns5cB1K6ZdjBYuS30umT4CQEETaxSiPcZ/E1kFktX4GkrcM4qu07IIlDYX1gp+A==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/fake-timers": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/environment": "^28.1.3", + "@jest/fake-timers": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", - "jest-mock": "^27.5.1", - "jest-util": "^27.5.1" + "jest-mock": "^28.1.3", + "jest-util": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-get-type": { @@ -2557,72 +2580,85 @@ } }, "node_modules/jest-haste-map": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-27.5.1.tgz", - "integrity": "sha512-7GgkZ4Fw4NFbMSDSpZwXeBiIbx+t/46nJ2QitkOjvwPYyZmqttu2TDSimMHP1EkPOi4xUZAN1doE5Vd25H4Jng==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-28.1.3.tgz", + "integrity": "sha512-3S+RQWDXccXDKSWnkHa/dPwt+2qwA8CJzR61w3FoYCvoo3Pn8tvGcysmMF0Bj0EX5RYvAI2EIvC57OmotfdtKA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "@types/graceful-fs": "^4.1.2", + "@jest/types": "^28.1.3", + "@types/graceful-fs": "^4.1.3", "@types/node": "*", "anymatch": "^3.0.3", "fb-watchman": "^2.0.0", "graceful-fs": "^4.2.9", - "jest-regex-util": "^27.5.1", - "jest-serializer": "^27.5.1", - "jest-util": "^27.5.1", - "jest-worker": "^27.5.1", + "jest-regex-util": "^28.0.2", + "jest-util": "^28.1.3", + "jest-worker": "^28.1.3", "micromatch": "^4.0.4", - "walker": "^1.0.7" + "walker": "^1.0.8" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "optionalDependencies": { "fsevents": "^2.3.2" } }, - "node_modules/jest-jasmine2": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz", - "integrity": "sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ==", + "node_modules/jest-leak-detector": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-28.1.3.tgz", + "integrity": "sha512-WFVJhnQsiKtDEo5lG2mM0v40QWnBM+zMdHHyJs8AWZ7J0QZJS59MsyKeJHWhpBZBH32S48FOVvGyOFT1h0DlqA==", "dev": true, "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/source-map": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "expect": "^27.5.1", - "is-generator-fn": "^2.0.0", - "jest-each": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", - "pretty-format": "^27.5.1", - "throat": "^6.0.1" + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-leak-detector": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz", - "integrity": "sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ==", + "node_modules/jest-leak-detector/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-leak-detector/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-leak-detector/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", "dev": true, "dependencies": { - "jest-get-type": "^27.5.1", - "pretty-format": "^27.5.1" + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/jest-leak-detector/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-matcher-utils": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", @@ -2639,36 +2675,69 @@ } }, "node_modules/jest-message-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.5.1.tgz", - "integrity": "sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-28.1.3.tgz", + "integrity": "sha512-PFdn9Iewbt575zKPf1286Ht9EPoJmYT7P0kY+RibeYZ2XtOr53pDLEFoTWXbd1h4JiGiWpTBC84fc8xMXQMb7g==", "dev": true, "dependencies": { "@babel/code-frame": "^7.12.13", - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "@types/stack-utils": "^2.0.0", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", "micromatch": "^4.0.4", - "pretty-format": "^27.5.1", + "pretty-format": "^28.1.3", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-message-util/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-message-util/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/jest-message-util/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-mock": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-27.5.1.tgz", - "integrity": "sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-28.1.3.tgz", + "integrity": "sha512-o3J2jr6dMMWYVH4Lh/NKmDXdosrsJgi4AviS8oXLujcjpCMBb1FMsblDnOXKZKfSiHLxYub1eS0IHuRXsio9eA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "@types/node": "*" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-pnp-resolver": { @@ -2689,180 +2758,232 @@ } }, "node_modules/jest-regex-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-27.5.1.tgz", - "integrity": "sha512-4bfKq2zie+x16okqDXjXn9ql2B0dScQu+vcwe4TvFVhkVyuWLqpZrZtXxLLWoXYgn0E87I6r6GRYHF7wFZBUvg==", + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-28.0.2.tgz", + "integrity": "sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw==", "dev": true, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-resolve": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-27.5.1.tgz", - "integrity": "sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-28.1.3.tgz", + "integrity": "sha512-Z1W3tTjE6QaNI90qo/BJpfnvpxtaFTFw5CDgwpyE/Kz8U/06N1Hjf4ia9quUhCh39qIGWF1ZuxFiBiJQwSEYKQ==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", "chalk": "^4.0.0", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", + "jest-haste-map": "^28.1.3", "jest-pnp-resolver": "^1.2.2", - "jest-util": "^27.5.1", - "jest-validate": "^27.5.1", + "jest-util": "^28.1.3", + "jest-validate": "^28.1.3", "resolve": "^1.20.0", "resolve.exports": "^1.1.0", "slash": "^3.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-resolve-dependencies": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz", - "integrity": "sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-28.1.3.tgz", + "integrity": "sha512-qa0QO2Q0XzQoNPouMbCc7Bvtsem8eQgVPNkwn9LnS+R2n8DaVDPL/U1gngC0LTl1RYXJU0uJa2BMC2DbTfFrHA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-snapshot": "^27.5.1" + "jest-regex-util": "^28.0.2", + "jest-snapshot": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-runner": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-27.5.1.tgz", - "integrity": "sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-28.1.3.tgz", + "integrity": "sha512-GkMw4D/0USd62OVO0oEgjn23TM+YJa2U2Wu5zz9xsQB1MxWKDOlrnykPxnMsN0tnJllfLPinHTka61u0QhaxBA==", "dev": true, "dependencies": { - "@jest/console": "^27.5.1", - "@jest/environment": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/console": "^28.1.3", + "@jest/environment": "^28.1.3", + "@jest/test-result": "^28.1.3", + "@jest/transform": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", "chalk": "^4.0.0", - "emittery": "^0.8.1", + "emittery": "^0.10.2", "graceful-fs": "^4.2.9", - "jest-docblock": "^27.5.1", - "jest-environment-jsdom": "^27.5.1", - "jest-environment-node": "^27.5.1", - "jest-haste-map": "^27.5.1", - "jest-leak-detector": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-runtime": "^27.5.1", - "jest-util": "^27.5.1", - "jest-worker": "^27.5.1", - "source-map-support": "^0.5.6", - "throat": "^6.0.1" + "jest-docblock": "^28.1.1", + "jest-environment-node": "^28.1.3", + "jest-haste-map": "^28.1.3", + "jest-leak-detector": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-resolve": "^28.1.3", + "jest-runtime": "^28.1.3", + "jest-util": "^28.1.3", + "jest-watcher": "^28.1.3", + "jest-worker": "^28.1.3", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-runtime": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-27.5.1.tgz", - "integrity": "sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A==", - "dev": true, - "dependencies": { - "@jest/environment": "^27.5.1", - "@jest/fake-timers": "^27.5.1", - "@jest/globals": "^27.5.1", - "@jest/source-map": "^27.5.1", - "@jest/test-result": "^27.5.1", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-28.1.3.tgz", + "integrity": "sha512-NU+881ScBQQLc1JHG5eJGU7Ui3kLKrmwCPPtYsJtBykixrM2OhVQlpMmFWJjMyDfdkGgBMNjXCGB/ebzsgNGQw==", + "dev": true, + "dependencies": { + "@jest/environment": "^28.1.3", + "@jest/fake-timers": "^28.1.3", + "@jest/globals": "^28.1.3", + "@jest/source-map": "^28.1.2", + "@jest/test-result": "^28.1.3", + "@jest/transform": "^28.1.3", + "@jest/types": "^28.1.3", "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", "execa": "^5.0.0", "glob": "^7.1.3", "graceful-fs": "^4.2.9", - "jest-haste-map": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-mock": "^27.5.1", - "jest-regex-util": "^27.5.1", - "jest-resolve": "^27.5.1", - "jest-snapshot": "^27.5.1", - "jest-util": "^27.5.1", + "jest-haste-map": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-mock": "^28.1.3", + "jest-regex-util": "^28.0.2", + "jest-resolve": "^28.1.3", + "jest-snapshot": "^28.1.3", + "jest-util": "^28.1.3", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" - } - }, - "node_modules/jest-serializer": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-serializer/-/jest-serializer-27.5.1.tgz", - "integrity": "sha512-jZCyo6iIxO1aqUxpuBlwTDMkzOAJS4a3eYz3YzgxxVQFwLeSA7Jfq5cbqCY+JLvTDrWirgusI/0KwxKMgrdf7w==", - "dev": true, - "dependencies": { - "@types/node": "*", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-snapshot": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-27.5.1.tgz", - "integrity": "sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-28.1.3.tgz", + "integrity": "sha512-4lzMgtiNlc3DU/8lZfmqxN3AYD6GGLbl+72rdBpXvcV+whX7mDrREzkPdp2RnmfIiWBg1YbuFSkXduF2JcafJg==", "dev": true, "dependencies": { - "@babel/core": "^7.7.2", + "@babel/core": "^7.11.6", "@babel/generator": "^7.7.2", "@babel/plugin-syntax-typescript": "^7.7.2", "@babel/traverse": "^7.7.2", - "@babel/types": "^7.0.0", - "@jest/transform": "^27.5.1", - "@jest/types": "^27.5.1", - "@types/babel__traverse": "^7.0.4", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^28.1.3", + "@jest/transform": "^28.1.3", + "@jest/types": "^28.1.3", + "@types/babel__traverse": "^7.0.6", "@types/prettier": "^2.1.5", "babel-preset-current-node-syntax": "^1.0.0", "chalk": "^4.0.0", - "expect": "^27.5.1", + "expect": "^28.1.3", "graceful-fs": "^4.2.9", - "jest-diff": "^27.5.1", - "jest-get-type": "^27.5.1", - "jest-haste-map": "^27.5.1", - "jest-matcher-utils": "^27.5.1", - "jest-message-util": "^27.5.1", - "jest-util": "^27.5.1", + "jest-diff": "^28.1.3", + "jest-get-type": "^28.0.2", + "jest-haste-map": "^28.1.3", + "jest-matcher-utils": "^28.1.3", + "jest-message-util": "^28.1.3", + "jest-util": "^28.1.3", "natural-compare": "^1.4.0", - "pretty-format": "^27.5.1", - "semver": "^7.3.2" + "pretty-format": "^28.1.3", + "semver": "^7.3.5" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-snapshot/node_modules/diff-sequences": { + "version": "28.1.1", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-28.1.1.tgz", + "integrity": "sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/jest-diff": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-28.1.3.tgz", + "integrity": "sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^28.1.1", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/jest-matcher-utils": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz", + "integrity": "sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^28.1.3", + "jest-get-type": "^28.0.2", + "pretty-format": "^28.1.3" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, - "node_modules/jest-snapshot/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/jest-snapshot/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", "dev": true, "dependencies": { - "yallist": "^4.0.0" + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" }, "engines": { - "node": ">=10" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, + "node_modules/jest-snapshot/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -2870,19 +2991,13 @@ "node": ">=10" } }, - "node_modules/jest-snapshot/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/jest-util": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-27.5.1.tgz", - "integrity": "sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-28.1.3.tgz", + "integrity": "sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "@types/node": "*", "chalk": "^4.0.0", "ci-info": "^3.2.0", @@ -2890,24 +3005,36 @@ "picomatch": "^2.2.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-validate": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-27.5.1.tgz", - "integrity": "sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-28.1.3.tgz", + "integrity": "sha512-SZbOGBWEsaTxBGCOpsRWlXlvNkvTkY0XxRfh7zYmvd8uL5Qzyg0CHAXiXKROflh801quA6+/DsT4ODDthOC/OA==", "dev": true, "dependencies": { - "@jest/types": "^27.5.1", + "@jest/types": "^28.1.3", "camelcase": "^6.2.0", "chalk": "^4.0.0", - "jest-get-type": "^27.5.1", + "jest-get-type": "^28.0.2", "leven": "^3.1.0", - "pretty-format": "^27.5.1" + "pretty-format": "^28.1.3" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-validate/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/jest-validate/node_modules/camelcase": { @@ -2922,28 +3049,59 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/jest-validate/node_modules/jest-get-type": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-28.0.2.tgz", + "integrity": "sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA==", + "dev": true, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-validate/node_modules/pretty-format": { + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-28.1.3.tgz", + "integrity": "sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q==", + "dev": true, + "dependencies": { + "@jest/schemas": "^28.1.3", + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" + } + }, + "node_modules/jest-validate/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + }, "node_modules/jest-watcher": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-27.5.1.tgz", - "integrity": "sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-28.1.3.tgz", + "integrity": "sha512-t4qcqj9hze+jviFPUN3YAtAEeFnr/azITXQEMARf5cMwKY2SMBRnCQTXLixTl20OR6mLh9KLMrgVJgJISym+1g==", "dev": true, "dependencies": { - "@jest/test-result": "^27.5.1", - "@jest/types": "^27.5.1", + "@jest/test-result": "^28.1.3", + "@jest/types": "^28.1.3", "@types/node": "*", "ansi-escapes": "^4.2.1", "chalk": "^4.0.0", - "jest-util": "^27.5.1", + "emittery": "^0.10.2", + "jest-util": "^28.1.3", "string-length": "^4.0.1" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "version": "28.1.3", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-28.1.3.tgz", + "integrity": "sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g==", "dev": true, "dependencies": { "@types/node": "*", @@ -2951,7 +3109,7 @@ "supports-color": "^8.0.0" }, "engines": { - "node": ">= 10.13.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" } }, "node_modules/jest-worker/node_modules/supports-color": { @@ -2988,66 +3146,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsdom": { - "version": "16.7.0", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.7.0.tgz", - "integrity": "sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==", - "dev": true, - "dependencies": { - "abab": "^2.0.5", - "acorn": "^8.2.4", - "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", - "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", - "domexception": "^2.0.1", - "escodegen": "^2.0.0", - "form-data": "^3.0.0", - "html-encoding-sniffer": "^2.0.1", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "saxes": "^5.0.1", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^2.0.0", - "webidl-conversions": "^6.1.0", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.5.0", - "ws": "^7.4.6", - "xml-name-validator": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } - } - }, - "node_modules/jsdom/node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -3113,12 +3211,6 @@ "node": ">=8" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -3149,26 +3241,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/make-dir/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/make-dir/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -3176,12 +3253,6 @@ "node": ">=10" } }, - "node_modules/make-dir/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -3204,12 +3275,12 @@ "dev": true }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -3267,9 +3338,9 @@ } }, "node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, "node_modules/natural-compare": { @@ -3341,9 +3412,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz", + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==", "dev": true }, "node_modules/normalize-path": { @@ -3367,12 +3438,6 @@ "node": ">=8" } }, - "node_modules/nwsapi": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", - "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", - "dev": true - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -3398,15 +3463,15 @@ } }, "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, "dependencies": { - "p-try": "^2.0.0" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">=6" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -3424,6 +3489,21 @@ "node": ">=8" } }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -3451,12 +3531,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse5": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", - "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", - "dev": true - }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3491,9 +3565,9 @@ "dev": true }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", "dev": true }, "node_modules/picomatch": { @@ -3568,27 +3642,6 @@ "node": ">= 6" } }, - "node_modules/psl": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true - }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -3604,16 +3657,10 @@ "node": ">=0.10.0" } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, "node_modules/resolve": { - "version": "1.22.4", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", - "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "dependencies": { "is-core-module": "^2.13.0", @@ -3661,6 +3708,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, "dependencies": { "glob": "^7.1.3" @@ -3672,24 +3720,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "node_modules/saxes": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/saxes/-/saxes-5.0.1.tgz", - "integrity": "sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw==", - "dev": true, - "dependencies": { - "xmlchars": "^2.2.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -3751,9 +3781,9 @@ } }, "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, "dependencies": { "buffer-from": "^1.0.0", @@ -3884,12 +3914,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", - "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true - }, "node_modules/terminal-link": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", @@ -3920,12 +3944,6 @@ "node": ">=8" } }, - "node_modules/throat": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/throat/-/throat-6.0.2.tgz", - "integrity": "sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ==", - "dev": true - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -3953,66 +3971,39 @@ "node": ">=8.0" } }, - "node_modules/tough-cookie": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", - "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", - "dev": true, - "dependencies": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.2.0", - "url-parse": "^1.5.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tr46": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz", - "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==", - "dev": true, - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/ts-jest": { - "version": "27.1.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz", - "integrity": "sha512-Xv6jBQPoBEvBq/5i2TeSG9tt/nqkbpcurrEG1b+2yfBrcJelOZF9Ml6dmyMh7bcW9JyFbRYpR5rxROSlBLTZHA==", + "version": "28.0.8", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.8.tgz", + "integrity": "sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg==", "dev": true, "dependencies": { "bs-logger": "0.x", "fast-json-stable-stringify": "2.x", - "jest-util": "^27.0.0", - "json5": "2.x", + "jest-util": "^28.0.0", + "json5": "^2.2.1", "lodash.memoize": "4.x", "make-error": "1.x", "semver": "7.x", - "yargs-parser": "20.x" + "yargs-parser": "^21.0.1" }, "bin": { "ts-jest": "cli.js" }, "engines": { - "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + "node": "^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0" }, "peerDependencies": { "@babel/core": ">=7.0.0-beta.0 <8", - "@types/jest": "^27.0.0", - "babel-jest": ">=27.0.0 <28", - "jest": "^27.0.0", - "typescript": ">=3.8 <5.0" + "@jest/types": "^28.0.0", + "babel-jest": "^28.0.0", + "jest": "^28.0.0", + "typescript": ">=4.3" }, "peerDependenciesMeta": { "@babel/core": { "optional": true }, - "@types/jest": { + "@jest/types": { "optional": true }, "babel-jest": { @@ -4098,15 +4089,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "dev": true, - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, "node_modules/typescript": { "version": "4.5.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", @@ -4126,19 +4108,10 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, - "node_modules/universalify": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", - "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "dev": true, "funding": [ { @@ -4155,8 +4128,8 @@ } ], "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.1.2", + "picocolors": "^1.0.1" }, "bin": { "update-browserslist-db": "cli.js" @@ -4165,60 +4138,25 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dev": true, - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "node_modules/v8-to-istanbul": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz", - "integrity": "sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", "dev": true, "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" + "convert-source-map": "^2.0.0" }, "engines": { "node": ">=10.12.0" } }, - "node_modules/v8-to-istanbul/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", - "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", - "deprecated": "Use your platform's native performance.now() and performance.timeOrigin.", - "dev": true, - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } - }, - "node_modules/w3c-xmlserializer": { + "node_modules/v8-to-istanbul/node_modules/convert-source-map": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz", - "integrity": "sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==", - "dev": true, - "dependencies": { - "xml-name-validator": "^3.0.0" - }, - "engines": { - "node": ">=10" - } + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true }, "node_modules/walker": { "version": "1.0.8", @@ -4237,44 +4175,6 @@ "node": ">= 14" } }, - "node_modules/webidl-conversions": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", - "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==", - "dev": true, - "engines": { - "node": ">=10.4" - } - }, - "node_modules/whatwg-encoding": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz", - "integrity": "sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==", - "dev": true, - "dependencies": { - "iconv-lite": "0.4.24" - } - }, - "node_modules/whatwg-mimetype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", - "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz", - "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==", - "dev": true, - "dependencies": { - "lodash": "^4.7.0", - "tr46": "^2.1.0", - "webidl-conversions": "^6.1.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4314,50 +4214,18 @@ "dev": true }, "node_modules/write-file-atomic": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", - "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "dev": true, - "engines": { - "node": ">=8.3.0" + "signal-exit": "^3.0.7" }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/xml-name-validator": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", - "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", - "dev": true - }, - "node_modules/xmlchars": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", - "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true - }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", @@ -4374,30 +4242,42 @@ "dev": true }, "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "dependencies": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.1.1" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } } } diff --git a/ecosystem-tests/node-ts4.5-jest27/package.json b/ecosystem-tests/node-ts4.5-jest28/package.json similarity index 90% rename from ecosystem-tests/node-ts4.5-jest27/package.json rename to ecosystem-tests/node-ts4.5-jest28/package.json index ae76bcc9c..c378a6fdc 100644 --- a/ecosystem-tests/node-ts4.5-jest27/package.json +++ b/ecosystem-tests/node-ts4.5-jest28/package.json @@ -18,8 +18,8 @@ "@types/jest": "27.5.2", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", - "jest": "27.5.1", - "ts-jest": "27.1.5", + "jest": "28.1.3", + "ts-jest": "^28.0.0", "typescript": "4.5.5" } } diff --git a/ecosystem-tests/node-ts4.5-jest27/sample1.mp3 b/ecosystem-tests/node-ts4.5-jest28/sample1.mp3 similarity index 100% rename from ecosystem-tests/node-ts4.5-jest27/sample1.mp3 rename to ecosystem-tests/node-ts4.5-jest28/sample1.mp3 diff --git a/ecosystem-tests/node-ts4.5-jest27/tests/test.ts b/ecosystem-tests/node-ts4.5-jest28/tests/test.ts similarity index 70% rename from ecosystem-tests/node-ts4.5-jest27/tests/test.ts rename to ecosystem-tests/node-ts4.5-jest28/tests/test.ts index 3f6e5d572..ae5db37e6 100644 --- a/ecosystem-tests/node-ts4.5-jest27/tests/test.ts +++ b/ecosystem-tests/node-ts4.5-jest28/tests/test.ts @@ -1,4 +1,3 @@ -import 'openai/shims/node'; import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; import fetch from 'node-fetch'; @@ -65,13 +64,12 @@ it(`raw response`, async function () { }) .asResponse(); - // test that we can use node-fetch Response API + const decoder = new TextDecoder(); const chunks: string[] = []; - response.body.on('data', (chunk) => chunks.push(chunk)); - await new Promise((resolve, reject) => { - response.body.once('end', resolve); - response.body.once('error', reject); - }); + for await (const chunk of response.body!) { + chunks.push(decoder.decode(chunk)); + } + const json: ChatCompletion = JSON.parse(chunks.join('')); expect(json.choices[0]?.message.content || '').toBeSimilarTo('This is a test', 10); }); @@ -100,18 +98,23 @@ it('handles formdata-node File', async function () { expect(result.text).toBeSimilarTo(correctAnswer, 12); }); -// @ts-ignore avoid DOM lib for testing purposes -if (typeof File !== 'undefined') { - it('handles builtinFile', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - // @ts-ignore avoid DOM lib for testing purposes - .then((x) => new File([x], filename)); +it('handles builtinFile', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then( + (x) => + new File( + [ + // @ts-ignore array buffer can't be passed to File at the type-level + x, + ], + filename, + ), + ); - const result = await client.audio.transcriptions.create({ file, model }); - expect(result.text).toBeSimilarTo(correctAnswer, 12); - }); -} + const result = await client.audio.transcriptions.create({ file, model }); + expect(result.text).toBeSimilarTo(correctAnswer, 12); +}); it('handles Response', async function () { const file = await fetch(url); @@ -133,26 +136,15 @@ const fineTune = `{"prompt": "", "completion": " { it('handles form-data Blob', async function () { const result = await client.files.create({ - file: await toFile( - new FormDataBlob([ - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - ]), - 'finetune.jsonl', - ), + file: await toFile(new FormDataBlob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); - // @ts-ignore avoid DOM lib for testing purposes if (typeof Blob !== 'undefined') { it('handles builtin Blob', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new Blob([new TextEncoder().encode(fineTune)]), - 'finetune.jsonl', - ), + file: await toFile(new Blob([new TextEncoder().encode(fineTune)]), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); @@ -160,44 +152,23 @@ describe('toFile', () => { } it('handles Uint8Array', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune), - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles ArrayBuffer', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new TextEncoder().encode(fineTune).buffer, - 'finetune.jsonl', - ), + file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); it('handles DataView', async function () { const result = await client.files.create({ - file: await toFile( - // @ts-ignore avoid DOM lib for testing purposes - new DataView(new TextEncoder().encode(fineTune).buffer), - 'finetune.jsonl', - ), + file: await toFile(new DataView(new TextEncoder().encode(fineTune).buffer), 'finetune.jsonl'), purpose: 'fine-tune', }); expect(result.filename).toEqual('finetune.jsonl'); }); }); - -test('query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); diff --git a/ecosystem-tests/node-ts4.5-jest27/tsconfig.json b/ecosystem-tests/node-ts4.5-jest28/tsconfig.json similarity index 100% rename from ecosystem-tests/node-ts4.5-jest27/tsconfig.json rename to ecosystem-tests/node-ts4.5-jest28/tsconfig.json diff --git a/ecosystem-tests/nodenext-tsup/index.ts b/ecosystem-tests/nodenext-tsup/index.ts deleted file mode 100644 index f70568435..000000000 --- a/ecosystem-tests/nodenext-tsup/index.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { OpenAI } from 'openai'; - -const openai = new OpenAI(); - -function assertEqual(actual: any, expected: any) { - if (actual === expected) { - return; - } - - console.error('expected', expected); - console.error('actual ', actual); - throw new Error('expected values to be equal'); -} - -async function main() { - const completion = await openai.chat.completions.create({ - model: 'gpt-4o-mini', - messages: [ - { - role: 'user', - content: 'What is the capital of the United States?', - }, - ], - }); - // smoke test for responses - if (!completion.choices[0]?.message.content) { - console.dir(completion, { depth: 4 }); - throw new Error('no response content!'); - } - - assertEqual( - decodeURIComponent((openai as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - 'foo[nested][a]=true&foo[nested][b]=foo', - ); - assertEqual( - decodeURIComponent((openai as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - 'foo[nested][a][]=hello&foo[nested][a][]=world', - ); -} - -main(); diff --git a/ecosystem-tests/nodenext-tsup/package-lock.json b/ecosystem-tests/nodenext-tsup/package-lock.json deleted file mode 100644 index 8f4729374..000000000 --- a/ecosystem-tests/nodenext-tsup/package-lock.json +++ /dev/null @@ -1,2078 +0,0 @@ -{ - "name": "nodenext-tsup", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "nodenext-tsup", - "devDependencies": { - "tsup": "^8.2.4" - }, - "peerDependencies": { - "typescript": "^5.5.4" - } - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", - "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", - "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", - "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", - "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", - "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", - "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", - "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", - "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", - "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", - "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", - "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", - "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", - "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", - "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", - "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", - "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", - "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", - "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", - "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", - "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", - "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", - "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", - "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", - "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", - "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.21.2.tgz", - "integrity": "sha512-fSuPrt0ZO8uXeS+xP3b+yYTCBUd05MoSp2N/MFOgjhhUhMmchXlpTQrTpI8T+YAwAQuK7MafsCOxW7VrPMrJcg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.21.2.tgz", - "integrity": "sha512-xGU5ZQmPlsjQS6tzTTGwMsnKUtu0WVbl0hYpTPauvbRAnmIvpInhJtgjj3mcuJpEiuUw4v1s4BimkdfDWlh7gA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.21.2.tgz", - "integrity": "sha512-99AhQ3/ZMxU7jw34Sq8brzXqWH/bMnf7ZVhvLk9QU2cOepbQSVTns6qoErJmSiAvU3InRqC2RRZ5ovh1KN0d0Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.21.2.tgz", - "integrity": "sha512-ZbRaUvw2iN/y37x6dY50D8m2BnDbBjlnMPotDi/qITMJ4sIxNY33HArjikDyakhSv0+ybdUxhWxE6kTI4oX26w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.21.2.tgz", - "integrity": "sha512-ztRJJMiE8nnU1YFcdbd9BcH6bGWG1z+jP+IPW2oDUAPxPjo9dverIOyXz76m6IPA6udEL12reYeLojzW2cYL7w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.21.2.tgz", - "integrity": "sha512-flOcGHDZajGKYpLV0JNc0VFH361M7rnV1ee+NTeC/BQQ1/0pllYcFmxpagltANYt8FYf9+kL6RSk80Ziwyhr7w==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.21.2.tgz", - "integrity": "sha512-69CF19Kp3TdMopyteO/LJbWufOzqqXzkrv4L2sP8kfMaAQ6iwky7NoXTp7bD6/irKgknDKM0P9E/1l5XxVQAhw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.21.2.tgz", - "integrity": "sha512-48pD/fJkTiHAZTnZwR0VzHrao70/4MlzJrq0ZsILjLW/Ab/1XlVUStYyGt7tdyIiVSlGZbnliqmult/QGA2O2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.21.2.tgz", - "integrity": "sha512-cZdyuInj0ofc7mAQpKcPR2a2iu4YM4FQfuUzCVA2u4HI95lCwzjoPtdWjdpDKyHxI0UO82bLDoOaLfpZ/wviyQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.21.2.tgz", - "integrity": "sha512-RL56JMT6NwQ0lXIQmMIWr1SW28z4E4pOhRRNqwWZeXpRlykRIlEpSWdsgNWJbYBEWD84eocjSGDu/XxbYeCmwg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.21.2.tgz", - "integrity": "sha512-PMxkrWS9z38bCr3rWvDFVGD6sFeZJw4iQlhrup7ReGmfn7Oukrr/zweLhYX6v2/8J6Cep9IEA/SmjXjCmSbrMQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.21.2.tgz", - "integrity": "sha512-B90tYAUoLhU22olrafY3JQCFLnT3NglazdwkHyxNDYF/zAxJt5fJUB/yBoWFoIQ7SQj+KLe3iL4BhOMa9fzgpw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.21.2.tgz", - "integrity": "sha512-7twFizNXudESmC9oneLGIUmoHiiLppz/Xs5uJQ4ShvE6234K0VB1/aJYU3f/4g7PhssLGKBVCC37uRkkOi8wjg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.21.2.tgz", - "integrity": "sha512-9rRero0E7qTeYf6+rFh3AErTNU1VCQg2mn7CQcI44vNUWM9Ze7MSRS/9RFuSsox+vstRt97+x3sOhEey024FRQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.21.2.tgz", - "integrity": "sha512-5rA4vjlqgrpbFVVHX3qkrCo/fZTj1q0Xxpg+Z7yIo3J2AilW7t2+n6Q8Jrx+4MrYpAnjttTYF8rr7bP46BPzRw==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.21.2.tgz", - "integrity": "sha512-6UUxd0+SKomjdzuAcp+HAmxw1FlGBnl1v2yEPSabtx4lBfdXHDVsW7+lQkgz9cNFJGY3AWR7+V8P5BqkD9L9nA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@types/estree": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", - "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", - "dev": true - }, - "node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bundle-require": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.0.0.tgz", - "integrity": "sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==", - "dev": true, - "dependencies": { - "load-tsconfig": "^0.2.3" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "peerDependencies": { - "esbuild": ">=0.18" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/consola": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", - "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==", - "dev": true, - "engines": { - "node": "^14.18.0 || >=16.10.0" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", - "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/esbuild": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", - "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.23.1", - "@esbuild/android-arm": "0.23.1", - "@esbuild/android-arm64": "0.23.1", - "@esbuild/android-x64": "0.23.1", - "@esbuild/darwin-arm64": "0.23.1", - "@esbuild/darwin-x64": "0.23.1", - "@esbuild/freebsd-arm64": "0.23.1", - "@esbuild/freebsd-x64": "0.23.1", - "@esbuild/linux-arm": "0.23.1", - "@esbuild/linux-arm64": "0.23.1", - "@esbuild/linux-ia32": "0.23.1", - "@esbuild/linux-loong64": "0.23.1", - "@esbuild/linux-mips64el": "0.23.1", - "@esbuild/linux-ppc64": "0.23.1", - "@esbuild/linux-riscv64": "0.23.1", - "@esbuild/linux-s390x": "0.23.1", - "@esbuild/linux-x64": "0.23.1", - "@esbuild/netbsd-x64": "0.23.1", - "@esbuild/openbsd-arm64": "0.23.1", - "@esbuild/openbsd-x64": "0.23.1", - "@esbuild/sunos-x64": "0.23.1", - "@esbuild/win32-arm64": "0.23.1", - "@esbuild/win32-ia32": "0.23.1", - "@esbuild/win32-x64": "0.23.1" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/joycon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", - "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/lilconfig": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.2.tgz", - "integrity": "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antonk52" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, - "node_modules/load-tsconfig": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", - "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/lodash.sortby": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", - "integrity": "sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", - "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==", - "dev": true - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", - "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/postcss-load-config": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", - "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "lilconfig": "^3.1.1" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "jiti": ">=1.21.0", - "postcss": ">=8.0.9", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - }, - "postcss": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.21.2.tgz", - "integrity": "sha512-e3TapAgYf9xjdLvKQCkQTnbTKd4a6jwlpQSJJFokHGaX2IVjoEqkIIhiQfqsi0cdwlOD+tQGuOd5AJkc5RngBw==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.5" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.21.2", - "@rollup/rollup-android-arm64": "4.21.2", - "@rollup/rollup-darwin-arm64": "4.21.2", - "@rollup/rollup-darwin-x64": "4.21.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.21.2", - "@rollup/rollup-linux-arm-musleabihf": "4.21.2", - "@rollup/rollup-linux-arm64-gnu": "4.21.2", - "@rollup/rollup-linux-arm64-musl": "4.21.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.21.2", - "@rollup/rollup-linux-riscv64-gnu": "4.21.2", - "@rollup/rollup-linux-s390x-gnu": "4.21.2", - "@rollup/rollup-linux-x64-gnu": "4.21.2", - "@rollup/rollup-linux-x64-musl": "4.21.2", - "@rollup/rollup-win32-arm64-msvc": "4.21.2", - "@rollup/rollup-win32-ia32-msvc": "4.21.2", - "@rollup/rollup-win32-x64-msvc": "4.21.2", - "fsevents": "~2.3.2" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.8.0-beta.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.8.0-beta.0.tgz", - "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", - "dev": true, - "dependencies": { - "whatwg-url": "^7.0.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/source-map/node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/source-map/node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", - "dev": true - }, - "node_modules/source-map/node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", - "dev": true, - "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/sucrase": { - "version": "3.35.0", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", - "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.2", - "commander": "^4.0.0", - "glob": "^10.3.10", - "lines-and-columns": "^1.1.6", - "mz": "^2.7.0", - "pirates": "^4.0.1", - "ts-interface-checker": "^0.1.9" - }, - "bin": { - "sucrase": "bin/sucrase", - "sucrase-node": "bin/sucrase-node" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, - "bin": { - "tree-kill": "cli.js" - } - }, - "node_modules/ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", - "dev": true - }, - "node_modules/tsup": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.2.4.tgz", - "integrity": "sha512-akpCPePnBnC/CXgRrcy72ZSntgIEUa1jN0oJbbvpALWKNOz1B7aM+UVDWGRGIO/T/PZugAESWDJUAb5FD48o8Q==", - "dev": true, - "dependencies": { - "bundle-require": "^5.0.0", - "cac": "^6.7.14", - "chokidar": "^3.6.0", - "consola": "^3.2.3", - "debug": "^4.3.5", - "esbuild": "^0.23.0", - "execa": "^5.1.1", - "globby": "^11.1.0", - "joycon": "^3.1.1", - "picocolors": "^1.0.1", - "postcss-load-config": "^6.0.1", - "resolve-from": "^5.0.0", - "rollup": "^4.19.0", - "source-map": "0.8.0-beta.0", - "sucrase": "^3.35.0", - "tree-kill": "^1.2.2" - }, - "bin": { - "tsup": "dist/cli-default.js", - "tsup-node": "dist/cli-node.js" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@microsoft/api-extractor": "^7.36.0", - "@swc/core": "^1", - "postcss": "^8.4.12", - "typescript": ">=4.5.0" - }, - "peerDependenciesMeta": { - "@microsoft/api-extractor": { - "optional": true - }, - "@swc/core": { - "optional": true - }, - "postcss": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - } - } -} diff --git a/ecosystem-tests/nodenext-tsup/package.json b/ecosystem-tests/nodenext-tsup/package.json deleted file mode 100644 index ddef80219..000000000 --- a/ecosystem-tests/nodenext-tsup/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "nodenext-tsup", - "module": "index.ts", - "type": "module", - "scripts": { - "build": "tsup", - "main": "npm run build && node dist/index.cjs" - }, - "dependencies": {}, - "devDependencies": { - "tsup": "^8.2.4" - }, - "peerDependencies": { - "typescript": "^5.5.4" - } -} diff --git a/ecosystem-tests/nodenext-tsup/tsconfig.json b/ecosystem-tests/nodenext-tsup/tsconfig.json deleted file mode 100644 index 49111f4a1..000000000 --- a/ecosystem-tests/nodenext-tsup/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "incremental": false, - "isolatedModules": true, - "lib": ["es2022", "DOM", "DOM.Iterable"], - "module": "NodeNext", - "moduleDetection": "force", - "moduleResolution": "NodeNext", - "noUncheckedIndexedAccess": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "strict": true, - "target": "ES2022" - } -} diff --git a/ecosystem-tests/nodenext-tsup/tsup.config.ts b/ecosystem-tests/nodenext-tsup/tsup.config.ts deleted file mode 100644 index 657cd79fa..000000000 --- a/ecosystem-tests/nodenext-tsup/tsup.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from "tsup"; - -export default defineConfig({ - entry: ["index.ts"], - noExternal: ["openai"], - platform: "neutral", -}); diff --git a/ecosystem-tests/ts-browser-webpack/package-lock.json b/ecosystem-tests/ts-browser-webpack/package-lock.json index 695b85955..c04a9b959 100644 --- a/ecosystem-tests/ts-browser-webpack/package-lock.json +++ b/ecosystem-tests/ts-browser-webpack/package-lock.json @@ -3150,6 +3150,15 @@ "node": ">= 10.0" } }, + "node_modules/clean-css/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -3748,6 +3757,16 @@ "source-map": "~0.6.1" } }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", @@ -4776,6 +4795,12 @@ "node": ">= 12" } }, + "node_modules/ip-address/node_modules/jsbn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", + "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", + "dev": true + }, "node_modules/ipaddr.js": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.1.0.tgz", @@ -5007,12 +5032,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/jsbn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", - "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "dev": true - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -6525,15 +6544,6 @@ "node": ">= 14" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/spdy": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", @@ -6816,6 +6826,15 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, + "node_modules/terser/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/terser/node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", diff --git a/ecosystem-tests/ts-browser-webpack/src/index.ts b/ecosystem-tests/ts-browser-webpack/src/index.ts index 75fb6ea7a..9a01bdc30 100644 --- a/ecosystem-tests/ts-browser-webpack/src/index.ts +++ b/ecosystem-tests/ts-browser-webpack/src/index.ts @@ -1,4 +1,3 @@ -import 'openai/shims/web'; import OpenAI, { toFile } from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; @@ -209,13 +208,4 @@ describe('toFile', () => { }); }); -it('handles query strings', () => { - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - ).toEqual('foo[nested][a]=true&foo[nested][b]=foo'); - expect( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - ).toEqual('foo[nested][a][]=hello&foo[nested][a][]=world'); -}); - runTests(); diff --git a/ecosystem-tests/vercel-edge/src/uploadWebApiTestCases.ts b/ecosystem-tests/vercel-edge/src/uploadWebApiTestCases.ts index eb8be0030..59ce5c49a 100644 --- a/ecosystem-tests/vercel-edge/src/uploadWebApiTestCases.ts +++ b/ecosystem-tests/vercel-edge/src/uploadWebApiTestCases.ts @@ -1,7 +1,6 @@ import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; import { ChatCompletion } from 'openai/resources/chat/completions'; -import * as nf from 'node-fetch'; /** * Tests uploads using various Web API data objects. @@ -58,18 +57,18 @@ export function uploadWebApiTestCases({ }) .asResponse(); - // test that we can use node-fetch Response API + const decoder = new TextDecoder(); const chunks: string[] = []; - // we can't have both node and web response types in one project, - // but the tests will work at runtime because they will be in different - // enrivonments. So cast to any here - const { body } = response as any as nf.Response; - if (!body) throw new Error(`expected response.body to be defined`); - body.on('data', (chunk) => chunks.push(chunk)); - await new Promise((resolve, reject) => { - body.once('end', resolve); - body.once('error', reject); - }); + + // We need to cast to any as we're using both node types and web types. + // This works with the node types but to get this to work with web types + // we would need to bump `typescript` to ~5.5 and add `DOM.AsyncIterable` + // to `lib` but we want to test older ts versions + const body = response.body! as any; + for await (const chunk of body) { + chunks.push(decoder.decode(chunk)); + } + const json: ChatCompletion = JSON.parse(chunks.join('')); expectSimilar(json.choices[0]?.message.content || '', 'This is a test', 10); }); @@ -180,15 +179,4 @@ export function uploadWebApiTestCases({ expectEqual(result.filename, 'finetune.jsonl'); }); } - - it('handles query strings', async () => { - expectEqual( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: true, b: 'foo' } } })), - 'foo[nested][a]=true&foo[nested][b]=foo', - ); - expectEqual( - decodeURIComponent((client as any).stringifyQuery({ foo: { nested: { a: ['hello', 'world'] } } })), - 'foo[nested][a][]=hello&foo[nested][a][]=world', - ); - }); } From 04f5c4c61f3f11805454b346d8c81681a71cae29 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:26:46 +0000 Subject: [PATCH 072/509] fix tests --- jest.config.ts | 1 - tests/lib/azure.test.ts | 378 +++++++++++++++++++++------------------- tests/responses.test.ts | 3 +- 3 files changed, 202 insertions(+), 180 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index f78198b16..7240121b5 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -10,7 +10,6 @@ const config: JestConfigWithTsJest = { '^openai$': '/src/index.ts', '^openai/(.*)$': '/src/$1', }, - setupFilesAfterEnv: ['/jest.setup.ts'], modulePathIgnorePatterns: [ '/ecosystem-tests/', '/dist/', diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 064a0098c..220a448df 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -1,7 +1,8 @@ import { AzureOpenAI } from 'openai'; import { APIUserAbortError } from 'openai'; -import { Headers } from 'openai/core'; -import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch'; +import { type Response, RequestInit, RequestInfo } from 'openai/internal/builtin-types'; + +const defaultFetch = fetch; const apiVersion = '2024-02-15-preview'; const deployment = 'deployment'; @@ -31,7 +32,7 @@ describe('instantiate azure client', () => { test('they are used in the request', () => { const { req } = client.buildRequest({ path: '/foo', method: 'post' }); - expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); + expect(req.headers.get('x-my-default-header')).toEqual('2'); }); test('can ignore `undefined` and leave the default', () => { @@ -40,7 +41,7 @@ describe('instantiate azure client', () => { method: 'post', headers: { 'X-My-Default-Header': undefined }, }); - expect((req.headers as Headers)['x-my-default-header']).toEqual('2'); + expect(req.headers.get('x-my-default-header')).toEqual('2'); }); test('can be removed with `null`', () => { @@ -49,7 +50,7 @@ describe('instantiate azure client', () => { method: 'post', headers: { 'X-My-Default-Header': null }, }); - expect(req.headers as Headers).not.toHaveProperty('x-my-default-header'); + expect(req.headers.has('x-my-default-header')).toBe(false); }); }); @@ -226,7 +227,7 @@ describe('instantiate azure client', () => { describe('Azure Active Directory (AD)', () => { test('with azureADTokenProvider', async () => { const testFetch = async (url: RequestInfo, { headers }: RequestInit = {}): Promise => { - return new Response(JSON.stringify({ a: 1 }), { headers }); + return new Response(JSON.stringify({ a: 1 }), { headers: headers ?? [] }); }; const client = new AzureOpenAI({ baseURL: 'http://localhost:5000/', @@ -255,7 +256,7 @@ describe('instantiate azure client', () => { ); }); - test('AAD token is refreshed', async () => { + test.skip('AAD token is refreshed', async () => { let fail = true; const testFetch = async (url: RequestInfo, req: RequestInit | undefined): Promise => { if (fail) { @@ -267,10 +268,9 @@ describe('instantiate azure client', () => { }, }); } - return new Response( - JSON.stringify({ auth: (req?.headers as Record)['authorization'] }), - { headers: { 'content-type': 'application/json' } }, - ); + return new Response(JSON.stringify({ auth: (req?.headers as Headers).get('authorization') }), { + headers: { 'content-type': 'application/json' }, + }); }; let counter = 0; async function azureADTokenProvider() { @@ -315,10 +315,8 @@ describe('azure request building', () => { const client = new AzureOpenAI({ baseURL: 'https://example.com/', apiKey: 'My API Key', apiVersion }); describe('model to deployment mapping', function () { - const testFetch = async (url: RequestInfo, { body }: RequestInit = {}): Promise => { - return new Response(JSON.stringify({ url, body }), { - headers: { 'content-type': 'application/json' }, - }); + const testFetch = async (url: RequestInfo): Promise => { + return new Response(JSON.stringify({ url }), { headers: { 'content-type': 'application/json' } }); }; describe('with client-level deployment', function () { const client = new AzureOpenAI({ @@ -329,110 +327,128 @@ describe('azure request building', () => { fetch: testFetch, }); - test('handles batch', async () => { - const { url } = (await client.batches.create({ - completion_window: '24h', - endpoint: '/v1/chat/completions', - input_file_id: 'file-id', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/batches?api-version=${apiVersion}`); + test('handles Batch', async () => { + expect( + await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/chat/completions', + input_file_id: 'file-id', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/batches?api-version=${apiVersion}`, + }); }); test('handles completions', async () => { - const { url } = (await client.completions.create({ - model, - prompt: 'prompt', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/completions?api-version=${apiVersion}`, - ); + expect( + await client.completions.create({ + model, + prompt: 'prompt', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/completions?api-version=${apiVersion}`, + }); }); test('handles chat completions', async () => { - const { url } = (await client.chat.completions.create({ - model, - messages: [{ role: 'system', content: 'Hello' }], - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/chat/completions?api-version=${apiVersion}`, - ); + expect( + await client.chat.completions.create({ + model, + messages: [{ role: 'system', content: 'Hello' }], + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/chat/completions?api-version=${apiVersion}`, + }); }); test('handles embeddings', async () => { - const { url } = (await client.embeddings.create({ - model, - input: 'input', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/embeddings?api-version=${apiVersion}`, - ); + expect( + await client.embeddings.create({ + model, + input: 'input', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/embeddings?api-version=${apiVersion}`, + }); }); test('handles audio translations', async () => { - const { url } = (await client.audio.translations.create({ - model, - file: { url: 'https://example.com/', blob: () => 0 as any }, - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, - ); + expect( + await client.audio.translations.create({ + model, + file: { url: 'https://example.com/', blob: () => 0 as any }, + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, + }); }); test('handles audio transcriptions', async () => { - const { url } = (await client.audio.transcriptions.create({ - model, - file: { url: 'https://example.com/', blob: () => 0 as any }, - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, - ); + expect( + await client.audio.transcriptions.create({ + model, + file: { url: 'https://example.com/', blob: () => 0 as any }, + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, + }); }); test('handles text to speech', async () => { - const { url, body } = await ( - await client.audio.speech.create({ - model, - input: '', - voice: 'alloy', - }) - ).json(); - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/audio/speech?api-version=${apiVersion}`, - ); - expect(body).toMatch(new RegExp(`"model": "${model}"`)); + expect( + await ( + await client.audio.speech.create({ + model, + input: '', + voice: 'alloy', + }) + ).json(), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/speech?api-version=${apiVersion}`, + }); }); test('handles image generation', async () => { - const { url } = (await client.images.generate({ - model, - prompt: 'prompt', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/images/generations?api-version=${apiVersion}`, - ); + expect( + await client.images.generate({ + model, + prompt: 'prompt', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/images/generations?api-version=${apiVersion}`, + }); }); test('handles assistants', async () => { - const { url } = (await client.beta.assistants.create({ - model, - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/assistants?api-version=${apiVersion}`); + expect( + await client.beta.assistants.create({ + model, + }), + ).toMatchObject({ + url: `https://example.com/openai/assistants?api-version=${apiVersion}`, + }); }); test('handles files', async () => { - const { url } = (await client.files.create({ - file: { url: 'https://example.com/', blob: () => 0 as any }, - purpose: 'assistants', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/files?api-version=${apiVersion}`); + expect( + await client.files.create({ + file: { url: 'https://example.com/', blob: () => 0 as any }, + purpose: 'assistants', + }), + ).toMatchObject({ + url: `https://example.com/openai/files?api-version=${apiVersion}`, + }); }); test('handles fine tuning', async () => { - const { url } = (await client.fineTuning.jobs.create({ - model, - training_file: '', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/fine_tuning/jobs?api-version=${apiVersion}`); + expect( + await client.fineTuning.jobs.create({ + model, + training_file: '', + }), + ).toMatchObject({ + url: `https://example.com/openai/fine_tuning/jobs?api-version=${apiVersion}`, + }); }); }); @@ -444,124 +460,132 @@ describe('azure request building', () => { fetch: testFetch, }); - test('handles batch', async () => { - const { url } = (await client.batches.create({ - completion_window: '24h', - endpoint: '/v1/chat/completions', - input_file_id: 'file-id', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/batches?api-version=${apiVersion}`); + test('Batch is not handled', async () => { + expect( + await client.batches.create({ + completion_window: '24h', + endpoint: '/v1/chat/completions', + input_file_id: 'file-id', + }), + ).toMatchObject({ + url: `https://example.com/openai/batches?api-version=${apiVersion}`, + }); }); test('handles completions', async () => { - const { url } = (await client.completions.create({ - model: deployment, - prompt: 'prompt', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/completions?api-version=${apiVersion}`, - ); + expect( + await client.completions.create({ + model: deployment, + prompt: 'prompt', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/completions?api-version=${apiVersion}`, + }); }); test('handles chat completions', async () => { - const { url } = (await client.chat.completions.create({ - model: deployment, - messages: [{ role: 'system', content: 'Hello' }], - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/chat/completions?api-version=${apiVersion}`, - ); + expect( + await client.chat.completions.create({ + model: deployment, + messages: [{ role: 'system', content: 'Hello' }], + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/chat/completions?api-version=${apiVersion}`, + }); }); test('handles embeddings', async () => { - const { url } = (await client.embeddings.create({ - model: deployment, - input: 'input', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/embeddings?api-version=${apiVersion}`, - ); + expect( + await client.embeddings.create({ + model: deployment, + input: 'input', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/embeddings?api-version=${apiVersion}`, + }); }); test('Audio translations is not handled', async () => { - const { url } = (await client.audio.translations.create({ - model: deployment, - file: { url: 'https://example.com/', blob: () => 0 as any }, - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/audio/translations?api-version=${apiVersion}`); + expect( + await client.audio.translations.create({ + model: deployment, + file: { url: 'https://example.com/', blob: () => 0 as any }, + }), + ).toMatchObject({ + url: `https://example.com/openai/audio/translations?api-version=${apiVersion}`, + }); }); test('Audio transcriptions is not handled', async () => { - const { url } = (await client.audio.transcriptions.create({ - model: deployment, - file: { url: 'https://example.com/', blob: () => 0 as any }, - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/audio/transcriptions?api-version=${apiVersion}`, - ); + expect( + await client.audio.transcriptions.create({ + model: deployment, + file: { url: 'https://example.com/', blob: () => 0 as any }, + }), + ).toMatchObject({ + url: `https://example.com/openai/audio/transcriptions?api-version=${apiVersion}`, + }); }); test('handles text to speech', async () => { - const { url, body } = await ( - await client.audio.speech.create({ - model: deployment, - input: '', - voice: 'alloy', - }) - ).json(); - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/audio/speech?api-version=${apiVersion}`, - ); - expect(body).toMatch(new RegExp(`"model": "${deployment}"`)); + expect( + await ( + await client.audio.speech.create({ + model: deployment, + input: '', + voice: 'alloy', + }) + ).json(), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/speech?api-version=${apiVersion}`, + }); }); test('handles image generation', async () => { - const { url } = (await client.images.generate({ - model: deployment, - prompt: 'prompt', - })) as any; - expect(url).toStrictEqual( - `https://example.com/openai/deployments/${deployment}/images/generations?api-version=${apiVersion}`, - ); + expect( + await client.images.generate({ + model: deployment, + prompt: 'prompt', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/images/generations?api-version=${apiVersion}`, + }); }); test('handles assistants', async () => { - const { url } = (await client.beta.assistants.create({ - model, - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/assistants?api-version=${apiVersion}`); + expect( + await client.beta.assistants.create({ + model, + }), + ).toMatchObject({ + url: `https://example.com/openai/assistants?api-version=${apiVersion}`, + }); }); test('handles files', async () => { - const { url } = (await client.files.create({ - file: { url: 'https://example.com/', blob: () => 0 as any }, - purpose: 'assistants', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/files?api-version=${apiVersion}`); + expect( + await client.files.create({ + file: { url: 'https://example.com/', blob: () => 0 as any }, + purpose: 'assistants', + }), + ).toMatchObject({ + url: `https://example.com/openai/files?api-version=${apiVersion}`, + }); }); test('handles fine tuning', async () => { - const { url } = (await client.fineTuning.jobs.create({ - model: deployment, - training_file: '', - })) as any; - expect(url).toStrictEqual(`https://example.com/openai/fine_tuning/jobs?api-version=${apiVersion}`); + expect( + await client.fineTuning.jobs.create({ + model, + training_file: '', + }), + ).toMatchObject({ + url: `https://example.com/openai/fine_tuning/jobs?api-version=${apiVersion}`, + }); }); }); }); - describe('Content-Length', () => { - test('handles multi-byte characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: '—' } }); - expect((req.headers as Record)['content-length']).toEqual('20'); - }); - - test('handles standard characters', () => { - const { req } = client.buildRequest({ path: '/foo', method: 'post', body: { value: 'hello' } }); - expect((req.headers as Record)['content-length']).toEqual('22'); - }); - }); - describe('custom headers', () => { test('handles undefined', () => { const { req } = client.buildRequest({ @@ -570,10 +594,10 @@ describe('azure request building', () => { body: { value: 'hello' }, headers: { 'X-Foo': 'baz', 'x-foo': 'bar', 'x-Foo': undefined, 'x-baz': 'bam', 'X-Baz': null }, }); - expect((req.headers as Record)['x-foo']).toEqual('bar'); - expect((req.headers as Record)['x-Foo']).toEqual(undefined); - expect((req.headers as Record)['X-Foo']).toEqual(undefined); - expect((req.headers as Record)['x-baz']).toEqual(undefined); + expect(req.headers.get('x-foo')).toEqual('bar'); + expect(req.headers.get('x-Foo')).toEqual('bar'); + expect(req.headers.get('X-Foo')).toEqual('bar'); + expect(req.headers.get('x-baz')).toEqual(null); }); }); }); diff --git a/tests/responses.test.ts b/tests/responses.test.ts index 2aa4c80d6..f24937cc0 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -1,6 +1,5 @@ -import { APIPromise } from 'openai/core'; +import { APIPromise } from 'openai/api-promise'; import OpenAI from 'openai/index'; -import { Response } from 'node-fetch'; import { compareType } from './utils/typing'; describe('request id', () => { From 93ff74bfb93b2ee663a99dbf773302510fbfc3b3 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:26:51 +0000 Subject: [PATCH 073/509] re-export azure client --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index 44de17c6a..50ce5b01a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,3 +27,5 @@ export { PermissionDeniedError, UnprocessableEntityError, } from './error'; + +export { AzureOpenAI } from './azure'; From 71c95c17c918084a823be3c5a51f04ca45a39488 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:29:53 +0000 Subject: [PATCH 074/509] CI: run on alpha branch --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6798e38a..50caff538 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: branches: - master - next + - alpha jobs: lint: From c85d9e6ce251e76f43a2282b81d7775e48b2b117 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:32:32 +0000 Subject: [PATCH 075/509] try fix --- jest.config.ts | 2 +- tests/lib/ChatCompletionRunFunctions.test.ts | 1 - tests/utils/mock-fetch.ts | 5 +---- tests/utils/mock-snapshots.ts | 6 +++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index 7240121b5..ed3ba8754 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -17,7 +17,7 @@ const config: JestConfigWithTsJest = { '/deno_tests/', ], testPathIgnorePatterns: ['scripts'], - prettierPath: require.resolve('prettier-2'), + // prettierPath: require.resolve('prettier-2'), }; export default config; diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index b684f204d..dcdc086de 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -9,7 +9,6 @@ import { type ChatCompletionStreamingFunctionRunnerParams, } from 'openai/resources/beta/chat/completions'; import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions'; -import { Response } from 'node-fetch'; import { isAssistantMessage } from '../../src/lib/chatCompletionUtils'; import { mockFetch } from '../utils/mock-fetch'; diff --git a/tests/utils/mock-fetch.ts b/tests/utils/mock-fetch.ts index e122f7aec..f8b2184f5 100644 --- a/tests/utils/mock-fetch.ts +++ b/tests/utils/mock-fetch.ts @@ -1,7 +1,4 @@ -import { type RequestInfo, type RequestInit } from 'openai/_shims/index'; -import { Response } from 'node-fetch'; - -type Fetch = (req: string | RequestInfo, init?: RequestInit) => Promise; +import { type Fetch, type RequestInfo, type RequestInit, type Response } from 'openai/internal/builtin-types'; /** * Creates a mock `fetch` function and a `handleRequest` function for intercepting `fetch` calls. diff --git a/tests/utils/mock-snapshots.ts b/tests/utils/mock-snapshots.ts index 317bf6b0f..fc6b5abd2 100644 --- a/tests/utils/mock-snapshots.ts +++ b/tests/utils/mock-snapshots.ts @@ -1,10 +1,10 @@ -import defaultFetch, { Response } from 'node-fetch'; import OpenAI from 'openai/index'; -import { RequestInit } from 'openai/_shims/auto/types'; -import { RequestInfo } from 'openai/_shims/auto/types'; +import { RequestInfo } from 'openai/internal/builtin-types'; import { mockFetch } from './mock-fetch'; import { Readable } from 'stream'; +const defaultFetch = fetch; + export async function makeSnapshotRequest( requestFn: (client: OpenAI) => Promise, snapshotIndex = 1, From 3c7a7baf5937261895c1dae09008f3fce11d2ef1 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:47:17 +0000 Subject: [PATCH 076/509] fix examples --- examples/audio.ts | 4 +- examples/function-call-helpers-zod.ts | 112 -------------------------- examples/function-call-helpers.ts | 110 ------------------------- 3 files changed, 2 insertions(+), 224 deletions(-) delete mode 100755 examples/function-call-helpers-zod.ts delete mode 100755 examples/function-call-helpers.ts diff --git a/examples/audio.ts b/examples/audio.ts index a37c93b20..1903aa184 100755 --- a/examples/audio.ts +++ b/examples/audio.ts @@ -1,5 +1,4 @@ #!/usr/bin/env -S npm run tsn -T -import 'openai/shims/node'; import OpenAI, { toFile } from 'openai'; import fs from 'fs'; @@ -23,9 +22,10 @@ async function streamingDemoNode() { input: 'the quick brown chicken jumped over the lazy dogs', }); - const stream = response.body; + const stream = response.body!; console.log(`Streaming response to ${speechFile}`); + // @ts-ignore await streamToFile(stream, speechFile); console.log('Finished streaming'); } diff --git a/examples/function-call-helpers-zod.ts b/examples/function-call-helpers-zod.ts deleted file mode 100755 index f783aee08..000000000 --- a/examples/function-call-helpers-zod.ts +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env -S npm run tsn -T - -import OpenAI from 'openai'; -import { ZodSchema, z } from 'zod'; -import { zodToJsonSchema } from 'zod-to-json-schema'; - -const openai = new OpenAI(); - -const ListParams = z.object({ - genre: z.enum(['mystery', 'nonfiction', 'memoir', 'romance', 'historical']), -}); - -const SearchParams = z.object({ - name: z.string(), -}); - -const GetParams = z.object({ - id: z.string(), -}); - -const functions = [ - { - name: 'list', - description: 'list queries books by genre, and returns a list of names of books', - parameters: zodToJsonSchema(ListParams), - parse: zodParseJSON(ListParams), - function: list, - }, - { - name: 'search', - description: 'search queries books by their name and returns a list of book names and their ids', - parameters: zodToJsonSchema(SearchParams), - parse: zodParseJSON(SearchParams), - function: search, - }, - { - name: 'get', - description: - "get returns a book's detailed information based on the id of the book. Note that this does not accept names, and only IDs, which you can get by using search.", - parameters: zodToJsonSchema(GetParams), - parse: zodParseJSON(GetParams), - function: get, - }, -] as const; - -async function main() { - const runner = await openai.beta.chat.completions - .runFunctions({ - model: 'gpt-3.5-turbo', - messages: [ - { - role: 'system', - content: - 'Please use our book database, which you can access using functions to answer the following questions.', - }, - { - role: 'user', - content: - 'I really enjoyed reading To Kill a Mockingbird, could you recommend me a book that is similar and tell me why?', - }, - ], - functions, - }) - .on('message', (msg) => console.log(msg)) - .on('content', (diff) => process.stdout.write(diff)); - - const result = await runner.finalChatCompletion(); - console.log(result); - - console.log(); - console.log(runner.messages); -} - -const db = [ - { - id: 'a1', - name: 'To Kill a Mockingbird', - genre: 'historical', - description: `Compassionate, dramatic, and deeply moving, "To Kill A Mockingbird" takes readers to the roots of human behavior - to innocence and experience, kindness and cruelty, love and hatred, humor and pathos. Now with over 18 million copies in print and translated into forty languages, this regional story by a young Alabama woman claims universal appeal. Harper Lee always considered her book to be a simple love story. Today it is regarded as a masterpiece of American literature.`, - }, - { - id: 'a2', - name: 'All the Light We Cannot See', - genre: 'historical', - description: `In a mining town in Germany, Werner Pfennig, an orphan, grows up with his younger sister, enchanted by a crude radio they find that brings them news and stories from places they have never seen or imagined. Werner becomes an expert at building and fixing these crucial new instruments and is enlisted to use his talent to track down the resistance. Deftly interweaving the lives of Marie-Laure and Werner, Doerr illuminates the ways, against all odds, people try to be good to one another.`, - }, - { - id: 'a3', - name: 'Where the Crawdads Sing', - genre: 'historical', - description: `For years, rumors of the “Marsh Girl” haunted Barkley Cove, a quiet fishing village. Kya Clark is barefoot and wild; unfit for polite society. So in late 1969, when the popular Chase Andrews is found dead, locals immediately suspect her. -But Kya is not what they say. A born naturalist with just one day of school, she takes life's lessons from the land, learning the real ways of the world from the dishonest signals of fireflies. But while she has the skills to live in solitude forever, the time comes when she yearns to be touched and loved. Drawn to two young men from town, who are each intrigued by her wild beauty, Kya opens herself to a new and startling world—until the unthinkable happens.`, - }, -]; - -async function list({ genre }: z.infer) { - return db.filter((item) => item.genre === genre).map((item) => ({ name: item.name, id: item.id })); -} - -async function search({ name }: z.infer) { - return db.filter((item) => item.name.includes(name)).map((item) => ({ name: item.name, id: item.id })); -} - -async function get({ id }: z.infer) { - return db.find((item) => item.id === id)!; -} - -function zodParseJSON(schema: ZodSchema) { - return (input: string): T => schema.parse(JSON.parse(input)); -} - -main(); diff --git a/examples/function-call-helpers.ts b/examples/function-call-helpers.ts deleted file mode 100755 index 48e2afd62..000000000 --- a/examples/function-call-helpers.ts +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env -S npm run tsn -T - -import OpenAI from 'openai'; - -// gets API Key from environment variable OPENAI_API_KEY -const openai = new OpenAI(); - -const functions = [ - { - name: 'list', - description: 'list queries books by genre, and returns a list of names of books', - parameters: { - type: 'object', - properties: { - genre: { type: 'string', enum: ['mystery', 'nonfiction', 'memoir', 'romance', 'historical'] }, - }, - }, - function: list, - parse: JSON.parse, - }, - { - name: 'search', - description: 'search queries books by their name and returns a list of book names and their ids', - parameters: { - type: 'object', - properties: { - name: { type: 'string' }, - }, - }, - function: search, - parse: JSON.parse, - }, - { - name: 'get', - description: - "get returns a book's detailed information based on the id of the book. Note that this does not accept names, and only IDs, which you can get by using search.", - parameters: { - type: 'object', - properties: { - id: { type: 'string' }, - }, - }, - function: get, - parse: JSON.parse, - }, -]; - -async function main() { - const runner = await openai.beta.chat.completions - .runFunctions({ - model: 'gpt-3.5-turbo', - messages: [ - { - role: 'system', - content: - 'Please use our book database, which you can access using functions to answer the following questions.', - }, - { - role: 'user', - content: - 'I really enjoyed reading To Kill a Mockingbird, could you recommend me a book that is similar and tell me why?', - }, - ], - functions, - }) - .on('message', (msg) => console.log(msg)) - .on('content', (diff) => process.stdout.write(diff)); - - const result = await runner.finalChatCompletion(); - console.log(result); - - console.log(); - console.log(runner.messages); -} - -const db = [ - { - id: 'a1', - name: 'To Kill a Mockingbird', - genre: 'historical', - description: `Compassionate, dramatic, and deeply moving, "To Kill A Mockingbird" takes readers to the roots of human behavior - to innocence and experience, kindness and cruelty, love and hatred, humor and pathos. Now with over 18 million copies in print and translated into forty languages, this regional story by a young Alabama woman claims universal appeal. Harper Lee always considered her book to be a simple love story. Today it is regarded as a masterpiece of American literature.`, - }, - { - id: 'a2', - name: 'All the Light We Cannot See', - genre: 'historical', - description: `In a mining town in Germany, Werner Pfennig, an orphan, grows up with his younger sister, enchanted by a crude radio they find that brings them news and stories from places they have never seen or imagined. Werner becomes an expert at building and fixing these crucial new instruments and is enlisted to use his talent to track down the resistance. Deftly interweaving the lives of Marie-Laure and Werner, Doerr illuminates the ways, against all odds, people try to be good to one another.`, - }, - { - id: 'a3', - name: 'Where the Crawdads Sing', - genre: 'historical', - description: `For years, rumors of the “Marsh Girl” haunted Barkley Cove, a quiet fishing village. Kya Clark is barefoot and wild; unfit for polite society. So in late 1969, when the popular Chase Andrews is found dead, locals immediately suspect her. -But Kya is not what they say. A born naturalist with just one day of school, she takes life's lessons from the land, learning the real ways of the world from the dishonest signals of fireflies. But while she has the skills to live in solitude forever, the time comes when she yearns to be touched and loved. Drawn to two young men from town, who are each intrigued by her wild beauty, Kya opens herself to a new and startling world—until the unthinkable happens.`, - }, -]; - -async function list({ genre }: { genre: string }) { - return db.filter((item) => item.genre === genre).map((item) => ({ name: item.name, id: item.id })); -} - -async function search({ name }: { name: string }) { - return db.filter((item) => item.name.includes(name)).map((item) => ({ name: item.name, id: item.id })); -} - -async function get({ id }: { id: string }) { - return db.find((item) => item.id === id)!; -} - -main(); From d4bdc935155d35557db4de09c5b8a5d69cf4d5ed Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 20:52:26 +0000 Subject: [PATCH 077/509] chore: bump version --- .release-please-manifest.json | 2 +- jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b843f931..b33fcdcea 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.0" + ".": "5.0.0-alpha.0" } diff --git a/jsr.json b/jsr.json index d76a2040e..bc854dbcd 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.0", + "version": "5.0.0-alpha.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index f0dbc9c9a..c05351d5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.0", + "version": "5.0.0-alpha.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index fdf4e5224..2205d0775 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.0'; // x-release-please-version +export const VERSION = '5.0.0-alpha.0'; // x-release-please-version From d70f6e835be4cef980e8e4026ec709177d3d3931 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:16:46 +0000 Subject: [PATCH 078/509] chore(internal): spec update (#1231) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7b5235e3c..248cc366d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-0d64ca9e45f51b4279f87b205eeb3a3576df98407698ce053f2e2302c1c08df1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml From 0f715f281715da744e01c2c08932008d0cfde614 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 22:07:12 +0000 Subject: [PATCH 079/509] fix(client): normalize method (#1235) --- src/core.ts | 12 +++++++++++- tests/index.test.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index 68f1e676a..972cceaec 100644 --- a/src/core.ts +++ b/src/core.ts @@ -557,9 +557,19 @@ export abstract class APIClient { const timeout = setTimeout(() => controller.abort(), ms); + const fetchOptions = { + signal: controller.signal as any, + ...options, + }; + if (fetchOptions.method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = fetchOptions.method.toUpperCase(); + } + return ( // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - this.fetch.call(undefined, url, { signal: controller.signal as any, ...options }).finally(() => { + this.fetch.call(undefined, url, fetchOptions).finally(() => { clearTimeout(timeout); }) ); diff --git a/tests/index.test.ts b/tests/index.test.ts index bf113e7bb..a6f0040a4 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -122,6 +122,19 @@ describe('instantiate client', () => { expect(spy).toHaveBeenCalledTimes(1); }); + test('normalized method', async () => { + let capturedRequest: RequestInit | undefined; + const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => { + capturedRequest = init; + return new Response(JSON.stringify({}), { headers: { 'Content-Type': 'application/json' } }); + }; + + const client = new OpenAI({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: testFetch }); + + await client.patch('/foo'); + expect(capturedRequest?.method).toEqual('PATCH'); + }); + describe('baseUrl', () => { test('trailing slash', () => { const client = new OpenAI({ baseURL: 'http://localhost:5000/custom/path/', apiKey: 'My API Key' }); From 4df92af7cace12c2134fbfb3db1ed5887dec0a4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:54:17 +0000 Subject: [PATCH 080/509] docs: minor formatting changes (#1236) --- CONTRIBUTING.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8bbc1b07..dde09d52d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ## Setting up the environment -This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable). +This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install). Other package managers may work but are not officially supported for development. To set up the repository, run: @@ -29,10 +29,10 @@ All files in the `examples/` directory are not modified by the generator and can … ``` -``` -chmod +x examples/.ts +```sh +$ chmod +x examples/.ts # run the example against your api -yarn tsn -T examples/.ts +$ yarn tsn -T examples/.ts ``` ## Using the repository from source From b6e4d947c69d255cd332bf247a2faedf578438c4 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 20 Dec 2024 21:28:36 +0000 Subject: [PATCH 081/509] docs(readme): add alpha callout --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b03bcd870..c926688f0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ +> [!IMPORTANT] +> We're actively working on a new alpha version that migrates from `node-fetch` to builtin fetch. +> +> Please try it out and let us know if you run into any issues! +> https://community.openai.com/t/your-feedback-requested-node-js-sdk-5-0-0-alpha/1063774 + # OpenAI TypeScript and JavaScript API Library [![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) From 3fdc7d4f67a6ceea51723684dcc0bc1895088259 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 05:06:15 +0000 Subject: [PATCH 082/509] release: 4.77.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b843f931..40491ea3b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.0" + ".": "4.77.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d33ce4c1a..e2ed8756c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.77.1 (2024-12-21) + +Full Changelog: [v4.77.0...v4.77.1](https://github.com/openai/openai-node/compare/v4.77.0...v4.77.1) + +### Bug Fixes + +* **client:** normalize method ([#1235](https://github.com/openai/openai-node/issues/1235)) ([4a213da](https://github.com/openai/openai-node/commit/4a213dad6f2104dc02a75724acc62134d25db472)) + + +### Chores + +* **internal:** spec update ([#1231](https://github.com/openai/openai-node/issues/1231)) ([a97ea73](https://github.com/openai/openai-node/commit/a97ea73cafcb56e94be7ff691c4022da575cf60e)) + + +### Documentation + +* minor formatting changes ([#1236](https://github.com/openai/openai-node/issues/1236)) ([6387968](https://github.com/openai/openai-node/commit/63879681ccaca3dc1e17b27464e2f830b8f63b4f)) +* **readme:** add alpha callout ([f2eff37](https://github.com/openai/openai-node/commit/f2eff3780e1216f7f420f7b86d47f4e21986b10e)) + ## 4.77.0 (2024-12-17) Full Changelog: [v4.76.3...v4.77.0](https://github.com/openai/openai-node/compare/v4.76.3...v4.77.0) diff --git a/jsr.json b/jsr.json index d76a2040e..f80d0a575 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.0", + "version": "4.77.1", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 54633aa5d..44030acd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.0", + "version": "4.77.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index fdf4e5224..a7b84d0c2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.0'; // x-release-please-version +export const VERSION = '4.77.1'; // x-release-please-version From c0ae6fc24957b1c3962b75f1d17c0d85ea2b298c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 01:44:21 +0000 Subject: [PATCH 083/509] chore: bump license year (#1246) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 621a6becf..f011417af 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 OpenAI + Copyright 2025 OpenAI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 9acdf8a3c44a4cce785b9dfa9efd32f8c47fa6d5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 05:06:49 +0000 Subject: [PATCH 084/509] release: 4.77.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 40491ea3b..c5f60a579 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.1" + ".": "4.77.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ed8756c..d5143492e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.77.2 (2025-01-02) + +Full Changelog: [v4.77.1...v4.77.2](https://github.com/openai/openai-node/compare/v4.77.1...v4.77.2) + +### Chores + +* bump license year ([#1246](https://github.com/openai/openai-node/issues/1246)) ([13197c1](https://github.com/openai/openai-node/commit/13197c1698f492529bd00b62d95f83c039ef0ac7)) + ## 4.77.1 (2024-12-21) Full Changelog: [v4.77.0...v4.77.1](https://github.com/openai/openai-node/compare/v4.77.0...v4.77.1) diff --git a/jsr.json b/jsr.json index f80d0a575..6e735f0b0 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.1", + "version": "4.77.2", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 44030acd3..947aad8d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.1", + "version": "4.77.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index a7b84d0c2..e1984f01e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.1'; // x-release-please-version +export const VERSION = '4.77.2'; // x-release-please-version From db16121d2db5a3104c2b9d85c6b7b3281f6f6299 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 22:57:05 +0000 Subject: [PATCH 085/509] chore(api): bump spec version (#1248) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 248cc366d..d223c8f1f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-02200a58ed631064b6419711da99fefd6e97bdbbeb577a80a1a6e0c8dbcb18f5.yml From f4066e1af907586946a5e6befee9459268425680 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 22:57:37 +0000 Subject: [PATCH 086/509] release: 4.77.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c5f60a579..e98ace9d7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.2" + ".": "4.77.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d5143492e..1f928b366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.77.3 (2025-01-03) + +Full Changelog: [v4.77.2...v4.77.3](https://github.com/openai/openai-node/compare/v4.77.2...v4.77.3) + +### Chores + +* **api:** bump spec version ([#1248](https://github.com/openai/openai-node/issues/1248)) ([37b3df9](https://github.com/openai/openai-node/commit/37b3df9ac6af76fea6eace8307aab9f0565e5660)) + ## 4.77.2 (2025-01-02) Full Changelog: [v4.77.1...v4.77.2](https://github.com/openai/openai-node/compare/v4.77.1...v4.77.2) diff --git a/jsr.json b/jsr.json index 6e735f0b0..57eb55bf8 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.2", + "version": "4.77.3", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 947aad8d4..2ad833206 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.2", + "version": "4.77.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index e1984f01e..81ee8f0d6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.2'; // x-release-please-version +export const VERSION = '4.77.3'; // x-release-please-version From 017d6010d40e84ea390293a46485beefcc8d386c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:22:26 +0000 Subject: [PATCH 087/509] docs(readme): fix misplaced period (#1252) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c926688f0..3039857a1 100644 --- a/README.md +++ b/README.md @@ -631,7 +631,7 @@ await client.models.list({ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: 1. Changes that only affect static types, without breaking runtime behavior. -2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ 3. Changes that we do not expect to impact the vast majority of users in practice. We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. From bb6ac193b7d9d45155d7e7bc93d40ea0a79645cc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:23:01 +0000 Subject: [PATCH 088/509] release: 4.77.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e98ace9d7..e66c326a9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.3" + ".": "4.77.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f928b366..7a811f188 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.77.4 (2025-01-08) + +Full Changelog: [v4.77.3...v4.77.4](https://github.com/openai/openai-node/compare/v4.77.3...v4.77.4) + +### Documentation + +* **readme:** fix misplaced period ([#1252](https://github.com/openai/openai-node/issues/1252)) ([c2fe465](https://github.com/openai/openai-node/commit/c2fe46522d59d1611ba8bb2b7e070f9be7264df0)) + ## 4.77.3 (2025-01-03) Full Changelog: [v4.77.2...v4.77.3](https://github.com/openai/openai-node/compare/v4.77.2...v4.77.3) diff --git a/jsr.json b/jsr.json index 57eb55bf8..da442da31 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.3", + "version": "4.77.4", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 2ad833206..453859b6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.3", + "version": "4.77.4", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 81ee8f0d6..7f6adc9bc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.3'; // x-release-please-version +export const VERSION = '4.77.4'; // x-release-please-version From d3736066a0a277ba544617cbf8d2ea057a9f0ecf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:58:16 +0000 Subject: [PATCH 089/509] feat(client): add realtime types (#1254) note this just defines types, there is no websocket interface provided yet --- .stats.yml | 4 +- api.md | 60 + src/resources/beta/beta.ts | 6 + src/resources/beta/index.ts | 1 + src/resources/beta/realtime/index.ts | 4 + src/resources/beta/realtime/realtime.ts | 1904 +++++++++++++++++ src/resources/beta/realtime/sessions.ts | 546 +++++ .../beta/realtime/sessions.test.ts | 45 + 8 files changed, 2568 insertions(+), 2 deletions(-) create mode 100644 src/resources/beta/realtime/index.ts create mode 100644 src/resources/beta/realtime/realtime.ts create mode 100644 src/resources/beta/realtime/sessions.ts create mode 100644 tests/api-resources/beta/realtime/sessions.test.ts diff --git a/.stats.yml b/.stats.yml index d223c8f1f..9600edae3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-02200a58ed631064b6419711da99fefd6e97bdbbeb577a80a1a6e0c8dbcb18f5.yml +configured_endpoints: 69 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b5b0e2c794b012919701c3fd43286af10fa25d33ceb8a881bec2636028f446e0.yml diff --git a/api.md b/api.md index 54bcf08d7..a885628a3 100644 --- a/api.md +++ b/api.md @@ -213,6 +213,66 @@ Methods: # Beta +## Realtime + +Types: + +- ConversationCreatedEvent +- ConversationItem +- ConversationItemContent +- ConversationItemCreateEvent +- ConversationItemCreatedEvent +- ConversationItemDeleteEvent +- ConversationItemDeletedEvent +- ConversationItemInputAudioTranscriptionCompletedEvent +- ConversationItemInputAudioTranscriptionFailedEvent +- ConversationItemTruncateEvent +- ConversationItemTruncatedEvent +- ErrorEvent +- InputAudioBufferAppendEvent +- InputAudioBufferClearEvent +- InputAudioBufferClearedEvent +- InputAudioBufferCommitEvent +- InputAudioBufferCommittedEvent +- InputAudioBufferSpeechStartedEvent +- InputAudioBufferSpeechStoppedEvent +- RateLimitsUpdatedEvent +- RealtimeClientEvent +- RealtimeResponse +- RealtimeResponseStatus +- RealtimeResponseUsage +- RealtimeServerEvent +- ResponseAudioDeltaEvent +- ResponseAudioDoneEvent +- ResponseAudioTranscriptDeltaEvent +- ResponseAudioTranscriptDoneEvent +- ResponseCancelEvent +- ResponseContentPartAddedEvent +- ResponseContentPartDoneEvent +- ResponseCreateEvent +- ResponseCreatedEvent +- ResponseDoneEvent +- ResponseFunctionCallArgumentsDeltaEvent +- ResponseFunctionCallArgumentsDoneEvent +- ResponseOutputItemAddedEvent +- ResponseOutputItemDoneEvent +- ResponseTextDeltaEvent +- ResponseTextDoneEvent +- SessionCreatedEvent +- SessionUpdateEvent +- SessionUpdatedEvent + +### Sessions + +Types: + +- Session +- SessionCreateResponse + +Methods: + +- client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse + ## VectorStores Types: diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index b904abe4a..ccd043243 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -21,6 +21,8 @@ import { RunStreamEvent, ThreadStreamEvent, } from './assistants'; +import * as RealtimeAPI from './realtime/realtime'; +import { Realtime } from './realtime/realtime'; import * as ThreadsAPI from './threads/threads'; import { AssistantResponseFormatOption, @@ -58,12 +60,14 @@ import { import { Chat } from './chat/chat'; export class Beta extends APIResource { + realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client); vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client); chat: ChatAPI.Chat = new ChatAPI.Chat(this._client); assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client); threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } +Beta.Realtime = Realtime; Beta.VectorStores = VectorStores; Beta.VectorStoresPage = VectorStoresPage; Beta.Assistants = Assistants; @@ -71,6 +75,8 @@ Beta.AssistantsPage = AssistantsPage; Beta.Threads = Threads; export declare namespace Beta { + export { Realtime as Realtime }; + export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index d7111288f..aa2e52d4c 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -19,6 +19,7 @@ export { type AssistantListParams, } from './assistants'; export { Beta } from './beta'; +export { Realtime } from './realtime/index'; export { Chat } from './chat/index'; export { Threads, diff --git a/src/resources/beta/realtime/index.ts b/src/resources/beta/realtime/index.ts new file mode 100644 index 000000000..66c3ecaae --- /dev/null +++ b/src/resources/beta/realtime/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Realtime } from './realtime'; +export { Sessions, type Session, type SessionCreateResponse, type SessionCreateParams } from './sessions'; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts new file mode 100644 index 000000000..5de06917a --- /dev/null +++ b/src/resources/beta/realtime/realtime.ts @@ -0,0 +1,1904 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as RealtimeAPI from './realtime'; +import * as SessionsAPI from './sessions'; +import { + Session as SessionsAPISession, + SessionCreateParams, + SessionCreateResponse, + Sessions, +} from './sessions'; + +export class Realtime extends APIResource { + sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client); +} + +/** + * Returned when a conversation is created. Emitted right after session creation. + */ +export interface ConversationCreatedEvent { + /** + * The conversation resource. + */ + conversation: ConversationCreatedEvent.Conversation; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `conversation.created`. + */ + type: 'conversation.created'; +} + +export namespace ConversationCreatedEvent { + /** + * The conversation resource. + */ + export interface Conversation { + /** + * The unique ID of the conversation. + */ + id?: string; + + /** + * The object type, must be `realtime.conversation`. + */ + object?: 'realtime.conversation'; + } +} + +/** + * The item to add to the conversation. + */ +export interface ConversationItem { + /** + * The unique ID of the item, this can be generated by the client to help manage + * server-side context, but is not required because the server will generate one if + * not provided. + */ + id?: string; + + /** + * The arguments of the function call (for `function_call` items). + */ + arguments?: string; + + /** + * The ID of the function call (for `function_call` and `function_call_output` + * items). If passed on a `function_call_output` item, the server will check that a + * `function_call` item with the same ID exists in the conversation history. + */ + call_id?: string; + + /** + * The content of the message, applicable for `message` items. + * + * - Message items of role `system` support only `input_text` content + * - Message items of role `user` support `input_text` and `input_audio` content + * - Message items of role `assistant` support `text` content. + */ + content?: Array; + + /** + * The name of the function being called (for `function_call` items). + */ + name?: string; + + /** + * Identifier for the API object being returned - always `realtime.item`. + */ + object?: 'realtime.item'; + + /** + * The output of the function call (for `function_call_output` items). + */ + output?: string; + + /** + * The role of the message sender (`user`, `assistant`, `system`), only applicable + * for `message` items. + */ + role?: 'user' | 'assistant' | 'system'; + + /** + * The status of the item (`completed`, `incomplete`). These have no effect on the + * conversation, but are accepted for consistency with the + * `conversation.item.created` event. + */ + status?: 'completed' | 'incomplete'; + + /** + * The type of the item (`message`, `function_call`, `function_call_output`). + */ + type?: 'message' | 'function_call' | 'function_call_output'; +} + +export interface ConversationItemContent { + /** + * ID of a previous conversation item to reference (for `item_reference` content + * types in `response.create` events). These can reference both client and server + * created items. + */ + id?: string; + + /** + * Base64-encoded audio bytes, used for `input_audio` content type. + */ + audio?: string; + + /** + * The text content, used for `input_text` and `text` content types. + */ + text?: string; + + /** + * The transcript of the audio, used for `input_audio` content type. + */ + transcript?: string; + + /** + * The content type (`input_text`, `input_audio`, `item_reference`, `text`). + */ + type?: 'input_text' | 'input_audio' | 'item_reference' | 'text'; +} + +/** + * Add a new Item to the Conversation's context, including messages, function + * calls, and function call responses. This event can be used both to populate a + * "history" of the conversation and to add new items mid-stream, but has the + * current limitation that it cannot populate assistant audio messages. + * + * If successful, the server will respond with a `conversation.item.created` event, + * otherwise an `error` event will be sent. + */ +export interface ConversationItemCreateEvent { + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The event type, must be `conversation.item.create`. + */ + type: 'conversation.item.create'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * The ID of the preceding item after which the new item will be inserted. If not + * set, the new item will be appended to the end of the conversation. If set, it + * allows an item to be inserted mid-conversation. If the ID cannot be found, an + * error will be returned and the item will not be added. + */ + previous_item_id?: string; +} + +/** + * Returned when a conversation item is created. There are several scenarios that + * produce this event: + * + * - The server is generating a Response, which if successful will produce either + * one or two Items, which will be of type `message` (role `assistant`) or type + * `function_call`. + * - The input audio buffer has been committed, either by the client or the server + * (in `server_vad` mode). The server will take the content of the input audio + * buffer and add it to a new user message Item. + * - The client has sent a `conversation.item.create` event to add a new Item to + * the Conversation. + */ +export interface ConversationItemCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The ID of the preceding item in the Conversation context, allows the client to + * understand the order of the conversation. + */ + previous_item_id: string; + + /** + * The event type, must be `conversation.item.created`. + */ + type: 'conversation.item.created'; +} + +/** + * Send this event when you want to remove any item from the conversation history. + * The server will respond with a `conversation.item.deleted` event, unless the + * item does not exist in the conversation history, in which case the server will + * respond with an error. + */ +export interface ConversationItemDeleteEvent { + /** + * The ID of the item to delete. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.delete`. + */ + type: 'conversation.item.delete'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an item in the conversation is deleted by the client with a + * `conversation.item.delete` event. This event is used to synchronize the server's + * understanding of the conversation history with the client's view. + */ +export interface ConversationItemDeletedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item that was deleted. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.deleted`. + */ + type: 'conversation.item.deleted'; +} + +/** + * This event is the output of audio transcription for user audio written to the + * user audio buffer. Transcription begins when the input audio buffer is committed + * by the client or server (in `server_vad` mode). Transcription runs + * asynchronously with Response creation, so this event may come before or after + * the Response events. + * + * Realtime API models accept audio natively, and thus input transcription is a + * separate process run on a separate ASR (Automatic Speech Recognition) model, + * currently always `whisper-1`. Thus the transcript may diverge somewhat from the + * model's interpretation, and should be treated as a rough guide. + */ +export interface ConversationItemInputAudioTranscriptionCompletedEvent { + /** + * The index of the content part containing the audio. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item containing the audio. + */ + item_id: string; + + /** + * The transcribed text. + */ + transcript: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.completed`. + */ + type: 'conversation.item.input_audio_transcription.completed'; +} + +/** + * Returned when input audio transcription is configured, and a transcription + * request for a user message failed. These events are separate from other `error` + * events so that the client can identify the related Item. + */ +export interface ConversationItemInputAudioTranscriptionFailedEvent { + /** + * The index of the content part containing the audio. + */ + content_index: number; + + /** + * Details of the transcription error. + */ + error: ConversationItemInputAudioTranscriptionFailedEvent.Error; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.failed`. + */ + type: 'conversation.item.input_audio_transcription.failed'; +} + +export namespace ConversationItemInputAudioTranscriptionFailedEvent { + /** + * Details of the transcription error. + */ + export interface Error { + /** + * Error code, if any. + */ + code?: string; + + /** + * A human-readable error message. + */ + message?: string; + + /** + * Parameter related to the error, if any. + */ + param?: string; + + /** + * The type of error. + */ + type?: string; + } +} + +/** + * Send this event to truncate a previous assistant message’s audio. The server + * will produce audio faster than realtime, so this event is useful when the user + * interrupts to truncate audio that has already been sent to the client but not + * yet played. This will synchronize the server's understanding of the audio with + * the client's playback. + * + * Truncating audio will delete the server-side text transcript to ensure there is + * not text in the context that hasn't been heard by the user. + * + * If successful, the server will respond with a `conversation.item.truncated` + * event. + */ +export interface ConversationItemTruncateEvent { + /** + * Inclusive duration up to which audio is truncated, in milliseconds. If the + * audio_end_ms is greater than the actual audio duration, the server will respond + * with an error. + */ + audio_end_ms: number; + + /** + * The index of the content part to truncate. Set this to 0. + */ + content_index: number; + + /** + * The ID of the assistant message item to truncate. Only assistant message items + * can be truncated. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.truncate`. + */ + type: 'conversation.item.truncate'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an earlier assistant audio message item is truncated by the client + * with a `conversation.item.truncate` event. This event is used to synchronize the + * server's understanding of the audio with the client's playback. + * + * This action will truncate the audio and remove the server-side text transcript + * to ensure there is no text in the context that hasn't been heard by the user. + */ +export interface ConversationItemTruncatedEvent { + /** + * The duration up to which the audio was truncated, in milliseconds. + */ + audio_end_ms: number; + + /** + * The index of the content part that was truncated. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the assistant message item that was truncated. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.truncated`. + */ + type: 'conversation.item.truncated'; +} + +/** + * Returned when an error occurs, which could be a client problem or a server + * problem. Most errors are recoverable and the session will stay open, we + * recommend to implementors to monitor and log error messages by default. + */ +export interface ErrorEvent { + /** + * Details of the error. + */ + error: ErrorEvent.Error; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `error`. + */ + type: 'error'; +} + +export namespace ErrorEvent { + /** + * Details of the error. + */ + export interface Error { + /** + * A human-readable error message. + */ + message: string; + + /** + * The type of error (e.g., "invalid_request_error", "server_error"). + */ + type: string; + + /** + * Error code, if any. + */ + code?: string | null; + + /** + * The event_id of the client event that caused the error, if applicable. + */ + event_id?: string | null; + + /** + * Parameter related to the error, if any. + */ + param?: string | null; + } +} + +/** + * Send this event to append audio bytes to the input audio buffer. The audio + * buffer is temporary storage you can write to and later commit. In Server VAD + * mode, the audio buffer is used to detect speech and the server will decide when + * to commit. When Server VAD is disabled, you must commit the audio buffer + * manually. + * + * The client may choose how much audio to place in each event up to a maximum of + * 15 MiB, for example streaming smaller chunks from the client may allow the VAD + * to be more responsive. Unlike made other client events, the server will not send + * a confirmation response to this event. + */ +export interface InputAudioBufferAppendEvent { + /** + * Base64-encoded audio bytes. This must be in the format specified by the + * `input_audio_format` field in the session configuration. + */ + audio: string; + + /** + * The event type, must be `input_audio_buffer.append`. + */ + type: 'input_audio_buffer.append'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Send this event to clear the audio bytes in the buffer. The server will respond + * with an `input_audio_buffer.cleared` event. + */ +export interface InputAudioBufferClearEvent { + /** + * The event type, must be `input_audio_buffer.clear`. + */ + type: 'input_audio_buffer.clear'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when the input audio buffer is cleared by the client with a + * `input_audio_buffer.clear` event. + */ +export interface InputAudioBufferClearedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `input_audio_buffer.cleared`. + */ + type: 'input_audio_buffer.cleared'; +} + +/** + * Send this event to commit the user input audio buffer, which will create a new + * user message item in the conversation. This event will produce an error if the + * input audio buffer is empty. When in Server VAD mode, the client does not need + * to send this event, the server will commit the audio buffer automatically. + * + * Committing the input audio buffer will trigger input audio transcription (if + * enabled in session configuration), but it will not create a response from the + * model. The server will respond with an `input_audio_buffer.committed` event. + */ +export interface InputAudioBufferCommitEvent { + /** + * The event type, must be `input_audio_buffer.commit`. + */ + type: 'input_audio_buffer.commit'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an input audio buffer is committed, either by the client or + * automatically in server VAD mode. The `item_id` property is the ID of the user + * message item that will be created, thus a `conversation.item.created` event will + * also be sent to the client. + */ +export interface InputAudioBufferCommittedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created. + */ + item_id: string; + + /** + * The ID of the preceding item after which the new item will be inserted. + */ + previous_item_id: string; + + /** + * The event type, must be `input_audio_buffer.committed`. + */ + type: 'input_audio_buffer.committed'; +} + +/** + * Sent by the server when in `server_vad` mode to indicate that speech has been + * detected in the audio buffer. This can happen any time audio is added to the + * buffer (unless speech is already detected). The client may want to use this + * event to interrupt audio playback or provide visual feedback to the user. + * + * The client should expect to receive a `input_audio_buffer.speech_stopped` event + * when speech stops. The `item_id` property is the ID of the user message item + * that will be created when speech stops and will also be included in the + * `input_audio_buffer.speech_stopped` event (unless the client manually commits + * the audio buffer during VAD activation). + */ +export interface InputAudioBufferSpeechStartedEvent { + /** + * Milliseconds from the start of all audio written to the buffer during the + * session when speech was first detected. This will correspond to the beginning of + * audio sent to the model, and thus includes the `prefix_padding_ms` configured in + * the Session. + */ + audio_start_ms: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created when speech stops. + */ + item_id: string; + + /** + * The event type, must be `input_audio_buffer.speech_started`. + */ + type: 'input_audio_buffer.speech_started'; +} + +/** + * Returned in `server_vad` mode when the server detects the end of speech in the + * audio buffer. The server will also send an `conversation.item.created` event + * with the user message item that is created from the audio buffer. + */ +export interface InputAudioBufferSpeechStoppedEvent { + /** + * Milliseconds since the session started when speech stopped. This will correspond + * to the end of audio sent to the model, and thus includes the + * `min_silence_duration_ms` configured in the Session. + */ + audio_end_ms: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created. + */ + item_id: string; + + /** + * The event type, must be `input_audio_buffer.speech_stopped`. + */ + type: 'input_audio_buffer.speech_stopped'; +} + +/** + * Emitted at the beginning of a Response to indicate the updated rate limits. When + * a Response is created some tokens will be "reserved" for the output tokens, the + * rate limits shown here reflect that reservation, which is then adjusted + * accordingly once the Response is completed. + */ +export interface RateLimitsUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * List of rate limit information. + */ + rate_limits: Array; + + /** + * The event type, must be `rate_limits.updated`. + */ + type: 'rate_limits.updated'; +} + +export namespace RateLimitsUpdatedEvent { + export interface RateLimit { + /** + * The maximum allowed value for the rate limit. + */ + limit?: number; + + /** + * The name of the rate limit (`requests`, `tokens`). + */ + name?: 'requests' | 'tokens'; + + /** + * The remaining value before the limit is reached. + */ + remaining?: number; + + /** + * Seconds until the rate limit resets. + */ + reset_seconds?: number; + } +} + +/** + * All events that the client can send to the Realtime API + */ +export type RealtimeClientEvent = + | SessionUpdateEvent + | InputAudioBufferAppendEvent + | InputAudioBufferCommitEvent + | InputAudioBufferClearEvent + | ConversationItemCreateEvent + | ConversationItemTruncateEvent + | ConversationItemDeleteEvent + | ResponseCreateEvent + | ResponseCancelEvent; + +/** + * The response resource. + */ +export interface RealtimeResponse { + /** + * The unique ID of the response. + */ + id?: string; + + /** + * Developer-provided string key-value pairs associated with this response. + */ + metadata?: unknown | null; + + /** + * The object type, must be `realtime.response`. + */ + object?: 'realtime.response'; + + /** + * The list of output items generated by the response. + */ + output?: Array; + + /** + * The final status of the response (`completed`, `cancelled`, `failed`, or + * `incomplete`). + */ + status?: 'completed' | 'cancelled' | 'failed' | 'incomplete'; + + /** + * Additional details about the status. + */ + status_details?: RealtimeResponseStatus; + + /** + * 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 + * Conversation, thus output from previous turns (text and audio tokens) will + * become the input for later turns. + */ + usage?: RealtimeResponseUsage; +} + +/** + * Additional details about the status. + */ +export interface RealtimeResponseStatus { + /** + * A description of the error that caused the response to fail, populated when the + * `status` is `failed`. + */ + error?: RealtimeResponseStatus.Error; + + /** + * The reason the Response did not complete. For a `cancelled` Response, one of + * `turn_detected` (the server VAD detected a new start of speech) or + * `client_cancelled` (the client sent a cancel event). For an `incomplete` + * Response, one of `max_output_tokens` or `content_filter` (the server-side safety + * filter activated and cut off the response). + */ + reason?: 'turn_detected' | 'client_cancelled' | 'max_output_tokens' | 'content_filter'; + + /** + * The type of error that caused the response to fail, corresponding with the + * `status` field (`completed`, `cancelled`, `incomplete`, `failed`). + */ + type?: 'completed' | 'cancelled' | 'incomplete' | 'failed'; +} + +export namespace RealtimeResponseStatus { + /** + * A description of the error that caused the response to fail, populated when the + * `status` is `failed`. + */ + export interface Error { + /** + * Error code, if any. + */ + code?: string; + + /** + * The type of error. + */ + type?: string; + } +} + +/** + * 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 + * Conversation, thus output from previous turns (text and audio tokens) will + * become the input for later turns. + */ +export interface RealtimeResponseUsage { + /** + * Details about the input tokens used in the Response. + */ + input_token_details?: RealtimeResponseUsage.InputTokenDetails; + + /** + * The number of input tokens used in the Response, including text and audio + * tokens. + */ + input_tokens?: number; + + /** + * Details about the output tokens used in the Response. + */ + output_token_details?: RealtimeResponseUsage.OutputTokenDetails; + + /** + * The number of output tokens sent in the Response, including text and audio + * tokens. + */ + output_tokens?: number; + + /** + * The total number of tokens in the Response including input and output text and + * audio tokens. + */ + total_tokens?: number; +} + +export namespace RealtimeResponseUsage { + /** + * Details about the input tokens used in the Response. + */ + export interface InputTokenDetails { + /** + * The number of audio tokens used in the Response. + */ + audio_tokens?: number; + + /** + * The number of cached tokens used in the Response. + */ + cached_tokens?: number; + + /** + * The number of text tokens used in the Response. + */ + text_tokens?: number; + } + + /** + * Details about the output tokens used in the Response. + */ + export interface OutputTokenDetails { + /** + * The number of audio tokens used in the Response. + */ + audio_tokens?: number; + + /** + * The number of text tokens used in the Response. + */ + text_tokens?: number; + } +} + +/** + * All events that the Realtime API can send back + */ +export type RealtimeServerEvent = + | ErrorEvent + | SessionCreatedEvent + | SessionUpdatedEvent + | ConversationCreatedEvent + | InputAudioBufferCommittedEvent + | InputAudioBufferClearedEvent + | InputAudioBufferSpeechStartedEvent + | InputAudioBufferSpeechStoppedEvent + | ConversationItemCreatedEvent + | ConversationItemInputAudioTranscriptionCompletedEvent + | ConversationItemInputAudioTranscriptionFailedEvent + | ConversationItemTruncatedEvent + | ConversationItemDeletedEvent + | ResponseCreatedEvent + | ResponseDoneEvent + | ResponseOutputItemAddedEvent + | ResponseOutputItemDoneEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent + | ResponseTextDeltaEvent + | ResponseTextDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent + | RateLimitsUpdatedEvent; + +/** + * Returned when the model-generated audio is updated. + */ +export interface ResponseAudioDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * Base64-encoded audio data delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio.delta`. + */ + type: 'response.audio.delta'; +} + +/** + * Returned when the model-generated audio is done. Also emitted when a Response is + * interrupted, incomplete, or cancelled. + */ +export interface ResponseAudioDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio.done`. + */ + type: 'response.audio.done'; +} + +/** + * Returned when the model-generated transcription of audio output is updated. + */ +export interface ResponseAudioTranscriptDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The transcript delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio_transcript.delta`. + */ + type: 'response.audio_transcript.delta'; +} + +/** + * Returned when the model-generated transcription of audio output is done + * streaming. Also emitted when a Response is interrupted, incomplete, or + * cancelled. + */ +export interface ResponseAudioTranscriptDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The final transcript of the audio. + */ + transcript: string; + + /** + * The event type, must be `response.audio_transcript.done`. + */ + type: 'response.audio_transcript.done'; +} + +/** + * Send this event to cancel an in-progress response. The server will respond with + * a `response.cancelled` event or an error if there is no response to cancel. + */ +export interface ResponseCancelEvent { + /** + * The event type, must be `response.cancel`. + */ + type: 'response.cancel'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * A specific response ID to cancel - if not provided, will cancel an in-progress + * response in the default conversation. + */ + response_id?: string; +} + +/** + * Returned when a new content part is added to an assistant message item during + * response generation. + */ +export interface ResponseContentPartAddedEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item to which the content part was added. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The content part that was added. + */ + part: ResponseContentPartAddedEvent.Part; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.content_part.added`. + */ + type: 'response.content_part.added'; +} + +export namespace ResponseContentPartAddedEvent { + /** + * The content part that was added. + */ + export interface Part { + /** + * Base64-encoded audio data (if type is "audio"). + */ + audio?: string; + + /** + * The text content (if type is "text"). + */ + text?: string; + + /** + * The transcript of the audio (if type is "audio"). + */ + transcript?: string; + + /** + * The content type ("text", "audio"). + */ + type?: 'text' | 'audio'; + } +} + +/** + * Returned when a content part is done streaming in an assistant message item. + * Also emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseContentPartDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The content part that is done. + */ + part: ResponseContentPartDoneEvent.Part; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.content_part.done`. + */ + type: 'response.content_part.done'; +} + +export namespace ResponseContentPartDoneEvent { + /** + * The content part that is done. + */ + export interface Part { + /** + * Base64-encoded audio data (if type is "audio"). + */ + audio?: string; + + /** + * The text content (if type is "text"). + */ + text?: string; + + /** + * The transcript of the audio (if type is "audio"). + */ + transcript?: string; + + /** + * The content type ("text", "audio"). + */ + type?: 'text' | 'audio'; + } +} + +/** + * This event instructs the server to create a Response, which means triggering + * model inference. When in Server VAD mode, the server will create Responses + * automatically. + * + * A Response will include at least one Item, and may have two, in which case the + * second will be a function call. These Items will be appended to the conversation + * history. + * + * The server will respond with a `response.created` event, events for Items and + * content created, and finally a `response.done` event to indicate the Response is + * complete. + * + * The `response.create` event includes inference configuration like + * `instructions`, and `temperature`. These fields will override the Session's + * configuration for this Response only. + */ +export interface ResponseCreateEvent { + /** + * The event type, must be `response.create`. + */ + type: 'response.create'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * Create a new Realtime response with these parameters + */ + response?: ResponseCreateEvent.Response; +} + +export namespace ResponseCreateEvent { + /** + * Create a new Realtime response with these parameters + */ + export interface Response { + /** + * Controls which conversation the response is added to. Currently supports `auto` + * and `none`, with `auto` as the default value. The `auto` value means that the + * contents of the response will be added to the default conversation. Set this to + * `none` to create an out-of-band response which will not add items to default + * conversation. + */ + conversation?: (string & {}) | 'auto' | 'none'; + + /** + * Input items to include in the prompt for the model. Creates a new context for + * this response, without including the default conversation. Can include + * references to items from the default conversation. + */ + input?: Array; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_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. Keys + * can be a maximum of 64 characters long and values can be a maximum of 512 + * characters long. + */ + metadata?: unknown | null; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function, like `{"type": "function", "function": {"name": "my_function"}}`. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + } + + export namespace Response { + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + } +} + +/** + * Returned when a new Response is created. The first event of response creation, + * where the response is in an initial state of `in_progress`. + */ +export interface ResponseCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The response resource. + */ + response: RealtimeResponse; + + /** + * The event type, must be `response.created`. + */ + type: 'response.created'; +} + +/** + * Returned when a Response is done streaming. Always emitted, no matter the final + * state. The Response object included in the `response.done` event will include + * all output Items in the Response but will omit the raw audio data. + */ +export interface ResponseDoneEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The response resource. + */ + response: RealtimeResponse; + + /** + * The event type, must be `response.done`. + */ + type: 'response.done'; +} + +/** + * Returned when the model-generated function call arguments are updated. + */ +export interface ResponseFunctionCallArgumentsDeltaEvent { + /** + * The ID of the function call. + */ + call_id: string; + + /** + * The arguments delta as a JSON string. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the function call item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.function_call_arguments.delta`. + */ + type: 'response.function_call_arguments.delta'; +} + +/** + * Returned when the model-generated function call arguments are done streaming. + * Also emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseFunctionCallArgumentsDoneEvent { + /** + * The final arguments as a JSON string. + */ + arguments: string; + + /** + * The ID of the function call. + */ + call_id: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the function call item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.function_call_arguments.done`. + */ + type: 'response.function_call_arguments.done'; +} + +/** + * Returned when a new Item is created during Response generation. + */ +export interface ResponseOutputItemAddedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The index of the output item in the Response. + */ + output_index: number; + + /** + * The ID of the Response to which the item belongs. + */ + response_id: string; + + /** + * The event type, must be `response.output_item.added`. + */ + type: 'response.output_item.added'; +} + +/** + * Returned when an Item is done streaming. Also emitted when a Response is + * interrupted, incomplete, or cancelled. + */ +export interface ResponseOutputItemDoneEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The index of the output item in the Response. + */ + output_index: number; + + /** + * The ID of the Response to which the item belongs. + */ + response_id: string; + + /** + * The event type, must be `response.output_item.done`. + */ + type: 'response.output_item.done'; +} + +/** + * Returned when the text value of a "text" content part is updated. + */ +export interface ResponseTextDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The text delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.text.delta`. + */ + type: 'response.text.delta'; +} + +/** + * Returned when the text value of a "text" content part is done streaming. Also + * emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseTextDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The final text content. + */ + text: string; + + /** + * The event type, must be `response.text.done`. + */ + type: 'response.text.done'; +} + +/** + * Returned when a Session is created. Emitted automatically when a new connection + * is established as the first server event. This event will contain the default + * Session configuration. + */ +export interface SessionCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * Realtime session object configuration. + */ + session: SessionsAPI.Session; + + /** + * The event type, must be `session.created`. + */ + type: 'session.created'; +} + +/** + * Send this event to update the session’s default configuration. The client may + * send this event at any time to update the session configuration, and any field + * may be updated at any time, except for "voice". The server will respond with a + * `session.updated` event that shows the full effective configuration. Only fields + * that are present are updated, thus the correct way to clear a field like + * "instructions" is to pass an empty string. + */ +export interface SessionUpdateEvent { + /** + * Realtime session object configuration. + */ + session: SessionUpdateEvent.Session; + + /** + * The event type, must be `session.update`. + */ + type: 'session.update'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +export namespace SessionUpdateEvent { + /** + * Realtime session object configuration. + */ + export interface Session { + /** + * The Realtime model used for this session. + */ + model: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: Session.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + } + + export namespace Session { + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when VAD is enabled. `true` + * by default. + */ + create_response?: boolean; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } + } +} + +/** + * Returned when a session is updated with a `session.update` event, unless there + * is an error. + */ +export interface SessionUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * Realtime session object configuration. + */ + session: SessionsAPI.Session; + + /** + * The event type, must be `session.updated`. + */ + type: 'session.updated'; +} + +Realtime.Sessions = Sessions; + +export declare namespace Realtime { + export { + Sessions as Sessions, + type SessionsAPISession as Session, + type SessionCreateResponse as SessionCreateResponse, + type SessionCreateParams as SessionCreateParams, + }; +} diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts new file mode 100644 index 000000000..c1082d236 --- /dev/null +++ b/src/resources/beta/realtime/sessions.ts @@ -0,0 +1,546 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Sessions extends APIResource { + /** + * Create an ephemeral API token for use in client-side applications with the + * Realtime API. Can be configured with the same session parameters as the + * `session.update` client event. + * + * It responds with a session object, plus a `client_secret` key which contains a + * usable ephemeral API token that can be used to authenticate browser clients for + * the Realtime API. + */ + create(body: SessionCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/realtime/sessions', { + body, + ...options, + headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + }); + } +} + +/** + * Realtime session object configuration. + */ +export interface Session { + /** + * Unique identifier for the session object. + */ + id?: string; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The Realtime model used for this session. + */ + model?: + | (string & {}) + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: Session.TurnDetection | null; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +export namespace Session { + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: 'server_vad'; + } +} + +/** + * A new Realtime session configuration, with an ephermeral key. Default TTL for + * keys is one minute. + */ +export interface SessionCreateResponse { + /** + * Ephemeral key returned by the API. + */ + client_secret?: SessionCreateResponse.ClientSecret; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: string; + + /** + * 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. + */ + input_audio_transcription?: SessionCreateResponse.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: string; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: SessionCreateResponse.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +export namespace SessionCreateResponse { + /** + * Ephemeral key returned by the API. + */ + export interface ClientSecret { + /** + * Timestamp for when the token expires. Currently, all tokens expire after one + * minute. + */ + 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; + } + + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export interface SessionCreateParams { + /** + * The Realtime model used for this session. + */ + model: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: SessionCreateParams.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: SessionCreateParams.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when VAD is enabled. `true` + * by default. + */ + create_response?: boolean; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export declare namespace Sessions { + export { + type Session as Session, + type SessionCreateResponse as SessionCreateResponse, + type SessionCreateParams as SessionCreateParams, + }; +} diff --git a/tests/api-resources/beta/realtime/sessions.test.ts b/tests/api-resources/beta/realtime/sessions.test.ts new file mode 100644 index 000000000..0ed998c27 --- /dev/null +++ b/tests/api-resources/beta/realtime/sessions.test.ts @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource sessions', () => { + test('create: only required params', async () => { + const responsePromise = client.beta.realtime.sessions.create({ model: 'gpt-4o-realtime-preview' }); + 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('create: required and optional params', async () => { + const response = await client.beta.realtime.sessions.create({ + model: 'gpt-4o-realtime-preview', + input_audio_format: 'pcm16', + input_audio_transcription: { model: 'model' }, + instructions: 'instructions', + max_response_output_tokens: 0, + modalities: ['text'], + output_audio_format: 'pcm16', + temperature: 0, + tool_choice: 'tool_choice', + tools: [{ description: 'description', name: 'name', parameters: {}, type: 'function' }], + turn_detection: { + create_response: true, + prefix_padding_ms: 0, + silence_duration_ms: 0, + threshold: 0, + type: 'type', + }, + voice: 'alloy', + }); + }); +}); From 66c9715482827f7f28f5b6b8592185ae338b5379 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jan 2025 05:07:17 +0000 Subject: [PATCH 090/509] release: 4.78.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e66c326a9..9785f7c4a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.77.4" + ".": "4.78.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a811f188..fbc82e722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.78.0 (2025-01-09) + +Full Changelog: [v4.77.4...v4.78.0](https://github.com/openai/openai-node/compare/v4.77.4...v4.78.0) + +### Features + +* **client:** add realtime types ([#1254](https://github.com/openai/openai-node/issues/1254)) ([7130995](https://github.com/openai/openai-node/commit/71309957a9a0883cac84b8b57697b796a9df3503)) + ## 4.77.4 (2025-01-08) Full Changelog: [v4.77.3...v4.77.4](https://github.com/openai/openai-node/compare/v4.77.3...v4.77.4) diff --git a/jsr.json b/jsr.json index da442da31..e26f2d5d8 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.77.4", + "version": "4.78.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 453859b6b..ab06be9cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.77.4", + "version": "4.78.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 7f6adc9bc..7ab855b86 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.77.4'; // x-release-please-version +export const VERSION = '4.78.0'; // x-release-please-version From 6070d964f6d62789f7deb670daa49f3c4f0a6f40 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:56:22 +0000 Subject: [PATCH 091/509] fix: send correct Accept header for certain endpoints (#1257) --- src/resources/audio/speech.ts | 7 ++++++- src/resources/files.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 1cda80f79..bd2ed9f65 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -9,7 +9,12 @@ export class Speech extends APIResource { * Generates audio from the input text. */ create(body: SpeechCreateParams, options?: Core.RequestOptions): Core.APIPromise { - return this._client.post('/audio/speech', { body, ...options, __binaryResponse: true }); + return this._client.post('/audio/speech', { + body, + ...options, + headers: { Accept: 'application/octet-stream', ...options?.headers }, + __binaryResponse: true, + }); } } diff --git a/src/resources/files.ts b/src/resources/files.ts index 42a7bdfba..43708310b 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -69,7 +69,11 @@ export class Files extends APIResource { * Returns the contents of the specified file. */ content(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/files/${fileId}/content`, { ...options, __binaryResponse: true }); + return this._client.get(`/files/${fileId}/content`, { + ...options, + headers: { Accept: 'application/binary', ...options?.headers }, + __binaryResponse: true, + }); } /** @@ -78,10 +82,7 @@ export class Files extends APIResource { * @deprecated The `.content()` method should be used instead */ retrieveContent(fileId: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/files/${fileId}/content`, { - ...options, - headers: { Accept: 'application/json', ...options?.headers }, - }); + return this._client.get(`/files/${fileId}/content`, options); } /** From 14784f95797d4d525dafecfd4ec9c7a133540da0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 15:56:57 +0000 Subject: [PATCH 092/509] release: 4.78.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9785f7c4a..3218ab333 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.78.0" + ".": "4.78.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index fbc82e722..320d00140 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.78.1 (2025-01-10) + +Full Changelog: [v4.78.0...v4.78.1](https://github.com/openai/openai-node/compare/v4.78.0...v4.78.1) + +### Bug Fixes + +* send correct Accept header for certain endpoints ([#1257](https://github.com/openai/openai-node/issues/1257)) ([8756693](https://github.com/openai/openai-node/commit/8756693c5690b16045cdd8d33636fe7643d45f3a)) + ## 4.78.0 (2025-01-09) Full Changelog: [v4.77.4...v4.78.0](https://github.com/openai/openai-node/compare/v4.77.4...v4.78.0) diff --git a/jsr.json b/jsr.json index e26f2d5d8..257faa02d 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.78.0", + "version": "4.78.1", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index ab06be9cf..ff6ec16bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.78.0", + "version": "4.78.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 7ab855b86..a8ac58ba2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.78.0'; // x-release-please-version +export const VERSION = '4.78.1'; // x-release-please-version From b08a846a9aae3686574527fa2a8d91bb0e6c7aaf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Jan 2025 16:19:51 +0000 Subject: [PATCH 093/509] chore(internal): streaming refactors (#1261) --- src/streaming.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/streaming.ts b/src/streaming.ts index 2891e6ac3..da633f7fd 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -38,9 +38,7 @@ export class Stream implements AsyncIterable { if (sse.data.startsWith('[DONE]')) { done = true; continue; - } - - if (sse.event === null) { + } else { let data; try { From 55f084dfcae4229075ad7ebc33fff2ef4cd095e5 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 13 Jan 2025 16:28:31 +0000 Subject: [PATCH 094/509] chore: fix streaming --- src/streaming.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/streaming.ts b/src/streaming.ts index da633f7fd..9cfd18176 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -52,22 +52,12 @@ export class Stream implements AsyncIterable { if (data && data.error) { throw new APIError(undefined, data.error, undefined, undefined); } - - yield data; - } else { - let data; - try { - data = JSON.parse(sse.data); - } catch (e) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e; - } // TODO: Is this where the error should be thrown? if (sse.event == 'error') { throw new APIError(undefined, data.error, data.message, undefined); } - yield { event: sse.event, data: data } as any; + + yield data; } } done = true; From 620ecd506fbf379018cf8f7a7fe92253ac49c9af Mon Sep 17 00:00:00 2001 From: Minh-Anh Phan <111523473+minhanh-phan@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:42:15 -0800 Subject: [PATCH 095/509] fix(logs/azure): redact sensitive header when DEBUG is set (#1218) --- src/core.ts | 36 ++++++++++++++++- tests/index.test.ts | 94 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 128 insertions(+), 2 deletions(-) diff --git a/src/core.ts b/src/core.ts index 972cceaec..3d2d029a5 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1148,9 +1148,43 @@ function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void { } } +const SENSITIVE_HEADERS = new Set(['authorization', 'api-key']); + export function debug(action: string, ...args: any[]) { if (typeof process !== 'undefined' && process?.env?.['DEBUG'] === 'true') { - console.log(`OpenAI:DEBUG:${action}`, ...args); + const modifiedArgs = args.map((arg) => { + if (!arg) { + return arg; + } + + // Check for sensitive headers in request body 'headers' object + if (arg['headers']) { + // clone so we don't mutate + const modifiedArg = { ...arg, headers: { ...arg['headers'] } }; + + for (const header in arg['headers']) { + if (SENSITIVE_HEADERS.has(header.toLowerCase())) { + modifiedArg['headers'][header] = 'REDACTED'; + } + } + + return modifiedArg; + } + + let modifiedArg = null; + + // Check for sensitive headers in headers object + for (const header in arg) { + if (SENSITIVE_HEADERS.has(header.toLowerCase())) { + // avoid making a copy until we need to + modifiedArg ??= { ...arg }; + modifiedArg[header] = 'REDACTED'; + } + } + + return modifiedArg ?? arg; + }); + console.log(`OpenAI:DEBUG:${action}`, ...modifiedArgs); } } diff --git a/tests/index.test.ts b/tests/index.test.ts index a6f0040a4..016d525f5 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -2,7 +2,7 @@ import OpenAI from 'openai'; import { APIUserAbortError } from 'openai'; -import { Headers } from 'openai/core'; +import { debug, Headers } from 'openai/core'; import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch'; describe('instantiate client', () => { @@ -424,3 +424,95 @@ describe('retries', () => { expect(count).toEqual(3); }); }); + +describe('debug()', () => { + const env = process.env; + const spy = jest.spyOn(console, 'log'); + + beforeEach(() => { + jest.resetModules(); + process.env = { ...env }; + process.env['DEBUG'] = 'true'; + }); + + afterEach(() => { + process.env = env; + }); + + test('body request object with Authorization header', function () { + // Test request body includes headers object with Authorization + const headersTest = { + headers: { + Authorization: 'fakeAuthorization', + }, + }; + debug('request', headersTest); + expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { + headers: { + Authorization: 'REDACTED', + }, + }); + }); + + test('body request object with api-key header', function () { + // Test request body includes headers object with api-ley + const apiKeyTest = { + headers: { + 'api-key': 'fakeKey', + }, + }; + debug('request', apiKeyTest); + expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { + headers: { + 'api-key': 'REDACTED', + }, + }); + }); + + test('header object with Authorization header', function () { + // Test headers object with authorization header + const authorizationTest = { + authorization: 'fakeValue', + }; + debug('request', authorizationTest); + expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { + authorization: 'REDACTED', + }); + }); + + test('input args are not mutated', function () { + const authorizationTest = { + authorization: 'fakeValue', + }; + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + defaultHeaders: authorizationTest, + apiKey: 'api-key', + }); + + const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + debug('request', authorizationTest); + expect((req.headers as Headers)['authorization']).toEqual('fakeValue'); + expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { + authorization: 'REDACTED', + }); + }); + + test('input headers are not mutated', function () { + const authorizationTest = { + authorization: 'fakeValue', + }; + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + defaultHeaders: authorizationTest, + apiKey: 'api-key', + }); + + const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + debug('request', { headers: req.headers }); + expect((req.headers as Headers)['authorization']).toEqual('fakeValue'); + expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { + authorization: 'REDACTED', + }); + }); +}); From 2bc96529a32fbddc8a86c53dbd8bbb93f703e056 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 13 Jan 2025 20:23:42 +0000 Subject: [PATCH 096/509] Revert "chore(internal): streaming refactors (#1261)" This reverts commit dd4af939792583854a313367c5fe2f98eea2f3c8. --- src/streaming.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/streaming.ts b/src/streaming.ts index 9cfd18176..2891e6ac3 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -38,7 +38,9 @@ export class Stream implements AsyncIterable { if (sse.data.startsWith('[DONE]')) { done = true; continue; - } else { + } + + if (sse.event === null) { let data; try { @@ -52,12 +54,22 @@ export class Stream implements AsyncIterable { if (data && data.error) { throw new APIError(undefined, data.error, undefined, undefined); } + + yield data; + } else { + let data; + try { + data = JSON.parse(sse.data); + } catch (e) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e; + } // TODO: Is this where the error should be thrown? if (sse.event == 'error') { throw new APIError(undefined, data.error, data.message, undefined); } - - yield data; + yield { event: sse.event, data: data } as any; } } done = true; From 5df77388f6a8cfc3ac465f77825f01ceb41fa505 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:59:41 +0000 Subject: [PATCH 097/509] chore(types): rename vector store chunking strategy (#1263) --- api.md | 2 +- src/resources/beta/beta.ts | 4 ++-- src/resources/beta/index.ts | 2 +- src/resources/beta/vector-stores/index.ts | 2 +- src/resources/beta/vector-stores/vector-stores.ts | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api.md b/api.md index a885628a3..33ab95ef6 100644 --- a/api.md +++ b/api.md @@ -283,7 +283,7 @@ Types: - OtherFileChunkingStrategyObject - StaticFileChunkingStrategy - StaticFileChunkingStrategyObject -- StaticFileChunkingStrategyParam +- StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index ccd043243..df929b2f7 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -48,7 +48,7 @@ import { OtherFileChunkingStrategyObject, StaticFileChunkingStrategy, StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyParam, + StaticFileChunkingStrategyObjectParam, VectorStore, VectorStoreCreateParams, VectorStoreDeleted, @@ -85,7 +85,7 @@ export declare namespace Beta { type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index aa2e52d4c..babca0016 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -46,7 +46,7 @@ export { type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/beta/vector-stores/index.ts index 89fc0cde0..d587bd160 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/beta/vector-stores/index.ts @@ -23,7 +23,7 @@ export { type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index 35ad8c369..cbff2d562 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -116,7 +116,7 @@ export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileC * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. */ -export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyParam; +export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam; /** * This is returned when the chunking strategy is unknown. Typically, this is @@ -154,7 +154,7 @@ export interface StaticFileChunkingStrategyObject { type: 'static'; } -export interface StaticFileChunkingStrategyParam { +export interface StaticFileChunkingStrategyObjectParam { static: StaticFileChunkingStrategy; /** @@ -397,7 +397,7 @@ export declare namespace VectorStores { type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, VectorStoresPage as VectorStoresPage, From 66067d37a4189f838f31ed9ca06ee335aef67616 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 15 Jan 2025 13:58:18 +0000 Subject: [PATCH 098/509] chore(types): add `| undefined` to client options properties (#1264) --- src/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2320850fb..cf6aa89e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -137,7 +137,7 @@ export interface ClientOptions { * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. */ - timeout?: number; + timeout?: number | undefined; /** * An HTTP agent used to manage HTTP(S) connections. @@ -145,7 +145,7 @@ export interface ClientOptions { * If not provided, an agent will be constructed by default in the Node.js environment, * otherwise no agent is used. */ - httpAgent?: Agent; + httpAgent?: Agent | undefined; /** * Specify a custom `fetch` function implementation. @@ -161,7 +161,7 @@ export interface ClientOptions { * * @default 2 */ - maxRetries?: number; + maxRetries?: number | undefined; /** * Default headers to include with every request to the API. @@ -169,7 +169,7 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * header to `undefined` or `null` in request options. */ - defaultHeaders?: Core.Headers; + defaultHeaders?: Core.Headers | undefined; /** * Default query parameters to include with every request to the API. @@ -177,13 +177,13 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ - defaultQuery?: Core.DefaultQuery; + defaultQuery?: Core.DefaultQuery | undefined; /** * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. */ - dangerouslyAllowBrowser?: boolean; + dangerouslyAllowBrowser?: boolean | undefined; } /** From a796d21f06307419f352da8b9943f6745ff4084f Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 16 Jan 2025 16:33:38 +0000 Subject: [PATCH 099/509] feat(client): add Realtime API support (#1266) --- README.md | 87 ++++++++++++++++++++++++++ examples/package.json | 7 ++- examples/realtime/websocket.ts | 48 +++++++++++++++ examples/realtime/ws.ts | 55 +++++++++++++++++ package.json | 6 ++ src/beta/realtime/index.ts | 1 + src/beta/realtime/internal-base.ts | 83 +++++++++++++++++++++++++ src/beta/realtime/websocket.ts | 97 +++++++++++++++++++++++++++++ src/beta/realtime/ws.ts | 69 +++++++++++++++++++++ src/lib/EventEmitter.ts | 98 ++++++++++++++++++++++++++++++ yarn.lock | 12 ++++ 11 files changed, 560 insertions(+), 3 deletions(-) create mode 100644 examples/realtime/websocket.ts create mode 100644 examples/realtime/ws.ts create mode 100644 src/beta/realtime/index.ts create mode 100644 src/beta/realtime/internal-base.ts create mode 100644 src/beta/realtime/websocket.ts create mode 100644 src/beta/realtime/ws.ts create mode 100644 src/lib/EventEmitter.ts diff --git a/README.md b/README.md index 3039857a1..e7d69a669 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,93 @@ main(); If you need to cancel a stream, you can `break` from the loop or call `stream.controller.abort()`. +## Realtime API beta + +The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. + +The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime). + +This SDK supports accessing the Realtime API through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) or with [ws](https://github.com/websockets/ws). + +Basic text based example with `ws`: + +```ts +// requires `yarn add ws @types/ws` +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; + +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + +// access the underlying `ws.WebSocket` instance +rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); +}); + +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); + +rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); +}); + +rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); +rt.on('response.text.done', () => console.log()); + +rt.on('response.done', () => rt.close()); + +rt.socket.on('close', () => console.log('\nConnection closed!')); +``` + +To use the web API `WebSocket` implementation, replace `OpenAIRealtimeWS` with `OpenAIRealtimeWebSocket` and adjust any `rt.socket` access: + +```ts +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +// ... +rt.socket.addEventListener('open', () => { + // ... +}); +``` + +A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/web.ts). + +### Realtime error handling + +When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime/realtime-api-beta#handling-errors), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. + +It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable. + +```ts +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); +``` + ### Request & Response types This library includes TypeScript definitions for all request params and response fields. You may import and use them like so: diff --git a/examples/package.json b/examples/package.json index c8a5f7087..b8c34ac45 100644 --- a/examples/package.json +++ b/examples/package.json @@ -6,14 +6,15 @@ "license": "MIT", "private": true, "dependencies": { + "@azure/identity": "^4.2.0", "express": "^4.18.2", "next": "^14.1.1", "openai": "file:..", - "zod-to-json-schema": "^3.21.4", - "@azure/identity": "^4.2.0" + "zod-to-json-schema": "^3.21.4" }, "devDependencies": { "@types/body-parser": "^1.19.3", - "@types/express": "^4.17.19" + "@types/express": "^4.17.19", + "@types/web": "^0.0.194" } } diff --git a/examples/realtime/websocket.ts b/examples/realtime/websocket.ts new file mode 100644 index 000000000..0da131bc3 --- /dev/null +++ b/examples/realtime/websocket.ts @@ -0,0 +1,48 @@ +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +async function main() { + const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + + // access the underlying `ws.WebSocket` instance + rt.socket.addEventListener('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts new file mode 100644 index 000000000..4bbe85e5d --- /dev/null +++ b/examples/realtime/ws.ts @@ -0,0 +1,55 @@ +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; + +async function main() { + const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + + // access the underlying `ws.WebSocket` instance + rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['foo'] as any, + model: 'gpt-4o-realtime-preview', + }, + }); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.on('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/package.json b/package.json index ff6ec16bc..77e2d609f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@swc/core": "^1.3.102", "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", + "@types/ws": "^8.5.13", "@typescript-eslint/eslint-plugin": "^6.7.0", "@typescript-eslint/parser": "^6.7.0", "eslint": "^8.49.0", @@ -52,6 +53,7 @@ "tsc-multi": "^1.1.0", "tsconfig-paths": "^4.0.0", "typescript": "^4.8.2", + "ws": "^8.18.0", "zod": "^3.23.8" }, "sideEffects": [ @@ -126,9 +128,13 @@ }, "bin": "./bin/cli", "peerDependencies": { + "ws": "^8.18.0", "zod": "^3.23.8" }, "peerDependenciesMeta": { + "ws": { + "optional": true + }, "zod": { "optional": true } diff --git a/src/beta/realtime/index.ts b/src/beta/realtime/index.ts new file mode 100644 index 000000000..75f0f3088 --- /dev/null +++ b/src/beta/realtime/index.ts @@ -0,0 +1 @@ +export { OpenAIRealtimeError } from './internal-base'; diff --git a/src/beta/realtime/internal-base.ts b/src/beta/realtime/internal-base.ts new file mode 100644 index 000000000..391d69911 --- /dev/null +++ b/src/beta/realtime/internal-base.ts @@ -0,0 +1,83 @@ +import { RealtimeClientEvent, RealtimeServerEvent, ErrorEvent } from '../../resources/beta/realtime/realtime'; +import { EventEmitter } from '../../lib/EventEmitter'; +import { OpenAIError } from '../../error'; + +export class OpenAIRealtimeError extends OpenAIError { + /** + * The error data that the API sent back in an `error` event. + */ + error?: ErrorEvent.Error | undefined; + + /** + * The unique ID of the server event. + */ + event_id?: string | undefined; + + constructor(message: string, event: ErrorEvent | null) { + super(message); + + this.error = event?.error; + this.event_id = event?.event_id; + } +} + +type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; + +type RealtimeEvents = Simplify< + { + event: (event: RealtimeServerEvent) => void; + error: (error: OpenAIRealtimeError) => void; + } & { + [EventType in Exclude]: ( + event: Extract, + ) => unknown; + } +>; + +export abstract class OpenAIRealtimeEmitter extends EventEmitter { + /** + * Send an event to the API. + */ + abstract send(event: RealtimeClientEvent): void; + + /** + * Close the websocket connection. + */ + abstract close(props?: { code: number; reason: string }): void; + + protected _onError(event: null, message: string, cause: any): void; + protected _onError(event: ErrorEvent, message?: string | undefined): void; + protected _onError(event: ErrorEvent | null, message?: string | undefined, cause?: any): void { + message = + event?.error ? + `${event.error.message} code=${event.error.code} param=${event.error.param} type=${event.error.type} event_id=${event.error.event_id}` + : message ?? 'unknown error'; + + if (!this._hasListener('error')) { + const error = new OpenAIRealtimeError( + message + + `\n\nTo resolve these unhandled rejection errors you should bind an \`error\` callback, e.g. \`rt.on('error', (error) => ...)\` `, + event, + ); + // @ts-ignore + error.cause = cause; + Promise.reject(error); + return; + } + + const error = new OpenAIRealtimeError(message, event); + // @ts-ignore + error.cause = cause; + + this._emit('error', error); + } +} + +export function buildRealtimeURL(props: { baseURL: string; model: string }): URL { + const path = '/realtime'; + + const url = new URL(props.baseURL + (props.baseURL.endsWith('/') ? path.slice(1) : path)); + url.protocol = 'wss'; + url.searchParams.set('model', props.model); + return url; +} diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts new file mode 100644 index 000000000..e0853779d --- /dev/null +++ b/src/beta/realtime/websocket.ts @@ -0,0 +1,97 @@ +import { OpenAI } from '../../index'; +import { OpenAIError } from '../../error'; +import * as Core from '../../core'; +import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; +import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base'; + +interface MessageEvent { + data: string; +} + +type _WebSocket = + typeof globalThis extends ( + { + WebSocket: infer ws; + } + ) ? + // @ts-ignore + InstanceType + : any; + +export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { + url: URL; + socket: _WebSocket; + + constructor( + props: { + model: string; + dangerouslyAllowBrowser?: boolean; + }, + client?: Pick, + ) { + super(); + + const dangerouslyAllowBrowser = + props.dangerouslyAllowBrowser ?? + (client as any)?._options?.dangerouslyAllowBrowser ?? + (client?.apiKey.startsWith('ek_') ? true : null); + + if (!dangerouslyAllowBrowser && Core.isRunningInBrowser()) { + throw new OpenAIError( + "It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\n\nYou can avoid this error by creating an ephemeral session token:\nhttps://platform.openai.com/docs/api-reference/realtime-sessions\n", + ); + } + + client ??= new OpenAI({ dangerouslyAllowBrowser }); + + this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model }); + // @ts-ignore + this.socket = new WebSocket(this.url, [ + 'realtime', + `openai-insecure-api-key.${client.apiKey}`, + 'openai-beta.realtime-v1', + ]); + + this.socket.addEventListener('message', (websocketEvent: MessageEvent) => { + const event = (() => { + try { + return JSON.parse(websocketEvent.data.toString()) as RealtimeServerEvent; + } catch (err) { + this._onError(null, 'could not parse websocket event', err); + return null; + } + })(); + + if (event) { + this._emit('event', event); + + if (event.type === 'error') { + this._onError(event); + } else { + // @ts-expect-error TS isn't smart enough to get the relationship right here + this._emit(event.type, event); + } + } + }); + + this.socket.addEventListener('error', (event: any) => { + this._onError(null, event.message, null); + }); + } + + send(event: RealtimeClientEvent) { + try { + this.socket.send(JSON.stringify(event)); + } catch (err) { + this._onError(null, 'could not send data', err); + } + } + + close(props?: { code: number; reason: string }) { + try { + this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK'); + } catch (err) { + this._onError(null, 'could not close the connection', err); + } + } +} diff --git a/src/beta/realtime/ws.ts b/src/beta/realtime/ws.ts new file mode 100644 index 000000000..33bb11ad9 --- /dev/null +++ b/src/beta/realtime/ws.ts @@ -0,0 +1,69 @@ +import WS from 'ws'; +import { OpenAI } from '../../index'; +import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; +import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base'; + +export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { + url: URL; + socket: WS.WebSocket; + + constructor( + props: { model: string; options?: WS.ClientOptions | undefined }, + client?: Pick, + ) { + super(); + client ??= new OpenAI(); + + this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model }); + this.socket = new WS.WebSocket(this.url, { + ...props.options, + headers: { + ...props.options?.headers, + Authorization: `Bearer ${client.apiKey}`, + 'OpenAI-Beta': 'realtime=v1', + }, + }); + + this.socket.on('message', (wsEvent) => { + const event = (() => { + try { + return JSON.parse(wsEvent.toString()) as RealtimeServerEvent; + } catch (err) { + this._onError(null, 'could not parse websocket event', err); + return null; + } + })(); + + if (event) { + this._emit('event', event); + + if (event.type === 'error') { + this._onError(event); + } else { + // @ts-expect-error TS isn't smart enough to get the relationship right here + this._emit(event.type, event); + } + } + }); + + this.socket.on('error', (err) => { + this._onError(null, err.message, err); + }); + } + + send(event: RealtimeClientEvent) { + try { + this.socket.send(JSON.stringify(event)); + } catch (err) { + this._onError(null, 'could not send data', err); + } + } + + close(props?: { code: number; reason: string }) { + try { + this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK'); + } catch (err) { + this._onError(null, 'could not close the connection', err); + } + } +} diff --git a/src/lib/EventEmitter.ts b/src/lib/EventEmitter.ts new file mode 100644 index 000000000..9adeebdc3 --- /dev/null +++ b/src/lib/EventEmitter.ts @@ -0,0 +1,98 @@ +type EventListener = Events[EventType]; + +type EventListeners = Array<{ + listener: EventListener; + once?: boolean; +}>; + +export type EventParameters = { + [Event in EventType]: EventListener extends (...args: infer P) => any ? P : never; +}[EventType]; + +export class EventEmitter any>> { + #listeners: { + [Event in keyof EventTypes]?: EventListeners; + } = {}; + + /** + * Adds the listener function to the end of the listeners array for the event. + * No checks are made to see if the listener has already been added. Multiple calls passing + * the same combination of event and listener will result in the listener being added, and + * called, multiple times. + * @returns this, so that calls can be chained + */ + on(event: Event, listener: EventListener): this { + const listeners: EventListeners = + this.#listeners[event] || (this.#listeners[event] = []); + listeners.push({ listener }); + return this; + } + + /** + * Removes the specified listener from the listener array for the event. + * off() will remove, at most, one instance of a listener from the listener array. If any single + * listener has been added multiple times to the listener array for the specified event, then + * off() must be called multiple times to remove each instance. + * @returns this, so that calls can be chained + */ + off(event: Event, listener: EventListener): this { + const listeners = this.#listeners[event]; + if (!listeners) return this; + const index = listeners.findIndex((l) => l.listener === listener); + if (index >= 0) listeners.splice(index, 1); + return this; + } + + /** + * Adds a one-time listener function for the event. The next time the event is triggered, + * this listener is removed and then invoked. + * @returns this, so that calls can be chained + */ + once(event: Event, listener: EventListener): this { + const listeners: EventListeners = + this.#listeners[event] || (this.#listeners[event] = []); + listeners.push({ listener, once: true }); + return this; + } + + /** + * This is similar to `.once()`, but returns a Promise that resolves the next time + * the event is triggered, instead of calling a listener callback. + * @returns a Promise that resolves the next time given event is triggered, + * or rejects if an error is emitted. (If you request the 'error' event, + * returns a promise that resolves with the error). + * + * Example: + * + * const message = await stream.emitted('message') // rejects if the stream errors + */ + emitted( + event: Event, + ): Promise< + EventParameters extends [infer Param] ? Param + : EventParameters extends [] ? void + : EventParameters + > { + return new Promise((resolve, reject) => { + // TODO: handle errors + this.once(event, resolve as any); + }); + } + + protected _emit( + this: EventEmitter, + event: Event, + ...args: EventParameters + ) { + const listeners: EventListeners | undefined = this.#listeners[event]; + if (listeners) { + this.#listeners[event] = listeners.filter((l) => !l.once) as any; + listeners.forEach(({ listener }: any) => listener(...(args as any))); + } + } + + protected _hasListener(event: keyof EventTypes): boolean { + const listeners = this.#listeners[event]; + return listeners && listeners.length > 0; + } +} diff --git a/yarn.lock b/yarn.lock index c0220f984..0a4307f70 100644 --- a/yarn.lock +++ b/yarn.lock @@ -881,6 +881,13 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/ws@^8.5.13": + version "8.5.13" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.13.tgz#6414c280875e2691d0d1e080b05addbf5cb91e20" + integrity sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.3" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" @@ -3472,6 +3479,11 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" +ws@^8.18.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" From 9d214eac82509028787b6ad148fec46689af74d3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 05:06:39 +0000 Subject: [PATCH 100/509] release: 4.79.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3218ab333..a4062b378 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.78.1" + ".": "4.79.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 320d00140..c2021f78a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 4.79.0 (2025-01-17) + +Full Changelog: [v4.78.1...v4.79.0](https://github.com/openai/openai-node/compare/v4.78.1...v4.79.0) + +### Features + +* **client:** add Realtime API support ([#1266](https://github.com/openai/openai-node/issues/1266)) ([7160ebe](https://github.com/openai/openai-node/commit/7160ebe647769fbf48a600c9961d1a6f86dc9622)) + + +### Bug Fixes + +* **logs/azure:** redact sensitive header when DEBUG is set ([#1218](https://github.com/openai/openai-node/issues/1218)) ([6a72fd7](https://github.com/openai/openai-node/commit/6a72fd736733db19504a829bf203b39d5b9e3644)) + + +### Chores + +* fix streaming ([379c743](https://github.com/openai/openai-node/commit/379c7435ed5d508458e9cdc22386039b84fcec5e)) +* **internal:** streaming refactors ([#1261](https://github.com/openai/openai-node/issues/1261)) ([dd4af93](https://github.com/openai/openai-node/commit/dd4af939792583854a313367c5fe2f98eea2f3c8)) +* **types:** add `| undefined` to client options properties ([#1264](https://github.com/openai/openai-node/issues/1264)) ([5e56979](https://github.com/openai/openai-node/commit/5e569799b9ac8f915b16de90d91d38b568c1edce)) +* **types:** rename vector store chunking strategy ([#1263](https://github.com/openai/openai-node/issues/1263)) ([d31acee](https://github.com/openai/openai-node/commit/d31acee860c80ba945d4e70b956c7ed75f5f849a)) + ## 4.78.1 (2025-01-10) Full Changelog: [v4.78.0...v4.78.1](https://github.com/openai/openai-node/compare/v4.78.0...v4.78.1) diff --git a/jsr.json b/jsr.json index 257faa02d..ac02a7435 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.78.1", + "version": "4.79.0", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 77e2d609f..3b01be9fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.78.1", + "version": "4.79.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index a8ac58ba2..afc5d7104 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.78.1'; // x-release-please-version +export const VERSION = '4.79.0'; // x-release-please-version From 6cd83178324271763c3b3ba236ea5406c1447dd4 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 17 Jan 2025 19:39:08 +0000 Subject: [PATCH 101/509] fix(realtime): correct import syntax (#1267) --- src/beta/realtime/ws.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beta/realtime/ws.ts b/src/beta/realtime/ws.ts index 33bb11ad9..631a36cd2 100644 --- a/src/beta/realtime/ws.ts +++ b/src/beta/realtime/ws.ts @@ -1,4 +1,4 @@ -import WS from 'ws'; +import * as WS from 'ws'; import { OpenAI } from '../../index'; import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base'; From 8383975a2e45aa222fcf56a45b38834bcf8b31c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 19:39:37 +0000 Subject: [PATCH 102/509] release: 4.79.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a4062b378..8d95306a8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.79.0" + ".": "4.79.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c2021f78a..d24eeffa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.79.1 (2025-01-17) + +Full Changelog: [v4.79.0...v4.79.1](https://github.com/openai/openai-node/compare/v4.79.0...v4.79.1) + +### Bug Fixes + +* **realtime:** correct import syntax ([#1267](https://github.com/openai/openai-node/issues/1267)) ([74702a7](https://github.com/openai/openai-node/commit/74702a739f566810d2b6c4e0832cfa17a1d1e272)) + ## 4.79.0 (2025-01-17) Full Changelog: [v4.78.1...v4.79.0](https://github.com/openai/openai-node/compare/v4.78.1...v4.79.0) diff --git a/jsr.json b/jsr.json index ac02a7435..9f4dbe4b6 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.79.0", + "version": "4.79.1", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 3b01be9fe..2984cf2d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.79.0", + "version": "4.79.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index afc5d7104..587a3c245 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.79.0'; // x-release-please-version +export const VERSION = '4.79.1'; // x-release-please-version From 6f3ad43ac1bbb8f8f6c8fae9e83398d85cead56c Mon Sep 17 00:00:00 2001 From: Kevin Whinnery Date: Fri, 17 Jan 2025 15:12:04 -0600 Subject: [PATCH 103/509] Create export for WebSocket on Deno/JSR --- jsr.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jsr.json b/jsr.json index 9f4dbe4b6..72575a407 100644 --- a/jsr.json +++ b/jsr.json @@ -1,7 +1,10 @@ { "name": "@openai/openai", "version": "4.79.1", - "exports": "./index.ts", + "exports": { + ".": "./index.ts", + "./beta/realtime/websocket": "./beta/realtime/websocket.ts" + }, "publish": { "exclude": [ "!." From 4640dc608f7f55624656007207c49feb5f3047e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:59:02 +0000 Subject: [PATCH 104/509] chore(internal): add test (#1270) --- tests/index.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/index.test.ts b/tests/index.test.ts index 016d525f5..6227d6fbe 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -96,6 +96,15 @@ describe('instantiate client', () => { expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true }); }); + test('explicit global fetch', async () => { + // make sure the global fetch type is assignable to our Fetch type + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + apiKey: 'My API Key', + fetch: defaultFetch, + }); + }); + test('custom signal', async () => { const client = new OpenAI({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', From 95886b57b1373c16e12a0ee1288d68cd8520695d Mon Sep 17 00:00:00 2001 From: Ali Tabesh Date: Tue, 21 Jan 2025 13:19:22 +0330 Subject: [PATCH 105/509] docs(readme): fix Realtime API example link (#1272) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e7d69a669..3bd386e99 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ rt.socket.addEventListener('open', () => { }); ``` -A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/web.ts). +A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/websocket.ts). ### Realtime error handling From 53149de69e19836568c1f1083ee7ee3c07123d1a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:49:52 +0000 Subject: [PATCH 106/509] release: 4.79.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8d95306a8..06a612d67 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.79.1" + ".": "4.79.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d24eeffa5..9151619f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.79.2 (2025-01-21) + +Full Changelog: [v4.79.1...v4.79.2](https://github.com/openai/openai-node/compare/v4.79.1...v4.79.2) + +### Chores + +* **internal:** add test ([#1270](https://github.com/openai/openai-node/issues/1270)) ([b7c2d3d](https://github.com/openai/openai-node/commit/b7c2d3d9abd315f1452a578b0fd0d82e6ac4ff60)) + + +### Documentation + +* **readme:** fix Realtime API example link ([#1272](https://github.com/openai/openai-node/issues/1272)) ([d0653c7](https://github.com/openai/openai-node/commit/d0653c7fef48360d137a7411dfdfb95d477cdbc5)) + ## 4.79.1 (2025-01-17) Full Changelog: [v4.79.0...v4.79.1](https://github.com/openai/openai-node/compare/v4.79.0...v4.79.1) diff --git a/jsr.json b/jsr.json index 9f4dbe4b6..ce967d67a 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.79.1", + "version": "4.79.2", "exports": "./index.ts", "publish": { "exclude": [ diff --git a/package.json b/package.json index 2984cf2d8..07b2da77d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.79.1", + "version": "4.79.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 587a3c245..2cedb894b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.79.1'; // x-release-please-version +export const VERSION = '4.79.2'; // x-release-please-version From e5e682f11783b14323f03ff9bf3298b8c6868136 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 21 Jan 2025 15:35:13 +0000 Subject: [PATCH 107/509] fix(jsr): export zod helpers --- jsr.json | 1 + 1 file changed, 1 insertion(+) diff --git a/jsr.json b/jsr.json index 35ee4e7ea..5819f2fa3 100644 --- a/jsr.json +++ b/jsr.json @@ -3,6 +3,7 @@ "version": "4.79.2", "exports": { ".": "./index.ts", + "./helpers/zod": "./helpers/zod.ts", "./beta/realtime/websocket": "./beta/realtime/websocket.ts" }, "publish": { From f5139d4aa281bd9a20b8cf5c801843f4d6c4bb3b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:53:54 +0000 Subject: [PATCH 108/509] release: 4.79.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 06a612d67..cdd63a113 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.79.2" + ".": "4.79.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9151619f9..8a1ce156f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.79.3 (2025-01-21) + +Full Changelog: [v4.79.2...v4.79.3](https://github.com/openai/openai-node/compare/v4.79.2...v4.79.3) + +### Bug Fixes + +* **jsr:** export zod helpers ([9dc55b6](https://github.com/openai/openai-node/commit/9dc55b62b564ad5ad1d4a60fe520b68235d05296)) + ## 4.79.2 (2025-01-21) Full Changelog: [v4.79.1...v4.79.2](https://github.com/openai/openai-node/compare/v4.79.1...v4.79.2) diff --git a/jsr.json b/jsr.json index 5819f2fa3..c070e4983 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.79.2", + "version": "4.79.3", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 07b2da77d..342f7c539 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.79.2", + "version": "4.79.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 2cedb894b..c2097ae42 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.79.2'; // x-release-please-version +export const VERSION = '4.79.3'; // x-release-please-version From a1d0ddc3b27b15700e355a476e8d183dae43987c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 17:22:40 +0000 Subject: [PATCH 109/509] docs: update deprecation messages (#1275) --- src/resources/chat/completions.ts | 24 ++++++++++++------------ src/resources/files.ts | 4 ++-- src/resources/fine-tuning/jobs/jobs.ts | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 31f5814cb..88c778036 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -163,8 +163,8 @@ export interface ChatCompletionAssistantMessageParam { content?: string | Array | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: ChatCompletionAssistantMessageParam.FunctionCall | null; @@ -198,8 +198,8 @@ export namespace ChatCompletionAssistantMessageParam { } /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** @@ -360,8 +360,8 @@ export namespace ChatCompletionChunk { content?: string | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: Delta.FunctionCall; @@ -380,8 +380,8 @@ export namespace ChatCompletionChunk { export namespace Delta { /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** @@ -620,8 +620,8 @@ export interface ChatCompletionMessage { audio?: ChatCompletionAudio | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: ChatCompletionMessage.FunctionCall | null; @@ -633,8 +633,8 @@ export interface ChatCompletionMessage { export namespace ChatCompletionMessage { /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** diff --git a/src/resources/files.ts b/src/resources/files.ts index 43708310b..67bc95469 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -168,13 +168,13 @@ export interface FileObject { | 'vision'; /** - * @deprecated: Deprecated. The current status of the file, which can be either + * @deprecated Deprecated. The current status of the file, which can be either * `uploaded`, `processed`, or `error`. */ status: 'uploaded' | 'processed' | 'error'; /** - * @deprecated: Deprecated. For details on why a fine-tuning training file failed + * @deprecated Deprecated. For details on why a fine-tuning training file failed * validation, see the `error` field on `fine_tuning.job`. */ status_details?: string; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 44dd011aa..9be03c302 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -516,7 +516,7 @@ export interface JobCreateParams { export namespace JobCreateParams { /** - * @deprecated: The hyperparameters used for the fine-tuning job. This value is now + * @deprecated The hyperparameters used for the fine-tuning job. This value is now * deprecated in favor of `method`, and should be passed in under the `method` * parameter. */ From c85dc9793ab6fb318b9ece1a557c4e00024265c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 21:00:49 +0000 Subject: [PATCH 110/509] chore(internal): minor restructuring (#1278) --- src/internal/decoders/line.ts | 2 +- src/internal/stream-utils.ts | 32 +++++++++++++++++++++++++++++ src/streaming.ts | 38 +++-------------------------------- 3 files changed, 36 insertions(+), 36 deletions(-) create mode 100644 src/internal/stream-utils.ts diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 1e0bbf390..34e41d1dc 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -1,6 +1,6 @@ import { OpenAIError } from '../../error'; -type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; +export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; /** * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally diff --git a/src/internal/stream-utils.ts b/src/internal/stream-utils.ts new file mode 100644 index 000000000..37f7793cf --- /dev/null +++ b/src/internal/stream-utils.ts @@ -0,0 +1,32 @@ +/** + * Most browsers don't yet have async iterable support for ReadableStream, + * and Node has a very different way of reading bytes from its "ReadableStream". + * + * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 + */ +export function ReadableStreamToAsyncIterable(stream: any): AsyncIterableIterator { + if (stream[Symbol.asyncIterator]) return stream; + + const reader = stream.getReader(); + return { + async next() { + try { + const result = await reader.read(); + if (result?.done) reader.releaseLock(); // release lock when stream becomes closed + return result; + } catch (e) { + reader.releaseLock(); // release lock when stream becomes errored + throw e; + } + }, + async return() { + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; + return { done: true, value: undefined }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/src/streaming.ts b/src/streaming.ts index 2891e6ac3..6a57a50a0 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -1,6 +1,7 @@ import { ReadableStream, type Response } from './_shims/index'; import { OpenAIError } from './error'; import { LineDecoder } from './internal/decoders/line'; +import { ReadableStreamToAsyncIterable } from './internal/stream-utils'; import { APIError } from './error'; @@ -96,7 +97,7 @@ export class Stream implements AsyncIterable { async function* iterLines(): AsyncGenerator { const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(readableStream); + const iter = ReadableStreamToAsyncIterable(readableStream); for await (const chunk of iter) { for (const line of lineDecoder.decode(chunk)) { yield line; @@ -210,7 +211,7 @@ export async function* _iterSSEMessages( const sseDecoder = new SSEDecoder(); const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(response.body); + const iter = ReadableStreamToAsyncIterable(response.body); for await (const sseChunk of iterSSEChunks(iter)) { for (const line of lineDecoder.decode(sseChunk)) { const sse = sseDecoder.decode(line); @@ -363,36 +364,3 @@ function partition(str: string, delimiter: string): [string, string, string] { return [str, '', '']; } - -/** - * Most browsers don't yet have async iterable support for ReadableStream, - * and Node has a very different way of reading bytes from its "ReadableStream". - * - * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 - */ -export function readableStreamAsyncIterable(stream: any): AsyncIterableIterator { - if (stream[Symbol.asyncIterator]) return stream; - - const reader = stream.getReader(); - return { - async next() { - try { - const result = await reader.read(); - if (result?.done) reader.releaseLock(); // release lock when stream becomes closed - return result; - } catch (e) { - reader.releaseLock(); // release lock when stream becomes errored - throw e; - } - }, - async return() { - const cancelPromise = reader.cancel(); - reader.releaseLock(); - await cancelPromise; - return { done: true, value: undefined }; - }, - [Symbol.asyncIterator]() { - return this; - }, - }; -} From e5aba740d98541e9ca7cb01998c27033c0f03c5f Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 21 Jan 2025 22:36:52 +0000 Subject: [PATCH 111/509] fix(jsr): correct zod config --- jsr.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsr.json b/jsr.json index c070e4983..8c24896f7 100644 --- a/jsr.json +++ b/jsr.json @@ -6,6 +6,9 @@ "./helpers/zod": "./helpers/zod.ts", "./beta/realtime/websocket": "./beta/realtime/websocket.ts" }, + "imports": { + "zod": "npm:zod@3" + }, "publish": { "exclude": [ "!." From 0fae08b33e6963c6b46e6318f23bada01d18f19f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:37:23 +0000 Subject: [PATCH 112/509] release: 4.79.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cdd63a113..b1ab5c7b9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.79.3" + ".": "4.79.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1ce156f..4254a9b8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.79.4 (2025-01-21) + +Full Changelog: [v4.79.3...v4.79.4](https://github.com/openai/openai-node/compare/v4.79.3...v4.79.4) + +### Bug Fixes + +* **jsr:** correct zod config ([e45fa5f](https://github.com/openai/openai-node/commit/e45fa5f535ca74789636001e60e33edcad4db83c)) + + +### Chores + +* **internal:** minor restructuring ([#1278](https://github.com/openai/openai-node/issues/1278)) ([58ea92a](https://github.com/openai/openai-node/commit/58ea92a7464a04223f24ba31dbc0f7d0cf99cc19)) + + +### Documentation + +* update deprecation messages ([#1275](https://github.com/openai/openai-node/issues/1275)) ([1c6599e](https://github.com/openai/openai-node/commit/1c6599e47ef75a71cb309a1e14d97bc97bd036d0)) + ## 4.79.3 (2025-01-21) Full Changelog: [v4.79.2...v4.79.3](https://github.com/openai/openai-node/compare/v4.79.2...v4.79.3) diff --git a/jsr.json b/jsr.json index 8c24896f7..e6d772116 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.79.3", + "version": "4.79.4", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 342f7c539..d7a5555e5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.79.3", + "version": "4.79.4", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c2097ae42..e8b9601ed 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.79.3'; // x-release-please-version +export const VERSION = '4.79.4'; // x-release-please-version From 74776c6923b36b8b610063e0f5d8773bbd94313f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:20:44 +0000 Subject: [PATCH 113/509] feat(api): update enum values, comments, and examples (#1280) --- .stats.yml | 2 +- src/resources/audio/speech.ts | 8 ++--- src/resources/beta/realtime/realtime.ts | 32 +++++++++++-------- src/resources/beta/realtime/sessions.ts | 30 ++++++++++------- src/resources/chat/completions.ts | 9 ++---- src/resources/embeddings.ts | 3 +- .../beta/realtime/sessions.test.ts | 27 ++-------------- tests/api-resources/chat/completions.test.ts | 2 +- tests/api-resources/completions.test.ts | 2 +- 9 files changed, 49 insertions(+), 66 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9600edae3..d518bac58 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-b5b0e2c794b012919701c3fd43286af10fa25d33ceb8a881bec2636028f446e0.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index bd2ed9f65..35e82c4c1 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -33,12 +33,12 @@ export interface SpeechCreateParams { model: (string & {}) | SpeechModel; /** - * The voice to use when generating the audio. Supported voices are `alloy`, - * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are - * available in the + * The voice to use when generating the audio. Supported voices are `alloy`, `ash`, + * `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the + * voices are available in the * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). */ - voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; + voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; /** * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5de06917a..0fb66eb49 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -173,9 +173,10 @@ export interface ConversationItemCreateEvent { /** * The ID of the preceding item after which the new item will be inserted. If not - * set, the new item will be appended to the end of the conversation. If set, it - * allows an item to be inserted mid-conversation. If the ID cannot be found, an - * error will be returned and the item will not be added. + * set, the new item will be appended to the end of the conversation. If set to + * `root`, the new item will be added to the beginning of the conversation. If set + * to an existing ID, it allows an item to be inserted mid-conversation. If the ID + * cannot be found, an error will be returned and the item will not be added. */ previous_item_id?: string; } @@ -1705,17 +1706,9 @@ export namespace SessionUpdateEvent { */ export interface Session { /** - * The Realtime model used for this session. - */ - model: - | 'gpt-4o-realtime-preview' - | 'gpt-4o-realtime-preview-2024-10-01' - | 'gpt-4o-realtime-preview-2024-12-17' - | 'gpt-4o-mini-realtime-preview' - | 'gpt-4o-mini-realtime-preview-2024-12-17'; - - /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -1756,8 +1749,19 @@ export namespace SessionUpdateEvent { */ modalities?: Array<'text' | 'audio'>; + /** + * The Realtime model used for this session. + */ + model?: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index c1082d236..68c48db59 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -32,7 +32,9 @@ export interface Session { id?: string; /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -86,6 +88,7 @@ export interface Session { /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -372,17 +375,9 @@ export namespace SessionCreateResponse { export interface SessionCreateParams { /** - * The Realtime model used for this session. - */ - model: - | 'gpt-4o-realtime-preview' - | 'gpt-4o-realtime-preview-2024-10-01' - | 'gpt-4o-realtime-preview-2024-12-17' - | 'gpt-4o-mini-realtime-preview' - | 'gpt-4o-mini-realtime-preview-2024-12-17'; - - /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -423,8 +418,19 @@ export interface SessionCreateParams { */ modalities?: Array<'text' | 'audio'>; + /** + * The Realtime model used for this session. + */ + model?: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 88c778036..683eb5ed4 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -76,8 +76,7 @@ export interface ChatCompletion { object: 'chat.completion'; /** - * The service tier used for processing the request. This field is only included if - * the `service_tier` parameter is specified in the request. + * The service tier used for processing the request. */ service_tier?: 'scale' | 'default' | null; @@ -300,8 +299,7 @@ export interface ChatCompletionChunk { object: 'chat.completion.chunk'; /** - * The service tier used for processing the request. This field is only included if - * the `service_tier` parameter is specified in the request. + * The service tier used for processing the request. */ service_tier?: 'scale' | 'default' | null; @@ -1115,9 +1113,6 @@ export interface ChatCompletionCreateParamsBase { * - If set to 'default', the request will be processed using the default service * tier with a lower uptime SLA and no latency guarentee. * - When not set, the default behavior is 'auto'. - * - * When this parameter is set, the response body will include the `service_tier` - * utilized. */ service_tier?: 'auto' | 'default' | null; diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 4b1644a68..d01ffc807 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -86,7 +86,8 @@ export interface EmbeddingCreateParams { * `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 * dimensions or less. * [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. + * for counting tokens. Some models may also impose a limit on total number of + * tokens summed across inputs. */ input: string | Array | Array | Array>; diff --git a/tests/api-resources/beta/realtime/sessions.test.ts b/tests/api-resources/beta/realtime/sessions.test.ts index 0ed998c27..dbb92ead3 100644 --- a/tests/api-resources/beta/realtime/sessions.test.ts +++ b/tests/api-resources/beta/realtime/sessions.test.ts @@ -9,8 +9,8 @@ const client = new OpenAI({ }); describe('resource sessions', () => { - test('create: only required params', async () => { - const responsePromise = client.beta.realtime.sessions.create({ model: 'gpt-4o-realtime-preview' }); + test('create', async () => { + const responsePromise = client.beta.realtime.sessions.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -19,27 +19,4 @@ describe('resource sessions', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('create: required and optional params', async () => { - const response = await client.beta.realtime.sessions.create({ - model: 'gpt-4o-realtime-preview', - input_audio_format: 'pcm16', - input_audio_transcription: { model: 'model' }, - instructions: 'instructions', - max_response_output_tokens: 0, - modalities: ['text'], - output_audio_format: 'pcm16', - temperature: 0, - tool_choice: 'tool_choice', - tools: [{ description: 'description', name: 'name', parameters: {}, type: 'function' }], - turn_detection: { - create_response: true, - prefix_padding_ms: 0, - silence_duration_ms: 0, - threshold: 0, - type: 'type', - }, - voice: 'alloy', - }); - }); }); diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index dfc09f69b..8f1bc7d4c 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -43,7 +43,7 @@ describe('resource completions', () => { presence_penalty: -2, reasoning_effort: 'low', response_format: { type: 'text' }, - seed: -9007199254740991, + seed: 0, service_tier: 'auto', stop: 'string', store: true, diff --git a/tests/api-resources/completions.test.ts b/tests/api-resources/completions.test.ts index 82322dc3a..c98501a87 100644 --- a/tests/api-resources/completions.test.ts +++ b/tests/api-resources/completions.test.ts @@ -32,7 +32,7 @@ describe('resource completions', () => { max_tokens: 16, n: 1, presence_penalty: -2, - seed: -9007199254740991, + seed: 0, stop: '\n', stream: false, stream_options: { include_usage: true }, From 180b9ca1b5472d7697202a9220960a948bfbb9c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 13:21:16 +0000 Subject: [PATCH 114/509] release: 4.80.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b1ab5c7b9..a21d67d78 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.79.4" + ".": "4.80.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4254a9b8f..9126bf6a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.80.0 (2025-01-22) + +Full Changelog: [v4.79.4...v4.80.0](https://github.com/openai/openai-node/compare/v4.79.4...v4.80.0) + +### Features + +* **api:** update enum values, comments, and examples ([#1280](https://github.com/openai/openai-node/issues/1280)) ([d38f2c2](https://github.com/openai/openai-node/commit/d38f2c2648b6990f217c3c7d83ca31f3739641d3)) + ## 4.79.4 (2025-01-21) Full Changelog: [v4.79.3...v4.79.4](https://github.com/openai/openai-node/compare/v4.79.3...v4.79.4) diff --git a/jsr.json b/jsr.json index e6d772116..d79b07c2f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.79.4", + "version": "4.80.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index d7a5555e5..fd85ffdd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.79.4", + "version": "4.80.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index e8b9601ed..c9b6787c2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.79.4'; // x-release-please-version +export const VERSION = '4.80.0'; // x-release-please-version From b7ab6bb304973ade94830f37eb646e800226d5ef Mon Sep 17 00:00:00 2001 From: hi019 <65871571+hi019@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:57:18 -0800 Subject: [PATCH 115/509] docs: fix typo, "zodFunctionTool" -> "zodFunction" (#1128) --- helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index abf980c82..aa3775a54 100644 --- a/helpers.md +++ b/helpers.md @@ -49,7 +49,7 @@ if (message?.parsed) { The `.parse()` method will also automatically parse `function` tool calls if: -- You use the `zodFunctionTool()` helper method +- You use the `zodFunction()` helper method - You mark your tool schema with `"strict": True` For example: From 9bfb778d547c34a6b7ed4168251786b1d6723985 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 22 Jan 2025 20:34:34 +0000 Subject: [PATCH 116/509] fix(azure): include retry count header --- src/index.ts | 7 +++++-- tests/lib/azure.test.ts | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index cf6aa89e3..944def00f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -577,7 +577,10 @@ export class AzureOpenAI extends OpenAI { this._deployment = deployment; } - override buildRequest(options: Core.FinalRequestOptions): { + override buildRequest( + options: Core.FinalRequestOptions, + props: { retryCount?: number } = {}, + ): { req: RequestInit; url: string; timeout: number; @@ -591,7 +594,7 @@ export class AzureOpenAI extends OpenAI { options.path = `/deployments/${model}${options.path}`; } } - return super.buildRequest(options); + return super.buildRequest(options, props); } private async _getAzureADToken(): Promise { diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 064a0098c..0e3c2c5a3 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -51,6 +51,18 @@ describe('instantiate azure client', () => { }); expect(req.headers as Headers).not.toHaveProperty('x-my-default-header'); }); + + test('includes retry count', () => { + const { req } = client.buildRequest( + { + path: '/foo', + method: 'post', + headers: { 'X-My-Default-Header': null }, + }, + { retryCount: 1 }, + ); + expect((req.headers as Headers)['x-stainless-retry-count']).toEqual('1'); + }); }); describe('defaultQuery', () => { From 654a2ac33d6b0bab723ec30ab734bbd9b693bbf3 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 22 Jan 2025 20:53:36 +0000 Subject: [PATCH 117/509] docs(helpers): fix type annotation --- helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index aa3775a54..16bc1f277 100644 --- a/helpers.md +++ b/helpers.md @@ -226,7 +226,7 @@ on in the documentation page [Message](https://platform.openai.com/docs/api-refe ```ts .on('textCreated', (content: Text) => ...) -.on('textDelta', (delta: RunStepDelta, snapshot: Text) => ...) +.on('textDelta', (delta: TextDelta, snapshot: Text) => ...) .on('textDone', (content: Text, snapshot: Message) => ...) ``` From 3fcded9eb387e39bdf03a06b701710cf3075f990 Mon Sep 17 00:00:00 2001 From: Guspan Tanadi <36249910+guspan-tanadi@users.noreply.github.com> Date: Fri, 24 Jan 2025 19:16:27 +0700 Subject: [PATCH 118/509] docs(readme): fix realtime errors docs link (#1286) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bd386e99..012511412 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ A full example can be found [here](https://github.com/openai/openai-node/blob/ma ### Realtime error handling -When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime/realtime-api-beta#handling-errors), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. +When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable. From fb61fc2db45d2fb1f25016b70608714a93a80c9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 12:16:56 +0000 Subject: [PATCH 119/509] release: 4.80.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a21d67d78..d140407b9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.80.0" + ".": "4.80.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9126bf6a2..e4d4d73b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.80.1 (2025-01-24) + +Full Changelog: [v4.80.0...v4.80.1](https://github.com/openai/openai-node/compare/v4.80.0...v4.80.1) + +### Bug Fixes + +* **azure:** include retry count header ([3e0ba40](https://github.com/openai/openai-node/commit/3e0ba409e57ce276fb1f95cd11c801e4ccaad572)) + + +### Documentation + +* fix typo, "zodFunctionTool" -> "zodFunction" ([#1128](https://github.com/openai/openai-node/issues/1128)) ([b7ab6bb](https://github.com/openai/openai-node/commit/b7ab6bb304973ade94830f37eb646e800226d5ef)) +* **helpers:** fix type annotation ([fc019df](https://github.com/openai/openai-node/commit/fc019df1d9cc276e8f8e689742853a09aa94991a)) +* **readme:** fix realtime errors docs link ([#1286](https://github.com/openai/openai-node/issues/1286)) ([d1d50c8](https://github.com/openai/openai-node/commit/d1d50c897c18cefea964e8057fe1acfd766ae2bf)) + ## 4.80.0 (2025-01-22) Full Changelog: [v4.79.4...v4.80.0](https://github.com/openai/openai-node/compare/v4.79.4...v4.80.0) diff --git a/jsr.json b/jsr.json index d79b07c2f..e2ecad87f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.80.0", + "version": "4.80.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index fd85ffdd0..497c7fae9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.80.0", + "version": "4.80.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c9b6787c2..7d762daed 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.80.0'; // x-release-please-version +export const VERSION = '4.80.1'; // x-release-please-version From b4bb01ddd9f1c1f6ae41ddc11a9e1b707ef04764 Mon Sep 17 00:00:00 2001 From: Deyaaeldeen Almahallawi Date: Wed, 29 Jan 2025 09:45:25 -0600 Subject: [PATCH 120/509] feat(azure): Realtime API support (#1287) --- README.md | 22 ++++++++- examples/{azure.ts => azure/chat.ts} | 3 +- examples/azure/realtime/websocket.ts | 60 +++++++++++++++++++++++++ examples/azure/realtime/ws.ts | 67 ++++++++++++++++++++++++++++ examples/package.json | 1 + examples/realtime/ws.ts | 2 +- src/beta/realtime/internal-base.ts | 18 ++++++-- src/beta/realtime/websocket.ts | 54 ++++++++++++++++++++-- src/beta/realtime/ws.ts | 35 +++++++++++++-- src/index.ts | 8 ++-- 10 files changed, 251 insertions(+), 19 deletions(-) rename examples/{azure.ts => azure/chat.ts} (91%) create mode 100644 examples/azure/realtime/websocket.ts create mode 100644 examples/azure/realtime/ws.ts diff --git a/README.md b/README.md index 012511412..a1f4bf760 100644 --- a/README.md +++ b/README.md @@ -499,7 +499,7 @@ const credential = new DefaultAzureCredential(); const scope = 'https://cognitiveservices.azure.com/.default'; const azureADTokenProvider = getBearerTokenProvider(credential, scope); -const openai = new AzureOpenAI({ azureADTokenProvider }); +const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "" }); const result = await openai.chat.completions.create({ model: 'gpt-4o', @@ -509,6 +509,26 @@ const result = await openai.chat.completions.create({ console.log(result.choices[0]!.message?.content); ``` +### Realtime API +This SDK provides real-time streaming capabilities for Azure OpenAI through the `OpenAIRealtimeWS` and `OpenAIRealtimeWebSocket` clients described previously. + +To utilize the real-time features, begin by creating a fully configured `AzureOpenAI` client and passing it into either `OpenAIRealtimeWS.azure` or `OpenAIRealtimeWebSocket.azure`. For example: + +```ts +const cred = new DefaultAzureCredential(); +const scope = 'https://cognitiveservices.azure.com/.default'; +const deploymentName = 'gpt-4o-realtime-preview-1001'; +const azureADTokenProvider = getBearerTokenProvider(cred, scope); +const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, +}); +const rt = await OpenAIRealtimeWS.azure(client); +``` + +Once the instance has been created, you can then begin sending requests and receiving streaming responses in real time. + ### Retries Certain errors will be automatically retried 2 times by default, with a short exponential backoff. diff --git a/examples/azure.ts b/examples/azure/chat.ts similarity index 91% rename from examples/azure.ts rename to examples/azure/chat.ts index 5fe1718fa..46df820f8 100755 --- a/examples/azure.ts +++ b/examples/azure/chat.ts @@ -2,6 +2,7 @@ import { AzureOpenAI } from 'openai'; import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity'; +import 'dotenv/config'; // Corresponds to your Model deployment within your OpenAI resource, e.g. gpt-4-1106-preview // Navigate to the Azure OpenAI Studio to deploy a model. @@ -13,7 +14,7 @@ const azureADTokenProvider = getBearerTokenProvider(credential, scope); // Make sure to set AZURE_OPENAI_ENDPOINT with the endpoint of your Azure resource. // You can find it in the Azure Portal. -const openai = new AzureOpenAI({ azureADTokenProvider }); +const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: '2024-10-01-preview' }); async function main() { console.log('Non-streaming:'); diff --git a/examples/azure/realtime/websocket.ts b/examples/azure/realtime/websocket.ts new file mode 100644 index 000000000..bec74e654 --- /dev/null +++ b/examples/azure/realtime/websocket.ts @@ -0,0 +1,60 @@ +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; +import { AzureOpenAI } from 'openai'; +import { DefaultAzureCredential, getBearerTokenProvider } from '@azure/identity'; +import 'dotenv/config'; + +async function main() { + const cred = new DefaultAzureCredential(); + const scope = 'https://cognitiveservices.azure.com/.default'; + const deploymentName = 'gpt-4o-realtime-preview-1001'; + const azureADTokenProvider = getBearerTokenProvider(cred, scope); + const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, + }); + const rt = await OpenAIRealtimeWebSocket.azure(client); + + // access the underlying `ws.WebSocket` instance + rt.socket.addEventListener('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts new file mode 100644 index 000000000..ae20a1438 --- /dev/null +++ b/examples/azure/realtime/ws.ts @@ -0,0 +1,67 @@ +import { DefaultAzureCredential, getBearerTokenProvider } from '@azure/identity'; +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; +import { AzureOpenAI } from 'openai'; +import 'dotenv/config'; + +async function main() { + const cred = new DefaultAzureCredential(); + const scope = 'https://cognitiveservices.azure.com/.default'; + const deploymentName = 'gpt-4o-realtime-preview-1001'; + const azureADTokenProvider = getBearerTokenProvider(cred, scope); + const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, + }); + const rt = await OpenAIRealtimeWS.azure(client); + + // access the underlying `ws.WebSocket` instance + rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.on('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/package.json b/examples/package.json index b8c34ac45..70ec2c523 100644 --- a/examples/package.json +++ b/examples/package.json @@ -7,6 +7,7 @@ "private": true, "dependencies": { "@azure/identity": "^4.2.0", + "dotenv": "^16.4.7", "express": "^4.18.2", "next": "^14.1.1", "openai": "file:..", diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts index 4bbe85e5d..bba140800 100644 --- a/examples/realtime/ws.ts +++ b/examples/realtime/ws.ts @@ -9,7 +9,7 @@ async function main() { rt.send({ type: 'session.update', session: { - modalities: ['foo'] as any, + modalities: ['text'], model: 'gpt-4o-realtime-preview', }, }); diff --git a/src/beta/realtime/internal-base.ts b/src/beta/realtime/internal-base.ts index 391d69911..b704812ee 100644 --- a/src/beta/realtime/internal-base.ts +++ b/src/beta/realtime/internal-base.ts @@ -1,6 +1,7 @@ import { RealtimeClientEvent, RealtimeServerEvent, ErrorEvent } from '../../resources/beta/realtime/realtime'; import { EventEmitter } from '../../lib/EventEmitter'; import { OpenAIError } from '../../error'; +import OpenAI, { AzureOpenAI } from '../../index'; export class OpenAIRealtimeError extends OpenAIError { /** @@ -73,11 +74,20 @@ export abstract class OpenAIRealtimeEmitter extends EventEmitter } } -export function buildRealtimeURL(props: { baseURL: string; model: string }): URL { - const path = '/realtime'; +export function isAzure(client: Pick): client is AzureOpenAI { + return client instanceof AzureOpenAI; +} - const url = new URL(props.baseURL + (props.baseURL.endsWith('/') ? path.slice(1) : path)); +export function buildRealtimeURL(client: Pick, model: string): URL { + const path = '/realtime'; + const baseURL = client.baseURL; + const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path)); url.protocol = 'wss'; - url.searchParams.set('model', props.model); + if (isAzure(client)) { + url.searchParams.set('api-version', client.apiVersion); + url.searchParams.set('deployment', model); + } else { + url.searchParams.set('model', model); + } return url; } diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts index e0853779d..349cf5760 100644 --- a/src/beta/realtime/websocket.ts +++ b/src/beta/realtime/websocket.ts @@ -1,8 +1,8 @@ -import { OpenAI } from '../../index'; +import { AzureOpenAI, OpenAI } from '../../index'; import { OpenAIError } from '../../error'; import * as Core from '../../core'; import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; -import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base'; +import { OpenAIRealtimeEmitter, buildRealtimeURL, isAzure } from './internal-base'; interface MessageEvent { data: string; @@ -26,6 +26,11 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { props: { model: string; dangerouslyAllowBrowser?: boolean; + /** + * Callback to mutate the URL, needed for Azure. + * @internal + */ + onURL?: (url: URL) => void; }, client?: Pick, ) { @@ -44,11 +49,13 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { client ??= new OpenAI({ dangerouslyAllowBrowser }); - this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model }); + this.url = buildRealtimeURL(client, props.model); + props.onURL?.(this.url); + // @ts-ignore this.socket = new WebSocket(this.url, [ 'realtime', - `openai-insecure-api-key.${client.apiKey}`, + ...(isAzure(client) ? [] : [`openai-insecure-api-key.${client.apiKey}`]), 'openai-beta.realtime-v1', ]); @@ -77,6 +84,45 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { this.socket.addEventListener('error', (event: any) => { this._onError(null, event.message, null); }); + + if (isAzure(client)) { + if (this.url.searchParams.get('Authorization') !== null) { + this.url.searchParams.set('Authorization', ''); + } else { + this.url.searchParams.set('api-key', ''); + } + } + } + + static async azure( + client: AzureOpenAI, + options: { deploymentName?: string; dangerouslyAllowBrowser?: boolean } = {}, + ): Promise { + const token = await client._getAzureADToken(); + function onURL(url: URL) { + if (client.apiKey !== '') { + url.searchParams.set('api-key', client.apiKey); + } else { + if (token) { + url.searchParams.set('Authorization', `Bearer ${token}`); + } else { + throw new Error('AzureOpenAI is not instantiated correctly. No API key or token provided.'); + } + } + } + const deploymentName = options.deploymentName ?? client.deploymentName; + if (!deploymentName) { + throw new Error('No deployment name provided'); + } + const { dangerouslyAllowBrowser } = options; + return new OpenAIRealtimeWebSocket( + { + model: deploymentName, + onURL, + ...(dangerouslyAllowBrowser ? { dangerouslyAllowBrowser } : {}), + }, + client, + ); } send(event: RealtimeClientEvent) { diff --git a/src/beta/realtime/ws.ts b/src/beta/realtime/ws.ts index 631a36cd2..51339089c 100644 --- a/src/beta/realtime/ws.ts +++ b/src/beta/realtime/ws.ts @@ -1,7 +1,7 @@ import * as WS from 'ws'; -import { OpenAI } from '../../index'; +import { AzureOpenAI, OpenAI } from '../../index'; import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; -import { OpenAIRealtimeEmitter, buildRealtimeURL } from './internal-base'; +import { OpenAIRealtimeEmitter, buildRealtimeURL, isAzure } from './internal-base'; export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { url: URL; @@ -14,12 +14,12 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { super(); client ??= new OpenAI(); - this.url = buildRealtimeURL({ baseURL: client.baseURL, model: props.model }); + this.url = buildRealtimeURL(client, props.model); this.socket = new WS.WebSocket(this.url, { ...props.options, headers: { ...props.options?.headers, - Authorization: `Bearer ${client.apiKey}`, + ...(isAzure(client) ? {} : { Authorization: `Bearer ${client.apiKey}` }), 'OpenAI-Beta': 'realtime=v1', }, }); @@ -51,6 +51,20 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { }); } + static async azure( + client: AzureOpenAI, + options: { deploymentName?: string; options?: WS.ClientOptions | undefined } = {}, + ): Promise { + const deploymentName = options.deploymentName ?? client.deploymentName; + if (!deploymentName) { + throw new Error('No deployment name provided'); + } + return new OpenAIRealtimeWS( + { model: deploymentName, options: { headers: await getAzureHeaders(client) } }, + client, + ); + } + send(event: RealtimeClientEvent) { try { this.socket.send(JSON.stringify(event)); @@ -67,3 +81,16 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { } } } + +async function getAzureHeaders(client: AzureOpenAI) { + if (client.apiKey !== '') { + return { 'api-key': client.apiKey }; + } else { + const token = await client._getAzureADToken(); + if (token) { + return { Authorization: `Bearer ${token}` }; + } else { + throw new Error('AzureOpenAI is not instantiated correctly. No API key or token provided.'); + } + } +} diff --git a/src/index.ts b/src/index.ts index 944def00f..3de224d90 100644 --- a/src/index.ts +++ b/src/index.ts @@ -491,7 +491,7 @@ export interface AzureClientOptions extends ClientOptions { /** API Client for interfacing with the Azure OpenAI API. */ export class AzureOpenAI extends OpenAI { private _azureADTokenProvider: (() => Promise) | undefined; - private _deployment: string | undefined; + deploymentName: string | undefined; apiVersion: string = ''; /** * API Client for interfacing with the Azure OpenAI API. @@ -574,7 +574,7 @@ export class AzureOpenAI extends OpenAI { this._azureADTokenProvider = azureADTokenProvider; this.apiVersion = apiVersion; - this._deployment = deployment; + this.deploymentName = deployment; } override buildRequest( @@ -589,7 +589,7 @@ export class AzureOpenAI extends OpenAI { if (!Core.isObj(options.body)) { throw new Error('Expected request body to be an object'); } - const model = this._deployment || options.body['model']; + const model = this.deploymentName || options.body['model']; if (model !== undefined && !this.baseURL.includes('/deployments')) { options.path = `/deployments/${model}${options.path}`; } @@ -597,7 +597,7 @@ export class AzureOpenAI extends OpenAI { return super.buildRequest(options, props); } - private async _getAzureADToken(): Promise { + async _getAzureADToken(): Promise { if (typeof this._azureADTokenProvider === 'function') { const token = await this._azureADTokenProvider(); if (!token || typeof token !== 'string') { From 6f89573f9b334960195b074e17ad70df32329e8e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 15:45:55 +0000 Subject: [PATCH 121/509] release: 4.81.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d140407b9..de35570a8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.80.1" + ".": "4.81.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e4d4d73b7..b24c0869d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 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) + +### Features + +* **azure:** Realtime API support ([#1287](https://github.com/openai/openai-node/issues/1287)) ([fe090c0](https://github.com/openai/openai-node/commit/fe090c0a57570217eb0b431e2cce40bf61de2b75)) + ## 4.80.1 (2025-01-24) Full Changelog: [v4.80.0...v4.80.1](https://github.com/openai/openai-node/compare/v4.80.0...v4.80.1) diff --git a/jsr.json b/jsr.json index e2ecad87f..18d000862 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.80.1", + "version": "4.81.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 497c7fae9..07faa0019 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.80.1", + "version": "4.81.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 7d762daed..3b4d4eee5 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.80.1'; // x-release-please-version +export const VERSION = '4.81.0'; // x-release-please-version From a0519f5882e4ed1df388f5c7014a6e0d408cdc40 Mon Sep 17 00:00:00 2001 From: Deyaaeldeen Almahallawi Date: Fri, 31 Jan 2025 04:26:47 -0600 Subject: [PATCH 122/509] fix(examples/realtime): remove duplicate `session.update` call (#1293) --- examples/azure/realtime/ws.ts | 7 ------- examples/realtime/ws.ts | 7 ------- 2 files changed, 14 deletions(-) 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', From 608200f7cfdeca079a9a6457f9c306baf96c4712 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 19:08:33 +0000 Subject: [PATCH 123/509] feat(api): add o3-mini (#1295) fix(types): correct metadata type + other fixes --- .stats.yml | 2 +- api.md | 1 + src/index.ts | 1 + src/resources/audio/transcriptions.ts | 4 +- src/resources/batches.ts | 20 ++-- src/resources/beta/assistants.ts | 42 +++++--- src/resources/beta/realtime/realtime.ts | 89 ++++++++++++++-- src/resources/beta/realtime/sessions.ts | 35 ++++-- src/resources/beta/threads/messages.ts | 31 +++--- src/resources/beta/threads/runs/runs.ts | 39 ++++--- src/resources/beta/threads/runs/steps.ts | 11 +- src/resources/beta/threads/threads.ts | 100 +++++++++++------- .../beta/vector-stores/vector-stores.ts | 31 +++--- src/resources/chat/chat.ts | 2 + src/resources/chat/completions.ts | 14 ++- src/resources/shared.ts | 10 ++ src/resources/uploads/uploads.ts | 2 +- tests/api-resources/beta/assistants.test.ts | 6 +- .../beta/threads/messages.test.ts | 2 +- .../beta/threads/runs/runs.test.ts | 4 +- .../beta/threads/threads.test.ts | 18 ++-- 21 files changed, 320 insertions(+), 144 deletions(-) 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/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/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/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' } }, + ], }, }, }, From 145ff671d3a8111c81497f6bc9cd0cb5053a6cb0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 19:09:24 +0000 Subject: [PATCH 124/509] release: 4.82.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) 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/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/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/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 From 7cf2a8571fb3c40ce3e67759af314e37bc3467e0 Mon Sep 17 00:00:00 2001 From: Deyaaeldeen Almahallawi Date: Mon, 3 Feb 2025 11:22:06 -0600 Subject: [PATCH 125/509] fix(azure/audio): use model param for deployments (#1297) --- src/core.ts | 2 ++ src/index.ts | 2 +- src/resources/audio/transcriptions.ts | 5 ++++- src/resources/audio/translations.ts | 5 ++++- tests/lib/azure.test.ts | 10 ++++++---- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/core.ts b/src/core.ts index 3d2d029a5..23d19b5bd 100644 --- a/src/core.ts +++ b/src/core.ts @@ -814,6 +814,7 @@ export type RequestOptions< signal?: AbortSignal | undefined | null; idempotencyKey?: string; + __metadata?: Record; __binaryRequest?: boolean | undefined; __binaryResponse?: boolean | undefined; __streamClass?: typeof Stream; @@ -836,6 +837,7 @@ const requestOptionsKeys: KeysEnum = { signal: true, idempotencyKey: true, + __metadata: true, __binaryRequest: true, __binaryResponse: true, __streamClass: true, diff --git a/src/index.ts b/src/index.ts index f860579d3..f4e940af8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -590,7 +590,7 @@ export class AzureOpenAI extends OpenAI { if (!Core.isObj(options.body)) { throw new Error('Expected request body to be an object'); } - const model = this.deploymentName || options.body['model']; + const model = this.deploymentName || options.body['model'] || options.__metadata?.['model']; if (model !== undefined && !this.baseURL.includes('/deployments')) { options.path = `/deployments/${model}${options.path}`; } diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 6d0a07e1e..d0e671243 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -25,7 +25,10 @@ export class Transcriptions extends APIResource { body: TranscriptionCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.post('/audio/transcriptions', Core.multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/audio/transcriptions', + Core.multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }), + ); } } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index c6bf7c870..0621deecb 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -26,7 +26,10 @@ export class Translations extends APIResource { body: TranslationCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.post('/audio/translations', Core.multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/audio/translations', + Core.multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }), + ); } } diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 0e3c2c5a3..430efbe57 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -495,21 +495,23 @@ describe('azure request building', () => { ); }); - test('Audio translations is not handled', async () => { + test('handles audio translations', async () => { const { url } = (await client.audio.translations.create({ model: deployment, file: { url: 'https://example.com/', blob: () => 0 as any }, })) as any; - expect(url).toStrictEqual(`https://example.com/openai/audio/translations?api-version=${apiVersion}`); + expect(url).toStrictEqual( + `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, + ); }); - test('Audio transcriptions is not handled', async () => { + test('handles audio transcriptions', async () => { const { url } = (await client.audio.transcriptions.create({ model: deployment, file: { url: 'https://example.com/', blob: () => 0 as any }, })) as any; expect(url).toStrictEqual( - `https://example.com/openai/audio/transcriptions?api-version=${apiVersion}`, + `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, ); }); From 29a86274c3965826e132373fccbea430efb3bacd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:39:40 +0000 Subject: [PATCH 126/509] feat(client): send `X-Stainless-Timeout` header (#1299) --- src/core.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/core.ts b/src/core.ts index 23d19b5bd..6578c0781 100644 --- a/src/core.ts +++ b/src/core.ts @@ -315,6 +315,7 @@ export abstract class APIClient { options: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, ): { req: RequestInit; url: string; timeout: number } { + options = { ...options }; const { method, path, query, headers: headers = {} } = options; const body = @@ -327,9 +328,9 @@ export abstract class APIClient { const url = this.buildURL(path!, query); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); - const timeout = options.timeout ?? this.timeout; + options.timeout = options.timeout ?? this.timeout; const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url); - const minAgentTimeout = timeout + 1000; + const minAgentTimeout = options.timeout + 1000; if ( typeof (httpAgent as any)?.options?.timeout === 'number' && minAgentTimeout > ((httpAgent as any).options.timeout ?? 0) @@ -358,7 +359,7 @@ export abstract class APIClient { signal: options.signal ?? null, }; - return { req, url, timeout }; + return { req, url, timeout: options.timeout }; } private buildHeaders({ @@ -386,15 +387,22 @@ export abstract class APIClient { delete reqHeaders['content-type']; } - // Don't set the retry count header if it was already set or removed through default headers or by the - // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to - // account for the removal case. + // Don't set theses headers if they were already set or removed through default headers or by the caller. + // We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account + // for the removal case. if ( getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && getHeader(headers, 'x-stainless-retry-count') === undefined ) { reqHeaders['x-stainless-retry-count'] = String(retryCount); } + if ( + getHeader(defaultHeaders, 'x-stainless-timeout') === undefined && + getHeader(headers, 'x-stainless-timeout') === undefined && + options.timeout + ) { + reqHeaders['x-stainless-timeout'] = String(options.timeout); + } this.validateHeaders(reqHeaders, headers); From bcf459fb5594d3d7198d95c5569cac4aa6bd483e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:26:36 +0000 Subject: [PATCH 127/509] fix(api/types): correct audio duration & role types (#1300) --- .stats.yml | 2 +- api.md | 1 + src/lib/ChatCompletionStream.ts | 3 +- src/resources/audio/transcriptions.ts | 2 +- src/resources/audio/translations.ts | 2 +- src/resources/beta/realtime/realtime.ts | 79 +++++++++++++++++++++++-- src/resources/chat/completions.ts | 4 +- 7 files changed, 83 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index e49b5c56e..df7877dfd 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-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml diff --git a/api.md b/api.md index 516188b20..01854a8e0 100644 --- a/api.md +++ b/api.md @@ -229,6 +229,7 @@ Types: - ConversationItemInputAudioTranscriptionFailedEvent - ConversationItemTruncateEvent - ConversationItemTruncatedEvent +- ConversationItemWithReference - ErrorEvent - InputAudioBufferAppendEvent - InputAudioBufferClearEvent diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index a88f8a23b..6c846f70b 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -12,6 +12,7 @@ import { type ChatCompletionCreateParams, type ChatCompletionCreateParamsStreaming, type ChatCompletionCreateParamsBase, + type ChatCompletionRole, } from '../resources/chat/completions'; import { AbstractChatCompletionRunner, @@ -797,7 +798,7 @@ export namespace ChatCompletionSnapshot { /** * The role of the author of this message. */ - role?: 'system' | 'user' | 'assistant' | 'function' | 'tool'; + role?: ChatCompletionRole; } export namespace Message { diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index d0e671243..6fbe96b58 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -106,7 +106,7 @@ export interface TranscriptionVerbose { /** * The duration of the input audio. */ - duration: string; + duration: number; /** * The language of the input audio. diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 0621deecb..dac519ede 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -41,7 +41,7 @@ export interface TranslationVerbose { /** * The duration of the input audio. */ - duration: string; + duration: number; /** * The language of the output translation (always `english`). diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index c666221e1..e46dcdaaf 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -439,6 +439,76 @@ export interface ConversationItemTruncatedEvent { type: 'conversation.item.truncated'; } +/** + * The item to add to the conversation. + */ +export interface ConversationItemWithReference { + /** + * For an item of type (`message` | `function_call` | `function_call_output`) this + * field allows the client to assign the unique ID of the item. It is not required + * because the server will generate one if not provided. + * + * For an item of type `item_reference`, this field is required and is a reference + * to any item that has previously existed in the conversation. + */ + id?: string; + + /** + * The arguments of the function call (for `function_call` items). + */ + arguments?: string; + + /** + * The ID of the function call (for `function_call` and `function_call_output` + * items). If passed on a `function_call_output` item, the server will check that a + * `function_call` item with the same ID exists in the conversation history. + */ + call_id?: string; + + /** + * The content of the message, applicable for `message` items. + * + * - Message items of role `system` support only `input_text` content + * - Message items of role `user` support `input_text` and `input_audio` content + * - Message items of role `assistant` support `text` content. + */ + content?: Array; + + /** + * The name of the function being called (for `function_call` items). + */ + name?: string; + + /** + * Identifier for the API object being returned - always `realtime.item`. + */ + object?: 'realtime.item'; + + /** + * The output of the function call (for `function_call_output` items). + */ + output?: string; + + /** + * The role of the message sender (`user`, `assistant`, `system`), only applicable + * for `message` items. + */ + role?: 'user' | 'assistant' | 'system'; + + /** + * The status of the item (`completed`, `incomplete`). These have no effect on the + * conversation, but are accepted for consistency with the + * `conversation.item.created` event. + */ + status?: 'completed' | 'incomplete'; + + /** + * The type of the item (`message`, `function_call`, `function_call_output`, + * `item_reference`). + */ + type?: 'message' | 'function_call' | 'function_call_output' | 'item_reference'; +} + /** * Returned when an error occurs, which could be a client problem or a server * problem. Most errors are recoverable and the session will stay open, we @@ -1336,11 +1406,12 @@ export namespace ResponseCreateEvent { conversation?: (string & {}) | 'auto' | 'none'; /** - * Input items to include in the prompt for the model. Creates a new context for - * this response, without including the default conversation. Can include - * references to items from the default conversation. + * Input items to include in the prompt for the model. Using this field creates a + * new context for this Response instead of using the default conversation. An + * empty array `[]` will clear the context for this Response. Note that this can + * include references to items from the default conversation. */ - input?: Array; + input?: Array; /** * The default system instructions (i.e. system message) prepended to model calls. diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index d2de11458..55b008cf0 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -371,7 +371,7 @@ export namespace ChatCompletionChunk { /** * The role of the author of this message. */ - role?: 'system' | 'user' | 'assistant' | 'tool'; + role?: 'developer' | 'system' | 'user' | 'assistant' | 'tool'; tool_calls?: Array; } @@ -756,7 +756,7 @@ export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high'; /** * The role of the author of a message */ -export type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'tool' | 'function'; +export type ChatCompletionRole = 'developer' | 'system' | 'user' | 'assistant' | 'tool' | 'function'; /** * Options for streaming response. Only set this when you set `stream: true`. From 41a7ce315f3ee4495ae259d9bbed77701dc52430 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 12:26:03 +0000 Subject: [PATCH 128/509] release: 4.83.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b2ee58e08..6eb0f130e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.82.0" + ".": "4.83.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 7565cb01a..f61def5e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.83.0 (2025-02-05) + +Full Changelog: [v4.82.0...v4.83.0](https://github.com/openai/openai-node/compare/v4.82.0...v4.83.0) + +### Features + +* **client:** send `X-Stainless-Timeout` header ([#1299](https://github.com/openai/openai-node/issues/1299)) ([ddfc686](https://github.com/openai/openai-node/commit/ddfc686f43a3420c3adf8dec2e82b4d10a121eb8)) + + +### Bug Fixes + +* **api/types:** correct audio duration & role types ([#1300](https://github.com/openai/openai-node/issues/1300)) ([a955ac2](https://github.com/openai/openai-node/commit/a955ac2bf5bee663d530d0c82b0005bf3ce6fc47)) +* **azure/audio:** use model param for deployments ([#1297](https://github.com/openai/openai-node/issues/1297)) ([85de382](https://github.com/openai/openai-node/commit/85de382db17cbe5f112650e79d0fc1cc841efbb2)) + ## 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) diff --git a/jsr.json b/jsr.json index 7569332ce..6fa05e624 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.82.0", + "version": "4.83.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 42e00822d..bd507e9f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.82.0", + "version": "4.83.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 07241a8cf..13c764d7d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.82.0'; // x-release-please-version +export const VERSION = '4.83.0'; // x-release-please-version From d71e56c39ff4470c8cb57ac9e49f04251372efc4 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 1 Jan 2025 20:43:12 -0500 Subject: [PATCH 129/509] chore: bump license year chore: unknown commit message --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 621a6becf..f011417af 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 OpenAI + Copyright 2025 OpenAI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 2cdfa926fca1910aaaf99695b394f0c9dc6a0dec Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:48:59 -0500 Subject: [PATCH 130/509] chore(api): bump spec version chore: unknown commit message --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 248cc366d..d223c8f1f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-a39aca84ed97ebafb707ebd5221e2787c5a42ff3d98f2ffaea8a0dcd84cbcbcb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-02200a58ed631064b6419711da99fefd6e97bdbbeb577a80a1a6e0c8dbcb18f5.yml From b535448fb25de5b90f58bf02821bcb762d7f3d25 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:04:34 -0500 Subject: [PATCH 131/509] docs(readme): fix misplaced . chore: unknown commit message --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index eb659577f..f2ec030b6 100644 --- a/README.md +++ b/README.md @@ -628,7 +628,7 @@ await client.models.list({ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: 1. Changes that only affect static types, without breaking runtime behavior. -2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. +2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_ 3. Changes that we do not expect to impact the vast majority of users in practice. We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. From f94f2704394b4318acc55d571fcd3f65b27ac9eb Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:38:24 -0500 Subject: [PATCH 132/509] feat(client): add realtime types chore: unknown commit message --- .stats.yml | 4 +- api.md | 60 + src/resources/beta/beta.ts | 6 + src/resources/beta/index.ts | 1 + src/resources/beta/realtime/index.ts | 4 + src/resources/beta/realtime/realtime.ts | 1904 +++++++++++++++++ src/resources/beta/realtime/sessions.ts | 547 +++++ .../beta/realtime/sessions.test.ts | 44 + 8 files changed, 2568 insertions(+), 2 deletions(-) create mode 100644 src/resources/beta/realtime/index.ts create mode 100644 src/resources/beta/realtime/realtime.ts create mode 100644 src/resources/beta/realtime/sessions.ts create mode 100644 tests/api-resources/beta/realtime/sessions.test.ts diff --git a/.stats.yml b/.stats.yml index d223c8f1f..9600edae3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-02200a58ed631064b6419711da99fefd6e97bdbbeb577a80a1a6e0c8dbcb18f5.yml +configured_endpoints: 69 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b5b0e2c794b012919701c3fd43286af10fa25d33ceb8a881bec2636028f446e0.yml diff --git a/api.md b/api.md index cd4c59e0c..02f26d475 100644 --- a/api.md +++ b/api.md @@ -212,6 +212,66 @@ Methods: # Beta +## Realtime + +Types: + +- ConversationCreatedEvent +- ConversationItem +- ConversationItemContent +- ConversationItemCreateEvent +- ConversationItemCreatedEvent +- ConversationItemDeleteEvent +- ConversationItemDeletedEvent +- ConversationItemInputAudioTranscriptionCompletedEvent +- ConversationItemInputAudioTranscriptionFailedEvent +- ConversationItemTruncateEvent +- ConversationItemTruncatedEvent +- ErrorEvent +- InputAudioBufferAppendEvent +- InputAudioBufferClearEvent +- InputAudioBufferClearedEvent +- InputAudioBufferCommitEvent +- InputAudioBufferCommittedEvent +- InputAudioBufferSpeechStartedEvent +- InputAudioBufferSpeechStoppedEvent +- RateLimitsUpdatedEvent +- RealtimeClientEvent +- RealtimeResponse +- RealtimeResponseStatus +- RealtimeResponseUsage +- RealtimeServerEvent +- ResponseAudioDeltaEvent +- ResponseAudioDoneEvent +- ResponseAudioTranscriptDeltaEvent +- ResponseAudioTranscriptDoneEvent +- ResponseCancelEvent +- ResponseContentPartAddedEvent +- ResponseContentPartDoneEvent +- ResponseCreateEvent +- ResponseCreatedEvent +- ResponseDoneEvent +- ResponseFunctionCallArgumentsDeltaEvent +- ResponseFunctionCallArgumentsDoneEvent +- ResponseOutputItemAddedEvent +- ResponseOutputItemDoneEvent +- ResponseTextDeltaEvent +- ResponseTextDoneEvent +- SessionCreatedEvent +- SessionUpdateEvent +- SessionUpdatedEvent + +### Sessions + +Types: + +- Session +- SessionCreateResponse + +Methods: + +- client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse + ## VectorStores Types: diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 1d1f8e255..78cef3c68 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -21,6 +21,8 @@ import { RunStreamEvent, ThreadStreamEvent, } from './assistants'; +import * as RealtimeAPI from './realtime/realtime'; +import { Realtime } from './realtime/realtime'; import * as ThreadsAPI from './threads/threads'; import { AssistantResponseFormatOption, @@ -58,17 +60,21 @@ import { import { Chat } from './chat/chat'; export class Beta extends APIResource { + realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client); vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client); chat: ChatAPI.Chat = new ChatAPI.Chat(this._client); assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client); threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } +Beta.Realtime = Realtime; Beta.VectorStores = VectorStores; Beta.Assistants = Assistants; Beta.Threads = Threads; export declare namespace Beta { + export { Realtime as Realtime }; + export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 633df5e82..7c2ffa9f5 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -19,6 +19,7 @@ export { type AssistantsPage, } from './assistants'; export { Beta } from './beta'; +export { Realtime } from './realtime/index'; export { Chat } from './chat/index'; export { Threads, diff --git a/src/resources/beta/realtime/index.ts b/src/resources/beta/realtime/index.ts new file mode 100644 index 000000000..66c3ecaae --- /dev/null +++ b/src/resources/beta/realtime/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Realtime } from './realtime'; +export { Sessions, type Session, type SessionCreateResponse, type SessionCreateParams } from './sessions'; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts new file mode 100644 index 000000000..5de06917a --- /dev/null +++ b/src/resources/beta/realtime/realtime.ts @@ -0,0 +1,1904 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as RealtimeAPI from './realtime'; +import * as SessionsAPI from './sessions'; +import { + Session as SessionsAPISession, + SessionCreateParams, + SessionCreateResponse, + Sessions, +} from './sessions'; + +export class Realtime extends APIResource { + sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client); +} + +/** + * Returned when a conversation is created. Emitted right after session creation. + */ +export interface ConversationCreatedEvent { + /** + * The conversation resource. + */ + conversation: ConversationCreatedEvent.Conversation; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `conversation.created`. + */ + type: 'conversation.created'; +} + +export namespace ConversationCreatedEvent { + /** + * The conversation resource. + */ + export interface Conversation { + /** + * The unique ID of the conversation. + */ + id?: string; + + /** + * The object type, must be `realtime.conversation`. + */ + object?: 'realtime.conversation'; + } +} + +/** + * The item to add to the conversation. + */ +export interface ConversationItem { + /** + * The unique ID of the item, this can be generated by the client to help manage + * server-side context, but is not required because the server will generate one if + * not provided. + */ + id?: string; + + /** + * The arguments of the function call (for `function_call` items). + */ + arguments?: string; + + /** + * The ID of the function call (for `function_call` and `function_call_output` + * items). If passed on a `function_call_output` item, the server will check that a + * `function_call` item with the same ID exists in the conversation history. + */ + call_id?: string; + + /** + * The content of the message, applicable for `message` items. + * + * - Message items of role `system` support only `input_text` content + * - Message items of role `user` support `input_text` and `input_audio` content + * - Message items of role `assistant` support `text` content. + */ + content?: Array; + + /** + * The name of the function being called (for `function_call` items). + */ + name?: string; + + /** + * Identifier for the API object being returned - always `realtime.item`. + */ + object?: 'realtime.item'; + + /** + * The output of the function call (for `function_call_output` items). + */ + output?: string; + + /** + * The role of the message sender (`user`, `assistant`, `system`), only applicable + * for `message` items. + */ + role?: 'user' | 'assistant' | 'system'; + + /** + * The status of the item (`completed`, `incomplete`). These have no effect on the + * conversation, but are accepted for consistency with the + * `conversation.item.created` event. + */ + status?: 'completed' | 'incomplete'; + + /** + * The type of the item (`message`, `function_call`, `function_call_output`). + */ + type?: 'message' | 'function_call' | 'function_call_output'; +} + +export interface ConversationItemContent { + /** + * ID of a previous conversation item to reference (for `item_reference` content + * types in `response.create` events). These can reference both client and server + * created items. + */ + id?: string; + + /** + * Base64-encoded audio bytes, used for `input_audio` content type. + */ + audio?: string; + + /** + * The text content, used for `input_text` and `text` content types. + */ + text?: string; + + /** + * The transcript of the audio, used for `input_audio` content type. + */ + transcript?: string; + + /** + * The content type (`input_text`, `input_audio`, `item_reference`, `text`). + */ + type?: 'input_text' | 'input_audio' | 'item_reference' | 'text'; +} + +/** + * Add a new Item to the Conversation's context, including messages, function + * calls, and function call responses. This event can be used both to populate a + * "history" of the conversation and to add new items mid-stream, but has the + * current limitation that it cannot populate assistant audio messages. + * + * If successful, the server will respond with a `conversation.item.created` event, + * otherwise an `error` event will be sent. + */ +export interface ConversationItemCreateEvent { + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The event type, must be `conversation.item.create`. + */ + type: 'conversation.item.create'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * The ID of the preceding item after which the new item will be inserted. If not + * set, the new item will be appended to the end of the conversation. If set, it + * allows an item to be inserted mid-conversation. If the ID cannot be found, an + * error will be returned and the item will not be added. + */ + previous_item_id?: string; +} + +/** + * Returned when a conversation item is created. There are several scenarios that + * produce this event: + * + * - The server is generating a Response, which if successful will produce either + * one or two Items, which will be of type `message` (role `assistant`) or type + * `function_call`. + * - The input audio buffer has been committed, either by the client or the server + * (in `server_vad` mode). The server will take the content of the input audio + * buffer and add it to a new user message Item. + * - The client has sent a `conversation.item.create` event to add a new Item to + * the Conversation. + */ +export interface ConversationItemCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The ID of the preceding item in the Conversation context, allows the client to + * understand the order of the conversation. + */ + previous_item_id: string; + + /** + * The event type, must be `conversation.item.created`. + */ + type: 'conversation.item.created'; +} + +/** + * Send this event when you want to remove any item from the conversation history. + * The server will respond with a `conversation.item.deleted` event, unless the + * item does not exist in the conversation history, in which case the server will + * respond with an error. + */ +export interface ConversationItemDeleteEvent { + /** + * The ID of the item to delete. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.delete`. + */ + type: 'conversation.item.delete'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an item in the conversation is deleted by the client with a + * `conversation.item.delete` event. This event is used to synchronize the server's + * understanding of the conversation history with the client's view. + */ +export interface ConversationItemDeletedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item that was deleted. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.deleted`. + */ + type: 'conversation.item.deleted'; +} + +/** + * This event is the output of audio transcription for user audio written to the + * user audio buffer. Transcription begins when the input audio buffer is committed + * by the client or server (in `server_vad` mode). Transcription runs + * asynchronously with Response creation, so this event may come before or after + * the Response events. + * + * Realtime API models accept audio natively, and thus input transcription is a + * separate process run on a separate ASR (Automatic Speech Recognition) model, + * currently always `whisper-1`. Thus the transcript may diverge somewhat from the + * model's interpretation, and should be treated as a rough guide. + */ +export interface ConversationItemInputAudioTranscriptionCompletedEvent { + /** + * The index of the content part containing the audio. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item containing the audio. + */ + item_id: string; + + /** + * The transcribed text. + */ + transcript: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.completed`. + */ + type: 'conversation.item.input_audio_transcription.completed'; +} + +/** + * Returned when input audio transcription is configured, and a transcription + * request for a user message failed. These events are separate from other `error` + * events so that the client can identify the related Item. + */ +export interface ConversationItemInputAudioTranscriptionFailedEvent { + /** + * The index of the content part containing the audio. + */ + content_index: number; + + /** + * Details of the transcription error. + */ + error: ConversationItemInputAudioTranscriptionFailedEvent.Error; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.failed`. + */ + type: 'conversation.item.input_audio_transcription.failed'; +} + +export namespace ConversationItemInputAudioTranscriptionFailedEvent { + /** + * Details of the transcription error. + */ + export interface Error { + /** + * Error code, if any. + */ + code?: string; + + /** + * A human-readable error message. + */ + message?: string; + + /** + * Parameter related to the error, if any. + */ + param?: string; + + /** + * The type of error. + */ + type?: string; + } +} + +/** + * Send this event to truncate a previous assistant message’s audio. The server + * will produce audio faster than realtime, so this event is useful when the user + * interrupts to truncate audio that has already been sent to the client but not + * yet played. This will synchronize the server's understanding of the audio with + * the client's playback. + * + * Truncating audio will delete the server-side text transcript to ensure there is + * not text in the context that hasn't been heard by the user. + * + * If successful, the server will respond with a `conversation.item.truncated` + * event. + */ +export interface ConversationItemTruncateEvent { + /** + * Inclusive duration up to which audio is truncated, in milliseconds. If the + * audio_end_ms is greater than the actual audio duration, the server will respond + * with an error. + */ + audio_end_ms: number; + + /** + * The index of the content part to truncate. Set this to 0. + */ + content_index: number; + + /** + * The ID of the assistant message item to truncate. Only assistant message items + * can be truncated. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.truncate`. + */ + type: 'conversation.item.truncate'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an earlier assistant audio message item is truncated by the client + * with a `conversation.item.truncate` event. This event is used to synchronize the + * server's understanding of the audio with the client's playback. + * + * This action will truncate the audio and remove the server-side text transcript + * to ensure there is no text in the context that hasn't been heard by the user. + */ +export interface ConversationItemTruncatedEvent { + /** + * The duration up to which the audio was truncated, in milliseconds. + */ + audio_end_ms: number; + + /** + * The index of the content part that was truncated. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the assistant message item that was truncated. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.truncated`. + */ + type: 'conversation.item.truncated'; +} + +/** + * Returned when an error occurs, which could be a client problem or a server + * problem. Most errors are recoverable and the session will stay open, we + * recommend to implementors to monitor and log error messages by default. + */ +export interface ErrorEvent { + /** + * Details of the error. + */ + error: ErrorEvent.Error; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `error`. + */ + type: 'error'; +} + +export namespace ErrorEvent { + /** + * Details of the error. + */ + export interface Error { + /** + * A human-readable error message. + */ + message: string; + + /** + * The type of error (e.g., "invalid_request_error", "server_error"). + */ + type: string; + + /** + * Error code, if any. + */ + code?: string | null; + + /** + * The event_id of the client event that caused the error, if applicable. + */ + event_id?: string | null; + + /** + * Parameter related to the error, if any. + */ + param?: string | null; + } +} + +/** + * Send this event to append audio bytes to the input audio buffer. The audio + * buffer is temporary storage you can write to and later commit. In Server VAD + * mode, the audio buffer is used to detect speech and the server will decide when + * to commit. When Server VAD is disabled, you must commit the audio buffer + * manually. + * + * The client may choose how much audio to place in each event up to a maximum of + * 15 MiB, for example streaming smaller chunks from the client may allow the VAD + * to be more responsive. Unlike made other client events, the server will not send + * a confirmation response to this event. + */ +export interface InputAudioBufferAppendEvent { + /** + * Base64-encoded audio bytes. This must be in the format specified by the + * `input_audio_format` field in the session configuration. + */ + audio: string; + + /** + * The event type, must be `input_audio_buffer.append`. + */ + type: 'input_audio_buffer.append'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Send this event to clear the audio bytes in the buffer. The server will respond + * with an `input_audio_buffer.cleared` event. + */ +export interface InputAudioBufferClearEvent { + /** + * The event type, must be `input_audio_buffer.clear`. + */ + type: 'input_audio_buffer.clear'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when the input audio buffer is cleared by the client with a + * `input_audio_buffer.clear` event. + */ +export interface InputAudioBufferClearedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The event type, must be `input_audio_buffer.cleared`. + */ + type: 'input_audio_buffer.cleared'; +} + +/** + * Send this event to commit the user input audio buffer, which will create a new + * user message item in the conversation. This event will produce an error if the + * input audio buffer is empty. When in Server VAD mode, the client does not need + * to send this event, the server will commit the audio buffer automatically. + * + * Committing the input audio buffer will trigger input audio transcription (if + * enabled in session configuration), but it will not create a response from the + * model. The server will respond with an `input_audio_buffer.committed` event. + */ +export interface InputAudioBufferCommitEvent { + /** + * The event type, must be `input_audio_buffer.commit`. + */ + type: 'input_audio_buffer.commit'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +/** + * Returned when an input audio buffer is committed, either by the client or + * automatically in server VAD mode. The `item_id` property is the ID of the user + * message item that will be created, thus a `conversation.item.created` event will + * also be sent to the client. + */ +export interface InputAudioBufferCommittedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created. + */ + item_id: string; + + /** + * The ID of the preceding item after which the new item will be inserted. + */ + previous_item_id: string; + + /** + * The event type, must be `input_audio_buffer.committed`. + */ + type: 'input_audio_buffer.committed'; +} + +/** + * Sent by the server when in `server_vad` mode to indicate that speech has been + * detected in the audio buffer. This can happen any time audio is added to the + * buffer (unless speech is already detected). The client may want to use this + * event to interrupt audio playback or provide visual feedback to the user. + * + * The client should expect to receive a `input_audio_buffer.speech_stopped` event + * when speech stops. The `item_id` property is the ID of the user message item + * that will be created when speech stops and will also be included in the + * `input_audio_buffer.speech_stopped` event (unless the client manually commits + * the audio buffer during VAD activation). + */ +export interface InputAudioBufferSpeechStartedEvent { + /** + * Milliseconds from the start of all audio written to the buffer during the + * session when speech was first detected. This will correspond to the beginning of + * audio sent to the model, and thus includes the `prefix_padding_ms` configured in + * the Session. + */ + audio_start_ms: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created when speech stops. + */ + item_id: string; + + /** + * The event type, must be `input_audio_buffer.speech_started`. + */ + type: 'input_audio_buffer.speech_started'; +} + +/** + * Returned in `server_vad` mode when the server detects the end of speech in the + * audio buffer. The server will also send an `conversation.item.created` event + * with the user message item that is created from the audio buffer. + */ +export interface InputAudioBufferSpeechStoppedEvent { + /** + * Milliseconds since the session started when speech stopped. This will correspond + * to the end of audio sent to the model, and thus includes the + * `min_silence_duration_ms` configured in the Session. + */ + audio_end_ms: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the user message item that will be created. + */ + item_id: string; + + /** + * The event type, must be `input_audio_buffer.speech_stopped`. + */ + type: 'input_audio_buffer.speech_stopped'; +} + +/** + * Emitted at the beginning of a Response to indicate the updated rate limits. When + * a Response is created some tokens will be "reserved" for the output tokens, the + * rate limits shown here reflect that reservation, which is then adjusted + * accordingly once the Response is completed. + */ +export interface RateLimitsUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * List of rate limit information. + */ + rate_limits: Array; + + /** + * The event type, must be `rate_limits.updated`. + */ + type: 'rate_limits.updated'; +} + +export namespace RateLimitsUpdatedEvent { + export interface RateLimit { + /** + * The maximum allowed value for the rate limit. + */ + limit?: number; + + /** + * The name of the rate limit (`requests`, `tokens`). + */ + name?: 'requests' | 'tokens'; + + /** + * The remaining value before the limit is reached. + */ + remaining?: number; + + /** + * Seconds until the rate limit resets. + */ + reset_seconds?: number; + } +} + +/** + * All events that the client can send to the Realtime API + */ +export type RealtimeClientEvent = + | SessionUpdateEvent + | InputAudioBufferAppendEvent + | InputAudioBufferCommitEvent + | InputAudioBufferClearEvent + | ConversationItemCreateEvent + | ConversationItemTruncateEvent + | ConversationItemDeleteEvent + | ResponseCreateEvent + | ResponseCancelEvent; + +/** + * The response resource. + */ +export interface RealtimeResponse { + /** + * The unique ID of the response. + */ + id?: string; + + /** + * Developer-provided string key-value pairs associated with this response. + */ + metadata?: unknown | null; + + /** + * The object type, must be `realtime.response`. + */ + object?: 'realtime.response'; + + /** + * The list of output items generated by the response. + */ + output?: Array; + + /** + * The final status of the response (`completed`, `cancelled`, `failed`, or + * `incomplete`). + */ + status?: 'completed' | 'cancelled' | 'failed' | 'incomplete'; + + /** + * Additional details about the status. + */ + status_details?: RealtimeResponseStatus; + + /** + * 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 + * Conversation, thus output from previous turns (text and audio tokens) will + * become the input for later turns. + */ + usage?: RealtimeResponseUsage; +} + +/** + * Additional details about the status. + */ +export interface RealtimeResponseStatus { + /** + * A description of the error that caused the response to fail, populated when the + * `status` is `failed`. + */ + error?: RealtimeResponseStatus.Error; + + /** + * The reason the Response did not complete. For a `cancelled` Response, one of + * `turn_detected` (the server VAD detected a new start of speech) or + * `client_cancelled` (the client sent a cancel event). For an `incomplete` + * Response, one of `max_output_tokens` or `content_filter` (the server-side safety + * filter activated and cut off the response). + */ + reason?: 'turn_detected' | 'client_cancelled' | 'max_output_tokens' | 'content_filter'; + + /** + * The type of error that caused the response to fail, corresponding with the + * `status` field (`completed`, `cancelled`, `incomplete`, `failed`). + */ + type?: 'completed' | 'cancelled' | 'incomplete' | 'failed'; +} + +export namespace RealtimeResponseStatus { + /** + * A description of the error that caused the response to fail, populated when the + * `status` is `failed`. + */ + export interface Error { + /** + * Error code, if any. + */ + code?: string; + + /** + * The type of error. + */ + type?: string; + } +} + +/** + * 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 + * Conversation, thus output from previous turns (text and audio tokens) will + * become the input for later turns. + */ +export interface RealtimeResponseUsage { + /** + * Details about the input tokens used in the Response. + */ + input_token_details?: RealtimeResponseUsage.InputTokenDetails; + + /** + * The number of input tokens used in the Response, including text and audio + * tokens. + */ + input_tokens?: number; + + /** + * Details about the output tokens used in the Response. + */ + output_token_details?: RealtimeResponseUsage.OutputTokenDetails; + + /** + * The number of output tokens sent in the Response, including text and audio + * tokens. + */ + output_tokens?: number; + + /** + * The total number of tokens in the Response including input and output text and + * audio tokens. + */ + total_tokens?: number; +} + +export namespace RealtimeResponseUsage { + /** + * Details about the input tokens used in the Response. + */ + export interface InputTokenDetails { + /** + * The number of audio tokens used in the Response. + */ + audio_tokens?: number; + + /** + * The number of cached tokens used in the Response. + */ + cached_tokens?: number; + + /** + * The number of text tokens used in the Response. + */ + text_tokens?: number; + } + + /** + * Details about the output tokens used in the Response. + */ + export interface OutputTokenDetails { + /** + * The number of audio tokens used in the Response. + */ + audio_tokens?: number; + + /** + * The number of text tokens used in the Response. + */ + text_tokens?: number; + } +} + +/** + * All events that the Realtime API can send back + */ +export type RealtimeServerEvent = + | ErrorEvent + | SessionCreatedEvent + | SessionUpdatedEvent + | ConversationCreatedEvent + | InputAudioBufferCommittedEvent + | InputAudioBufferClearedEvent + | InputAudioBufferSpeechStartedEvent + | InputAudioBufferSpeechStoppedEvent + | ConversationItemCreatedEvent + | ConversationItemInputAudioTranscriptionCompletedEvent + | ConversationItemInputAudioTranscriptionFailedEvent + | ConversationItemTruncatedEvent + | ConversationItemDeletedEvent + | ResponseCreatedEvent + | ResponseDoneEvent + | ResponseOutputItemAddedEvent + | ResponseOutputItemDoneEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent + | ResponseTextDeltaEvent + | ResponseTextDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent + | RateLimitsUpdatedEvent; + +/** + * Returned when the model-generated audio is updated. + */ +export interface ResponseAudioDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * Base64-encoded audio data delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio.delta`. + */ + type: 'response.audio.delta'; +} + +/** + * Returned when the model-generated audio is done. Also emitted when a Response is + * interrupted, incomplete, or cancelled. + */ +export interface ResponseAudioDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio.done`. + */ + type: 'response.audio.done'; +} + +/** + * Returned when the model-generated transcription of audio output is updated. + */ +export interface ResponseAudioTranscriptDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The transcript delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.audio_transcript.delta`. + */ + type: 'response.audio_transcript.delta'; +} + +/** + * Returned when the model-generated transcription of audio output is done + * streaming. Also emitted when a Response is interrupted, incomplete, or + * cancelled. + */ +export interface ResponseAudioTranscriptDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The final transcript of the audio. + */ + transcript: string; + + /** + * The event type, must be `response.audio_transcript.done`. + */ + type: 'response.audio_transcript.done'; +} + +/** + * Send this event to cancel an in-progress response. The server will respond with + * a `response.cancelled` event or an error if there is no response to cancel. + */ +export interface ResponseCancelEvent { + /** + * The event type, must be `response.cancel`. + */ + type: 'response.cancel'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * A specific response ID to cancel - if not provided, will cancel an in-progress + * response in the default conversation. + */ + response_id?: string; +} + +/** + * Returned when a new content part is added to an assistant message item during + * response generation. + */ +export interface ResponseContentPartAddedEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item to which the content part was added. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The content part that was added. + */ + part: ResponseContentPartAddedEvent.Part; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.content_part.added`. + */ + type: 'response.content_part.added'; +} + +export namespace ResponseContentPartAddedEvent { + /** + * The content part that was added. + */ + export interface Part { + /** + * Base64-encoded audio data (if type is "audio"). + */ + audio?: string; + + /** + * The text content (if type is "text"). + */ + text?: string; + + /** + * The transcript of the audio (if type is "audio"). + */ + transcript?: string; + + /** + * The content type ("text", "audio"). + */ + type?: 'text' | 'audio'; + } +} + +/** + * Returned when a content part is done streaming in an assistant message item. + * Also emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseContentPartDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The content part that is done. + */ + part: ResponseContentPartDoneEvent.Part; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.content_part.done`. + */ + type: 'response.content_part.done'; +} + +export namespace ResponseContentPartDoneEvent { + /** + * The content part that is done. + */ + export interface Part { + /** + * Base64-encoded audio data (if type is "audio"). + */ + audio?: string; + + /** + * The text content (if type is "text"). + */ + text?: string; + + /** + * The transcript of the audio (if type is "audio"). + */ + transcript?: string; + + /** + * The content type ("text", "audio"). + */ + type?: 'text' | 'audio'; + } +} + +/** + * This event instructs the server to create a Response, which means triggering + * model inference. When in Server VAD mode, the server will create Responses + * automatically. + * + * A Response will include at least one Item, and may have two, in which case the + * second will be a function call. These Items will be appended to the conversation + * history. + * + * The server will respond with a `response.created` event, events for Items and + * content created, and finally a `response.done` event to indicate the Response is + * complete. + * + * The `response.create` event includes inference configuration like + * `instructions`, and `temperature`. These fields will override the Session's + * configuration for this Response only. + */ +export interface ResponseCreateEvent { + /** + * The event type, must be `response.create`. + */ + type: 'response.create'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; + + /** + * Create a new Realtime response with these parameters + */ + response?: ResponseCreateEvent.Response; +} + +export namespace ResponseCreateEvent { + /** + * Create a new Realtime response with these parameters + */ + export interface Response { + /** + * Controls which conversation the response is added to. Currently supports `auto` + * and `none`, with `auto` as the default value. The `auto` value means that the + * contents of the response will be added to the default conversation. Set this to + * `none` to create an out-of-band response which will not add items to default + * conversation. + */ + conversation?: (string & {}) | 'auto' | 'none'; + + /** + * Input items to include in the prompt for the model. Creates a new context for + * this response, without including the default conversation. Can include + * references to items from the default conversation. + */ + input?: Array; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_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. Keys + * can be a maximum of 64 characters long and values can be a maximum of 512 + * characters long. + */ + metadata?: unknown | null; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function, like `{"type": "function", "function": {"name": "my_function"}}`. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + } + + export namespace Response { + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + } +} + +/** + * Returned when a new Response is created. The first event of response creation, + * where the response is in an initial state of `in_progress`. + */ +export interface ResponseCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The response resource. + */ + response: RealtimeResponse; + + /** + * The event type, must be `response.created`. + */ + type: 'response.created'; +} + +/** + * Returned when a Response is done streaming. Always emitted, no matter the final + * state. The Response object included in the `response.done` event will include + * all output Items in the Response but will omit the raw audio data. + */ +export interface ResponseDoneEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The response resource. + */ + response: RealtimeResponse; + + /** + * The event type, must be `response.done`. + */ + type: 'response.done'; +} + +/** + * Returned when the model-generated function call arguments are updated. + */ +export interface ResponseFunctionCallArgumentsDeltaEvent { + /** + * The ID of the function call. + */ + call_id: string; + + /** + * The arguments delta as a JSON string. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the function call item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.function_call_arguments.delta`. + */ + type: 'response.function_call_arguments.delta'; +} + +/** + * Returned when the model-generated function call arguments are done streaming. + * Also emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseFunctionCallArgumentsDoneEvent { + /** + * The final arguments as a JSON string. + */ + arguments: string; + + /** + * The ID of the function call. + */ + call_id: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the function call item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.function_call_arguments.done`. + */ + type: 'response.function_call_arguments.done'; +} + +/** + * Returned when a new Item is created during Response generation. + */ +export interface ResponseOutputItemAddedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The index of the output item in the Response. + */ + output_index: number; + + /** + * The ID of the Response to which the item belongs. + */ + response_id: string; + + /** + * The event type, must be `response.output_item.added`. + */ + type: 'response.output_item.added'; +} + +/** + * Returned when an Item is done streaming. Also emitted when a Response is + * interrupted, incomplete, or cancelled. + */ +export interface ResponseOutputItemDoneEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: ConversationItem; + + /** + * The index of the output item in the Response. + */ + output_index: number; + + /** + * The ID of the Response to which the item belongs. + */ + response_id: string; + + /** + * The event type, must be `response.output_item.done`. + */ + type: 'response.output_item.done'; +} + +/** + * Returned when the text value of a "text" content part is updated. + */ +export interface ResponseTextDeltaEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The text delta. + */ + delta: string; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The event type, must be `response.text.delta`. + */ + type: 'response.text.delta'; +} + +/** + * Returned when the text value of a "text" content part is done streaming. Also + * emitted when a Response is interrupted, incomplete, or cancelled. + */ +export interface ResponseTextDoneEvent { + /** + * The index of the content part in the item's content array. + */ + content_index: number; + + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item in the response. + */ + output_index: number; + + /** + * The ID of the response. + */ + response_id: string; + + /** + * The final text content. + */ + text: string; + + /** + * The event type, must be `response.text.done`. + */ + type: 'response.text.done'; +} + +/** + * Returned when a Session is created. Emitted automatically when a new connection + * is established as the first server event. This event will contain the default + * Session configuration. + */ +export interface SessionCreatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * Realtime session object configuration. + */ + session: SessionsAPI.Session; + + /** + * The event type, must be `session.created`. + */ + type: 'session.created'; +} + +/** + * Send this event to update the session’s default configuration. The client may + * send this event at any time to update the session configuration, and any field + * may be updated at any time, except for "voice". The server will respond with a + * `session.updated` event that shows the full effective configuration. Only fields + * that are present are updated, thus the correct way to clear a field like + * "instructions" is to pass an empty string. + */ +export interface SessionUpdateEvent { + /** + * Realtime session object configuration. + */ + session: SessionUpdateEvent.Session; + + /** + * The event type, must be `session.update`. + */ + type: 'session.update'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +export namespace SessionUpdateEvent { + /** + * Realtime session object configuration. + */ + export interface Session { + /** + * The Realtime model used for this session. + */ + model: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: Session.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + } + + export namespace Session { + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when VAD is enabled. `true` + * by default. + */ + create_response?: boolean; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } + } +} + +/** + * Returned when a session is updated with a `session.update` event, unless there + * is an error. + */ +export interface SessionUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * Realtime session object configuration. + */ + session: SessionsAPI.Session; + + /** + * The event type, must be `session.updated`. + */ + type: 'session.updated'; +} + +Realtime.Sessions = Sessions; + +export declare namespace Realtime { + export { + Sessions as Sessions, + type SessionsAPISession as Session, + type SessionCreateResponse as SessionCreateResponse, + type SessionCreateParams as SessionCreateParams, + }; +} diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts new file mode 100644 index 000000000..855989cd8 --- /dev/null +++ b/src/resources/beta/realtime/sessions.ts @@ -0,0 +1,547 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { APIPromise } from '../../../api-promise'; +import { RequestOptions } from '../../../internal/request-options'; + +export class Sessions extends APIResource { + /** + * Create an ephemeral API token for use in client-side applications with the + * Realtime API. Can be configured with the same session parameters as the + * `session.update` client event. + * + * It responds with a session object, plus a `client_secret` key which contains a + * usable ephemeral API token that can be used to authenticate browser clients for + * the Realtime API. + */ + create(body: SessionCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/realtime/sessions', { + body, + ...options, + headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + }); + } +} + +/** + * Realtime session object configuration. + */ +export interface Session { + /** + * Unique identifier for the session object. + */ + id?: string; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The Realtime model used for this session. + */ + model?: + | (string & {}) + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: Session.TurnDetection | null; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +export namespace Session { + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: 'server_vad'; + } +} + +/** + * A new Realtime session configuration, with an ephermeral key. Default TTL for + * keys is one minute. + */ +export interface SessionCreateResponse { + /** + * Ephemeral key returned by the API. + */ + client_secret?: SessionCreateResponse.ClientSecret; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: string; + + /** + * 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. + */ + input_audio_transcription?: SessionCreateResponse.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: string; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: SessionCreateResponse.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +export namespace SessionCreateResponse { + /** + * Ephemeral key returned by the API. + */ + export interface ClientSecret { + /** + * Timestamp for when the token expires. Currently, all tokens expire after one + * minute. + */ + 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; + } + + /** + * 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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export interface SessionCreateParams { + /** + * The Realtime model used for this session. + */ + model: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * 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. + */ + input_audio_transcription?: SessionCreateParams.InputAudioTranscription; + + /** + * The default system instructions (i.e. system message) prepended to model calls. + * This field allows the client to guide the model on desired responses. The model + * can be instructed on response content and format, (e.g. "be extremely succinct", + * "act friendly", "here are examples of good responses") and on audio behavior + * (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The + * instructions are not guaranteed to be followed by the model, but they provide + * guidance to the model on the desired behavior. + * + * Note that the server sets default instructions which will be used if this field + * is not set and are visible in the `session.created` event at the start of the + * session. + */ + instructions?: string; + + /** + * Maximum number of output tokens for a single assistant response, inclusive of + * tool calls. Provide an integer between 1 and 4096 to limit output tokens, or + * `inf` for the maximum available tokens for a given model. Defaults to `inf`. + */ + max_response_output_tokens?: number | 'inf'; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + */ + temperature?: number; + + /** + * How the model chooses tools. Options are `auto`, `none`, `required`, or specify + * a function. + */ + tool_choice?: string; + + /** + * Tools (functions) available to the model. + */ + tools?: Array; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: SessionCreateParams.TurnDetection; + + /** + * The voice the model uses to respond. Voice cannot be changed during the session + * once the model has responded with audio at least once. Current voice options are + * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + */ + voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; +} + +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. + */ + export interface InputAudioTranscription { + /** + * The model to use for transcription, `whisper-1` is the only currently supported + * model. + */ + model?: string; + } + + export interface Tool { + /** + * The description of the function, including guidance on when and how to call it, + * and guidance about what to tell the user when calling (if anything). + */ + description?: string; + + /** + * The name of the function. + */ + name?: string; + + /** + * Parameters of the function in JSON Schema. + */ + parameters?: unknown; + + /** + * The type of the tool, i.e. `function`. + */ + type?: 'function'; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when VAD is enabled. `true` + * by default. + */ + create_response?: boolean; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export declare namespace Sessions { + export { + type Session as Session, + type SessionCreateResponse as SessionCreateResponse, + type SessionCreateParams as SessionCreateParams, + }; +} diff --git a/tests/api-resources/beta/realtime/sessions.test.ts b/tests/api-resources/beta/realtime/sessions.test.ts new file mode 100644 index 000000000..fbc77df2b --- /dev/null +++ b/tests/api-resources/beta/realtime/sessions.test.ts @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource sessions', () => { + test('create: only required params', async () => { + const responsePromise = client.beta.realtime.sessions.create({ model: 'gpt-4o-realtime-preview' }); + 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('create: required and optional params', async () => { + const response = await client.beta.realtime.sessions.create({ + model: 'gpt-4o-realtime-preview', + input_audio_format: 'pcm16', + input_audio_transcription: { model: 'model' }, + instructions: 'instructions', + max_response_output_tokens: 0, + modalities: ['text'], + output_audio_format: 'pcm16', + temperature: 0, + tool_choice: 'tool_choice', + tools: [{ description: 'description', name: 'name', parameters: {}, type: 'function' }], + turn_detection: { + create_response: true, + prefix_padding_ms: 0, + silence_duration_ms: 0, + threshold: 0, + type: 'type', + }, + voice: 'alloy', + }); + }); +}); From 81b20f7be7fdabb5970e30b2c53b16cb2285a325 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:49:57 -0500 Subject: [PATCH 133/509] feat(client): improve debug logs chore: unknown commit message --- README.md | 2 +- src/api-promise.ts | 14 +++++-- src/client.ts | 60 +++++++++++++++++++++++++--- src/internal/parse.ts | 16 +++++--- src/internal/utils/log.ts | 48 ++++++++++++++++++++-- src/pagination.ts | 7 ++-- tests/index.test.ts | 83 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 208 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f2ec030b6..2024d313f 100644 --- a/README.md +++ b/README.md @@ -596,7 +596,7 @@ const client = new OpenAI({ }); ``` -Note that if given a `DEBUG=true` environment variable, this library will log all requests and responses automatically. +Note that if given a `OPENAI_LOG=debug` environment variable, this library will log all requests and responses automatically. This is intended for debugging purposes only and may change in the future without notice. ### Configuring an HTTP(S) Agent (e.g., for proxies) diff --git a/src/api-promise.ts b/src/api-promise.ts index 5786070a6..c9d9a9a9f 100644 --- a/src/api-promise.ts +++ b/src/api-promise.ts @@ -1,5 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import { type OpenAI } from './client'; + import { type PromiseOrValue } from './internal/types'; import { type APIResponseProps, @@ -14,10 +16,13 @@ import { */ export class APIPromise extends Promise> { private parsedPromise: Promise> | undefined; + #client: OpenAI; constructor( + client: OpenAI, private responsePromise: Promise, private parseResponse: ( + client: OpenAI, props: APIResponseProps, ) => PromiseOrValue> = defaultParseResponse, ) { @@ -27,11 +32,12 @@ export class APIPromise extends Promise> { // to parse the response resolve(null as any); }); + this.#client = client; } _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { - return new APIPromise(this.responsePromise, async (props) => - addRequestID(transform(await this.parseResponse(props), props), props.response), + return new APIPromise(this.#client, this.responsePromise, async (client, props) => + addRequestID(transform(await this.parseResponse(client, props), props), props.response), ); } @@ -69,7 +75,9 @@ export class APIPromise extends Promise> { private parse(): Promise> { if (!this.parsedPromise) { - this.parsedPromise = this.responsePromise.then(this.parseResponse) as any as Promise>; + this.parsedPromise = this.responsePromise.then((data) => + this.parseResponse(this.#client, data), + ) as any as Promise>; } return this.parsedPromise; } diff --git a/src/client.ts b/src/client.ts index 6d4d6d6bc..772e71772 100644 --- a/src/client.ts +++ b/src/client.ts @@ -2,7 +2,6 @@ import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; import type { HTTPMethod, PromiseOrValue } from './internal/types'; -import { debug } from './internal/utils/log'; import { uuid4 } from './internal/utils/uuid'; import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; @@ -81,6 +80,7 @@ import { Moderations, } from './resources/moderations'; import { readEnv } from './internal/utils/env'; +import { logger } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; @@ -134,6 +134,25 @@ const safeJSON = (text: string) => { } }; +type LogFn = (message: string, ...rest: unknown[]) => void; +export type Logger = { + error: LogFn; + warn: LogFn; + info: LogFn; + debug: LogFn; +}; +export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug'; +const isLogLevel = (key: string | undefined): key is LogLevel => { + const levels: Record = { + off: true, + error: true, + warn: true, + info: true, + debug: true, + }; + return key! in levels; +}; + export interface ClientOptions { /** * Defaults to process.env['OPENAI_API_KEY']. @@ -210,6 +229,20 @@ export interface ClientOptions { * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. */ dangerouslyAllowBrowser?: boolean; + + /** + * Set the log level. + * + * Defaults to process.env['OPENAI_LOG']. + */ + logLevel?: LogLevel | undefined | null; + + /** + * Set the logger. + * + * Defaults to globalThis.console. + */ + logger?: Logger | undefined | null; } type FinalizedRequestInit = RequestInit & { headers: Headers }; @@ -225,6 +258,8 @@ export class OpenAI { baseURL: string; maxRetries: number; timeout: number; + logger: Logger | undefined; + logLevel: LogLevel | undefined; httpAgent: Shims.Agent | undefined; private fetch: Fetch; @@ -276,6 +311,15 @@ export class OpenAI { this.baseURL = options.baseURL!; this.timeout = options.timeout ?? OpenAI.DEFAULT_TIMEOUT /* 10 minutes */; + this.logger = options.logger ?? console; + if (options.logLevel != null) { + this.logLevel = options.logLevel; + } else { + const envLevel = readEnv('OPENAI_LOG'); + if (isLogLevel(envLevel)) { + this.logLevel = envLevel; + } + } this.httpAgent = options.httpAgent; this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); @@ -415,7 +459,7 @@ export class OpenAI { options: PromiseOrValue, remainingRetries: number | null = null, ): APIPromise { - return new APIPromise(this.makeRequest(options, remainingRetries)); + return new APIPromise(this, this.makeRequest(options, remainingRetries)); } private async makeRequest( @@ -434,7 +478,7 @@ export class OpenAI { await this.prepareRequest(req, { url, options }); - debug('request', url, options, req.headers); + logger(this).debug('request', url, options, req.headers); if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); @@ -459,7 +503,7 @@ export class OpenAI { if (!response.ok) { if (retriesRemaining && this.shouldRetry(response)) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; - debug(`response (error; ${retryMessage})`, response.status, url, response.headers); + logger(this).debug(`response (error; ${retryMessage})`, response.status, url, response.headers); return this.retryRequest(options, retriesRemaining, response.headers); } @@ -468,7 +512,13 @@ export class OpenAI { const errMessage = errJSON ? undefined : errText; const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; - debug(`response (error; ${retryMessage})`, response.status, url, response.headers, errMessage); + logger(this).debug( + `response (error; ${retryMessage})`, + response.status, + url, + response.headers, + errMessage, + ); const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); throw err; diff --git a/src/internal/parse.ts b/src/internal/parse.ts index cf431e4a6..c1f75ec45 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -1,8 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { debug } from './utils/log'; -import { FinalRequestOptions } from './request-options'; +import type { FinalRequestOptions } from './request-options'; import { Stream } from '../streaming'; +import { type OpenAI } from '../client'; +import { logger } from './utils/log'; import type { AbstractPage } from '../pagination'; export type APIResponseProps = { @@ -11,10 +12,13 @@ export type APIResponseProps = { controller: AbortController; }; -export async function defaultParseResponse(props: APIResponseProps): Promise> { +export async function defaultParseResponse( + client: OpenAI, + props: APIResponseProps, +): Promise> { const { response } = props; if (props.options.stream) { - debug('response', response.status, response.url, response.headers, response.body); + logger(client).debug('response', response.status, response.url, response.headers, response.body); // Note: there is an invariant here that isn't represented in the type system // that if you set `stream: true` the response type must also be `Stream` @@ -41,13 +45,13 @@ export async function defaultParseResponse(props: APIResponseProps): Promise< if (isJSON) { const json = await response.json(); - debug('response', response.status, response.url, response.headers, json); + logger(client).debug('response', response.status, response.url, response.headers, json); return addRequestID(json as T, response); } const text = await response.text(); - debug('response', response.status, response.url, response.headers, text); + logger(client).debug('response', response.status, response.url, response.headers, text); // TODO handle blob, arraybuffer, other content types, etc. return text as unknown as WithRequestID; diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 39b826eb1..0cfaf7cc4 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -1,9 +1,49 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { readEnv } from './env'; +import type { LogLevel, Logger } from '../../client'; +import { type OpenAI } from '../../client'; -export function debug(action: string, ...args: any[]) { - if (readEnv('DEBUG') === 'true') { - console.log(`OpenAI:DEBUG:${action}`, ...args); +const levelNumbers = { + off: 0, + error: 200, + warn: 300, + info: 400, + debug: 500, +}; + +function noop() {} + +function logFn(logger: Logger | undefined, clientLevel: LogLevel | undefined, level: keyof Logger) { + if (!logger || levelNumbers[level] > levelNumbers[clientLevel!]!) { + return noop; + } else { + // Don't wrap logger functions, we want the stacktrace intact! + return logger[level].bind(logger); + } +} + +let lastLogger: { deref(): Logger } | undefined; +let lastLevel: LogLevel | undefined; +let lastLevelLogger: Logger; + +export function logger(client: OpenAI): Logger { + let { logger, logLevel: clientLevel } = client; + if (lastLevel === clientLevel && (logger === lastLogger || logger === lastLogger?.deref())) { + return lastLevelLogger; } + const levelLogger = { + error: logFn(logger, clientLevel, 'error'), + warn: logFn(logger, clientLevel, 'warn'), + info: logFn(logger, clientLevel, 'info'), + debug: logFn(logger, clientLevel, 'debug'), + }; + const { WeakRef } = globalThis as any; + lastLogger = + logger ? + WeakRef ? new WeakRef(logger) + : { deref: () => logger } + : undefined; + lastLevel = clientLevel; + lastLevelLogger = levelLogger; + return levelLogger; } diff --git a/src/pagination.ts b/src/pagination.ts index b45b64eae..9a4aa86d1 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import type { OpenAI } from './client'; import { OpenAIError } from './error'; import { FinalRequestOptions } from './internal/request-options'; import { defaultParseResponse, WithRequestID } from './internal/parse'; import { APIPromise } from './api-promise'; +import { type OpenAI } from './client'; import { type APIResponseProps } from './internal/parse'; import { maybeObj } from './internal/utils/values'; @@ -86,12 +86,13 @@ export class PagePromise< Page: new (...args: ConstructorParameters) => PageClass, ) { super( + client, request, - async (props) => + async (client, props) => new Page( client, props.response, - await defaultParseResponse(props), + await defaultParseResponse(client, props), props.options, ) as WithRequestID, ); diff --git a/tests/index.test.ts b/tests/index.test.ts index 34b7f5860..c164cf4bb 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,5 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import { APIPromise } from 'openai/api-promise'; + import util from 'node:util'; import OpenAI from 'openai'; import { APIUserAbortError } from 'openai'; @@ -49,6 +51,87 @@ describe('instantiate client', () => { expect(req.headers.has('x-my-default-header')).toBe(false); }); }); + describe('logging', () => { + afterEach(() => { + process.env['OPENAI_LOG'] = undefined; + }); + + const forceAPIResponseForClient = async (client: OpenAI) => { + await new APIPromise( + client, + Promise.resolve({ + response: new Response(), + controller: new AbortController(), + options: { + method: 'get', + path: '/', + }, + }), + ); + }; + + test('debug logs when log level is debug', async () => { + const debugMock = jest.fn(); + const logger = { + debug: debugMock, + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + }; + + const client = new OpenAI({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' }); + + await forceAPIResponseForClient(client); + expect(debugMock).toHaveBeenCalled(); + }); + + test('debug logs are skipped when log level is info', async () => { + const debugMock = jest.fn(); + const logger = { + debug: debugMock, + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + }; + + const client = new OpenAI({ logger: logger, logLevel: 'info', apiKey: 'My API Key' }); + + await forceAPIResponseForClient(client); + expect(debugMock).not.toHaveBeenCalled(); + }); + + test('debug logs happen with debug env var', async () => { + const debugMock = jest.fn(); + const logger = { + debug: debugMock, + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + }; + + process.env['OPENAI_LOG'] = 'debug'; + const client = new OpenAI({ logger: logger, apiKey: 'My API Key' }); + + await forceAPIResponseForClient(client); + expect(debugMock).toHaveBeenCalled(); + }); + + test('client log level overrides env var', async () => { + const debugMock = jest.fn(); + const logger = { + debug: debugMock, + info: jest.fn(), + warn: jest.fn(), + error: jest.fn(), + }; + + process.env['OPENAI_LOG'] = 'debug'; + const client = new OpenAI({ logger: logger, logLevel: 'off', apiKey: 'My API Key' }); + + await forceAPIResponseForClient(client); + expect(debugMock).not.toHaveBeenCalled(); + }); + }); describe('defaultQuery', () => { test('with null query params given', () => { From 4593dab41912a6137ec4facc2c2fef5c1a19644b Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:53:11 -0500 Subject: [PATCH 134/509] fix: send correct Accept header for certain endpoints chore: unknown commit message --- src/resources/audio/speech.ts | 7 ++++++- src/resources/files.ts | 11 ++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index c65cea1c8..110c0149d 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -9,7 +9,12 @@ export class Speech extends APIResource { * Generates audio from the input text. */ create(body: SpeechCreateParams, options?: RequestOptions): APIPromise { - return this._client.post('/audio/speech', { body, ...options, __binaryResponse: true }); + return this._client.post('/audio/speech', { + body, + ...options, + headers: { Accept: 'application/octet-stream', ...options?.headers }, + __binaryResponse: true, + }); } } diff --git a/src/resources/files.ts b/src/resources/files.ts index 39ad3f4c9..f44ccf6f4 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -64,7 +64,11 @@ export class Files extends APIResource { * Returns the contents of the specified file. */ content(fileID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/files/${fileID}/content`, { ...options, __binaryResponse: true }); + return this._client.get(`/files/${fileID}/content`, { + ...options, + headers: { Accept: 'application/binary', ...options?.headers }, + __binaryResponse: true, + }); } /** @@ -73,10 +77,7 @@ export class Files extends APIResource { * @deprecated The `.content()` method should be used instead */ retrieveContent(fileID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/files/${fileID}/content`, { - ...options, - headers: { Accept: 'application/json', ...options?.headers }, - }); + return this._client.get(`/files/${fileID}/content`, options); } /** From 3b4aedee6cc2dba248ef7625f2c82a7260069494 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 06:51:34 -0500 Subject: [PATCH 135/509] chore(types): rename vector store chunking strategy chore: unknown commit message --- api.md | 2 +- src/resources/beta/beta.ts | 4 ++-- src/resources/beta/index.ts | 2 +- src/resources/beta/vector-stores/index.ts | 2 +- src/resources/beta/vector-stores/vector-stores.ts | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/api.md b/api.md index 02f26d475..d200faa34 100644 --- a/api.md +++ b/api.md @@ -282,7 +282,7 @@ Types: - OtherFileChunkingStrategyObject - StaticFileChunkingStrategy - StaticFileChunkingStrategyObject -- StaticFileChunkingStrategyParam +- StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 78cef3c68..beab540c5 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -48,7 +48,7 @@ import { OtherFileChunkingStrategyObject, StaticFileChunkingStrategy, StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyParam, + StaticFileChunkingStrategyObjectParam, VectorStore, VectorStoreCreateParams, VectorStoreDeleted, @@ -83,7 +83,7 @@ export declare namespace Beta { type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, type VectorStoresPage as VectorStoresPage, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 7c2ffa9f5..cedb1791a 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -45,7 +45,7 @@ export { type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/beta/vector-stores/index.ts index d41fce089..d3353db63 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/beta/vector-stores/index.ts @@ -26,7 +26,7 @@ export { type OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, type VectorStoreCreateParams, diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index c1a98c87d..ab9f0b2b0 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -112,7 +112,7 @@ export type FileChunkingStrategy = StaticFileChunkingStrategyObject | OtherFileC * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. */ -export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyParam; +export type FileChunkingStrategyParam = AutoFileChunkingStrategyParam | StaticFileChunkingStrategyObjectParam; /** * This is returned when the chunking strategy is unknown. Typically, this is @@ -150,7 +150,7 @@ export interface StaticFileChunkingStrategyObject { type: 'static'; } -export interface StaticFileChunkingStrategyParam { +export interface StaticFileChunkingStrategyObjectParam { static: StaticFileChunkingStrategy; /** @@ -391,7 +391,7 @@ export declare namespace VectorStores { type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, type StaticFileChunkingStrategy as StaticFileChunkingStrategy, type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyParam as StaticFileChunkingStrategyParam, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, type VectorStoresPage as VectorStoresPage, From 28662b90b5bb0a3c4767990a9f35c66fb0ee2c93 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 08:21:49 -0500 Subject: [PATCH 136/509] refactor(types): remove deprecated params type aliases chore: unknown commit message --- src/resources/chat/chat.ts | 6 ------ src/resources/chat/completions.ts | 18 ------------------ src/resources/chat/index.ts | 3 --- 3 files changed, 27 deletions(-) diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 57d246067..205360648 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -34,9 +34,6 @@ import { ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, ChatCompletionUserMessageParam, - CompletionCreateParams, - CompletionCreateParamsNonStreaming, - CompletionCreateParamsStreaming, Completions, } from './completions'; @@ -119,10 +116,7 @@ export declare namespace Chat { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type ChatCompletionCreateParams as ChatCompletionCreateParams, - type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, - type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, - type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, }; } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index ecb69099f..245aba27e 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1226,11 +1226,6 @@ export namespace ChatCompletionCreateParams { export type ChatCompletionCreateParamsStreaming = ChatCompletionsAPI.ChatCompletionCreateParamsStreaming; } -/** - * @deprecated Use ChatCompletionCreateParams instead - */ -export type CompletionCreateParams = ChatCompletionCreateParams; - export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase { /** * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be @@ -1243,11 +1238,6 @@ export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCr stream?: false | null; } -/** - * @deprecated Use ChatCompletionCreateParamsNonStreaming instead - */ -export type CompletionCreateParamsNonStreaming = ChatCompletionCreateParamsNonStreaming; - export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase { /** * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be @@ -1260,11 +1250,6 @@ export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreat stream: true; } -/** - * @deprecated Use ChatCompletionCreateParamsStreaming instead - */ -export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreaming; - export declare namespace Completions { export { type ChatCompletion as ChatCompletion, @@ -1296,10 +1281,7 @@ export declare namespace Completions { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type ChatCompletionCreateParams as ChatCompletionCreateParams, - type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, - type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, - type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, }; } diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index ea7371d9f..4ae265190 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -32,9 +32,6 @@ export { type ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam, type ChatCompletionCreateParams, - type CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming, - type CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming, - type CompletionCreateParamsStreaming, } from './completions'; From 0fd0d7cbd06b63665713e7cc04080a03e0a1cdce Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 14 Jan 2025 18:05:52 -0500 Subject: [PATCH 137/509] chore(client): clean up file helpers chore: unknown commit message --- src/client.ts | 11 +- src/index.ts | 8 +- src/internal/uploads.ts | 262 ++++++++++++++++++++++++++ src/resources/audio/transcriptions.ts | 3 +- src/resources/audio/translations.ts | 3 +- src/resources/files.ts | 3 +- src/resources/images.ts | 3 +- src/resources/uploads/parts.ts | 3 +- src/uploads.ts | 259 +------------------------ tests/form.test.ts | 3 +- tests/uploads.test.ts | 5 +- 11 files changed, 281 insertions(+), 282 deletions(-) create mode 100644 src/internal/uploads.ts diff --git a/src/client.ts b/src/client.ts index 772e71772..e48b116b5 100644 --- a/src/client.ts +++ b/src/client.ts @@ -12,7 +12,6 @@ import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; import * as qs from './internal/qs'; import { VERSION } from './version'; -import { isBlobLike } from './uploads'; import { buildHeaders } from './internal/headers'; import * as Errors from './error'; import * as Pagination from './pagination'; @@ -443,14 +442,8 @@ export class OpenAI { opts?: PromiseOrValue, ): APIPromise { return this.request( - Promise.resolve(opts).then(async (opts) => { - const body = - opts && isBlobLike(opts?.body) ? new DataView(await opts.body.arrayBuffer()) - : opts?.body instanceof DataView ? opts.body - : opts?.body instanceof ArrayBuffer ? new DataView(opts.body) - : opts && ArrayBuffer.isView(opts?.body) ? new DataView(opts.body.buffer) - : opts?.body; - return { method, path, ...opts, body }; + Promise.resolve(opts).then((opts) => { + return { method, path, ...opts }; }), ); } diff --git a/src/index.ts b/src/index.ts index 50ce5b01a..9fb1eeb03 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,13 +2,7 @@ export { OpenAI as default } from './client'; -export { - multipartFormRequestOptions, - maybeMultipartFormRequestOptions, - type Uploadable, - createForm, - toFile, -} from './uploads'; +export { type Uploadable, toFile } from './uploads'; export { APIPromise } from './api-promise'; export { OpenAI, type ClientOptions } from './client'; export { PagePromise } from './pagination'; diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts new file mode 100644 index 000000000..608618272 --- /dev/null +++ b/src/internal/uploads.ts @@ -0,0 +1,262 @@ +import { type RequestOptions } from './request-options'; +import { type FilePropertyBag } from './builtin-types'; +import { isFsReadStreamLike, type FsReadStreamLike } from './shims'; +import './polyfill/file.node.js'; + +type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; +type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; + +/** + * Typically, this is a native "File" class. + * + * We provide the {@link toFile} utility to convert a variety of objects + * into the File class. + * + * For convenience, you can also pass a fetch Response, or in Node, + * the result of fs.createReadStream(). + */ +export type Uploadable = FileLike | ResponseLike | FsReadStreamLike; + +/** + * Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc. + * Don't add arrayBuffer here, node-fetch doesn't have it + */ +interface BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ + readonly size: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ + readonly type: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ + text(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ + slice(start?: number, end?: number): BlobLike; +} + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.size === 'number' && + typeof value.type === 'string' && + typeof value.text === 'function' && + typeof value.slice === 'function' && + typeof value.arrayBuffer === 'function'; + +/** + * Intended to match DOM File, node:buffer File, undici File, etc. + */ +interface FileLike extends BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ + readonly lastModified: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ + readonly name: string; +} +declare var FileClass: { + prototype: FileLike; + new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike; +}; + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isFileLike = (value: any): value is FileLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.name === 'string' && + typeof value.lastModified === 'number' && + isBlobLike(value); + +/** + * Intended to match DOM Response, node-fetch Response, undici Response, etc. + */ +export interface ResponseLike { + url: string; + blob(): Promise; +} + +const isResponseLike = (value: any): value is ResponseLike => + value != null && + typeof value === 'object' && + typeof value.url === 'string' && + typeof value.blob === 'function'; + +const isUploadable = (value: any): value is Uploadable => { + return isFileLike(value) || isResponseLike(value) || isFsReadStreamLike(value); +}; + +type ToFileInput = Uploadable | Exclude | AsyncIterable; + +/** + * Construct a `File` instance. This is used to ensure a helpful error is thrown + * for environments that don't define a global `File` yet and so that we don't + * accidentally rely on a global `File` type in our annotations. + */ +function makeFile(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike { + const File = (globalThis as any).File as typeof FileClass | undefined; + if (typeof File === 'undefined') { + throw new Error('`File` is not defined as a global which is required for file uploads'); + } + + return new File(fileBits, fileName, options); +} + +/** + * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats + * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s + * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible + * @param {Object=} options additional properties + * @param {string=} options.type the MIME type of the content + * @param {number=} options.lastModified the last modified timestamp + * @returns a {@link File} with the given properties + */ +export async function toFile( + value: ToFileInput | PromiseLike, + name?: string | null | undefined, + options?: FilePropertyBag | undefined, +): Promise { + // If it's a promise, resolve it. + value = await value; + + // If we've been given a `File` we don't need to do anything + if (isFileLike(value)) { + const File = (globalThis as any).File as typeof FileClass | undefined; + if (File && value instanceof File) { + return value; + } + return makeFile([await value.arrayBuffer()], value.name); + } + + if (isResponseLike(value)) { + const blob = await value.blob(); + name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'; + + return makeFile(await getBytes(blob), name, options); + } + + const parts = await getBytes(value); + + name ||= getName(value) ?? 'unknown_file'; + + if (!options?.type) { + const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type); + if (typeof type === 'string') { + options = { ...options, type }; + } + } + + return makeFile(parts, name, options); +} + +export async function getBytes( + value: Uploadable | BlobLikePart | AsyncIterable, +): Promise> { + let parts: Array = []; + if ( + typeof value === 'string' || + ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. + value instanceof ArrayBuffer + ) { + parts.push(value); + } else if (isBlobLike(value)) { + parts.push(value instanceof Blob ? value : await value.arrayBuffer()); + } else if ( + isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc. + ) { + for await (const chunk of value) { + parts.push(...(await getBytes(chunk as BlobLikePart))); // TODO, consider validating? + } + } else { + const constructor = value?.constructor?.name; + throw new Error( + `Unexpected data type: ${typeof value}${ + constructor ? `; constructor: ${constructor}` : '' + }${propsForError(value)}`, + ); + } + + return parts; +} + +function propsForError(value: unknown): string { + if (typeof value !== 'object' || value === null) return ''; + const props = Object.getOwnPropertyNames(value); + return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; +} + +function getName(value: unknown): string | undefined { + return ( + (typeof value === 'object' && + value !== null && + (('name' in value && String(value.name)) || + ('filename' in value && String(value.filename)) || + ('path' in value && String(value.path).split(/[\\/]/).pop()))) || + undefined + ); +} + +const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator => + value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'; + +/** + * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value. + * Otherwise returns the request as is. + */ +export const maybeMultipartFormRequestOptions = async (opts: RequestOptions): Promise => { + if (!hasUploadableValue(opts.body)) return opts; + + return { ...opts, body: await createForm(opts.body) }; +}; + +type MultipartFormRequestOptions = Omit & { body: unknown }; + +export const multipartFormRequestOptions = async ( + opts: MultipartFormRequestOptions, +): Promise => { + return { ...opts, body: await createForm(opts.body) }; +}; + +export const createForm = async >(body: T | undefined): Promise => { + const form = new FormData(); + await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value))); + return form; +}; + +const hasUploadableValue = (value: unknown): boolean => { + if (isUploadable(value)) return true; + if (Array.isArray(value)) return value.some(hasUploadableValue); + if (value && typeof value === 'object') { + for (const k in value) { + if (hasUploadableValue((value as any)[k])) return true; + } + } + return false; +}; + +const addFormValue = async (form: FormData, key: string, value: unknown): Promise => { + if (value === undefined) return; + if (value == null) { + throw new TypeError( + `Received null for "${key}"; to pass null in FormData, you must use the string 'null'`, + ); + } + + // TODO: make nested formats configurable + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { + form.append(key, String(value)); + } else if (isUploadable(value)) { + const file = await toFile(value); + form.append(key, file as any); + } else if (Array.isArray(value)) { + await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry))); + } else if (typeof value === 'object') { + await Promise.all( + Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)), + ); + } else { + throw new TypeError( + `Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`, + ); + } +}; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 648ee7655..cbf8af624 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -3,8 +3,9 @@ import { APIResource } from '../../resource'; import * as AudioAPI from './audio'; import { APIPromise } from '../../api-promise'; -import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { type Uploadable } from '../../uploads'; import { RequestOptions } from '../../internal/request-options'; +import { multipartFormRequestOptions } from '../../internal/uploads'; export class Transcriptions extends APIResource { /** diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 71c192ce6..d965a8fd6 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -4,8 +4,9 @@ import { APIResource } from '../../resource'; import * as AudioAPI from './audio'; import * as TranscriptionsAPI from './transcriptions'; import { APIPromise } from '../../api-promise'; -import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { type Uploadable } from '../../uploads'; import { RequestOptions } from '../../internal/request-options'; +import { multipartFormRequestOptions } from '../../internal/uploads'; export class Translations extends APIResource { /** diff --git a/src/resources/files.ts b/src/resources/files.ts index f44ccf6f4..462188a93 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -3,10 +3,11 @@ import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; -import { type Uploadable, multipartFormRequestOptions } from '../uploads'; +import { type Uploadable } from '../uploads'; import { RequestOptions } from '../internal/request-options'; import { sleep } from '../internal/utils/sleep'; import { APIConnectionTimeoutError } from '../error'; +import { multipartFormRequestOptions } from '../internal/uploads'; export class Files extends APIResource { /** diff --git a/src/resources/images.ts b/src/resources/images.ts index ca3578d24..10cfa3c13 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -2,8 +2,9 @@ import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; -import { type Uploadable, multipartFormRequestOptions } from '../uploads'; +import { type Uploadable } from '../uploads'; import { RequestOptions } from '../internal/request-options'; +import { multipartFormRequestOptions } from '../internal/uploads'; export class Images extends APIResource { /** diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index 2bdd6bb4f..ba17f19e3 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -2,8 +2,9 @@ import { APIResource } from '../../resource'; import { APIPromise } from '../../api-promise'; -import { type Uploadable, multipartFormRequestOptions } from '../../uploads'; +import { type Uploadable } from '../../uploads'; import { RequestOptions } from '../../internal/request-options'; +import { multipartFormRequestOptions } from '../../internal/uploads'; export class Parts extends APIResource { /** diff --git a/src/uploads.ts b/src/uploads.ts index 58f3782be..77b65766a 100644 --- a/src/uploads.ts +++ b/src/uploads.ts @@ -1,258 +1 @@ -import { type RequestOptions } from './internal/request-options'; -import { type FilePropertyBag } from './internal/builtin-types'; -import { isFsReadStreamLike, type FsReadStreamLike } from './internal/shims'; -import './internal/polyfill/file.node.js'; - -type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | Uint8Array | DataView; -export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | Uint8Array | DataView; - -/** - * Typically, this is a native "File" class. - * - * We provide the {@link toFile} utility to convert a variety of objects - * into the File class. - * - * For convenience, you can also pass a fetch Response, or in Node, - * the result of fs.createReadStream(). - */ -export type Uploadable = FileLike | ResponseLike | FsReadStreamLike; - -/** - * Intended to match web.Blob, node.Blob, undici.Blob, etc. - */ -export interface BlobLike { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ - readonly size: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ - readonly type: string; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ - text(): Promise; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ - slice(start?: number, end?: number): BlobLike; -} - -/** - * This check adds the arrayBuffer() method type because it is available and used at runtime - */ -export const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => - value != null && - typeof value === 'object' && - typeof value.size === 'number' && - typeof value.type === 'string' && - typeof value.text === 'function' && - typeof value.slice === 'function' && - typeof value.arrayBuffer === 'function'; - -/** - * Intended to match web.File, node.File, undici.File, etc. - */ -export interface FileLike extends BlobLike { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ - readonly lastModified: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ - readonly name: string; -} -declare var FileClass: { - prototype: FileLike; - new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike; -}; - -export const isFileLike = (value: any): value is FileLike => - value != null && - typeof value === 'object' && - typeof value.name === 'string' && - typeof value.lastModified === 'number' && - isBlobLike(value); - -/** - * Intended to match web.Response, node.Response, undici.Response, etc. - */ -export interface ResponseLike { - url: string; - blob(): Promise; -} - -export const isResponseLike = (value: any): value is ResponseLike => - value != null && - typeof value === 'object' && - typeof value.url === 'string' && - typeof value.blob === 'function'; - -export const isUploadable = (value: any): value is Uploadable => { - return isFileLike(value) || isResponseLike(value) || isFsReadStreamLike(value); -}; - -export type ToFileInput = Uploadable | Exclude | AsyncIterable; - -/** - * Construct a `File` instance. This is used to ensure a helpful error is thrown - * for environments that don't define a global `File` yet and so that we don't - * accidentally rely on a global `File` type in our annotations. - */ -function makeFile(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike { - const File = (globalThis as any).File as typeof FileClass | undefined; - if (typeof File === 'undefined') { - throw new Error('`File` is not defined as a global which is required for file uploads'); - } - - return new File(fileBits, fileName, options); -} - -/** - * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats - * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s - * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible - * @param {Object=} options additional properties - * @param {string=} options.type the MIME type of the content - * @param {number=} options.lastModified the last modified timestamp - * @returns a {@link File} with the given properties - */ -export async function toFile( - value: ToFileInput | PromiseLike, - name?: string | null | undefined, - options?: FilePropertyBag | undefined, -): Promise { - // If it's a promise, resolve it. - value = await value; - - // If we've been given a `File` we don't need to do anything - if (isFileLike(value)) { - return value; - } - - if (isResponseLike(value)) { - const blob = await value.blob(); - name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'; - - // we need to convert the `Blob` into an array buffer because the `Blob` class - // that `node-fetch` defines is incompatible with the web standard which results - // in `new File` interpreting it as a string instead of binary data. - const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob]; - - return makeFile(data, name, options); - } - - const bits = await getBytes(value); - - name ||= getName(value) ?? 'unknown_file'; - - if (!options?.type) { - const type = (bits[0] as any)?.type; - if (typeof type === 'string') { - options = { ...options, type }; - } - } - - return makeFile(bits, name, options); -} - -async function getBytes(value: ToFileInput): Promise> { - let parts: Array = []; - if ( - typeof value === 'string' || - ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. - value instanceof ArrayBuffer - ) { - parts.push(value); - } else if (isBlobLike(value)) { - parts.push(await value.arrayBuffer()); - } else if ( - isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc. - ) { - for await (const chunk of value) { - parts.push(chunk as BlobPart); // TODO, consider validating? - } - } else { - throw new Error( - `Unexpected data type: ${typeof value}; constructor: ${value?.constructor - ?.name}; props: ${propsForError(value)}`, - ); - } - - return parts; -} - -function propsForError(value: any): string { - const props = Object.getOwnPropertyNames(value); - return `[${props.map((p) => `"${p}"`).join(', ')}]`; -} - -function getName(value: any): string | undefined { - return ( - getStringFromMaybeBuffer(value.name) || - getStringFromMaybeBuffer(value.filename) || - // For fs.ReadStream - getStringFromMaybeBuffer(value.path)?.split(/[\\/]/).pop() - ); -} - -const getStringFromMaybeBuffer = (x: string | Buffer | unknown): string | undefined => { - if (typeof x === 'string') return x; - if (typeof Buffer !== 'undefined' && x instanceof Buffer) return String(x); - return undefined; -}; - -const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator => - value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'; - -/** - * Returns a multipart/form-data request if any part of the given request body contains a File / Blob value. - * Otherwise returns the request as is. - */ -export const maybeMultipartFormRequestOptions = async (opts: RequestOptions): Promise => { - if (!hasUploadableValue(opts.body)) return opts; - - return { ...opts, body: await createForm(opts.body) }; -}; - -type MultipartFormRequestOptions = Omit & { body: unknown }; - -export const multipartFormRequestOptions = async ( - opts: MultipartFormRequestOptions, -): Promise => { - return { ...opts, body: await createForm(opts.body) }; -}; - -export const createForm = async >(body: T | undefined): Promise => { - const form = new FormData(); - await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value))); - return form; -}; - -const hasUploadableValue = (value: unknown): boolean => { - if (isUploadable(value)) return true; - if (Array.isArray(value)) return value.some(hasUploadableValue); - if (value && typeof value === 'object') { - for (const k in value) { - if (hasUploadableValue((value as any)[k])) return true; - } - } - return false; -}; - -const addFormValue = async (form: FormData, key: string, value: unknown): Promise => { - if (value === undefined) return; - if (value == null) { - throw new TypeError( - `Received null for "${key}"; to pass null in FormData, you must use the string 'null'`, - ); - } - - // TODO: make nested formats configurable - if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { - form.append(key, String(value)); - } else if (isUploadable(value)) { - const file = await toFile(value); - form.append(key, file as any); - } else if (Array.isArray(value)) { - await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry))); - } else if (typeof value === 'object') { - await Promise.all( - Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop)), - ); - } else { - throw new TypeError( - `Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`, - ); - } -}; +export { type Uploadable, toFile } from './internal/uploads'; diff --git a/tests/form.test.ts b/tests/form.test.ts index 0bd22c549..f330875af 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -1,4 +1,5 @@ -import { multipartFormRequestOptions, createForm, toFile } from 'openai'; +import { multipartFormRequestOptions, createForm } from 'openai/internal/uploads'; +import { toFile } from 'openai/uploads'; describe('form data validation', () => { test('valid values do not error', async () => { diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 16456daf6..44d10769b 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,5 +1,6 @@ import fs from 'fs'; -import { toFile, type ResponseLike } from 'openai/uploads'; +import type { ResponseLike } from 'openai/internal/uploads'; +import { toFile } from 'openai/uploads'; class MyClass { name: string = 'foo'; @@ -8,7 +9,7 @@ class MyClass { function mockResponse({ url, content }: { url: string; content?: Blob }): ResponseLike { return { url, - blob: async () => content as any, + blob: async () => content || new Blob([]), }; } From b20705e8d33e7b2e955206711ba25283eb77354a Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 15 Jan 2025 08:55:11 -0500 Subject: [PATCH 138/509] chore(types): add `| undefined` to client options properties chore: unknown commit message --- src/client.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index e48b116b5..c1ab94941 100644 --- a/src/client.ts +++ b/src/client.ts @@ -182,7 +182,7 @@ export interface ClientOptions { * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. */ - timeout?: number; + timeout?: number | undefined; /** * An HTTP agent used to manage HTTP(S) connections. @@ -190,7 +190,7 @@ export interface ClientOptions { * If not provided, an agent will be constructed by default in the Node.js environment, * otherwise no agent is used. */ - httpAgent?: Shims.Agent; + httpAgent?: Shims.Agent | undefined; /** * Specify a custom `fetch` function implementation. @@ -205,7 +205,7 @@ export interface ClientOptions { * * @default 2 */ - maxRetries?: number; + maxRetries?: number | undefined; /** * Default headers to include with every request to the API. @@ -213,7 +213,7 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ - defaultHeaders?: HeadersLike; + defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. @@ -221,13 +221,13 @@ export interface ClientOptions { * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ - defaultQuery?: Record; + defaultQuery?: Record | undefined; /** * By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers. * Only set this option to `true` if you understand the risks and have appropriate mitigations in place. */ - dangerouslyAllowBrowser?: boolean; + dangerouslyAllowBrowser?: boolean | undefined; /** * Set the log level. From 54231c096e94fd738733684df6f8c50ecf345f8f Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:26:35 -0500 Subject: [PATCH 139/509] chore(client): improve node-fetch file upload errors chore: unknown commit message --- src/internal/uploads.ts | 55 ++++++++++++++++-- src/resources/audio/transcriptions.ts | 5 +- src/resources/audio/translations.ts | 5 +- src/resources/files.ts | 2 +- src/resources/images.ts | 10 +++- src/resources/uploads/parts.ts | 5 +- tests/form.test.ts | 83 +++++++++++++++++---------- 7 files changed, 123 insertions(+), 42 deletions(-) diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 608618272..1632df8a7 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -1,6 +1,7 @@ import { type RequestOptions } from './request-options'; -import { type FilePropertyBag } from './builtin-types'; +import type { FilePropertyBag, Fetch } from './builtin-types'; import { isFsReadStreamLike, type FsReadStreamLike } from './shims'; +import type { OpenAI } from '../client'; import './polyfill/file.node.js'; type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; @@ -203,21 +204,65 @@ const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator => { +export const maybeMultipartFormRequestOptions = async ( + opts: RequestOptions, + fetch: OpenAI | Fetch, +): Promise => { if (!hasUploadableValue(opts.body)) return opts; - return { ...opts, body: await createForm(opts.body) }; + return { ...opts, body: await createForm(opts.body, fetch) }; }; type MultipartFormRequestOptions = Omit & { body: unknown }; export const multipartFormRequestOptions = async ( opts: MultipartFormRequestOptions, + fetch: OpenAI | Fetch, ): Promise => { - return { ...opts, body: await createForm(opts.body) }; + return { ...opts, body: await createForm(opts.body, fetch) }; }; -export const createForm = async >(body: T | undefined): Promise => { +const supportsFormDataMap = new WeakMap>(); + +/** + * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending + * properly-encoded form data, it just stringifies the object, resulting in a request body of "[object FormData]". + * This function detects if the fetch function provided supports the global FormData object to avoid + * confusing error messages later on. + */ +function supportsFormData(fetchObject: OpenAI | Fetch): Promise { + const fetch: Fetch = typeof fetchObject === 'function' ? fetchObject : (fetchObject as any).fetch; + const cached = supportsFormDataMap.get(fetch); + if (cached) return cached; + const promise = (async () => { + try { + const FetchResponse = ( + 'Response' in fetch ? + fetch.Response + : (await fetch('data:,')).constructor) as typeof Response; + const data = new FormData(); + if (data.toString() === (await new FetchResponse(data).text())) { + return false; + } + return true; + } catch { + // avoid false negatives + return true; + } + })(); + supportsFormDataMap.set(fetch, promise); + return promise; +} + +export const createForm = async >( + body: T | undefined, + fetch: OpenAI | Fetch, +): Promise => { + if (!(await supportsFormData(fetch))) { + throw new TypeError( + 'The provided fetch function does not support file uploads with the current global FormData class.', + ); + } const form = new FormData(); await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value))); return form; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index cbf8af624..b61476d46 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -28,7 +28,10 @@ export class Transcriptions extends APIResource { body: TranscriptionCreateParams, options?: RequestOptions, ): APIPromise { - return this._client.post('/audio/transcriptions', multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/audio/transcriptions', + multipartFormRequestOptions({ body, ...options }, this._client), + ); } } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index d965a8fd6..9a7f54856 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -26,7 +26,10 @@ export class Translations extends APIResource { body: TranslationCreateParams, options?: RequestOptions, ): APIPromise { - return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/audio/translations', + multipartFormRequestOptions({ body, ...options }, this._client), + ); } } diff --git a/src/resources/files.ts b/src/resources/files.ts index 462188a93..c67e4ea69 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -34,7 +34,7 @@ export class Files extends APIResource { * storage limits. */ create(body: FileCreateParams, options?: RequestOptions): APIPromise { - return this._client.post('/files', multipartFormRequestOptions({ body, ...options })); + return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client)); } /** diff --git a/src/resources/images.ts b/src/resources/images.ts index 10cfa3c13..d8eb5be4c 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -11,14 +11,20 @@ export class Images extends APIResource { * Creates a variation of a given image. */ createVariation(body: ImageCreateVariationParams, options?: RequestOptions): APIPromise { - return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/images/variations', + multipartFormRequestOptions({ body, ...options }, this._client), + ); } /** * Creates an edited or extended image given an original image and a prompt. */ edit(body: ImageEditParams, options?: RequestOptions): APIPromise { - return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options })); + return this._client.post( + '/images/edits', + multipartFormRequestOptions({ body, ...options }, this._client), + ); } /** diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index ba17f19e3..fbf2dc226 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -21,7 +21,10 @@ export class Parts extends APIResource { * [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete). */ create(uploadID: string, body: PartCreateParams, options?: RequestOptions): APIPromise { - return this._client.post(`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options })); + return this._client.post( + `/uploads/${uploadID}/parts`, + multipartFormRequestOptions({ body, ...options }, this._client), + ); } } diff --git a/tests/form.test.ts b/tests/form.test.ts index f330875af..5ca5b75f2 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -3,62 +3,83 @@ import { toFile } from 'openai/uploads'; describe('form data validation', () => { test('valid values do not error', async () => { - await multipartFormRequestOptions({ - body: { - foo: 'foo', - string: 1, - bool: true, - file: await toFile(Buffer.from('some-content')), - blob: new Blob(['Some content'], { type: 'text/plain' }), + await multipartFormRequestOptions( + { + body: { + foo: 'foo', + string: 1, + bool: true, + file: await toFile(Buffer.from('some-content')), + blob: new Blob(['Some content'], { type: 'text/plain' }), + }, }, - }); + fetch, + ); }); test('null', async () => { await expect(() => - multipartFormRequestOptions({ - body: { - null: null, + multipartFormRequestOptions( + { + body: { + null: null, + }, }, - }), + fetch, + ), ).rejects.toThrow(TypeError); }); test('undefined is stripped', async () => { - const form = await createForm({ - foo: undefined, - bar: 'baz', - }); + const form = await createForm( + { + foo: undefined, + bar: 'baz', + }, + fetch, + ); expect(form.has('foo')).toBe(false); expect(form.get('bar')).toBe('baz'); }); test('nested undefined property is stripped', async () => { - const form = await createForm({ - bar: { - baz: undefined, + const form = await createForm( + { + bar: { + baz: undefined, + }, }, - }); + fetch, + ); expect(Array.from(form.entries())).toEqual([]); - const form2 = await createForm({ - bar: { - foo: 'string', - baz: undefined, + const form2 = await createForm( + { + bar: { + foo: 'string', + baz: undefined, + }, }, - }); + fetch, + ); expect(Array.from(form2.entries())).toEqual([['bar[foo]', 'string']]); }); test('nested undefined array item is stripped', async () => { - const form = await createForm({ - bar: [undefined, undefined], - }); + const form = await createForm( + { + bar: [undefined, undefined], + }, + fetch, + ); expect(Array.from(form.entries())).toEqual([]); - const form2 = await createForm({ - bar: [undefined, 'foo'], - }); + const form2 = await createForm( + { + bar: [undefined, 'foo'], + }, + fetch, + ); expect(Array.from(form2.entries())).toEqual([['bar[]', 'foo']]); }); }); From 183d8e7d9fc6b7553eab420b663c61671ff10326 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 20 Jan 2025 12:55:52 -0500 Subject: [PATCH 140/509] chore(client)!: document proxy use + clean up old code chore: unknown commit message --- README.md | 58 +++++++++++++++++---- scripts/utils/attw-report.cjs | 5 +- src/client.ts | 33 ++++-------- src/internal/builtin-types.ts | 2 +- src/internal/request-options.ts | 7 ++- src/internal/shims.ts | 12 ----- src/internal/types.ts | 92 +++++++++++++++++++++++++++++++++ tests/index.test.ts | 9 ++++ 8 files changed, 165 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 2024d313f..f9ae98eb3 100644 --- a/README.md +++ b/README.md @@ -599,25 +599,61 @@ const client = new OpenAI({ Note that if given a `OPENAI_LOG=debug` environment variable, this library will log all requests and responses automatically. This is intended for debugging purposes only and may change in the future without notice. -### Configuring an HTTP(S) Agent (e.g., for proxies) +### Fetch options -By default, this library uses a stable agent for all http/https requests to reuse TCP connections, eliminating many TCP & TLS handshakes and shaving around 100ms off most requests. +If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.) -If you would like to disable or customize this behavior, for example to use the API behind a proxy, you can pass an `httpAgent` which is used for all requests (be they http or https), for example: +```ts +import OpenAI from 'openai'; + +const client = new OpenAI({ + fetchOptions: { + // `RequestInit` options + }, +}); +``` + +#### Configuring proxies + +To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy +options to requests: + + **Node** [[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)] - ```ts -import http from 'http'; -import { HttpsProxyAgent } from 'https-proxy-agent'; +import OpenAI from 'openai'; +import * as undici from 'undici'; + +const proxyAgent = new undici.ProxyAgent('http://localhost:8888/'); +const client = new OpenAI({ + fetchOptions: { + dispatcher: proxyAgent, + }, +}); +``` + + **Bun** [[docs](https://bun.sh/guides/http/proxy)] + +```ts +import OpenAI from 'openai'; -// Configure the default for all requests: const client = new OpenAI({ - httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), + fetchOptions: { + proxy: 'http://localhost:8888/', + }, }); +``` -// Override per-request: -await client.models.list({ - httpAgent: new http.Agent({ keepAlive: false }), + **Deno** [[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)] + +```ts +import OpenAI from 'npm:openai'; + +const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888/' } }); +const client = new OpenAI({ + fetchOptions: { + client: httpClient, + }, }); ``` diff --git a/scripts/utils/attw-report.cjs b/scripts/utils/attw-report.cjs index e45e7952b..b3477c0ef 100644 --- a/scripts/utils/attw-report.cjs +++ b/scripts/utils/attw-report.cjs @@ -8,7 +8,10 @@ const problems = Object.values(JSON.parse(fs.readFileSync('.attw.json', 'utf-8') ( (problem.kind === 'CJSResolvesToESM' && problem.entrypoint.endsWith('.mjs')) || // This is intentional for backwards compat reasons. - (problem.kind === 'MissingExportEquals' && problem.implementationFileName.endsWith('/index.js')) + (problem.kind === 'MissingExportEquals' && problem.implementationFileName.endsWith('/index.js')) || + // this is intentional, we deliberately attempt to import types that may not exist from parent node_modules + // folders to better support various runtimes without triggering automatic type acquisition. + (problem.kind === 'InternalResolutionError' && problem.moduleSpecifier.includes('node_modules')) ) ), ); diff --git a/src/client.ts b/src/client.ts index c1ab94941..0fbb915b9 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; -import type { HTTPMethod, PromiseOrValue } from './internal/types'; +import type { HTTPMethod, PromiseOrValue, MergedRequestInit } from './internal/types'; import { uuid4 } from './internal/utils/uuid'; import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; @@ -183,14 +183,11 @@ export interface ClientOptions { * much longer than this timeout before the promise succeeds or fails. */ timeout?: number | undefined; - /** - * An HTTP agent used to manage HTTP(S) connections. - * - * If not provided, an agent will be constructed by default in the Node.js environment, - * otherwise no agent is used. + * Additional `RequestInit` options to be passed to `fetch` calls. + * Properties will be overridden by per-request `fetchOptions`. */ - httpAgent?: Shims.Agent | undefined; + fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. @@ -259,7 +256,7 @@ export class OpenAI { timeout: number; logger: Logger | undefined; logLevel: LogLevel | undefined; - httpAgent: Shims.Agent | undefined; + fetchOptions: MergedRequestInit | undefined; private fetch: Fetch; #encoder: Opts.RequestEncoder; @@ -274,7 +271,7 @@ export class OpenAI { * @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null] * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL'] ?? https://api.openai.com/v1] - Override the default base URL for the API. * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. - * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections. + * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. @@ -319,7 +316,7 @@ export class OpenAI { this.logLevel = envLevel; } } - this.httpAgent = options.httpAgent; + this.fetchOptions = options.fetchOptions; this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); this.#encoder = Opts.FallbackEncoder; @@ -657,30 +654,18 @@ export class OpenAI { const url = this.buildURL(path!, query as Record); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); const timeout = options.timeout ?? this.timeout; - const httpAgent = options.httpAgent ?? this.httpAgent; - const minAgentTimeout = timeout + 1000; - if ( - typeof (httpAgent as any)?.options?.timeout === 'number' && - minAgentTimeout > ((httpAgent as any).options.timeout ?? 0) - ) { - // Allow any given request to bump our agent active socket timeout. - // This may seem strange, but leaking active sockets should be rare and not particularly problematic, - // and without mutating agent we would need to create more of them. - // This tradeoff optimizes for performance. - (httpAgent as any).options.timeout = minAgentTimeout; - } - const { bodyHeaders, body } = this.buildBody({ options }); const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount }); const req: FinalizedRequestInit = { method, headers: reqHeaders, - ...(httpAgent && { agent: httpAgent }), ...(options.signal && { signal: options.signal }), ...((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }), ...(body && { body }), + ...((this.fetchOptions as any) ?? {}), + ...((options.fetchOptions as any) ?? {}), }; return { req, url, timeout }; diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts index ca1be792c..b2e598a81 100644 --- a/src/internal/builtin-types.ts +++ b/src/internal/builtin-types.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export type Fetch = typeof fetch; +export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise; /** * An alias to the builtin `RequestInit` type so we can diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index d4a5c66d8..8a8627000 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -2,11 +2,10 @@ import { NullableHeaders } from './headers'; -import type { Agent } from './shims'; import type { BodyInit } from './builtin-types'; import { isEmptyObj, hasOwn } from './utils/values'; import { Stream } from '../streaming'; -import type { HTTPMethod, KeysEnum } from './types'; +import type { HTTPMethod, KeysEnum, MergedRequestInit } from './types'; import { type HeadersLike } from './headers'; export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string }; @@ -20,7 +19,7 @@ export type RequestOptions = { maxRetries?: number; stream?: boolean | undefined; timeout?: number; - httpAgent?: Agent; + fetchOptions?: MergedRequestInit; signal?: AbortSignal | undefined | null; idempotencyKey?: string; @@ -41,7 +40,7 @@ const requestOptionsKeys: KeysEnum = { maxRetries: true, stream: true, timeout: true, - httpAgent: true, + fetchOptions: true, signal: true, idempotencyKey: true, diff --git a/src/internal/shims.ts b/src/internal/shims.ts index 4edbafe41..1f73701f0 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -10,18 +10,6 @@ import { type Fetch } from './builtin-types'; import { type ReadableStream } from './shim-types'; -/** - * A minimal copy of the `Agent` type from `undici-types` so we can - * use it in the `ClientOptions` type. - * - * https://nodejs.org/api/http.html#class-httpagent - */ -export interface Agent { - dispatch(options: any, handler: any): boolean; - closed: boolean; - destroyed: boolean; -} - export function getDefaultFetch(): Fetch { if (typeof fetch !== 'undefined') { return fetch; diff --git a/src/internal/types.ts b/src/internal/types.ts index 99740c34f..50c16e9d2 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -4,3 +4,95 @@ export type PromiseOrValue = T | Promise; export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; export type KeysEnum = { [P in keyof Required]: true }; + +type NotAny = [unknown] extends [T] ? never : T; +type Literal = PropertyKey extends T ? never : T; +type MappedLiteralKeys = T extends any ? Literal : never; +type MappedIndex = + T extends any ? + K extends keyof T ? + T[K] + : never + : never; + +/** + * Some environments overload the global fetch function, and Parameters only gets the last signature. + */ +type OverloadedParameters = + T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + (...args: infer C): unknown; + (...args: infer D): unknown; + } + ) ? + A | B | C | D + : T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + (...args: infer C): unknown; + } + ) ? + A | B | C + : T extends ( + { + (...args: infer A): unknown; + (...args: infer B): unknown; + } + ) ? + A | B + : T extends (...args: infer A) => unknown ? A + : never; + +/* eslint-disable */ +/** + * These imports attempt to get types from a parent package's dependencies. + * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which + * would cause typescript to show types not present at runtime. To avoid this, we import + * directly from parent node_modules folders. + * + * We need to check multiple levels because we don't know what directory structure we'll be in. + * For example, pnpm generates directories like this: + * ``` + * node_modules + * ├── .pnpm + * │ └── pkg@1.0.0 + * │ └── node_modules + * │ └── pkg + * │ └── internal + * │ └── types.d.ts + * ├── pkg -> .pnpm/pkg@1.0.0/node_modules/pkg + * └── undici + * ``` + * + * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition + */ +/** @ts-ignore For users with \@types/node */ +type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with undici */ +type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with \@types/bun */ +type BunRequestInit = globalThis.FetchRequestInit; +/** @ts-ignore For users with node-fetch */ +type NodeFetchRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users who use Deno */ +type FetchRequestInit = NonNullable[1]>; +/* eslint-enable */ + +type RequestInits = + | NotAny + | NotAny + | NotAny + | NotAny + | NotAny + | NotAny; + +/** + * This type contains `RequestInit` options that may be available on the current runtime, + * including per-platform extensions like `dispatcher`, `agent`, `client`, etc. + */ +export type MergedRequestInit = { + [K in MappedLiteralKeys]?: MappedIndex | undefined; +}; diff --git a/tests/index.test.ts b/tests/index.test.ts index c164cf4bb..f4dbc7b51 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -179,6 +179,15 @@ describe('instantiate client', () => { expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true }); }); + test('explicit global fetch', async () => { + // make sure the global fetch type is assignable to our Fetch type + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + apiKey: 'My API Key', + fetch: defaultFetch, + }); + }); + test('custom signal', async () => { const client = new OpenAI({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', From 4c7fcca4d308eaf78ee5ecf3a2c503861cde9fe7 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 21 Jan 2025 11:02:58 -0500 Subject: [PATCH 141/509] fix: correctly send default header values chore: unknown commit message --- src/client.ts | 3 +-- src/resources/audio/speech.ts | 3 ++- src/resources/beta/assistants.ts | 11 ++++++----- src/resources/beta/realtime/sessions.ts | 3 ++- src/resources/beta/threads/messages.ts | 11 ++++++----- src/resources/beta/threads/runs/runs.ts | 14 +++++++------- src/resources/beta/threads/runs/steps.ts | 5 +++-- src/resources/beta/threads/threads.ts | 11 ++++++----- src/resources/beta/vector-stores/file-batches.ts | 10 +++++----- src/resources/beta/vector-stores/files.ts | 10 +++++----- src/resources/beta/vector-stores/vector-stores.ts | 11 ++++++----- src/resources/files.ts | 3 ++- 12 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/client.ts b/src/client.ts index 0fbb915b9..9e6bf92c7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -12,7 +12,6 @@ import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; import * as qs from './internal/qs'; import { VERSION } from './version'; -import { buildHeaders } from './internal/headers'; import * as Errors from './error'; import * as Pagination from './pagination'; import { AbstractPage, type CursorPageParams, CursorPageResponse, PageResponse } from './pagination'; @@ -21,7 +20,7 @@ import * as API from './resources/index'; import { APIPromise } from './api-promise'; import { type Fetch } from './internal/builtin-types'; import { isRunningInBrowser } from './internal/detect-platform'; -import { HeadersLike, NullableHeaders } from './internal/headers'; +import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; import { Batch, diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 110c0149d..d29d0b560 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../resource'; import { APIPromise } from '../../api-promise'; +import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; export class Speech extends APIResource { @@ -12,7 +13,7 @@ export class Speech extends APIResource { return this._client.post('/audio/speech', { body, ...options, - headers: { Accept: 'application/octet-stream', ...options?.headers }, + headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]), __binaryResponse: true, }); } diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 8ee717fd7..470a019fe 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -10,6 +10,7 @@ import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; import { APIPromise } from '../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; export class Assistants extends APIResource { @@ -20,7 +21,7 @@ export class Assistants extends APIResource { return this._client.post('/assistants', { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -30,7 +31,7 @@ export class Assistants extends APIResource { retrieve(assistantID: string, options?: RequestOptions): APIPromise { return this._client.get(`/assistants/${assistantID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -41,7 +42,7 @@ export class Assistants extends APIResource { return this._client.post(`/assistants/${assistantID}`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -55,7 +56,7 @@ export class Assistants extends APIResource { return this._client.getAPIList('/assistants', CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -65,7 +66,7 @@ export class Assistants extends APIResource { delete(assistantID: string, options?: RequestOptions): APIPromise { return this._client.delete(`/assistants/${assistantID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } } diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 855989cd8..d13363042 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../resource'; import { APIPromise } from '../../../api-promise'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Sessions extends APIResource { @@ -18,7 +19,7 @@ export class Sessions extends APIResource { return this._client.post('/realtime/sessions', { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } } diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 2c613b49d..67161722f 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../../resource'; import * as AssistantsAPI from '../assistants'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class Messages extends APIResource { @@ -14,7 +15,7 @@ export class Messages extends APIResource { return this._client.post(`/threads/${threadID}/messages`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -25,7 +26,7 @@ export class Messages extends APIResource { const { thread_id } = params; return this._client.get(`/threads/${thread_id}/messages/${messageID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -37,7 +38,7 @@ export class Messages extends APIResource { return this._client.post(`/threads/${thread_id}/messages/${messageID}`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -52,7 +53,7 @@ export class Messages extends APIResource { return this._client.getAPIList(`/threads/${threadID}/messages`, CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -67,7 +68,7 @@ export class Messages extends APIResource { const { thread_id } = params; return this._client.delete(`/threads/${thread_id}/messages/${messageID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } } diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 1cbf7dde6..be414972c 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -34,11 +34,11 @@ import { import { APIPromise } from '../../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; import { Stream } from '../../../../streaming'; +import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; import { sleep } from '../../../../internal/utils/sleep'; import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; -import { buildHeaders } from '../../../../internal/headers'; export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); @@ -67,7 +67,7 @@ export class Runs extends APIResource { query: { include }, body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), stream: params.stream ?? false, }) as APIPromise | APIPromise>; } @@ -79,7 +79,7 @@ export class Runs extends APIResource { const { thread_id } = params; return this._client.get(`/threads/${thread_id}/runs/${runID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -91,7 +91,7 @@ export class Runs extends APIResource { return this._client.post(`/threads/${thread_id}/runs/${runID}`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -106,7 +106,7 @@ export class Runs extends APIResource { return this._client.getAPIList(`/threads/${threadID}/runs`, CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -117,7 +117,7 @@ export class Runs extends APIResource { const { thread_id } = params; return this._client.post(`/threads/${thread_id}/runs/${runID}/cancel`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -241,7 +241,7 @@ export class Runs extends APIResource { return this._client.post(`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), stream: params.stream ?? false, }) as APIPromise | APIPromise>; } diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 444488b41..4ee178a00 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 * as StepsAPI from './steps'; import { APIPromise } from '../../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; +import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; export class Steps extends APIResource { @@ -15,7 +16,7 @@ export class Steps extends APIResource { return this._client.get(`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -27,7 +28,7 @@ export class Steps extends APIResource { return this._client.getAPIList(`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index ece8234d6..ab08991a0 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -69,6 +69,7 @@ import { } from './runs/runs'; import { APIPromise } from '../../../api-promise'; import { Stream } from '../../../streaming'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; @@ -83,7 +84,7 @@ export class Threads extends APIResource { return this._client.post('/threads', { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -93,7 +94,7 @@ export class Threads extends APIResource { retrieve(threadID: string, options?: RequestOptions): APIPromise { return this._client.get(`/threads/${threadID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -104,7 +105,7 @@ export class Threads extends APIResource { return this._client.post(`/threads/${threadID}`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -114,7 +115,7 @@ export class Threads extends APIResource { delete(threadID: string, options?: RequestOptions): APIPromise { return this._client.delete(`/threads/${threadID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -137,7 +138,7 @@ export class Threads extends APIResource { return this._client.post('/threads/runs', { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), stream: body.stream ?? false, }) as APIPromise | APIPromise>; } diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index 845903e24..347cc7b77 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -6,11 +6,11 @@ import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { sleep } from '../../../internal/utils/sleep'; import { type Uploadable } from '../../../uploads'; import { allSettledWithThrow } from '../../../lib/Util'; -import { buildHeaders } from '../../../internal/headers'; export class FileBatches extends APIResource { /** @@ -24,7 +24,7 @@ export class FileBatches extends APIResource { return this._client.post(`/vector_stores/${vectorStoreID}/file_batches`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -39,7 +39,7 @@ export class FileBatches extends APIResource { const { vector_store_id } = params; return this._client.get(`/vector_stores/${vector_store_id}/file_batches/${batchID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -55,7 +55,7 @@ export class FileBatches extends APIResource { const { vector_store_id } = params; return this._client.post(`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -83,7 +83,7 @@ export class FileBatches extends APIResource { return this._client.getAPIList( `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, - { query, ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } }, + { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]) }, ); } diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index 5561b6a2b..81a718e1c 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -4,10 +4,10 @@ import { APIResource } from '../../../resource'; import * as VectorStoresAPI from './vector-stores'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { sleep } from '../../../internal/utils'; import { Uploadable } from '../../../uploads'; -import { buildHeaders } from '../../../internal/headers'; export class Files extends APIResource { /** @@ -23,7 +23,7 @@ export class Files extends APIResource { return this._client.post(`/vector_stores/${vectorStoreID}/files`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -38,7 +38,7 @@ export class Files extends APIResource { const { vector_store_id } = params; return this._client.get(`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -53,7 +53,7 @@ export class Files extends APIResource { return this._client.getAPIList(`/vector_stores/${vectorStoreID}/files`, CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -71,7 +71,7 @@ export class Files extends APIResource { const { vector_store_id } = params; return this._client.delete(`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index ab9f0b2b0..08b99f43d 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -23,6 +23,7 @@ import { } from './files'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; export class VectorStores extends APIResource { @@ -36,7 +37,7 @@ export class VectorStores extends APIResource { return this._client.post('/vector_stores', { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -46,7 +47,7 @@ export class VectorStores extends APIResource { retrieve(vectorStoreID: string, options?: RequestOptions): APIPromise { return this._client.get(`/vector_stores/${vectorStoreID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -61,7 +62,7 @@ export class VectorStores extends APIResource { return this._client.post(`/vector_stores/${vectorStoreID}`, { body, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -75,7 +76,7 @@ export class VectorStores extends APIResource { return this._client.getAPIList('/vector_stores', CursorPage, { query, ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } @@ -85,7 +86,7 @@ export class VectorStores extends APIResource { delete(vectorStoreID: string, options?: RequestOptions): APIPromise { return this._client.delete(`/vector_stores/${vectorStoreID}`, { ...options, - headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } } diff --git a/src/resources/files.ts b/src/resources/files.ts index c67e4ea69..5889c4a47 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -4,6 +4,7 @@ import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; import { type Uploadable } from '../uploads'; +import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { sleep } from '../internal/utils/sleep'; import { APIConnectionTimeoutError } from '../error'; @@ -67,7 +68,7 @@ export class Files extends APIResource { content(fileID: string, options?: RequestOptions): APIPromise { return this._client.get(`/files/${fileID}/content`, { ...options, - headers: { Accept: 'application/binary', ...options?.headers }, + headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]), __binaryResponse: true, }); } From c0e99db36cec5ca32d73241bee82f0d864717089 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:18:21 -0500 Subject: [PATCH 142/509] docs: update deprecation messages chore: unknown commit message --- src/resources/chat/completions.ts | 24 ++++++++++++------------ src/resources/files.ts | 4 ++-- src/resources/fine-tuning/jobs/jobs.ts | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 245aba27e..6892b71ec 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -160,8 +160,8 @@ export interface ChatCompletionAssistantMessageParam { content?: string | Array | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: ChatCompletionAssistantMessageParam.FunctionCall | null; @@ -195,8 +195,8 @@ export namespace ChatCompletionAssistantMessageParam { } /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** @@ -357,8 +357,8 @@ export namespace ChatCompletionChunk { content?: string | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: Delta.FunctionCall; @@ -377,8 +377,8 @@ export namespace ChatCompletionChunk { export namespace Delta { /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** @@ -617,8 +617,8 @@ export interface ChatCompletionMessage { audio?: ChatCompletionAudio | null; /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ function_call?: ChatCompletionMessage.FunctionCall | null; @@ -630,8 +630,8 @@ export interface ChatCompletionMessage { export namespace ChatCompletionMessage { /** - * @deprecated: Deprecated and replaced by `tool_calls`. The name and arguments of - * a function that should be called, as generated by the model. + * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a + * function that should be called, as generated by the model. */ export interface FunctionCall { /** diff --git a/src/resources/files.ts b/src/resources/files.ts index 5889c4a47..d80ef2309 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -165,13 +165,13 @@ export interface FileObject { | 'vision'; /** - * @deprecated: Deprecated. The current status of the file, which can be either + * @deprecated Deprecated. The current status of the file, which can be either * `uploaded`, `processed`, or `error`. */ status: 'uploaded' | 'processed' | 'error'; /** - * @deprecated: Deprecated. For details on why a fine-tuning training file failed + * @deprecated Deprecated. For details on why a fine-tuning training file failed * validation, see the `error` field on `fine_tuning.job`. */ status_details?: string; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 3c842de34..7beabbd7a 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -497,7 +497,7 @@ export interface JobCreateParams { export namespace JobCreateParams { /** - * @deprecated: The hyperparameters used for the fine-tuning job. This value is now + * @deprecated The hyperparameters used for the fine-tuning job. This value is now * deprecated in favor of `method`, and should be passed in under the `method` * parameter. */ From 3e3a48a091014f738f356117977ecd94285e937d Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:57:46 -0500 Subject: [PATCH 143/509] chore(internal): minor restructuring chore: unknown commit message --- src/internal/decoders/line.ts | 2 +- src/internal/shims.ts | 33 ++++++++++++++++++++++++++++++ src/streaming.ts | 38 +++-------------------------------- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 1e0bbf390..34e41d1dc 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -1,6 +1,6 @@ import { OpenAIError } from '../../error'; -type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; +export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; /** * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally diff --git a/src/internal/shims.ts b/src/internal/shims.ts index 1f73701f0..9624eba28 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -110,3 +110,36 @@ export function ReadableStreamFrom(iterable: Iterable | AsyncIterable): }, }); } + +/** + * Most browsers don't yet have async iterable support for ReadableStream, + * and Node has a very different way of reading bytes from its "ReadableStream". + * + * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 + */ +export function ReadableStreamToAsyncIterable(stream: any): AsyncIterableIterator { + if (stream[Symbol.asyncIterator]) return stream; + + const reader = stream.getReader(); + return { + async next() { + try { + const result = await reader.read(); + if (result?.done) reader.releaseLock(); // release lock when stream becomes closed + return result; + } catch (e) { + reader.releaseLock(); // release lock when stream becomes errored + throw e; + } + }, + async return() { + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; + return { done: true, value: undefined }; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/src/streaming.ts b/src/streaming.ts index 841a748a9..e7b682e21 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -2,6 +2,7 @@ import { OpenAIError } from './error'; import { type ReadableStream } from './internal/shim-types'; import { makeReadableStream } from './internal/shims'; import { LineDecoder } from './internal/decoders/line'; +import { ReadableStreamToAsyncIterable } from './internal/shims'; import { APIError } from './error'; @@ -97,7 +98,7 @@ export class Stream implements AsyncIterable { async function* iterLines(): AsyncGenerator { const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(readableStream); + const iter = ReadableStreamToAsyncIterable(readableStream); for await (const chunk of iter) { for (const line of lineDecoder.decode(chunk)) { yield line; @@ -211,7 +212,7 @@ export async function* _iterSSEMessages( const sseDecoder = new SSEDecoder(); const lineDecoder = new LineDecoder(); - const iter = readableStreamAsyncIterable(response.body); + const iter = ReadableStreamToAsyncIterable(response.body); for await (const sseChunk of iterSSEChunks(iter)) { for (const line of lineDecoder.decode(sseChunk)) { const sse = sseDecoder.decode(line); @@ -364,36 +365,3 @@ function partition(str: string, delimiter: string): [string, string, string] { return [str, '', '']; } - -/** - * Most browsers don't yet have async iterable support for ReadableStream, - * and Node has a very different way of reading bytes from its "ReadableStream". - * - * This polyfill was pulled from https://github.com/MattiasBuelens/web-streams-polyfill/pull/122#issuecomment-1627354490 - */ -export function readableStreamAsyncIterable(stream: any): AsyncIterableIterator { - if (stream[Symbol.asyncIterator]) return stream; - - const reader = stream.getReader(); - return { - async next() { - try { - const result = await reader.read(); - if (result?.done) reader.releaseLock(); // release lock when stream becomes closed - return result; - } catch (e) { - reader.releaseLock(); // release lock when stream becomes errored - throw e; - } - }, - async return() { - const cancelPromise = reader.cancel(); - reader.releaseLock(); - await cancelPromise; - return { done: true, value: undefined }; - }, - [Symbol.asyncIterator]() { - return this; - }, - }; -} From 6477a603d9578213d35d9a734fe6dcbf39742079 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 22 Jan 2025 08:15:39 -0500 Subject: [PATCH 144/509] feat(api): update enum values, comments, and examples chore: unknown commit message --- .stats.yml | 2 +- src/resources/audio/speech.ts | 8 ++--- src/resources/beta/realtime/realtime.ts | 32 +++++++++++-------- src/resources/beta/realtime/sessions.ts | 30 ++++++++++------- src/resources/chat/completions.ts | 9 ++---- src/resources/embeddings.ts | 3 +- .../beta/realtime/sessions.test.ts | 27 ++-------------- tests/api-resources/chat/completions.test.ts | 2 +- tests/api-resources/completions.test.ts | 2 +- 9 files changed, 49 insertions(+), 66 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9600edae3..d518bac58 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-b5b0e2c794b012919701c3fd43286af10fa25d33ceb8a881bec2636028f446e0.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-3904ef6b29a89c98f93a9b7da19879695f3c440564be6384db7af1b734611ede.yml diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index d29d0b560..81dc3e47d 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -34,12 +34,12 @@ export interface SpeechCreateParams { model: (string & {}) | SpeechModel; /** - * The voice to use when generating the audio. Supported voices are `alloy`, - * `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are - * available in the + * The voice to use when generating the audio. Supported voices are `alloy`, `ash`, + * `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the + * voices are available in the * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). */ - voice: 'alloy' | 'echo' | 'fable' | 'onyx' | 'nova' | 'shimmer'; + voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; /** * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5de06917a..0fb66eb49 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -173,9 +173,10 @@ export interface ConversationItemCreateEvent { /** * The ID of the preceding item after which the new item will be inserted. If not - * set, the new item will be appended to the end of the conversation. If set, it - * allows an item to be inserted mid-conversation. If the ID cannot be found, an - * error will be returned and the item will not be added. + * set, the new item will be appended to the end of the conversation. If set to + * `root`, the new item will be added to the beginning of the conversation. If set + * to an existing ID, it allows an item to be inserted mid-conversation. If the ID + * cannot be found, an error will be returned and the item will not be added. */ previous_item_id?: string; } @@ -1705,17 +1706,9 @@ export namespace SessionUpdateEvent { */ export interface Session { /** - * The Realtime model used for this session. - */ - model: - | 'gpt-4o-realtime-preview' - | 'gpt-4o-realtime-preview-2024-10-01' - | 'gpt-4o-realtime-preview-2024-12-17' - | 'gpt-4o-mini-realtime-preview' - | 'gpt-4o-mini-realtime-preview-2024-12-17'; - - /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -1756,8 +1749,19 @@ export namespace SessionUpdateEvent { */ modalities?: Array<'text' | 'audio'>; + /** + * The Realtime model used for this session. + */ + model?: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index d13363042..6d0ad6b39 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -34,7 +34,9 @@ export interface Session { id?: string; /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -88,6 +90,7 @@ export interface Session { /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -374,17 +377,9 @@ export namespace SessionCreateResponse { export interface SessionCreateParams { /** - * The Realtime model used for this session. - */ - model: - | 'gpt-4o-realtime-preview' - | 'gpt-4o-realtime-preview-2024-10-01' - | 'gpt-4o-realtime-preview-2024-12-17' - | 'gpt-4o-mini-realtime-preview' - | 'gpt-4o-mini-realtime-preview-2024-12-17'; - - /** - * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; @@ -425,8 +420,19 @@ export interface SessionCreateParams { */ modalities?: Array<'text' | 'audio'>; + /** + * The Realtime model used for this session. + */ + model?: + | 'gpt-4o-realtime-preview' + | 'gpt-4o-realtime-preview-2024-10-01' + | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-mini-realtime-preview' + | 'gpt-4o-mini-realtime-preview-2024-12-17'; + /** * The format of output audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + * For `pcm16`, output audio is sampled at a rate of 24kHz. */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 6892b71ec..142ff53bd 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -73,8 +73,7 @@ export interface ChatCompletion { object: 'chat.completion'; /** - * The service tier used for processing the request. This field is only included if - * the `service_tier` parameter is specified in the request. + * The service tier used for processing the request. */ service_tier?: 'scale' | 'default' | null; @@ -297,8 +296,7 @@ export interface ChatCompletionChunk { object: 'chat.completion.chunk'; /** - * The service tier used for processing the request. This field is only included if - * the `service_tier` parameter is specified in the request. + * The service tier used for processing the request. */ service_tier?: 'scale' | 'default' | null; @@ -1107,9 +1105,6 @@ export interface ChatCompletionCreateParamsBase { * - If set to 'default', the request will be processed using the default service * tier with a lower uptime SLA and no latency guarentee. * - When not set, the default behavior is 'auto'. - * - * When this parameter is set, the response body will include the `service_tier` - * utilized. */ service_tier?: 'auto' | 'default' | null; diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index 65d328725..dcd542a1a 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -84,7 +84,8 @@ export interface EmbeddingCreateParams { * `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 * dimensions or less. * [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. + * for counting tokens. Some models may also impose a limit on total number of + * tokens summed across inputs. */ input: string | Array | Array | Array>; diff --git a/tests/api-resources/beta/realtime/sessions.test.ts b/tests/api-resources/beta/realtime/sessions.test.ts index fbc77df2b..1a75a532c 100644 --- a/tests/api-resources/beta/realtime/sessions.test.ts +++ b/tests/api-resources/beta/realtime/sessions.test.ts @@ -8,8 +8,8 @@ const client = new OpenAI({ }); describe('resource sessions', () => { - test('create: only required params', async () => { - const responsePromise = client.beta.realtime.sessions.create({ model: 'gpt-4o-realtime-preview' }); + test('create', async () => { + const responsePromise = client.beta.realtime.sessions.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -18,27 +18,4 @@ describe('resource sessions', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('create: required and optional params', async () => { - const response = await client.beta.realtime.sessions.create({ - model: 'gpt-4o-realtime-preview', - input_audio_format: 'pcm16', - input_audio_transcription: { model: 'model' }, - instructions: 'instructions', - max_response_output_tokens: 0, - modalities: ['text'], - output_audio_format: 'pcm16', - temperature: 0, - tool_choice: 'tool_choice', - tools: [{ description: 'description', name: 'name', parameters: {}, type: 'function' }], - turn_detection: { - create_response: true, - prefix_padding_ms: 0, - silence_duration_ms: 0, - threshold: 0, - type: 'type', - }, - voice: 'alloy', - }); - }); }); diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts index 7aa8c5d99..92cae8b66 100644 --- a/tests/api-resources/chat/completions.test.ts +++ b/tests/api-resources/chat/completions.test.ts @@ -42,7 +42,7 @@ describe('resource completions', () => { presence_penalty: -2, reasoning_effort: 'low', response_format: { type: 'text' }, - seed: -9007199254740991, + seed: 0, service_tier: 'auto', stop: 'string', store: true, diff --git a/tests/api-resources/completions.test.ts b/tests/api-resources/completions.test.ts index 96a2262ae..a9d188a2b 100644 --- a/tests/api-resources/completions.test.ts +++ b/tests/api-resources/completions.test.ts @@ -31,7 +31,7 @@ describe('resource completions', () => { max_tokens: 16, n: 1, presence_penalty: -2, - seed: -9007199254740991, + seed: 0, stop: '\n', stream: false, stream_options: { include_usage: true }, From 179e314f24600ba37c16f6e9a9fa4a7a9e774275 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Mon, 27 Jan 2025 09:49:14 -0500 Subject: [PATCH 145/509] chore(types): remove type-level dependency on some platform specifics chore: unknown commit message --- src/client.ts | 8 ++++---- src/internal/decoders/line.ts | 20 ++++++++++++-------- src/internal/detect-platform.ts | 14 +++++++++----- src/internal/shims.ts | 4 ++-- src/internal/utils/base64.ts | 13 +++++-------- src/internal/utils/env.ts | 10 ++++------ src/internal/utils/sleep.ts | 2 +- src/streaming.ts | 8 +++++--- tsconfig.dist-src.json | 4 ++-- 9 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/client.ts b/src/client.ts index 9e6bf92c7..f6efd0db6 100644 --- a/src/client.ts +++ b/src/client.ts @@ -380,12 +380,12 @@ export class OpenAI { private calculateContentLength(body: unknown): string | null { if (typeof body === 'string') { - if (typeof Buffer !== 'undefined') { - return Buffer.byteLength(body, 'utf8').toString(); + if (typeof (globalThis as any).Buffer !== 'undefined') { + return (globalThis as any).Buffer.byteLength(body, 'utf8').toString(); } - if (typeof TextEncoder !== 'undefined') { - const encoder = new TextEncoder(); + if (typeof (globalThis as any).TextEncoder !== 'undefined') { + const encoder = new (globalThis as any).TextEncoder(); const encoded = encoder.encode(body); return encoded.length.toString(); } diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 34e41d1dc..1760f1030 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -1,6 +1,6 @@ import { OpenAIError } from '../../error'; -export type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; +export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; /** * A re-implementation of httpx's `LineDecoder` in Python that handles incrementally @@ -15,7 +15,11 @@ export class LineDecoder { buffer: string[]; trailingCR: boolean; - textDecoder: any; // TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types. + textDecoder: + | undefined + | { + decode(buffer: Uint8Array | ArrayBuffer): string; + }; constructor() { this.buffer = []; @@ -69,12 +73,12 @@ export class LineDecoder { if (typeof bytes === 'string') return bytes; // Node: - if (typeof Buffer !== 'undefined') { - if (bytes instanceof Buffer) { + if (typeof (globalThis as any).Buffer !== 'undefined') { + if (bytes instanceof (globalThis as any).Buffer) { return bytes.toString(); } if (bytes instanceof Uint8Array) { - return Buffer.from(bytes).toString(); + return (globalThis as any).Buffer.from(bytes).toString(); } throw new OpenAIError( @@ -83,10 +87,10 @@ export class LineDecoder { } // Browser - if (typeof TextDecoder !== 'undefined') { + if (typeof (globalThis as any).TextDecoder !== 'undefined') { if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { - this.textDecoder ??= new TextDecoder('utf8'); - return this.textDecoder.decode(bytes); + this.textDecoder ??= new (globalThis as any).TextDecoder('utf8'); + return this.textDecoder!.decode(bytes); } throw new OpenAIError( diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts index 24eec519e..c5e273b97 100644 --- a/src/internal/detect-platform.ts +++ b/src/internal/detect-platform.ts @@ -25,7 +25,11 @@ function getDetectedPlatform(): DetectedPlatform { if (typeof EdgeRuntime !== 'undefined') { return 'edge'; } - if (Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]') { + if ( + Object.prototype.toString.call( + typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0, + ) === '[object process]' + ) { return 'node'; } return 'unknown'; @@ -73,7 +77,7 @@ const getPlatformProperties = (): PlatformProperties => { 'X-Stainless-OS': 'Unknown', 'X-Stainless-Arch': `other:${EdgeRuntime}`, 'X-Stainless-Runtime': 'edge', - 'X-Stainless-Runtime-Version': process.version, + 'X-Stainless-Runtime-Version': (globalThis as any).process.version, }; } // Check if Node.js @@ -81,10 +85,10 @@ const getPlatformProperties = (): PlatformProperties => { return { 'X-Stainless-Lang': 'js', 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': normalizePlatform(process.platform), - 'X-Stainless-Arch': normalizeArch(process.arch), + 'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform), + 'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch), 'X-Stainless-Runtime': 'node', - 'X-Stainless-Runtime-Version': process.version, + 'X-Stainless-Runtime-Version': (globalThis as any).process.version, }; } diff --git a/src/internal/shims.ts b/src/internal/shims.ts index 9624eba28..ede4c8852 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -12,7 +12,7 @@ import { type ReadableStream } from './shim-types'; export function getDefaultFetch(): Fetch { if (typeof fetch !== 'undefined') { - return fetch; + return fetch as any; } throw new Error( @@ -97,7 +97,7 @@ export function ReadableStreamFrom(iterable: Iterable | AsyncIterable): return makeReadableStream({ start() {}, - async pull(controller) { + async pull(controller: any) { const { done, value } = await iter.next(); if (done) { controller.close(); diff --git a/src/internal/utils/base64.ts b/src/internal/utils/base64.ts index b45c3b074..978bacde2 100644 --- a/src/internal/utils/base64.ts +++ b/src/internal/utils/base64.ts @@ -2,18 +2,15 @@ import { OpenAIError } from '../../error'; -// @ts-ignore -declare const Buffer: typeof import('node:buffer').Buffer; - export const toBase64 = (data: string | Uint8Array | null | undefined): string => { if (!data) return ''; if (typeof data === 'string') { - data = new TextEncoder().encode(data); + data = new (globalThis as any).TextEncoder().encode(data); } - if (typeof Buffer !== 'undefined') { - return Buffer.from(data).toString('base64'); + if (typeof (globalThis as any).Buffer !== 'undefined') { + return (globalThis as any).Buffer.from(data).toString('base64'); } if (typeof btoa !== 'undefined') { @@ -24,8 +21,8 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string = }; export const fromBase64 = (str: string): Uint8Array => { - if (typeof Buffer !== 'undefined') { - return new Uint8Array(Buffer.from(str, 'base64')); + if (typeof (globalThis as any).Buffer !== 'undefined') { + return new Uint8Array((globalThis as any).Buffer.from(str, 'base64')); } if (typeof atob !== 'undefined') { diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts index d9b1dc4a8..2d8480077 100644 --- a/src/internal/utils/env.ts +++ b/src/internal/utils/env.ts @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -declare const Deno: any; - /** * Read an environment variable. * @@ -10,11 +8,11 @@ declare const Deno: any; * Will return undefined if the environment variable doesn't exist or cannot be accessed. */ export const readEnv = (env: string): string | undefined => { - if (typeof process !== 'undefined') { - return process.env?.[env]?.trim() ?? undefined; + if (typeof (globalThis as any).process !== 'undefined') { + return (globalThis as any).process.env?.[env]?.trim() ?? undefined; } - if (typeof Deno !== 'undefined') { - return Deno.env?.get?.(env)?.trim(); + if (typeof (globalThis as any).Deno !== 'undefined') { + return (globalThis as any).Deno.env?.get?.(env)?.trim(); } return undefined; }; diff --git a/src/internal/utils/sleep.ts b/src/internal/utils/sleep.ts index fcf4e0833..65e52962b 100644 --- a/src/internal/utils/sleep.ts +++ b/src/internal/utils/sleep.ts @@ -1,3 +1,3 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); +export const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/src/streaming.ts b/src/streaming.ts index e7b682e21..3da922374 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -6,7 +6,7 @@ import { ReadableStreamToAsyncIterable } from './internal/shims'; import { APIError } from './error'; -type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; +type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; export type ServerSentEvent = { event: string | null; @@ -175,7 +175,9 @@ export class Stream implements AsyncIterable { toReadableStream(): ReadableStream { const self = this; let iter: AsyncIterator; - const encoder = new TextEncoder(); + const encoder: { + encode(str: string): Uint8Array; + } = new (globalThis as any).TextEncoder(); return makeReadableStream({ async start() { @@ -240,7 +242,7 @@ async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGene const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) - : typeof chunk === 'string' ? new TextEncoder().encode(chunk) + : typeof chunk === 'string' ? new (globalThis as any).TextEncoder().encode(chunk) : chunk; let newData = new Uint8Array(data.length + binaryChunk.length); diff --git a/tsconfig.dist-src.json b/tsconfig.dist-src.json index 0f6aba91b..c550e2996 100644 --- a/tsconfig.dist-src.json +++ b/tsconfig.dist-src.json @@ -4,8 +4,8 @@ // via declaration maps "include": ["index.ts"], "compilerOptions": { - "target": "es2015", - "lib": ["DOM", "DOM.Iterable"], + "target": "ES2015", + "lib": ["DOM", "DOM.Iterable", "ES2018"], "moduleResolution": "node" } } From e585df19a780d619d4456e98597f60e0460fb9ed Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Thu, 30 Jan 2025 10:54:38 -0500 Subject: [PATCH 146/509] chore(client): handle expo fetch abort errors chore: unknown commit message --- src/client.ts | 4 ++-- src/internal/errors.ts | 8 ++++++-- src/streaming.ts | 13 +++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/client.ts b/src/client.ts index f6efd0db6..97c46b3a1 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5,7 +5,7 @@ import type { HTTPMethod, PromiseOrValue, MergedRequestInit } from './internal/t import { uuid4 } from './internal/utils/uuid'; import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; -import { castToError } from './internal/errors'; +import { castToError, isAbortError } from './internal/errors'; import type { APIResponseProps } from './internal/parse'; import { getPlatformHeaders } from './internal/detect-platform'; import * as Shims from './internal/shims'; @@ -483,7 +483,7 @@ export class OpenAI { if (retriesRemaining) { return this.retryRequest(options, retriesRemaining); } - if (response.name === 'AbortError') { + if (isAbortError(response)) { throw new Errors.APIConnectionTimeoutError(); } throw new Errors.APIConnectionError({ cause: response }); diff --git a/src/internal/errors.ts b/src/internal/errors.ts index 08321f317..2e625bda1 100644 --- a/src/internal/errors.ts +++ b/src/internal/errors.ts @@ -2,8 +2,12 @@ export function isAbortError(err: unknown) { return ( - (err instanceof Error && err.name === 'AbortError') || - (typeof err === 'object' && err && 'name' in err && (err as any).name === 'AbortError') + typeof err === 'object' && + err !== null && + // Spec-compliant fetch implementations + (('name' in err && (err as any).name === 'AbortError') || + // Expo fetch + ('message' in err && String((err as any).message).includes('FetchRequestCanceledException'))) ); } diff --git a/src/streaming.ts b/src/streaming.ts index 3da922374..a5e901d35 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -3,6 +3,7 @@ import { type ReadableStream } from './internal/shim-types'; import { makeReadableStream } from './internal/shims'; import { LineDecoder } from './internal/decoders/line'; import { ReadableStreamToAsyncIterable } from './internal/shims'; +import { isAbortError } from './internal/errors'; import { APIError } from './error'; @@ -77,7 +78,7 @@ export class Stream implements AsyncIterable { done = true; } catch (e) { // If the user calls `stream.controller.abort()`, we should exit without throwing. - if (e instanceof Error && e.name === 'AbortError') return; + if (isAbortError(e)) return; throw e; } finally { // If the user `break`s, abort the ongoing request. @@ -124,7 +125,7 @@ export class Stream implements AsyncIterable { done = true; } catch (e) { // If the user calls `stream.controller.abort()`, we should exit without throwing. - if (e instanceof Error && e.name === 'AbortError') return; + if (isAbortError(e)) return; throw e; } finally { // If the user `break`s, abort the ongoing request. @@ -208,6 +209,14 @@ export async function* _iterSSEMessages( ): AsyncGenerator { if (!response.body) { controller.abort(); + if ( + typeof (globalThis as any).navigator !== 'undefined' && + (globalThis as any).navigator.product === 'ReactNative' + ) { + throw new OpenAIError( + `The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`, + ); + } throw new OpenAIError(`Attempted to iterate over a response with no body`); } From 7d3f8efc3db437df1c98a95e155ef9eaf320aaff Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Thu, 30 Jan 2025 13:26:27 -0500 Subject: [PATCH 147/509] chore(client): detect node and deno timeout errors chore: unknown commit message --- src/client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client.ts b/src/client.ts index 97c46b3a1..9c81cfb30 100644 --- a/src/client.ts +++ b/src/client.ts @@ -486,6 +486,13 @@ export class OpenAI { if (isAbortError(response)) { throw new Errors.APIConnectionTimeoutError(); } + // detect native connection timeout errors + // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)" + // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)" + // others do not provide enough information to distinguish timeouts from other connection errors + if (/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''))) { + throw new Errors.APIConnectionTimeoutError(); + } throw new Errors.APIConnectionError({ cause: response }); } From 1e832a19c0f94482f97c1ac80d97de00864876fd Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Fri, 31 Jan 2025 13:58:29 -0500 Subject: [PATCH 148/509] feat(api): add o3-mini chore: unknown commit message --- .stats.yml | 2 +- api.md | 1 + src/client.ts | 1 + src/resources/audio/transcriptions.ts | 4 +- src/resources/batches.ts | 20 ++-- src/resources/beta/assistants.ts | 42 +++++--- src/resources/beta/realtime/realtime.ts | 89 ++++++++++++++-- src/resources/beta/realtime/sessions.ts | 35 ++++-- src/resources/beta/threads/messages.ts | 29 +++-- src/resources/beta/threads/runs/runs.ts | 37 ++++--- src/resources/beta/threads/runs/steps.ts | 11 +- src/resources/beta/threads/threads.ts | 100 +++++++++++------- .../beta/vector-stores/vector-stores.ts | 31 +++--- src/resources/chat/chat.ts | 2 + src/resources/chat/completions.ts | 14 ++- src/resources/shared.ts | 10 ++ src/resources/uploads/uploads.ts | 2 +- tests/api-resources/beta/assistants.test.ts | 6 +- .../beta/threads/messages.test.ts | 4 +- .../beta/threads/runs/runs.test.ts | 6 +- .../beta/threads/threads.test.ts | 18 ++-- 21 files changed, 320 insertions(+), 144 deletions(-) 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/api.md b/api.md index d200faa34..80d9d7f0e 100644 --- a/api.md +++ b/api.md @@ -5,6 +5,7 @@ Types: - ErrorObject - FunctionDefinition - FunctionParameters +- Metadata - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText diff --git a/src/client.ts b/src/client.ts index 9c81cfb30..6ca2f2a3e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -924,6 +924,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 b61476d46..7cdf8f244 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -172,8 +172,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 b69189d0a..6d1f2e9a5 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -2,6 +2,7 @@ import { APIResource } from '../resource'; import * as BatchesAPI from './batches'; +import * as Shared from './shared'; import { APIPromise } from '../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; import { RequestOptions } from '../internal/request-options'; @@ -133,11 +134,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. @@ -232,9 +235,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 470a019fe..d7cc8bd6b 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -100,11 +100,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 @@ -1107,11 +1109,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. @@ -1231,12 +1235,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; } } } @@ -1256,11 +1262,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 6d0ad6b39..8d9140bf9 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -205,7 +205,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`. @@ -294,14 +294,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; } /** @@ -387,8 +387,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; @@ -472,15 +475,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 67161722f..3390040cf 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; @@ -397,11 +398,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`. @@ -650,11 +653,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 { @@ -697,10 +702,12 @@ export interface MessageUpdateParams { /** * 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 maximum 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; } export interface MessageListParams extends CursorPageParams { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index be414972c..80e5ca26c 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../../resource'; 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'; @@ -391,11 +392,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 @@ -681,10 +684,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 @@ -799,11 +804,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 { @@ -889,10 +896,12 @@ export interface RunUpdateParams { /** * 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 maximum 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; } export interface RunListParams extends CursorPageParams { diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 4ee178a00..114dfb190 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../../resource'; import * as StepsAPI from './steps'; +import * as Shared from '../../../shared'; import { APIPromise } from '../../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; import { buildHeaders } from '../../../../internal/headers'; @@ -477,11 +478,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 ab08991a0..4b56a1cc3 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -240,11 +240,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`. @@ -312,11 +314,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 @@ -351,11 +355,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 { @@ -437,12 +443,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; } } } @@ -451,11 +459,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 @@ -539,11 +549,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 @@ -599,7 +611,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; @@ -648,7 +661,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 { /** @@ -659,11 +673,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 @@ -698,11 +714,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 { @@ -784,12 +802,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 08b99f43d..e40226a9f 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import * as Shared from '../../shared'; import * as FileBatchesAPI from './file-batches'; import { FileBatchCancelParams, @@ -184,11 +185,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. @@ -297,11 +300,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. @@ -335,11 +340,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 205360648..55097e989 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -42,6 +42,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 142ff53bd..57821b76e 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1004,10 +1004,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 @@ -1101,9 +1105,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 ff72798b0..c263c049a 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -110,7 +110,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/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index 8d04127e1..d799a118b 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -24,7 +24,7 @@ describe('resource assistants', () => { model: 'gpt-4o', description: 'description', instructions: 'instructions', - metadata: {}, + metadata: { foo: 'string' }, name: 'name', response_format: 'auto', temperature: 1, @@ -32,7 +32,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 98f607b18..587daf0a1 100644 --- a/tests/api-resources/beta/threads/messages.test.ts +++ b/tests/api-resources/beta/threads/messages.test.ts @@ -27,7 +27,7 @@ describe('resource messages', () => { content: 'string', role: 'user', attachments: [{ file_id: 'file_id', tools: [{ type: 'code_interpreter' }] }], - metadata: {}, + metadata: { foo: 'string' }, }); }); @@ -60,7 +60,7 @@ describe('resource messages', () => { test('update: required and optional params', async () => { const response = await client.beta.threads.messages.update('message_id', { thread_id: 'thread_id', - 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 18474bd94..b11138810 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -29,13 +29,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', @@ -77,7 +77,7 @@ describe('resource runs', () => { test('update: required and optional params', async () => { const response = await client.beta.threads.runs.update('run_id', { thread_id: 'thread_id', - metadata: {}, + metadata: { foo: 'string' }, }); }); diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index 67e015ef1..532bacb7c 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -29,15 +29,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' } }, + ], }, }, }, @@ -96,7 +98,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', @@ -108,15 +110,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' } }, + ], }, }, }, From 893d5ec2562f390b1a85a97350de2fd3bc4f4989 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 4 Feb 2025 12:30:46 -0500 Subject: [PATCH 149/509] chore(internal): remove unused `isRequestOptions()` function chore: unknown commit message --- src/internal/request-options.ts | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 8a8627000..d46c3b33f 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -3,9 +3,8 @@ import { NullableHeaders } from './headers'; import type { BodyInit } from './builtin-types'; -import { isEmptyObj, hasOwn } from './utils/values'; import { Stream } from '../streaming'; -import type { HTTPMethod, KeysEnum, MergedRequestInit } from './types'; +import type { HTTPMethod, MergedRequestInit } from './types'; import { type HeadersLike } from './headers'; export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string }; @@ -27,36 +26,6 @@ export type RequestOptions = { __streamClass?: typeof Stream; }; -// This is required so that we can determine if a given object matches the RequestOptions -// type at runtime. While this requires duplication, it is enforced by the TypeScript -// compiler such that any missing / extraneous keys will cause an error. -const requestOptionsKeys: KeysEnum = { - method: true, - path: true, - query: true, - body: true, - headers: true, - - maxRetries: true, - stream: true, - timeout: true, - fetchOptions: true, - signal: true, - idempotencyKey: true, - - __binaryResponse: true, - __streamClass: true, -}; - -export const isRequestOptions = (obj: unknown): obj is RequestOptions => { - return ( - typeof obj === 'object' && - obj !== null && - !isEmptyObj(obj) && - Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k)) - ); -}; - export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit }; export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent; From a8343ef66f52a8cae1bf66e66e1cb7d088a61da6 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 4 Feb 2025 13:36:18 -0500 Subject: [PATCH 150/509] feat(client): send `X-Stainless-Timeout` header chore: unknown commit message --- src/client.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 6ca2f2a3e..42f2a44d0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -655,11 +655,12 @@ export class OpenAI { options: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, ): { req: FinalizedRequestInit; url: string; timeout: number } { + options = { ...options }; const { method, path, query } = options; const url = this.buildURL(path!, query as Record); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); - const timeout = options.timeout ?? this.timeout; + options.timeout = options.timeout ?? this.timeout; const { bodyHeaders, body } = this.buildBody({ options }); const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount }); @@ -674,7 +675,7 @@ export class OpenAI { ...((options.fetchOptions as any) ?? {}), }; - return { req, url, timeout }; + return { req, url, timeout: options.timeout }; } private buildHeaders({ @@ -700,6 +701,7 @@ export class OpenAI { Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount), + ...(options.timeout ? { 'X-Stainless-Timeout': String(options.timeout) } : {}), ...getPlatformHeaders(), 'OpenAI-Organization': this.organization, 'OpenAI-Project': this.project, From 983da6db3e073b62b7ae0d513eb94bb31cfedebd Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 4 Feb 2025 14:34:04 -0500 Subject: [PATCH 151/509] chore(api): delete deprecated method chore: unknown commit message --- api.md | 1 - src/resources/files.ts | 9 --------- tests/api-resources/files.test.ts | 11 ----------- 3 files changed, 21 deletions(-) diff --git a/api.md b/api.md index 80d9d7f0e..1dfbfab3d 100644 --- a/api.md +++ b/api.md @@ -93,7 +93,6 @@ Methods: - client.files.list({ ...params }) -> FileObjectsPage - client.files.delete(fileID) -> FileDeleted - client.files.content(fileID) -> Response -- client.files.retrieveContent(fileID) -> string - client.files.waitForProcessing(id, { pollInterval = 5000, maxWait = 30 _ 60 _ 1000 }) -> Promise<FileObject> # Images diff --git a/src/resources/files.ts b/src/resources/files.ts index d80ef2309..03d016614 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -73,15 +73,6 @@ export class Files extends APIResource { }); } - /** - * Returns the contents of the specified file. - * - * @deprecated The `.content()` method should be used instead - */ - retrieveContent(fileID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/files/${fileID}/content`, options); - } - /** * Waits for the given file to be processed, default timeout is 30 mins. */ diff --git a/tests/api-resources/files.test.ts b/tests/api-resources/files.test.ts index 647742af2..96c8ac563 100644 --- a/tests/api-resources/files.test.ts +++ b/tests/api-resources/files.test.ts @@ -71,15 +71,4 @@ describe('resource files', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('retrieveContent', async () => { - const responsePromise = client.files.retrieveContent('file_id'); - 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); - }); }); From b157a4b39ba1525dd4ac887c674f388f258ddaff Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 5 Feb 2025 06:23:14 -0500 Subject: [PATCH 152/509] fix(api/types): correct audio duration & role types chore: unknown commit message --- .stats.yml | 2 +- api.md | 1 + src/resources/audio/transcriptions.ts | 2 +- src/resources/audio/translations.ts | 2 +- src/resources/beta/realtime/realtime.ts | 79 +++++++++++++++++++++++-- src/resources/chat/completions.ts | 4 +- 6 files changed, 81 insertions(+), 9 deletions(-) diff --git a/.stats.yml b/.stats.yml index e49b5c56e..df7877dfd 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-6204952a29973265b9c0d66fc67ffaf53c6a90ae4d75cdacf9d147676f5274c9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml diff --git a/api.md b/api.md index 1dfbfab3d..4d463c37e 100644 --- a/api.md +++ b/api.md @@ -227,6 +227,7 @@ Types: - ConversationItemInputAudioTranscriptionFailedEvent - ConversationItemTruncateEvent - ConversationItemTruncatedEvent +- ConversationItemWithReference - ErrorEvent - InputAudioBufferAppendEvent - InputAudioBufferClearEvent diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 7cdf8f244..a7dc61c34 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -109,7 +109,7 @@ export interface TranscriptionVerbose { /** * The duration of the input audio. */ - duration: string; + duration: number; /** * The language of the input audio. diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 9a7f54856..7f983713e 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -41,7 +41,7 @@ export interface TranslationVerbose { /** * The duration of the input audio. */ - duration: string; + duration: number; /** * The language of the output translation (always `english`). diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index c666221e1..e46dcdaaf 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -439,6 +439,76 @@ export interface ConversationItemTruncatedEvent { type: 'conversation.item.truncated'; } +/** + * The item to add to the conversation. + */ +export interface ConversationItemWithReference { + /** + * For an item of type (`message` | `function_call` | `function_call_output`) this + * field allows the client to assign the unique ID of the item. It is not required + * because the server will generate one if not provided. + * + * For an item of type `item_reference`, this field is required and is a reference + * to any item that has previously existed in the conversation. + */ + id?: string; + + /** + * The arguments of the function call (for `function_call` items). + */ + arguments?: string; + + /** + * The ID of the function call (for `function_call` and `function_call_output` + * items). If passed on a `function_call_output` item, the server will check that a + * `function_call` item with the same ID exists in the conversation history. + */ + call_id?: string; + + /** + * The content of the message, applicable for `message` items. + * + * - Message items of role `system` support only `input_text` content + * - Message items of role `user` support `input_text` and `input_audio` content + * - Message items of role `assistant` support `text` content. + */ + content?: Array; + + /** + * The name of the function being called (for `function_call` items). + */ + name?: string; + + /** + * Identifier for the API object being returned - always `realtime.item`. + */ + object?: 'realtime.item'; + + /** + * The output of the function call (for `function_call_output` items). + */ + output?: string; + + /** + * The role of the message sender (`user`, `assistant`, `system`), only applicable + * for `message` items. + */ + role?: 'user' | 'assistant' | 'system'; + + /** + * The status of the item (`completed`, `incomplete`). These have no effect on the + * conversation, but are accepted for consistency with the + * `conversation.item.created` event. + */ + status?: 'completed' | 'incomplete'; + + /** + * The type of the item (`message`, `function_call`, `function_call_output`, + * `item_reference`). + */ + type?: 'message' | 'function_call' | 'function_call_output' | 'item_reference'; +} + /** * Returned when an error occurs, which could be a client problem or a server * problem. Most errors are recoverable and the session will stay open, we @@ -1336,11 +1406,12 @@ export namespace ResponseCreateEvent { conversation?: (string & {}) | 'auto' | 'none'; /** - * Input items to include in the prompt for the model. Creates a new context for - * this response, without including the default conversation. Can include - * references to items from the default conversation. + * Input items to include in the prompt for the model. Using this field creates a + * new context for this Response instead of using the default conversation. An + * empty array `[]` will clear the context for this Response. Note that this can + * include references to items from the default conversation. */ - input?: Array; + input?: Array; /** * The default system instructions (i.e. system message) prepended to model calls. diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 57821b76e..f2eb4625a 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -368,7 +368,7 @@ export namespace ChatCompletionChunk { /** * The role of the author of this message. */ - role?: 'system' | 'user' | 'assistant' | 'tool'; + role?: 'developer' | 'system' | 'user' | 'assistant' | 'tool'; tool_calls?: Array; } @@ -753,7 +753,7 @@ export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high'; /** * The role of the author of a message */ -export type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'tool' | 'function'; +export type ChatCompletionRole = 'developer' | 'system' | 'user' | 'assistant' | 'tool' | 'function'; /** * Options for streaming response. Only set this when you set `stream: true`. From 0e057f960f23d625399b198bb79c5b73000ec878 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 5 Feb 2025 16:14:29 -0500 Subject: [PATCH 153/509] fix(client)!: uri encode path parameters chore: unknown commit message --- src/internal/utils/path.ts | 63 ++++ src/resources/batches.ts | 5 +- src/resources/beta/assistants.ts | 7 +- src/resources/beta/threads/messages.ts | 11 +- src/resources/beta/threads/runs/runs.ts | 13 +- src/resources/beta/threads/runs/steps.ts | 5 +- src/resources/beta/threads/threads.ts | 7 +- .../beta/vector-stores/file-batches.ts | 9 +- src/resources/beta/vector-stores/files.ts | 9 +- .../beta/vector-stores/vector-stores.ts | 7 +- src/resources/files.ts | 7 +- src/resources/fine-tuning/jobs/checkpoints.ts | 3 +- src/resources/fine-tuning/jobs/jobs.ts | 7 +- src/resources/models.ts | 5 +- src/resources/uploads/parts.ts | 3 +- src/resources/uploads/uploads.ts | 5 +- tests/path.test.ts | 318 ++++++++++++++++++ 17 files changed, 440 insertions(+), 44 deletions(-) create mode 100644 src/internal/utils/path.ts create mode 100644 tests/path.test.ts diff --git a/src/internal/utils/path.ts b/src/internal/utils/path.ts new file mode 100644 index 000000000..b40291903 --- /dev/null +++ b/src/internal/utils/path.ts @@ -0,0 +1,63 @@ +import { OpenAIError } from '../../error'; + +/** + * Percent-encode everything that isn't safe to have in a path without encoding safe chars. + * + * Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3: + * > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" + * > pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + */ +export function encodeURIPath(str: string) { + return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent); +} + +export const createPathTagFunction = (pathEncoder = encodeURIPath) => + function path(statics: readonly string[], ...params: readonly unknown[]): string { + // If there are no params, no processing is needed. + if (statics.length === 1) return statics[0]!; + + let postPath = false; + const path = statics.reduce((previousValue, currentValue, index) => { + if (/[?#]/.test(currentValue)) { + postPath = true; + } + return ( + previousValue + + currentValue + + (index === params.length ? '' : (postPath ? encodeURIComponent : pathEncoder)(String(params[index]))) + ); + }, ''); + + const pathOnly = path.split(/[?#]/, 1)[0]!; + const invalidSegments = []; + const invalidSegmentPattern = /(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi; + let match; + + // Find all invalid segments + while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) { + invalidSegments.push({ + start: match.index, + length: match[0].length, + }); + } + + if (invalidSegments.length > 0) { + let lastEnd = 0; + const underline = invalidSegments.reduce((acc, segment) => { + const spaces = ' '.repeat(segment.start - lastEnd); + const arrows = '^'.repeat(segment.length); + lastEnd = segment.start + segment.length; + return acc + spaces + arrows; + }, ''); + + throw new OpenAIError(`Path parameters result in path with invalid segments:\n${path}\n${underline}`); + } + + return path; + }; + +/** + * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced. + */ +export const path = createPathTagFunction(encodeURIPath); diff --git a/src/resources/batches.ts b/src/resources/batches.ts index 6d1f2e9a5..db32d782b 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -6,6 +6,7 @@ import * as Shared from './shared'; import { APIPromise } from '../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; import { RequestOptions } from '../internal/request-options'; +import { path } from '../internal/utils/path'; export class Batches extends APIResource { /** @@ -19,7 +20,7 @@ export class Batches extends APIResource { * Retrieves a batch. */ retrieve(batchID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/batches/${batchID}`, options); + return this._client.get(path`/batches/${batchID}`, options); } /** @@ -38,7 +39,7 @@ export class Batches extends APIResource { * (if any) available in the output file. */ cancel(batchID: string, options?: RequestOptions): APIPromise { - return this._client.post(`/batches/${batchID}/cancel`, options); + return this._client.post(path`/batches/${batchID}/cancel`, options); } } diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index d7cc8bd6b..a588df115 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -12,6 +12,7 @@ import { APIPromise } from '../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; export class Assistants extends APIResource { /** @@ -29,7 +30,7 @@ export class Assistants extends APIResource { * Retrieves an assistant. */ retrieve(assistantID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/assistants/${assistantID}`, { + return this._client.get(path`/assistants/${assistantID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -39,7 +40,7 @@ export class Assistants extends APIResource { * Modifies an assistant. */ update(assistantID: string, body: AssistantUpdateParams, options?: RequestOptions): APIPromise { - return this._client.post(`/assistants/${assistantID}`, { + return this._client.post(path`/assistants/${assistantID}`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -64,7 +65,7 @@ export class Assistants extends APIResource { * Delete an assistant. */ delete(assistantID: string, options?: RequestOptions): APIPromise { - return this._client.delete(`/assistants/${assistantID}`, { + return this._client.delete(path`/assistants/${assistantID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 3390040cf..3bba148b9 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -7,13 +7,14 @@ import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; export class Messages extends APIResource { /** * Create a message. */ create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise { - return this._client.post(`/threads/${threadID}/messages`, { + return this._client.post(path`/threads/${threadID}/messages`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -25,7 +26,7 @@ export class Messages extends APIResource { */ retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; - return this._client.get(`/threads/${thread_id}/messages/${messageID}`, { + return this._client.get(path`/threads/${thread_id}/messages/${messageID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -36,7 +37,7 @@ export class Messages extends APIResource { */ update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; - return this._client.post(`/threads/${thread_id}/messages/${messageID}`, { + return this._client.post(path`/threads/${thread_id}/messages/${messageID}`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -51,7 +52,7 @@ export class Messages extends APIResource { query: MessageListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { - return this._client.getAPIList(`/threads/${threadID}/messages`, CursorPage, { + return this._client.getAPIList(path`/threads/${threadID}/messages`, CursorPage, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -67,7 +68,7 @@ export class Messages extends APIResource { options?: RequestOptions, ): APIPromise { const { thread_id } = params; - return this._client.delete(`/threads/${thread_id}/messages/${messageID}`, { + return this._client.delete(path`/threads/${thread_id}/messages/${messageID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 80e5ca26c..8f7ce54ad 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -40,6 +40,7 @@ import { RequestOptions } from '../../../../internal/request-options'; import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; import { sleep } from '../../../../internal/utils/sleep'; import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; +import { path } from '../../../../internal/utils/path'; export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); @@ -64,7 +65,7 @@ export class Runs extends APIResource { options?: RequestOptions, ): APIPromise | APIPromise> { const { include, ...body } = params; - return this._client.post(`/threads/${threadID}/runs`, { + return this._client.post(path`/threads/${threadID}/runs`, { query: { include }, body, ...options, @@ -78,7 +79,7 @@ export class Runs extends APIResource { */ retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; - return this._client.get(`/threads/${thread_id}/runs/${runID}`, { + return this._client.get(path`/threads/${thread_id}/runs/${runID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -89,7 +90,7 @@ export class Runs extends APIResource { */ update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; - return this._client.post(`/threads/${thread_id}/runs/${runID}`, { + return this._client.post(path`/threads/${thread_id}/runs/${runID}`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -104,7 +105,7 @@ export class Runs extends APIResource { query: RunListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { - return this._client.getAPIList(`/threads/${threadID}/runs`, CursorPage, { + return this._client.getAPIList(path`/threads/${threadID}/runs`, CursorPage, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -116,7 +117,7 @@ export class Runs extends APIResource { */ cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise { const { thread_id } = params; - return this._client.post(`/threads/${thread_id}/runs/${runID}/cancel`, { + return this._client.post(path`/threads/${thread_id}/runs/${runID}/cancel`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -239,7 +240,7 @@ export class Runs extends APIResource { options?: RequestOptions, ): APIPromise | APIPromise> { const { thread_id, ...body } = params; - return this._client.post(`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, { + return this._client.post(path`/threads/${thread_id}/runs/${runID}/submit_tool_outputs`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 114dfb190..adaa4c9a1 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -7,6 +7,7 @@ import { APIPromise } from '../../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; +import { path } from '../../../../internal/utils/path'; export class Steps extends APIResource { /** @@ -14,7 +15,7 @@ export class Steps extends APIResource { */ retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id, run_id, ...query } = params; - return this._client.get(`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, { + return this._client.get(path`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -26,7 +27,7 @@ export class Steps extends APIResource { */ list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise { const { thread_id, ...query } = params; - return this._client.getAPIList(`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, { + return this._client.getAPIList(path`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 4b56a1cc3..b7ae889a6 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -72,6 +72,7 @@ import { Stream } from '../../../streaming'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; +import { path } from '../../../internal/utils/path'; export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); @@ -92,7 +93,7 @@ export class Threads extends APIResource { * Retrieves a thread. */ retrieve(threadID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/threads/${threadID}`, { + return this._client.get(path`/threads/${threadID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -102,7 +103,7 @@ export class Threads extends APIResource { * Modifies a thread. */ update(threadID: string, body: ThreadUpdateParams, options?: RequestOptions): APIPromise { - return this._client.post(`/threads/${threadID}`, { + return this._client.post(path`/threads/${threadID}`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -113,7 +114,7 @@ export class Threads extends APIResource { * Delete a thread. */ delete(threadID: string, options?: RequestOptions): APIPromise { - return this._client.delete(`/threads/${threadID}`, { + return this._client.delete(path`/threads/${threadID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/beta/vector-stores/file-batches.ts index 347cc7b77..4cb62feb8 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/beta/vector-stores/file-batches.ts @@ -11,6 +11,7 @@ import { RequestOptions } from '../../../internal/request-options'; import { sleep } from '../../../internal/utils/sleep'; import { type Uploadable } from '../../../uploads'; import { allSettledWithThrow } from '../../../lib/Util'; +import { path } from '../../../internal/utils/path'; export class FileBatches extends APIResource { /** @@ -21,7 +22,7 @@ export class FileBatches extends APIResource { body: FileBatchCreateParams, options?: RequestOptions, ): APIPromise { - return this._client.post(`/vector_stores/${vectorStoreID}/file_batches`, { + return this._client.post(path`/vector_stores/${vectorStoreID}/file_batches`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -37,7 +38,7 @@ export class FileBatches extends APIResource { options?: RequestOptions, ): APIPromise { const { vector_store_id } = params; - return this._client.get(`/vector_stores/${vector_store_id}/file_batches/${batchID}`, { + return this._client.get(path`/vector_stores/${vector_store_id}/file_batches/${batchID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -53,7 +54,7 @@ export class FileBatches extends APIResource { options?: RequestOptions, ): APIPromise { const { vector_store_id } = params; - return this._client.post(`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, { + return this._client.post(path`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -81,7 +82,7 @@ export class FileBatches extends APIResource { ): PagePromise { const { vector_store_id, ...query } = params; return this._client.getAPIList( - `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, + path`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]) }, ); diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/beta/vector-stores/files.ts index 81a718e1c..2c499930e 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/beta/vector-stores/files.ts @@ -8,6 +8,7 @@ import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { sleep } from '../../../internal/utils'; import { Uploadable } from '../../../uploads'; +import { path } from '../../../internal/utils/path'; export class Files extends APIResource { /** @@ -20,7 +21,7 @@ export class Files extends APIResource { body: FileCreateParams, options?: RequestOptions, ): APIPromise { - return this._client.post(`/vector_stores/${vectorStoreID}/files`, { + return this._client.post(path`/vector_stores/${vectorStoreID}/files`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -36,7 +37,7 @@ export class Files extends APIResource { options?: RequestOptions, ): APIPromise { const { vector_store_id } = params; - return this._client.get(`/vector_stores/${vector_store_id}/files/${fileID}`, { + return this._client.get(path`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -50,7 +51,7 @@ export class Files extends APIResource { query: FileListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { - return this._client.getAPIList(`/vector_stores/${vectorStoreID}/files`, CursorPage, { + return this._client.getAPIList(path`/vector_stores/${vectorStoreID}/files`, CursorPage, { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -69,7 +70,7 @@ export class Files extends APIResource { options?: RequestOptions, ): APIPromise { const { vector_store_id } = params; - return this._client.delete(`/vector_stores/${vector_store_id}/files/${fileID}`, { + return this._client.delete(path`/vector_stores/${vector_store_id}/files/${fileID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/beta/vector-stores/vector-stores.ts index e40226a9f..94f32905e 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/beta/vector-stores/vector-stores.ts @@ -26,6 +26,7 @@ import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; export class VectorStores extends APIResource { files: FilesAPI.Files = new FilesAPI.Files(this._client); @@ -46,7 +47,7 @@ export class VectorStores extends APIResource { * Retrieves a vector store. */ retrieve(vectorStoreID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/vector_stores/${vectorStoreID}`, { + return this._client.get(path`/vector_stores/${vectorStoreID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); @@ -60,7 +61,7 @@ export class VectorStores extends APIResource { body: VectorStoreUpdateParams, options?: RequestOptions, ): APIPromise { - return this._client.post(`/vector_stores/${vectorStoreID}`, { + return this._client.post(path`/vector_stores/${vectorStoreID}`, { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), @@ -85,7 +86,7 @@ export class VectorStores extends APIResource { * Delete a vector store. */ delete(vectorStoreID: string, options?: RequestOptions): APIPromise { - return this._client.delete(`/vector_stores/${vectorStoreID}`, { + return this._client.delete(path`/vector_stores/${vectorStoreID}`, { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); diff --git a/src/resources/files.ts b/src/resources/files.ts index 03d016614..759cc9cb2 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -9,6 +9,7 @@ import { RequestOptions } from '../internal/request-options'; import { sleep } from '../internal/utils/sleep'; import { APIConnectionTimeoutError } from '../error'; import { multipartFormRequestOptions } from '../internal/uploads'; +import { path } from '../internal/utils/path'; export class Files extends APIResource { /** @@ -42,7 +43,7 @@ export class Files extends APIResource { * Returns information about a specific file. */ retrieve(fileID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/files/${fileID}`, options); + return this._client.get(path`/files/${fileID}`, options); } /** @@ -59,14 +60,14 @@ export class Files extends APIResource { * Delete a file. */ delete(fileID: string, options?: RequestOptions): APIPromise { - return this._client.delete(`/files/${fileID}`, options); + return this._client.delete(path`/files/${fileID}`, options); } /** * Returns the contents of the specified file. */ content(fileID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/files/${fileID}/content`, { + return this._client.get(path`/files/${fileID}/content`, { ...options, headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]), __binaryResponse: true, diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index 2b7ea0e95..134715cec 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../../resource'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; export class Checkpoints extends APIResource { /** @@ -14,7 +15,7 @@ export class Checkpoints extends APIResource { options?: RequestOptions, ): PagePromise { return this._client.getAPIList( - `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, + path`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query, ...options }, ); diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 7beabbd7a..51cac957c 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -11,6 +11,7 @@ import { import { APIPromise } from '../../../api-promise'; import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; export class Jobs extends APIResource { checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); @@ -34,7 +35,7 @@ export class Jobs extends APIResource { * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) */ retrieve(fineTuningJobID: string, options?: RequestOptions): APIPromise { - return this._client.get(`/fine_tuning/jobs/${fineTuningJobID}`, options); + return this._client.get(path`/fine_tuning/jobs/${fineTuningJobID}`, options); } /** @@ -51,7 +52,7 @@ export class Jobs extends APIResource { * Immediately cancel a fine-tune job. */ cancel(fineTuningJobID: string, options?: RequestOptions): APIPromise { - return this._client.post(`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options); + return this._client.post(path`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options); } /** @@ -63,7 +64,7 @@ export class Jobs extends APIResource { options?: RequestOptions, ): PagePromise { return this._client.getAPIList( - `/fine_tuning/jobs/${fineTuningJobID}/events`, + path`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query, ...options }, ); diff --git a/src/resources/models.ts b/src/resources/models.ts index f6ec034ec..69ba58279 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -4,6 +4,7 @@ import { APIResource } from '../resource'; import { APIPromise } from '../api-promise'; import { Page, PagePromise } from '../pagination'; import { RequestOptions } from '../internal/request-options'; +import { path } from '../internal/utils/path'; export class Models extends APIResource { /** @@ -11,7 +12,7 @@ export class Models extends APIResource { * the owner and permissioning. */ retrieve(model: string, options?: RequestOptions): APIPromise { - return this._client.get(`/models/${model}`, options); + return this._client.get(path`/models/${model}`, options); } /** @@ -27,7 +28,7 @@ export class Models extends APIResource { * delete a model. */ delete(model: string, options?: RequestOptions): APIPromise { - return this._client.delete(`/models/${model}`, options); + return this._client.delete(path`/models/${model}`, options); } } diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index fbf2dc226..18568c3e4 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -5,6 +5,7 @@ import { APIPromise } from '../../api-promise'; import { type Uploadable } from '../../uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; +import { path } from '../../internal/utils/path'; export class Parts extends APIResource { /** @@ -22,7 +23,7 @@ export class Parts extends APIResource { */ create(uploadID: string, body: PartCreateParams, options?: RequestOptions): APIPromise { return this._client.post( - `/uploads/${uploadID}/parts`, + path`/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client), ); } diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index c263c049a..8bd783c4d 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -6,6 +6,7 @@ import * as PartsAPI from './parts'; import { PartCreateParams, Parts, UploadPart } from './parts'; import { APIPromise } from '../../api-promise'; import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; export class Uploads extends APIResource { parts: PartsAPI.Parts = new PartsAPI.Parts(this._client); @@ -40,7 +41,7 @@ export class Uploads extends APIResource { * Cancels the Upload. No Parts may be added after an Upload is cancelled. */ cancel(uploadID: string, options?: RequestOptions): APIPromise { - return this._client.post(`/uploads/${uploadID}/cancel`, options); + return this._client.post(path`/uploads/${uploadID}/cancel`, options); } /** @@ -59,7 +60,7 @@ export class Uploads extends APIResource { * an Upload is completed. */ complete(uploadID: string, body: UploadCompleteParams, options?: RequestOptions): APIPromise { - return this._client.post(`/uploads/${uploadID}/complete`, { body, ...options }); + return this._client.post(path`/uploads/${uploadID}/complete`, { body, ...options }); } } diff --git a/tests/path.test.ts b/tests/path.test.ts new file mode 100644 index 000000000..832e4a676 --- /dev/null +++ b/tests/path.test.ts @@ -0,0 +1,318 @@ +import { createPathTagFunction, encodeURIPath } from 'openai/internal/utils/path'; +import { inspect } from 'node:util'; + +describe('path template tag function', () => { + test('validates input', () => { + const testParams = ['', '.', '..', 'x', '%2e', '%2E', '%2e%2e', '%2E%2e', '%2e%2E', '%2E%2E']; + const testCases = [ + ['/path_params/', '/a'], + ['/path_params/', '/'], + ['/path_params/', ''], + ['', '/a'], + ['', '/'], + ['', ''], + ['a'], + [''], + ['/path_params/', ':initiate'], + ['/path_params/', '.json'], + ['/path_params/', '?beta=true'], + ['/path_params/', '.?beta=true'], + ['/path_params/', '/', '/download'], + ['/path_params/', '-', '/download'], + ['/path_params/', '', '/download'], + ['/path_params/', '.', '/download'], + ['/path_params/', '..', '/download'], + ['/plain/path'], + ]; + + function paramPermutations(len: number): string[][] { + if (len === 0) return []; + if (len === 1) return testParams.map((e) => [e]); + const rest = paramPermutations(len - 1); + return testParams.flatMap((e) => rest.map((r) => [e, ...r])); + } + + // we need to test how %2E is handled so we use a custom encoder that does no escaping + const rawPath = createPathTagFunction((s) => s); + + const results: { + [pathParts: string]: { + [params: string]: { valid: boolean; result?: string; error?: string }; + }; + } = {}; + + for (const pathParts of testCases) { + const pathResults: Record = {}; + results[JSON.stringify(pathParts)] = pathResults; + for (const params of paramPermutations(pathParts.length - 1)) { + const stringRaw = String.raw({ raw: pathParts }, ...params); + const plainString = String.raw( + { raw: pathParts.map((e) => e.replace(/\./g, 'x')) }, + ...params.map((e) => 'X'.repeat(e.length)), + ); + const normalizedStringRaw = new URL(stringRaw, 'https://example.com/').href; + const normalizedPlainString = new URL(plainString, 'https://example.com/').href; + const pathResultsKey = JSON.stringify(params); + try { + const result = rawPath(pathParts, ...params); + expect(result).toBe(stringRaw); + // there are no special segments, so the length of the normalized path is + // equal to the length of the normalized plain path. + expect(normalizedStringRaw.length).toBe(normalizedPlainString.length); + pathResults[pathResultsKey] = { + valid: true, + result, + }; + } catch (e) { + const error = String(e); + expect(error).toMatch(/Path parameters result in path with invalid segment/); + // there are special segments, so the length of the normalized path is + // different than the length of the normalized plain path. + expect(normalizedStringRaw.length).not.toBe(normalizedPlainString.length); + pathResults[pathResultsKey] = { + valid: false, + error, + }; + } + } + } + + expect(results).toMatchObject({ + '["/path_params/","/a"]': { + '["x"]': { valid: true, result: '/path_params/x/a' }, + '[""]': { valid: true, result: '/path_params//a' }, + '["%2E%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E%2e/a\n' + + ' ^^^^^^', + }, + '["%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E/a\n' + + ' ^^^', + }, + }, + '["/path_params/","/"]': { + '["x"]': { valid: true, result: '/path_params/x/' }, + '[""]': { valid: true, result: '/path_params//' }, + '["%2e%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2e%2E/\n' + + ' ^^^^^^', + }, + '["%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2e/\n' + + ' ^^^', + }, + }, + '["/path_params/",""]': { + '[""]': { valid: true, result: '/path_params/' }, + '["x"]': { valid: true, result: '/path_params/x' }, + '["%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E\n' + + ' ^^^', + }, + '["%2E%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E%2e\n' + + ' ^^^^^^', + }, + }, + '["","/a"]': { + '[""]': { valid: true, result: '/a' }, + '["x"]': { valid: true, result: 'x/a' }, + '["%2E"]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n%2E/a\n^^^', + }, + '["%2e%2E"]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n' + '%2e%2E/a\n' + '^^^^^^', + }, + }, + '["","/"]': { + '["x"]': { valid: true, result: 'x/' }, + '[""]': { valid: true, result: '/' }, + '["%2E%2e"]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n' + '%2E%2e/\n' + '^^^^^^', + }, + '["."]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n./\n^', + }, + }, + '["",""]': { + '[""]': { valid: true, result: '' }, + '["x"]': { valid: true, result: 'x' }, + '[".."]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n..\n^^', + }, + '["."]': { + valid: false, + error: 'Error: Path parameters result in path with invalid segments:\n.\n^', + }, + }, + '["a"]': {}, + '[""]': {}, + '["/path_params/",":initiate"]': { + '[""]': { valid: true, result: '/path_params/:initiate' }, + '["."]': { valid: true, result: '/path_params/.:initiate' }, + }, + '["/path_params/",".json"]': { + '["x"]': { valid: true, result: '/path_params/x.json' }, + '["."]': { valid: true, result: '/path_params/..json' }, + }, + '["/path_params/","?beta=true"]': { + '["x"]': { valid: true, result: '/path_params/x?beta=true' }, + '[""]': { valid: true, result: '/path_params/?beta=true' }, + '["%2E%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E%2E?beta=true\n' + + ' ^^^^^^', + }, + '["%2e%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2e%2E?beta=true\n' + + ' ^^^^^^', + }, + }, + '["/path_params/",".?beta=true"]': { + '[".."]': { valid: true, result: '/path_params/...?beta=true' }, + '["x"]': { valid: true, result: '/path_params/x.?beta=true' }, + '[""]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/.?beta=true\n' + + ' ^', + }, + '["%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2e.?beta=true\n' + + ' ^^^^', + }, + }, + '["/path_params/","/","/download"]': { + '["",""]': { valid: true, result: '/path_params///download' }, + '["","x"]': { valid: true, result: '/path_params//x/download' }, + '[".","%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/./%2e/download\n' + + ' ^ ^^^', + }, + '["%2E%2e","%2e"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E%2e/%2e/download\n' + + ' ^^^^^^ ^^^', + }, + }, + '["/path_params/","-","/download"]': { + '["","%2e"]': { valid: true, result: '/path_params/-%2e/download' }, + '["%2E",".."]': { valid: true, result: '/path_params/%2E-../download' }, + }, + '["/path_params/","","/download"]': { + '["%2E%2e","%2e%2E"]': { valid: true, result: '/path_params/%2E%2e%2e%2E/download' }, + '["%2E",".."]': { valid: true, result: '/path_params/%2E../download' }, + '["","%2E"]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E/download\n' + + ' ^^^', + }, + '["%2E","."]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/%2E./download\n' + + ' ^^^^', + }, + }, + '["/path_params/",".","/download"]': { + '["%2e%2e",""]': { valid: true, result: '/path_params/%2e%2e./download' }, + '["","%2e%2e"]': { valid: true, result: '/path_params/.%2e%2e/download' }, + '["",""]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/./download\n' + + ' ^', + }, + '["","."]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/../download\n' + + ' ^^', + }, + }, + '["/path_params/","..","/download"]': { + '["","%2E"]': { valid: true, result: '/path_params/..%2E/download' }, + '["","x"]': { valid: true, result: '/path_params/..x/download' }, + '["",""]': { + valid: false, + error: + 'Error: Path parameters result in path with invalid segments:\n' + + '/path_params/../download\n' + + ' ^^', + }, + }, + }); + }); +}); + +describe('encodeURIPath', () => { + const testCases: string[] = [ + '', + // Every ASCII character + ...Array.from({ length: 0x7f }, (_, i) => String.fromCharCode(i)), + // Unicode BMP codepoint + 'å', + // Unicode supplementary codepoint + '😃', + ]; + + for (const param of testCases) { + test('properly encodes ' + inspect(param), () => { + const encoded = encodeURIPath(param); + const naiveEncoded = encodeURIComponent(param); + // we should never encode more characters than encodeURIComponent + expect(naiveEncoded.length).toBeGreaterThanOrEqual(encoded.length); + expect(decodeURIComponent(encoded)).toBe(param); + }); + } + + test("leaves ':' intact", () => { + expect(encodeURIPath(':')).toBe(':'); + }); + + test("leaves '@' intact", () => { + expect(encodeURIPath('@')).toBe('@'); + }); +}); From d99b497ee86adacb17e97f9b96728b31eb7dbf71 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 10 Feb 2025 18:54:04 +0000 Subject: [PATCH 154/509] fix: ChatCompletionStream types --- src/lib/ChatCompletionStream.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index a6747aeb1..ce64e1aad 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -11,6 +11,7 @@ import { type ChatCompletionCreateParams, type ChatCompletionCreateParamsStreaming, type ChatCompletionCreateParamsBase, + type ChatCompletionRole, } from '../resources/chat/completions'; import { AbstractChatCompletionRunner, @@ -797,7 +798,7 @@ export namespace ChatCompletionSnapshot { /** * The role of the author of this message. */ - role?: 'system' | 'user' | 'assistant' | 'function' | 'tool'; + role?: ChatCompletionRole; } export namespace Message { From 4cec09d0b608a8c38969522c494818bd119a23df Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 5 Feb 2025 21:25:49 +0000 Subject: [PATCH 155/509] fix(api): add missing reasoning effort + model enums --- .stats.yml | 2 +- src/resources/beta/assistants.ts | 51 ++++++++++++++++++- src/resources/beta/threads/runs/runs.ts | 10 ++++ src/resources/chat/completions.ts | 8 +-- tests/api-resources/beta/assistants.test.ts | 1 + .../beta/threads/runs/runs.test.ts | 1 + 6 files changed, 67 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index df7877dfd..8a5d2c06b 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-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index a588df115..f6f8f4297 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1123,6 +1123,16 @@ export interface AssistantCreateParams { */ name?: string | null; + /** + * **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), @@ -1278,13 +1288,52 @@ export interface AssistantUpdateParams { * [Model overview](https://platform.openai.com/docs/models) for descriptions of * them. */ - model?: string; + model?: + | (string & {}) + | 'o3-mini' + | 'o3-mini-2025-01-31' + | 'o1' + | 'o1-2024-12-17' + | 'gpt-4o' + | 'gpt-4o-2024-11-20' + | 'gpt-4o-2024-08-06' + | 'gpt-4o-2024-05-13' + | 'gpt-4o-mini' + | 'gpt-4o-mini-2024-07-18' + | 'gpt-4-turbo' + | 'gpt-4-turbo-2024-04-09' + | 'gpt-4-0125-preview' + | 'gpt-4-turbo-preview' + | 'gpt-4-1106-preview' + | 'gpt-4-vision-preview' + | 'gpt-4' + | 'gpt-4-0314' + | 'gpt-4-0613' + | 'gpt-4-32k' + | 'gpt-4-32k-0314' + | 'gpt-4-32k-0613' + | 'gpt-3.5-turbo' + | 'gpt-3.5-turbo-16k' + | 'gpt-3.5-turbo-0613' + | 'gpt-3.5-turbo-1106' + | 'gpt-3.5-turbo-0125' + | 'gpt-3.5-turbo-16k-0613'; /** * The name of the assistant. The maximum length is 256 characters. */ name?: string | null; + /** + * **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 8f7ce54ad..b9708dc34 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -708,6 +708,16 @@ export interface RunCreateParamsBase { */ parallel_tool_calls?: boolean; + /** + * Body param: **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Body param: Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index f2eb4625a..48577e667 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -741,14 +741,14 @@ export interface ChatCompletionPredictionContent { } /** - * **o1 models only** + * **o1 and o3-mini models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ -export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high'; +export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; /** * The role of the author of a message @@ -1055,14 +1055,14 @@ export interface ChatCompletionCreateParamsBase { presence_penalty?: number | null; /** - * **o1 models only** + * **o1 and o3-mini models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: ChatCompletionReasoningEffort; + reasoning_effort?: ChatCompletionReasoningEffort | null; /** * An object specifying the format that the model must output. diff --git a/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index d799a118b..8bdbc408e 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -26,6 +26,7 @@ describe('resource assistants', () => { instructions: 'instructions', metadata: { foo: 'string' }, name: 'name', + reasoning_effort: 'low', response_format: 'auto', temperature: 1, tool_resources: { diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index b11138810..118a4f324 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -38,6 +38,7 @@ describe('resource runs', () => { metadata: { foo: 'string' }, model: 'gpt-4o', parallel_tool_calls: true, + reasoning_effort: 'low', response_format: 'auto', stream: false, temperature: 1, From 87d26db4f3b59b06f94fd64b8ecf5680ef83efcc Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Thu, 6 Feb 2025 10:12:43 -0500 Subject: [PATCH 156/509] feat(pagination): avoid fetching when has_more: false chore: unknown commit message --- .stats.yml | 2 +- src/pagination.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8a5d2c06b..d59a86d22 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-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-dfb00c627f58e5180af7a9b29ed2f2aa0764a3b9daa6a32a1cc45bc8e48dfe15.yml diff --git a/src/pagination.ts b/src/pagination.ts index 9a4aa86d1..7a2ef53a9 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -145,6 +145,8 @@ export class Page extends AbstractPage implements PageResponse export interface CursorPageResponse { data: Array; + + has_more: boolean; } export interface CursorPageParams { @@ -159,6 +161,8 @@ export class CursorPage { data: Array; + has_more: boolean; + constructor( client: OpenAI, response: Response, @@ -168,12 +172,21 @@ export class CursorPage super(client, response, body, options); this.data = body.data || []; + this.has_more = body.has_more || false; } getPaginatedItems(): Item[] { return this.data ?? []; } + override hasNextPage() { + if (this.has_more === false) { + return false; + } + + return super.hasNextPage(); + } + nextPageRequestOptions(): PageRequestOptions | null { const data = this.getPaginatedItems(); const id = data[data.length - 1]?.id; From 0b35b7014c67f0d0d50397622fc77c701e8be793 Mon Sep 17 00:00:00 2001 From: Em Date: Tue, 4 Feb 2025 14:12:50 -0500 Subject: [PATCH 157/509] chore(internal): fix tests --- package.json | 1 + tests/lib/azure.test.ts | 12 ++++++------ tests/responses.test.ts | 5 +++++ yarn.lock | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index c05351d5f..bd6ab9aae 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "eslint": "^8.49.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-unused-imports": "^3.0.0", + "execa": "^5.1.1", "fast-check": "^3.22.0", "iconv-lite": "^0.6.3", "jest": "^29.4.0", diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 220a448df..9f0ddd311 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -376,7 +376,7 @@ describe('azure request building', () => { expect( await client.audio.translations.create({ model, - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, @@ -387,7 +387,7 @@ describe('azure request building', () => { expect( await client.audio.transcriptions.create({ model, - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, @@ -432,7 +432,7 @@ describe('azure request building', () => { test('handles files', async () => { expect( await client.files.create({ - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, purpose: 'assistants', }), ).toMatchObject({ @@ -509,7 +509,7 @@ describe('azure request building', () => { expect( await client.audio.translations.create({ model: deployment, - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ url: `https://example.com/openai/audio/translations?api-version=${apiVersion}`, @@ -520,7 +520,7 @@ describe('azure request building', () => { expect( await client.audio.transcriptions.create({ model: deployment, - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ url: `https://example.com/openai/audio/transcriptions?api-version=${apiVersion}`, @@ -565,7 +565,7 @@ describe('azure request building', () => { test('handles files', async () => { expect( await client.files.create({ - file: { url: 'https://example.com/', blob: () => 0 as any }, + file: { url: 'https://example.com/', blob: async () => new Blob([]) }, purpose: 'assistants', }), ).toMatchObject({ diff --git a/tests/responses.test.ts b/tests/responses.test.ts index f24937cc0..fe741673c 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -2,6 +2,8 @@ import { APIPromise } from 'openai/api-promise'; import OpenAI from 'openai/index'; import { compareType } from './utils/typing'; +const client = new OpenAI(); + describe('request id', () => { test('types', () => { compareType>, string>(true); @@ -54,6 +56,7 @@ describe('request id', () => { test('envelope response', async () => { const promise = new APIPromise<{ data: { foo: string } }>( + client, (async () => { return { response: new Response(JSON.stringify({ data: { foo: 'bar' } }), { @@ -86,6 +89,7 @@ describe('request id', () => { test('array response', async () => { const promise = new APIPromise>( + client, (async () => { return { response: new Response(JSON.stringify([{ foo: 'bar' }]), { @@ -105,6 +109,7 @@ describe('request id', () => { test('string response', async () => { const promise = new APIPromise( + client, (async () => { return { response: new Response('hello world', { diff --git a/yarn.lock b/yarn.lock index de41e5502..88e46f311 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1694,7 +1694,7 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -execa@^5.0.0: +execa@^5.0.0, execa@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== From 7f4714c6b2d061e43e3368a83eb30bbcb6f9ea21 Mon Sep 17 00:00:00 2001 From: hi019 <65871571+hi019@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:57:18 -0800 Subject: [PATCH 158/509] docs: fix typo, "zodFunctionTool" -> "zodFunction" (#1128) --- helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index abf980c82..aa3775a54 100644 --- a/helpers.md +++ b/helpers.md @@ -49,7 +49,7 @@ if (message?.parsed) { The `.parse()` method will also automatically parse `function` tool calls if: -- You use the `zodFunctionTool()` helper method +- You use the `zodFunction()` helper method - You mark your tool schema with `"strict": True` For example: From 71dd1547e5fdcee33eab760027865f0e3e6b5aee Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 22 Jan 2025 20:53:36 +0000 Subject: [PATCH 159/509] docs(helpers): fix type annotation --- helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers.md b/helpers.md index aa3775a54..16bc1f277 100644 --- a/helpers.md +++ b/helpers.md @@ -226,7 +226,7 @@ on in the documentation page [Message](https://platform.openai.com/docs/api-refe ```ts .on('textCreated', (content: Text) => ...) -.on('textDelta', (delta: RunStepDelta, snapshot: Text) => ...) +.on('textDelta', (delta: TextDelta, snapshot: Text) => ...) .on('textDone', (content: Text, snapshot: Message) => ...) ``` From a40d359538cf68733a55dbd22749fd80d019878f Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 10 Feb 2025 20:31:48 +0000 Subject: [PATCH 160/509] chore(internal): remove segfault-handler --- ecosystem-tests/cli.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 39361ae2e..d4fa48b0d 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -4,12 +4,6 @@ import yargs from 'yargs'; import assert from 'assert'; import path from 'path'; -try { - // @ts-ignore - var SegfaultHandler = require('segfault-handler'); - SegfaultHandler.registerHandler('crash.log'); -} catch (_) {} - const TAR_NAME = 'openai.tgz'; const PACK_FOLDER = '.pack'; const PACK_FILE = `${PACK_FOLDER}/${TAR_NAME}`; From 2a43456b2e085f79ff3ebebdfa55c65f68dfbe56 Mon Sep 17 00:00:00 2001 From: Minh Anh Date: Wed, 5 Feb 2025 11:29:45 -0800 Subject: [PATCH 161/509] Fix Azure OpenAI client import --- src/beta/realtime/websocket.ts | 2 +- src/beta/realtime/ws.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts index 349cf5760..e8143fdbf 100644 --- a/src/beta/realtime/websocket.ts +++ b/src/beta/realtime/websocket.ts @@ -95,7 +95,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { } static async azure( - client: AzureOpenAI, + client: Pick, options: { deploymentName?: string; dangerouslyAllowBrowser?: boolean } = {}, ): Promise { const token = await client._getAzureADToken(); diff --git a/src/beta/realtime/ws.ts b/src/beta/realtime/ws.ts index 51339089c..3f51dfc4b 100644 --- a/src/beta/realtime/ws.ts +++ b/src/beta/realtime/ws.ts @@ -52,7 +52,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { } static async azure( - client: AzureOpenAI, + client: Pick, options: { deploymentName?: string; options?: WS.ClientOptions | undefined } = {}, ): Promise { const deploymentName = options.deploymentName ?? client.deploymentName; @@ -82,7 +82,7 @@ export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { } } -async function getAzureHeaders(client: AzureOpenAI) { +async function getAzureHeaders(client: Pick) { if (client.apiKey !== '') { return { 'api-key': client.apiKey }; } else { From 27d354a363d3c8dc5056bd28f8f1073757046f48 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Feb 2025 21:25:41 +0000 Subject: [PATCH 162/509] fix(api): add missing reasoning effort + model enums (#1302) --- .stats.yml | 2 +- src/resources/beta/assistants.ts | 51 ++++++++++++++++++- src/resources/beta/threads/runs/runs.ts | 10 ++++ src/resources/chat/completions.ts | 8 +-- tests/api-resources/beta/assistants.test.ts | 1 + .../beta/threads/runs/runs.test.ts | 1 + 6 files changed, 67 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index df7877dfd..8a5d2c06b 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-fc5dbc19505b0035f9e7f88868619f4fb519b048bde011f6154f3132d4be71fb.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 69a5db520..0cc63d691 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1133,6 +1133,16 @@ export interface AssistantCreateParams { */ name?: string | null; + /** + * **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), @@ -1288,13 +1298,52 @@ export interface AssistantUpdateParams { * [Model overview](https://platform.openai.com/docs/models) for descriptions of * them. */ - model?: string; + model?: + | (string & {}) + | 'o3-mini' + | 'o3-mini-2025-01-31' + | 'o1' + | 'o1-2024-12-17' + | 'gpt-4o' + | 'gpt-4o-2024-11-20' + | 'gpt-4o-2024-08-06' + | 'gpt-4o-2024-05-13' + | 'gpt-4o-mini' + | 'gpt-4o-mini-2024-07-18' + | 'gpt-4-turbo' + | 'gpt-4-turbo-2024-04-09' + | 'gpt-4-0125-preview' + | 'gpt-4-turbo-preview' + | 'gpt-4-1106-preview' + | 'gpt-4-vision-preview' + | 'gpt-4' + | 'gpt-4-0314' + | 'gpt-4-0613' + | 'gpt-4-32k' + | 'gpt-4-32k-0314' + | 'gpt-4-32k-0613' + | 'gpt-3.5-turbo' + | 'gpt-3.5-turbo-16k' + | 'gpt-3.5-turbo-0613' + | 'gpt-3.5-turbo-1106' + | 'gpt-3.5-turbo-0125' + | 'gpt-3.5-turbo-16k-0613'; /** * The name of the assistant. The maximum length is 256 characters. */ name?: string | null; + /** + * **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 84ba7b63c..8ab94cc99 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -731,6 +731,16 @@ export interface RunCreateParamsBase { */ parallel_tool_calls?: boolean; + /** + * Body param: **o1 and o3-mini models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + reasoning_effort?: 'low' | 'medium' | 'high' | null; + /** * Body param: Specifies the format that the model must output. Compatible with * [GPT-4o](https://platform.openai.com/docs/models#gpt-4o), diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 55b008cf0..2586845c3 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -744,14 +744,14 @@ export interface ChatCompletionPredictionContent { } /** - * **o1 models only** + * **o1 and o3-mini models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ -export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high'; +export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; /** * The role of the author of a message @@ -1063,14 +1063,14 @@ export interface ChatCompletionCreateParamsBase { presence_penalty?: number | null; /** - * **o1 models only** + * **o1 and o3-mini models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: ChatCompletionReasoningEffort; + reasoning_effort?: ChatCompletionReasoningEffort | null; /** * An object specifying the format that the model must output. diff --git a/tests/api-resources/beta/assistants.test.ts b/tests/api-resources/beta/assistants.test.ts index 88a10ba8f..16bc9f942 100644 --- a/tests/api-resources/beta/assistants.test.ts +++ b/tests/api-resources/beta/assistants.test.ts @@ -27,6 +27,7 @@ describe('resource assistants', () => { instructions: 'instructions', metadata: { foo: 'string' }, name: 'name', + reasoning_effort: 'low', response_format: 'auto', temperature: 1, tool_resources: { diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 9b728403f..13ae89a00 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -39,6 +39,7 @@ describe('resource runs', () => { metadata: { foo: 'string' }, model: 'gpt-4o', parallel_tool_calls: true, + reasoning_effort: 'low', response_format: 'auto', stream: false, temperature: 1, From f44641236e9f90758c535cc948d5734ae20fd5a5 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 5 Feb 2025 20:33:57 +0000 Subject: [PATCH 163/509] docs(readme): cleanup into multiple files --- README.md | 421 +++++++++++----------------------------------------- azure.md | 49 ++++++ helpers.md | 122 ++++++++++----- realtime.md | 87 +++++++++++ 4 files changed, 313 insertions(+), 366 deletions(-) create mode 100644 azure.md create mode 100644 realtime.md diff --git a/README.md b/README.md index a1f4bf760..166e35e22 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ import OpenAI from 'jsr:@openai/openai'; The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples). The code below shows how to get started using the chat completions API. -```js +```ts import OpenAI from 'openai'; const client = new OpenAI({ @@ -80,189 +80,11 @@ async function main() { main(); ``` -If you need to cancel a stream, you can `break` from the loop -or call `stream.controller.abort()`. - -## Realtime API beta - -The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. - -The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime). - -This SDK supports accessing the Realtime API through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) or with [ws](https://github.com/websockets/ws). - -Basic text based example with `ws`: - -```ts -// requires `yarn add ws @types/ws` -import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; - -const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); - -// access the underlying `ws.WebSocket` instance -rt.socket.on('open', () => { - console.log('Connection opened!'); - rt.send({ - type: 'session.update', - session: { - modalities: ['text'], - model: 'gpt-4o-realtime-preview', - }, - }); - - rt.send({ - type: 'conversation.item.create', - item: { - type: 'message', - role: 'user', - content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], - }, - }); - - rt.send({ type: 'response.create' }); -}); - -rt.on('error', (err) => { - // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors - throw err; -}); - -rt.on('session.created', (event) => { - console.log('session created!', event.session); - console.log(); -}); - -rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); -rt.on('response.text.done', () => console.log()); - -rt.on('response.done', () => rt.close()); - -rt.socket.on('close', () => console.log('\nConnection closed!')); -``` - -To use the web API `WebSocket` implementation, replace `OpenAIRealtimeWS` with `OpenAIRealtimeWebSocket` and adjust any `rt.socket` access: - -```ts -import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; - -const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); -// ... -rt.socket.addEventListener('open', () => { - // ... -}); -``` - -A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/websocket.ts). - -### Realtime error handling - -When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. - -It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable. - -```ts -const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); -rt.on('error', (err) => { - // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors - throw err; -}); -``` - -### Request & Response types - -This library includes TypeScript definitions for all request params and response fields. You may import and use them like so: - - -```ts -import OpenAI from 'openai'; - -const client = new OpenAI({ - apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted -}); - -async function main() { - const params: OpenAI.Chat.ChatCompletionCreateParams = { - messages: [{ role: 'user', content: 'Say this is a test' }], - model: 'gpt-4o', - }; - const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params); -} - -main(); -``` - -Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors. - -> [!IMPORTANT] -> Previous versions of this SDK used a `Configuration` class. See the [v3 to v4 migration guide](https://github.com/openai/openai-node/discussions/217). - -### Polling Helpers - -When interacting with the API some actions such as starting a Run and adding files to vector stores are asynchronous and take time to complete. The SDK includes -helper functions which will poll the status until it reaches a terminal state and then return the resulting object. -If an API method results in an action which could benefit from polling there will be a corresponding version of the -method ending in 'AndPoll'. - -For instance to create a Run and poll until it reaches a terminal state you can run: - -```ts -const run = await openai.beta.threads.runs.createAndPoll(thread.id, { - assistant_id: assistantId, -}); -``` - -More information on the lifecycle of a Run can be found in the [Run Lifecycle Documentation](https://platform.openai.com/docs/assistants/deep-dive/run-lifecycle) - -### Bulk Upload Helpers - -When creating and interacting with vector stores, you can use the polling helpers to monitor the status of operations. -For convenience, we also provide a bulk upload helper to allow you to simultaneously upload several files at once. - -```ts -const fileList = [ - createReadStream('/home/data/example.pdf'), - ... -]; - -const batch = await openai.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, {files: fileList}); -``` - -### Streaming Helpers - -The SDK also includes helpers to process streams and handle the incoming events. - -```ts -const run = openai.beta.threads.runs - .stream(thread.id, { - assistant_id: assistant.id, - }) - .on('textCreated', (text) => process.stdout.write('\nassistant > ')) - .on('textDelta', (textDelta, snapshot) => process.stdout.write(textDelta.value)) - .on('toolCallCreated', (toolCall) => process.stdout.write(`\nassistant > ${toolCall.type}\n\n`)) - .on('toolCallDelta', (toolCallDelta, snapshot) => { - if (toolCallDelta.type === 'code_interpreter') { - if (toolCallDelta.code_interpreter.input) { - process.stdout.write(toolCallDelta.code_interpreter.input); - } - if (toolCallDelta.code_interpreter.outputs) { - process.stdout.write('\noutput >\n'); - toolCallDelta.code_interpreter.outputs.forEach((output) => { - if (output.type === 'logs') { - process.stdout.write(`\n${output.logs}\n`); - } - }); - } - } - }); -``` - -More information on streaming helpers can be found in the dedicated documentation: [helpers.md](helpers.md) +If you need to cancel a stream, you can `break` from the loop or call `stream.controller.abort()`. -### Streaming responses +### Chat Completion streaming helpers -This library provides several conveniences for streaming chat completions, for example: +This library also provides several conveniences for streaming chat completions, for example: ```ts import OpenAI from 'openai'; @@ -292,98 +114,32 @@ async function main() { main(); ``` -Streaming with `openai.beta.chat.completions.stream({…})` exposes -[various helpers for your convenience](helpers.md#chat-events) including event handlers and promises. - -Alternatively, you can use `openai.chat.completions.create({ stream: true, … })` -which only returns an async iterable of the chunks in the stream and thus uses less memory -(it does not build up a final chat completion object for you). - -If you need to cancel a stream, you can `break` from a `for await` loop or call `stream.abort()`. - -### Automated function calls +See [helpers.md](helpers.md#chat-events) for more details. -We provide the `openai.beta.chat.completions.runTools({…})` -convenience helper for using function tool calls with the `/chat/completions` endpoint -which automatically call the JavaScript functions you provide -and sends their results back to the `/chat/completions` endpoint, -looping as long as the model requests tool calls. - -If you pass a `parse` function, it will automatically parse the `arguments` for you -and returns any parsing errors to the model to attempt auto-recovery. -Otherwise, the args will be passed to the function you provide as a string. +### Request & Response types -If you pass `tool_choice: {function: {name: …}}` instead of `auto`, -it returns immediately after calling that function (and only loops to auto-recover parsing errors). +This library includes TypeScript definitions for all request params and response fields. You may import and use them like so: + ```ts import OpenAI from 'openai'; -const client = new OpenAI(); +const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted +}); async function main() { - const runner = client.beta.chat.completions - .runTools({ - model: 'gpt-4o', - messages: [{ role: 'user', content: 'How is the weather this week?' }], - tools: [ - { - type: 'function', - function: { - function: getCurrentLocation, - parameters: { type: 'object', properties: {} }, - }, - }, - { - type: 'function', - function: { - function: getWeather, - parse: JSON.parse, // or use a validation library like zod for typesafe parsing. - parameters: { - type: 'object', - properties: { - location: { type: 'string' }, - }, - }, - }, - }, - ], - }) - .on('message', (message) => console.log(message)); - - const finalContent = await runner.finalContent(); - console.log(); - console.log('Final content:', finalContent); -} - -async function getCurrentLocation() { - return 'Boston'; // Simulate lookup -} - -async function getWeather(args: { location: string }) { - const { location } = args; - // … do lookup … - return { temperature, precipitation }; + const params: OpenAI.Chat.ChatCompletionCreateParams = { + messages: [{ role: 'user', content: 'Say this is a test' }], + model: 'gpt-4o', + }; + const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params); } main(); - -// {role: "user", content: "How's the weather this week?"} -// {role: "assistant", tool_calls: [{type: "function", function: {name: "getCurrentLocation", arguments: "{}"}, id: "123"} -// {role: "tool", name: "getCurrentLocation", content: "Boston", tool_call_id: "123"} -// {role: "assistant", tool_calls: [{type: "function", function: {name: "getWeather", arguments: '{"location": "Boston"}'}, id: "1234"}]} -// {role: "tool", name: "getWeather", content: '{"temperature": "50degF", "preciptation": "high"}', tool_call_id: "1234"} -// {role: "assistant", content: "It's looking cold and rainy - you might want to wear a jacket!"} -// -// Final content: "It's looking cold and rainy - you might want to wear a jacket!" ``` -Like with `.stream()`, we provide a variety of [helpers and events](helpers.md#chat-events). - -Note that `runFunctions` was previously available as well, but has been deprecated in favor of `runTools`. - -Read more about various examples such as with integrating with [zod](helpers.md#integrate-with-zod), -[next.js](helpers.md#integrate-with-nextjs), and [proxying a stream to the browser](helpers.md#proxy-streaming-to-a-browser). +Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors. ## File uploads @@ -434,6 +190,7 @@ async function main() { .create({ model: 'gpt-4o', training_file: 'file-abc123' }) .catch(async (err) => { if (err instanceof OpenAI.APIError) { + console.log(err.request_id); console.log(err.status); // 400 console.log(err.name); // BadRequestError console.log(err.headers); // {server: 'nginx', ...} @@ -459,76 +216,6 @@ Error codes are as followed: | >=500 | `InternalServerError` | | N/A | `APIConnectionError` | -## Request IDs - -> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests) - -All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI. - -```ts -const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }); -console.log(completion._request_id) // req_123 -``` - -You can also access the Request ID using the `.withResponse()` method: - -```ts -const { data: stream, request_id } = await openai.chat.completions - .create({ - model: 'gpt-4', - messages: [{ role: 'user', content: 'Say this is a test' }], - stream: true, - }) - .withResponse(); -``` - -## Microsoft Azure OpenAI - -To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` -class instead of the `OpenAI` class. - -> [!IMPORTANT] -> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params -> won't always be correct. - -```ts -import { AzureOpenAI } from 'openai'; -import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity'; - -const credential = new DefaultAzureCredential(); -const scope = 'https://cognitiveservices.azure.com/.default'; -const azureADTokenProvider = getBearerTokenProvider(credential, scope); - -const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "" }); - -const result = await openai.chat.completions.create({ - model: 'gpt-4o', - messages: [{ role: 'user', content: 'Say hello!' }], -}); - -console.log(result.choices[0]!.message?.content); -``` - -### Realtime API -This SDK provides real-time streaming capabilities for Azure OpenAI through the `OpenAIRealtimeWS` and `OpenAIRealtimeWebSocket` clients described previously. - -To utilize the real-time features, begin by creating a fully configured `AzureOpenAI` client and passing it into either `OpenAIRealtimeWS.azure` or `OpenAIRealtimeWebSocket.azure`. For example: - -```ts -const cred = new DefaultAzureCredential(); -const scope = 'https://cognitiveservices.azure.com/.default'; -const deploymentName = 'gpt-4o-realtime-preview-1001'; -const azureADTokenProvider = getBearerTokenProvider(cred, scope); -const client = new AzureOpenAI({ - azureADTokenProvider, - apiVersion: '2024-10-01-preview', - deployment: deploymentName, -}); -const rt = await OpenAIRealtimeWS.azure(client); -``` - -Once the instance has been created, you can then begin sending requests and receiving streaming responses in real time. - ### Retries Certain errors will be automatically retried 2 times by default, with a short exponential backoff. @@ -571,6 +258,29 @@ On timeout, an `APIConnectionTimeoutError` is thrown. Note that requests which time out will be [retried twice by default](#retries). +## Request IDs + +> For more information on debugging requests, see [these docs](https://platform.openai.com/docs/api-reference/debugging-requests) + +All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI. + +```ts +const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }); +console.log(completion._request_id) // req_123 +``` + +You can also access the Request ID using the `.withResponse()` method: + +```ts +const { data: stream, request_id } = await openai.chat.completions + .create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + stream: true, + }) + .withResponse(); +``` + ## Auto-pagination List methods in the OpenAI API are paginated. @@ -602,6 +312,55 @@ while (page.hasNextPage()) { } ``` +## Realtime API Beta + +The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. + +```ts +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + +rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); +``` + +For more information see [realtime.md](realtime.md). + +## Microsoft Azure OpenAI + +To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` +class instead of the `OpenAI` class. + +> [!IMPORTANT] +> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params +> won't always be correct. + +```ts +import { AzureOpenAI } from 'openai'; +import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity'; + +const credential = new DefaultAzureCredential(); +const scope = 'https://cognitiveservices.azure.com/.default'; +const azureADTokenProvider = getBearerTokenProvider(credential, scope); + +const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "" }); + +const result = await openai.chat.completions.create({ + model: 'gpt-4o', + messages: [{ role: 'user', content: 'Say hello!' }], +}); + +console.log(result.choices[0]!.message?.content); +``` + +For more information on support for the Azure API, see [azure.md](azure.md). + +## Automated function calls + +We provide the `openai.beta.chat.completions.runTools({…})` convenience helper for using function tool calls with the `/chat/completions` endpoint which automatically call the JavaScript functions you provide and sends their results back to the `/chat/completions` endpoint, looping as long as the model requests tool calls. + +For more information see [helpers.md](helpers.md#automated-function-calls). + ## Advanced Usage ### Accessing raw Response data (e.g., headers) diff --git a/azure.md b/azure.md new file mode 100644 index 000000000..df06c2985 --- /dev/null +++ b/azure.md @@ -0,0 +1,49 @@ +# Microsoft Azure OpenAI + +To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` +class instead of the `OpenAI` class. + +> [!IMPORTANT] +> The Azure API shape slightly differs from the core API shape which means that the static types for responses / params +> won't always be correct. + +```ts +import { AzureOpenAI } from 'openai'; +import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity'; + +const credential = new DefaultAzureCredential(); +const scope = 'https://cognitiveservices.azure.com/.default'; +const azureADTokenProvider = getBearerTokenProvider(credential, scope); + +const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: "" }); + +const result = await openai.chat.completions.create({ + model: 'gpt-4o', + messages: [{ role: 'user', content: 'Say hello!' }], +}); + +console.log(result.choices[0]!.message?.content); +``` + +For more information on support for the Azure API, see [azure.md](azure.md). + +## Realtime API + +This SDK provides real-time streaming capabilities for Azure OpenAI through the `OpenAIRealtimeWS` and `OpenAIRealtimeWebSocket` clients described previously. + +To utilize the real-time features, begin by creating a fully configured `AzureOpenAI` client and passing it into either `OpenAIRealtimeWS.azure` or `OpenAIRealtimeWebSocket.azure`. For example: + +```ts +const cred = new DefaultAzureCredential(); +const scope = 'https://cognitiveservices.azure.com/.default'; +const deploymentName = 'gpt-4o-realtime-preview-1001'; +const azureADTokenProvider = getBearerTokenProvider(cred, scope); +const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, +}); +const rt = await OpenAIRealtimeWS.azure(client); +``` + +Once the instance has been created, you can then begin sending requests and receiving streaming responses in real time. diff --git a/helpers.md b/helpers.md index 16bc1f277..41b352e5e 100644 --- a/helpers.md +++ b/helpers.md @@ -142,9 +142,7 @@ More information can be found in the documentation: [Assistant Streaming](https: ```ts const run = openai.beta.threads.runs - .stream(thread.id, { - assistant_id: assistant.id, - }) + .stream(thread.id, { assistant_id: assistant.id }) .on('textCreated', (text) => process.stdout.write('\nassistant > ')) .on('textDelta', (textDelta, snapshot) => process.stdout.write(textDelta.value)) .on('toolCallCreated', (toolCall) => process.stdout.write(`\nassistant > ${toolCall.type}\n\n`)) @@ -304,47 +302,87 @@ If you need to cancel a stream, you can `break` from a `for await` loop or call See an example of streaming helpers in action in [`examples/stream.ts`](examples/stream.ts). -### Automated Function Calls +### Automated function calls -```ts -openai.chat.completions.runTools({ stream: false, … }, options?): ChatCompletionRunner -openai.chat.completions.runTools({ stream: true, … }, options?): ChatCompletionStreamingRunner -``` +We provide the `openai.beta.chat.completions.runTools({…})` +convenience helper for using function tool calls with the `/chat/completions` endpoint +which automatically call the JavaScript functions you provide +and sends their results back to the `/chat/completions` endpoint, +looping as long as the model requests tool calls. -`openai.chat.completions.runTools()` returns a Runner -for automating function calls with chat completions. -The runner automatically calls the JavaScript functions you provide and sends their results back -to the API, looping as long as the model requests function calls. +If you pass a `parse` function, it will automatically parse the `arguments` for you +and returns any parsing errors to the model to attempt auto-recovery. +Otherwise, the args will be passed to the function you provide as a string. -If you pass a `parse` function, it will automatically parse the `arguments` for you and returns any parsing -errors to the model to attempt auto-recovery. Otherwise, the args will be passed to the function you provide -as a string. +If you pass `tool_choice: {function: {name: …}}` instead of `auto`, +it returns immediately after calling that function (and only loops to auto-recover parsing errors). ```ts -client.chat.completions.runTools({ - model: 'gpt-3.5-turbo', - messages: [{ role: 'user', content: 'How is the weather this week?' }], - tools: [ - { - type: 'function', - function: { - function: getWeather as (args: { location: string; time: Date }) => any, - parse: parseFunction as (args: strings) => { location: string; time: Date }, - parameters: { - type: 'object', - properties: { - location: { type: 'string' }, - time: { type: 'string', format: 'date-time' }, +import OpenAI from 'openai'; + +const client = new OpenAI(); + +async function main() { + const runner = client.beta.chat.completions + .runTools({ + model: 'gpt-4o', + messages: [{ role: 'user', content: 'How is the weather this week?' }], + tools: [ + { + type: 'function', + function: { + function: getCurrentLocation, + parameters: { type: 'object', properties: {} }, }, }, - }, - }, - ], -}); + { + type: 'function', + function: { + function: getWeather, + parse: JSON.parse, // or use a validation library like zod for typesafe parsing. + parameters: { + type: 'object', + properties: { + location: { type: 'string' }, + }, + }, + }, + }, + ], + }) + .on('message', (message) => console.log(message)); + + const finalContent = await runner.finalContent(); + console.log(); + console.log('Final content:', finalContent); +} + +async function getCurrentLocation() { + return 'Boston'; // Simulate lookup +} + +async function getWeather(args: { location: string }) { + const { location } = args; + // … do lookup … + return { temperature, precipitation }; +} + +main(); + +// {role: "user", content: "How's the weather this week?"} +// {role: "assistant", tool_calls: [{type: "function", function: {name: "getCurrentLocation", arguments: "{}"}, id: "123"} +// {role: "tool", name: "getCurrentLocation", content: "Boston", tool_call_id: "123"} +// {role: "assistant", tool_calls: [{type: "function", function: {name: "getWeather", arguments: '{"location": "Boston"}'}, id: "1234"}]} +// {role: "tool", name: "getWeather", content: '{"temperature": "50degF", "preciptation": "high"}', tool_call_id: "1234"} +// {role: "assistant", content: "It's looking cold and rainy - you might want to wear a jacket!"} +// +// Final content: "It's looking cold and rainy - you might want to wear a jacket!" ``` -If you pass `function_call: {name: …}` instead of `auto`, it returns immediately after calling that -function (and only loops to auto-recover parsing errors). +Like with `.stream()`, we provide a variety of [helpers and events](helpers.md#chat-events). + +Read more about various examples such as with integrating with [zod](#integrate-with-zod), +[next.js](#integrate-with-nextjs), and [proxying a stream to the browser](#proxy-streaming-to-a-browser). By default, we run the loop up to 10 chat completions from the API. You can change this behavior by adjusting `maxChatCompletions` in the request options object. Note that `max_tokens` is the limit per @@ -662,3 +700,17 @@ client.beta.vectorStores.files.createAndPoll((...) client.beta.vectorStores.fileBatches.createAndPoll((...) client.beta.vectorStores.fileBatches.uploadAndPoll((...) ``` + +# Bulk Upload Helpers + +When creating and interacting with vector stores, you can use the polling helpers to monitor the status of operations. +For convenience, we also provide a bulk upload helper to allow you to simultaneously upload several files at once. + +```ts +const fileList = [ + createReadStream('/home/data/example.pdf'), + ... +]; + +const batch = await openai.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, {files: fileList}); +``` diff --git a/realtime.md b/realtime.md new file mode 100644 index 000000000..2fcd17e9e --- /dev/null +++ b/realtime.md @@ -0,0 +1,87 @@ +## Realtime API beta + +The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. + +The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime). + +This SDK supports accessing the Realtime API through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) or with [ws](https://github.com/websockets/ws). + +Basic text based example with `ws`: + +```ts +// requires `yarn add ws @types/ws` +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; + +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + +// access the underlying `ws.WebSocket` instance +rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); +}); + +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); + +rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); +}); + +rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); +rt.on('response.text.done', () => console.log()); + +rt.on('response.done', () => rt.close()); + +rt.socket.on('close', () => console.log('\nConnection closed!')); +``` + +To use the web API `WebSocket` implementation, replace `OpenAIRealtimeWS` with `OpenAIRealtimeWebSocket` and adjust any `rt.socket` access: + +```ts +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +// ... +rt.socket.addEventListener('open', () => { + // ... +}); +``` + +A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/websocket.ts). + +### Realtime error handling + +When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. + +It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable. + +```ts +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); +``` + From 23c194b4b927e50d0f5a78272e9ac50b181c53eb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:16:31 +0000 Subject: [PATCH 164/509] feat(pagination): avoid fetching when has_more: false (#1305) --- .stats.yml | 2 +- src/pagination.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8a5d2c06b..d59a86d22 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-7c699d4503077d06a4a44f52c0c1f902d19a87c766b8be75b97c8dfd484ad4aa.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-dfb00c627f58e5180af7a9b29ed2f2aa0764a3b9daa6a32a1cc45bc8e48dfe15.yml diff --git a/src/pagination.ts b/src/pagination.ts index 63644e333..ad90a3a74 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -43,6 +43,8 @@ export class Page extends AbstractPage implements PageResponse export interface CursorPageResponse { data: Array; + + has_more: boolean; } export interface CursorPageParams { @@ -57,6 +59,8 @@ export class CursorPage { data: Array; + has_more: boolean; + constructor( client: APIClient, response: Response, @@ -66,12 +70,21 @@ export class CursorPage super(client, response, body, options); this.data = body.data || []; + this.has_more = body.has_more || false; } getPaginatedItems(): Item[] { return this.data ?? []; } + override hasNextPage() { + if (this.has_more === false) { + return false; + } + + return super.hasNextPage(); + } + // @deprecated Please use `nextPageInfo()` instead nextPageParams(): Partial | null { const info = this.nextPageInfo(); From 2d071dfd9e507e3a37177d1f96a5438ba9ac1268 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 10 Feb 2025 12:12:44 +0000 Subject: [PATCH 165/509] chore(internal): remove segfault-handler dependency --- ecosystem-tests/cli.ts | 4 ---- package.json | 1 - yarn.lock | 25 ------------------------- 3 files changed, 30 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 00120e5f9..4803b47c2 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -4,10 +4,6 @@ import yargs from 'yargs'; import assert from 'assert'; import path from 'path'; -// @ts-ignore -var SegfaultHandler = require('segfault-handler'); -SegfaultHandler.registerHandler('crash.log'); - const TAR_NAME = 'openai.tgz'; const PACK_FOLDER = '.pack'; const PACK_FILE = `${PACK_FOLDER}/${TAR_NAME}`; diff --git a/package.json b/package.json index bd507e9f8..df2dcd2bc 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "jest": "^29.4.0", "prettier": "^3.0.0", "prettier-2": "npm:prettier@^2", - "segfault-handler": "^1.3.0", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", "tsc-multi": "^1.1.0", diff --git a/yarn.lock b/yarn.lock index 0a4307f70..ad5fb7630 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1176,13 +1176,6 @@ big-integer@^1.6.44: resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== -bindings@^1.2.1: - version "1.5.0" - resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" - integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== - dependencies: - file-uri-to-path "1.0.0" - bplist-parser@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" @@ -1760,11 +1753,6 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -file-uri-to-path@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" - integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -2706,11 +2694,6 @@ ms@^2.0.0, ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -nan@^2.14.0: - version "2.22.0" - resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.0.tgz#31bc433fc33213c97bad36404bb68063de604de3" - integrity sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -3061,14 +3044,6 @@ safe-buffer@~5.2.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -segfault-handler@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/segfault-handler/-/segfault-handler-1.3.0.tgz#054bc847832fa14f218ba6a79e42877501c8870e" - integrity sha512-p7kVHo+4uoYkr0jmIiTBthwV5L2qmWtben/KDunDZ834mbos+tY+iO0//HpAJpOFSQZZ+wxKWuRo4DxV02B7Lg== - dependencies: - bindings "^1.2.1" - nan "^2.14.0" - semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" From 85ff876a75147490e60c70c2f36e964513f1086a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 20:06:34 +0000 Subject: [PATCH 166/509] fix: correctly decode multi-byte characters over multiple chunks (#1316) --- src/internal/decoders/line.ts | 107 ++++++++++++++++++++++------------ src/streaming.ts | 6 +- tests/streaming.test.ts | 53 ++++++++++++++++- 3 files changed, 126 insertions(+), 40 deletions(-) diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 34e41d1dc..66f62c057 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -13,52 +13,58 @@ export class LineDecoder { static NEWLINE_CHARS = new Set(['\n', '\r']); static NEWLINE_REGEXP = /\r\n|[\n\r]/g; - buffer: string[]; - trailingCR: boolean; + buffer: Uint8Array; + #carriageReturnIndex: number | null; textDecoder: any; // TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types. constructor() { - this.buffer = []; - this.trailingCR = false; + this.buffer = new Uint8Array(); + this.#carriageReturnIndex = null; } decode(chunk: Bytes): string[] { - let text = this.decodeText(chunk); - - if (this.trailingCR) { - text = '\r' + text; - this.trailingCR = false; - } - if (text.endsWith('\r')) { - this.trailingCR = true; - text = text.slice(0, -1); - } - - if (!text) { + if (chunk == null) { return []; } - const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ''); - let lines = text.split(LineDecoder.NEWLINE_REGEXP); + const binaryChunk = + chunk instanceof ArrayBuffer ? new Uint8Array(chunk) + : typeof chunk === 'string' ? new TextEncoder().encode(chunk) + : chunk; + + let newData = new Uint8Array(this.buffer.length + binaryChunk.length); + newData.set(this.buffer); + newData.set(binaryChunk, this.buffer.length); + this.buffer = newData; + + const lines: string[] = []; + let patternIndex; + while ((patternIndex = findNewlineIndex(this.buffer, this.#carriageReturnIndex)) != null) { + if (patternIndex.carriage && this.#carriageReturnIndex == null) { + // skip until we either get a corresponding `\n`, a new `\r` or nothing + this.#carriageReturnIndex = patternIndex.index; + continue; + } - // if there is a trailing new line then the last entry will be an empty - // string which we don't care about - if (trailingNewline) { - lines.pop(); - } + // we got double \r or \rtext\n + if ( + this.#carriageReturnIndex != null && + (patternIndex.index !== this.#carriageReturnIndex + 1 || patternIndex.carriage) + ) { + lines.push(this.decodeText(this.buffer.slice(0, this.#carriageReturnIndex - 1))); + this.buffer = this.buffer.slice(this.#carriageReturnIndex); + this.#carriageReturnIndex = null; + continue; + } - if (lines.length === 1 && !trailingNewline) { - this.buffer.push(lines[0]!); - return []; - } + const endIndex = + this.#carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding; - if (this.buffer.length > 0) { - lines = [this.buffer.join('') + lines[0], ...lines.slice(1)]; - this.buffer = []; - } + const line = this.decodeText(this.buffer.slice(0, endIndex)); + lines.push(line); - if (!trailingNewline) { - this.buffer = [lines.pop() || '']; + this.buffer = this.buffer.slice(patternIndex.index); + this.#carriageReturnIndex = null; } return lines; @@ -102,13 +108,38 @@ export class LineDecoder { } flush(): string[] { - if (!this.buffer.length && !this.trailingCR) { + if (!this.buffer.length) { return []; } + return this.decode('\n'); + } +} - const lines = [this.buffer.join('')]; - this.buffer = []; - this.trailingCR = false; - return lines; +/** + * This function searches the buffer for the end patterns, (\r or \n) + * and returns an object with the index preceding the matched newline and the + * index after the newline char. `null` is returned if no new line is found. + * + * ```ts + * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 } + * ``` + */ +function findNewlineIndex( + buffer: Uint8Array, + startIndex: number | null, +): { preceding: number; index: number; carriage: boolean } | null { + const newline = 0x0a; // \n + const carriage = 0x0d; // \r + + for (let i = startIndex ?? 0; i < buffer.length; i++) { + if (buffer[i] === newline) { + return { preceding: i, index: i + 1, carriage: false }; + } + + if (buffer[i] === carriage) { + return { preceding: i, index: i + 1, carriage: true }; + } } + + return null; } diff --git a/src/streaming.ts b/src/streaming.ts index 6a57a50a0..1d1ae344b 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -346,13 +346,17 @@ class SSEDecoder { } /** This is an internal helper function that's just used for testing */ -export function _decodeChunks(chunks: string[]): string[] { +export function _decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { const decoder = new LineDecoder(); const lines: string[] = []; for (const chunk of chunks) { lines.push(...decoder.decode(chunk)); } + if (flush) { + lines.push(...decoder.flush()); + } + return lines; } diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 6fe9a5781..8e5d0ca31 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -2,6 +2,7 @@ import { Response } from 'node-fetch'; import { PassThrough } from 'stream'; import assert from 'assert'; import { _iterSSEMessages, _decodeChunks as decodeChunks } from 'openai/streaming'; +import { LineDecoder } from 'openai/internal/decoders/line'; describe('line decoder', () => { test('basic', () => { @@ -10,8 +11,8 @@ describe('line decoder', () => { }); test('basic with \\r', () => { - // baz is not included because the line hasn't ended yet expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); + expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); }); test('trailing new lines', () => { @@ -29,6 +30,56 @@ describe('line decoder', () => { test('escaped new lines with \\r', () => { expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); }); + + test('\\r & \\n split across multiple chunks', () => { + expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('single \\r', () => { + expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('double \\r', () => { + expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + // implementation detail that we don't yield the single \r line until a new \r or \n is encountered + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); + }); + + test('double \\r then \\r\\n', () => { + expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + }); + + test('double newline', () => { + expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('multi-byte characters across chunks', () => { + const decoder = new LineDecoder(); + + // bytes taken from the string 'известни' and arbitrarily split + // so that some multi-byte characters span multiple chunks + expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); + expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); + expect( + decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), + ).toHaveLength(0); + + const decoded = decoder.decode(new Uint8Array([0xa])); + expect(decoded).toEqual(['известни']); + }); + + test('flushing trailing newlines', () => { + expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('flushing empty buffer', () => { + expect(decodeChunks([], { flush: true })).toEqual([]); + }); }); describe('streaming decoding', () => { From 5e5a38a3f5bd45e74eb624fe85664294247bf580 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Feb 2025 11:19:35 +0000 Subject: [PATCH 167/509] fix(assistants): handle `thread.run.incomplete` event --- src/lib/AssistantStream.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index caf68e7dd..9b6cc20c5 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -370,6 +370,7 @@ export class AssistantStream case 'thread.run.in_progress': case 'thread.run.requires_action': case 'thread.run.completed': + case 'thread.run.incomplete': case 'thread.run.failed': case 'thread.run.cancelling': case 'thread.run.cancelled': @@ -400,6 +401,8 @@ export class AssistantStream throw new Error( 'Encountered an error event in event processing - errors should be processed earlier', ); + default: + assertNever(event); } } @@ -772,3 +775,5 @@ export class AssistantStream return await this._createToolAssistantStream(runs, threadId, runId, params, options); } } + +function assertNever(_x: never) {} From 0ea723831b52ed22cadfc997ddb45a758e2247db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Feb 2025 05:07:11 +0000 Subject: [PATCH 168/509] release: 4.84.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 25 +++++++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6eb0f130e..063dfb8fd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.83.0" + ".": "4.84.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f61def5e4..d18ddf815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,30 @@ # Changelog +## 4.84.0 (2025-02-12) + +Full Changelog: [v4.83.0...v4.84.0](https://github.com/openai/openai-node/compare/v4.83.0...v4.84.0) + +### Features + +* **pagination:** avoid fetching when has_more: false ([#1305](https://github.com/openai/openai-node/issues/1305)) ([b6944c6](https://github.com/openai/openai-node/commit/b6944c634b53c9084f2ccf777c2491e89b2cc7af)) + + +### Bug Fixes + +* **api:** add missing reasoning effort + model enums ([#1302](https://github.com/openai/openai-node/issues/1302)) ([14c55c3](https://github.com/openai/openai-node/commit/14c55c312e31f1ed46d02f39a99049f785504a53)) +* **assistants:** handle `thread.run.incomplete` event ([7032cc4](https://github.com/openai/openai-node/commit/7032cc40b8aa0a58459cf114bceb8028a8517400)) +* correctly decode multi-byte characters over multiple chunks ([#1316](https://github.com/openai/openai-node/issues/1316)) ([dd776c4](https://github.com/openai/openai-node/commit/dd776c4867401f527f699bd4b9e567890256e849)) + + +### Chores + +* **internal:** remove segfault-handler dependency ([3521ca3](https://github.com/openai/openai-node/commit/3521ca34e7f5bd51542084e27c084a5d7cc5448b)) + + +### Documentation + +* **readme:** cleanup into multiple files ([da94424](https://github.com/openai/openai-node/commit/da944242e542e9e5e51cb11853c621fc6825ac02)) + ## 4.83.0 (2025-02-05) Full Changelog: [v4.82.0...v4.83.0](https://github.com/openai/openai-node/compare/v4.82.0...v4.83.0) diff --git a/jsr.json b/jsr.json index 6fa05e624..47c478074 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.83.0", + "version": "4.84.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index df2dcd2bc..96e9b048f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.83.0", + "version": "4.84.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 13c764d7d..b67556e78 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.83.0'; // x-release-please-version +export const VERSION = '4.84.0'; // x-release-please-version From 0e1981a128b4db5db657f22a54b711420ebbdb32 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 12 Feb 2025 16:01:16 +0000 Subject: [PATCH 169/509] fix(realtime): correct websocket type var constraint (#1321) --- src/beta/realtime/websocket.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts index e8143fdbf..b10a2519d 100644 --- a/src/beta/realtime/websocket.ts +++ b/src/beta/realtime/websocket.ts @@ -11,7 +11,7 @@ interface MessageEvent { type _WebSocket = typeof globalThis extends ( { - WebSocket: infer ws; + WebSocket: infer ws extends abstract new (...args: any) => any; } ) ? // @ts-ignore From c91ebef762fd55a553e15d7e4a1908243ea3e007 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 05:07:08 +0000 Subject: [PATCH 170/509] release: 4.84.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 063dfb8fd..023314f41 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.84.0" + ".": "4.84.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d18ddf815..444430307 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.84.1 (2025-02-13) + +Full Changelog: [v4.84.0...v4.84.1](https://github.com/openai/openai-node/compare/v4.84.0...v4.84.1) + +### Bug Fixes + +* **realtime:** correct websocket type var constraint ([#1321](https://github.com/openai/openai-node/issues/1321)) ([afb17ea](https://github.com/openai/openai-node/commit/afb17ea6497b860ebbe5d8e68e4a97681dd307ff)) + ## 4.84.0 (2025-02-12) Full Changelog: [v4.83.0...v4.84.0](https://github.com/openai/openai-node/compare/v4.83.0...v4.84.0) diff --git a/jsr.json b/jsr.json index 47c478074..3148d6fca 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.84.0", + "version": "4.84.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 96e9b048f..4686e3a97 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.84.0", + "version": "4.84.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index b67556e78..767424b0e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.84.0'; // x-release-please-version +export const VERSION = '4.84.1'; // x-release-please-version From 6e9444c6c77a93ff4ce06bd5b27a9c236ba6f307 Mon Sep 17 00:00:00 2001 From: Jamon Holmgren Date: Thu, 13 Feb 2025 05:27:35 -0800 Subject: [PATCH 171/509] fix(realtime): call .toString() on WebSocket url (#1324) The [WebSocket spec at WHATWG](https://websockets.spec.whatwg.org/#ref-for-dom-websocket-websocket%E2%91%A0) indicates that the `url` parameter of the WebSocket constructor is a string. Some implementations (like Chrome) will accept a URL object, but calling .toString() should work for all cases. Fixes #1323. --- src/beta/realtime/websocket.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts index b10a2519d..e8900e809 100644 --- a/src/beta/realtime/websocket.ts +++ b/src/beta/realtime/websocket.ts @@ -53,7 +53,7 @@ export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { props.onURL?.(this.url); // @ts-ignore - this.socket = new WebSocket(this.url, [ + this.socket = new WebSocket(this.url.toString(), [ 'realtime', ...(isAzure(client) ? [] : [`openai-insecure-api-key.${client.apiKey}`]), 'openai-beta.realtime-v1', From be1ca6b9a6732214ac21ca375b5b0a9b7f492fd6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 19:41:49 +0000 Subject: [PATCH 172/509] feat(api): add support for storing chat completions (#1327) --- .stats.yml | 4 +- api.md | 72 ++++---- src/index.ts | 27 ++- src/lib/ChatCompletionStream.ts | 2 +- src/resources/chat/chat.ts | 19 +- .../chat/{ => completions}/completions.ts | 170 ++++++++++++++++-- src/resources/chat/completions/index.ts | 49 +++++ src/resources/chat/completions/messages.ts | 52 ++++++ src/resources/chat/index.ts | 10 +- src/resources/completions.ts | 4 +- src/resources/moderations.ts | 4 +- tests/api-resources/chat/completions.test.ts | 65 ------- .../chat/completions/completions.test.ts | 144 +++++++++++++++ .../chat/completions/messages.test.ts | 40 +++++ 14 files changed, 534 insertions(+), 128 deletions(-) rename src/resources/chat/{ => completions}/completions.ts (88%) create mode 100644 src/resources/chat/completions/index.ts create mode 100644 src/resources/chat/completions/messages.ts delete mode 100644 tests/api-resources/chat/completions.test.ts create mode 100644 tests/api-resources/chat/completions/completions.test.ts create mode 100644 tests/api-resources/chat/completions/messages.test.ts diff --git a/.stats.yml b/.stats.yml index d59a86d22..658877d3b 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-dfb00c627f58e5180af7a9b29ed2f2aa0764a3b9daa6a32a1cc45bc8e48dfe15.yml +configured_endpoints: 74 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml diff --git a/api.md b/api.md index 01854a8e0..63f239628 100644 --- a/api.md +++ b/api.md @@ -32,39 +32,51 @@ Types: Types: -- ChatCompletion -- ChatCompletionAssistantMessageParam -- ChatCompletionAudio -- ChatCompletionAudioParam -- ChatCompletionChunk -- ChatCompletionContentPart -- ChatCompletionContentPartImage -- ChatCompletionContentPartInputAudio -- ChatCompletionContentPartRefusal -- ChatCompletionContentPartText -- ChatCompletionDeveloperMessageParam -- ChatCompletionFunctionCallOption -- ChatCompletionFunctionMessageParam -- ChatCompletionMessage -- ChatCompletionMessageParam -- ChatCompletionMessageToolCall -- ChatCompletionModality -- ChatCompletionNamedToolChoice -- ChatCompletionPredictionContent -- ChatCompletionReasoningEffort -- ChatCompletionRole -- ChatCompletionStreamOptions -- ChatCompletionSystemMessageParam -- ChatCompletionTokenLogprob -- ChatCompletionTool -- ChatCompletionToolChoiceOption -- ChatCompletionToolMessageParam -- ChatCompletionUserMessageParam -- CreateChatCompletionRequestMessage +- ChatCompletion +- ChatCompletionAssistantMessageParam +- ChatCompletionAudio +- ChatCompletionAudioParam +- ChatCompletionChunk +- ChatCompletionContentPart +- ChatCompletionContentPartImage +- ChatCompletionContentPartInputAudio +- ChatCompletionContentPartRefusal +- ChatCompletionContentPartText +- ChatCompletionDeleted +- ChatCompletionDeveloperMessageParam +- ChatCompletionFunctionCallOption +- ChatCompletionFunctionMessageParam +- ChatCompletionMessage +- ChatCompletionMessageParam +- ChatCompletionMessageToolCall +- ChatCompletionModality +- ChatCompletionNamedToolChoice +- ChatCompletionPredictionContent +- ChatCompletionReasoningEffort +- ChatCompletionRole +- ChatCompletionStoreMessage +- ChatCompletionStreamOptions +- ChatCompletionSystemMessageParam +- ChatCompletionTokenLogprob +- ChatCompletionTool +- ChatCompletionToolChoiceOption +- ChatCompletionToolMessageParam +- ChatCompletionUserMessageParam +- CreateChatCompletionRequestMessage Methods: -- client.chat.completions.create({ ...params }) -> ChatCompletion +- client.chat.completions.create({ ...params }) -> ChatCompletion +- client.chat.completions.retrieve(completionId) -> ChatCompletion +- client.chat.completions.update(completionId, { ...params }) -> ChatCompletion +- client.chat.completions.list({ ...params }) -> ChatCompletionsPage +- client.chat.completions.del(completionId) -> ChatCompletionDeleted + +### Messages + +Methods: + +- client.chat.completions.messages.list(completionId, { ...params }) -> ChatCompletionStoreMessagesPage # Embeddings diff --git a/src/index.ts b/src/index.ts index f4e940af8..debefce8c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,6 +66,13 @@ import { import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat, ChatModel } from './resources/chat/chat'; +import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { + Upload, + UploadCompleteParams, + UploadCreateParams, + Uploads as UploadsAPIUploads, +} from './resources/uploads/uploads'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -80,9 +87,11 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeleted, ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, + ChatCompletionListParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, @@ -91,21 +100,17 @@ import { ChatCompletionPredictionContent, ChatCompletionReasoningEffort, ChatCompletionRole, + ChatCompletionStoreMessage, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, ChatCompletionTokenLogprob, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, + ChatCompletionUpdateParams, ChatCompletionUserMessageParam, -} from './resources/chat/completions'; -import { FineTuning } from './resources/fine-tuning/fine-tuning'; -import { - Upload, - UploadCompleteParams, - UploadCreateParams, - Uploads as UploadsAPIUploads, -} from './resources/uploads/uploads'; + ChatCompletionsPage, +} from './resources/chat/completions/completions'; export interface ClientOptions { /** @@ -310,6 +315,7 @@ export class OpenAI extends Core.APIClient { OpenAI.Completions = Completions; OpenAI.Chat = Chat; +OpenAI.ChatCompletionsPage = ChatCompletionsPage; OpenAI.Embeddings = Embeddings; OpenAI.Files = Files; OpenAI.FileObjectsPage = FileObjectsPage; @@ -355,6 +361,7 @@ export declare namespace OpenAI { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -366,6 +373,7 @@ export declare namespace OpenAI { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -373,9 +381,12 @@ export declare namespace OpenAI { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, }; export { diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index 6c846f70b..35648c27b 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -13,7 +13,7 @@ import { type ChatCompletionCreateParamsStreaming, type ChatCompletionCreateParamsBase, type ChatCompletionRole, -} from '../resources/chat/completions'; +} from '../resources/chat/completions/completions'; import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index d4a18929c..5bceec45a 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as CompletionsAPI from './completions'; +import * as CompletionsAPI from './completions/completions'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -16,9 +16,11 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeleted, ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, + ChatCompletionListParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, @@ -27,19 +29,24 @@ import { ChatCompletionPredictionContent, ChatCompletionReasoningEffort, ChatCompletionRole, + ChatCompletionStoreMessage, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, ChatCompletionTokenLogprob, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, + ChatCompletionUpdateParams, ChatCompletionUserMessageParam, + ChatCompletionsPage, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, + CompletionListParams, + CompletionUpdateParams, Completions, CreateChatCompletionRequestMessage, -} from './completions'; +} from './completions/completions'; export class Chat extends APIResource { completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client); @@ -87,6 +94,7 @@ export type ChatModel = | 'gpt-3.5-turbo-16k-0613'; Chat.Completions = Completions; +Chat.ChatCompletionsPage = ChatCompletionsPage; export declare namespace Chat { export { type ChatModel as ChatModel }; @@ -103,6 +111,7 @@ export declare namespace Chat { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -114,6 +123,7 @@ export declare namespace Chat { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -122,11 +132,16 @@ export declare namespace Chat { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type CompletionUpdateParams as CompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, + type CompletionListParams as CompletionListParams, }; } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions/completions.ts similarity index 88% rename from src/resources/chat/completions.ts rename to src/resources/chat/completions/completions.ts index 2586845c3..3af4a3a1d 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1,15 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import { APIPromise } from '../../core'; -import * as Core from '../../core'; -import * as ChatCompletionsAPI from './completions'; -import * as CompletionsAPI from '../completions'; -import * as Shared from '../shared'; -import * as ChatAPI from './chat'; -import { Stream } from '../../streaming'; +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import { APIPromise } from '../../../core'; +import * as Core from '../../../core'; +import * as CompletionsCompletionsAPI from './completions'; +import * as CompletionsAPI from '../../completions'; +import * as Shared from '../../shared'; +import * as ChatAPI from '../chat'; +import * as MessagesAPI from './messages'; +import { MessageListParams, Messages } from './messages'; +import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { Stream } from '../../../streaming'; export class Completions extends APIResource { + messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); + /** * Creates a model response for the given chat conversation. Learn more in the * [text generation](https://platform.openai.com/docs/guides/text-generation), @@ -42,8 +48,60 @@ export class Completions extends APIResource { | APIPromise | APIPromise>; } + + /** + * Get a stored chat completion. Only chat completions that have been created with + * the `store` parameter set to `true` will be returned. + */ + retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/chat/completions/${completionId}`, options); + } + + /** + * Modify a stored chat completion. Only chat completions that have been created + * with the `store` parameter set to `true` can be modified. Currently, the only + * supported modification is to update the `metadata` field. + */ + update( + completionId: string, + body: ChatCompletionUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/chat/completions/${completionId}`, { body, ...options }); + } + + /** + * List stored chat completions. Only chat completions that have been stored with + * the `store` parameter set to `true` will be returned. + */ + list( + query?: ChatCompletionListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: ChatCompletionListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/chat/completions', ChatCompletionsPage, { query, ...options }); + } + + /** + * Delete a stored chat completion. Only chat completions that have been created + * with the `store` parameter set to `true` can be deleted. + */ + del(completionId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/chat/completions/${completionId}`, options); + } } +export class ChatCompletionsPage extends CursorPage {} + +export class ChatCompletionStoreMessagesPage extends CursorPage {} + /** * Represents a chat completion response returned by model, based on the provided * input. @@ -119,7 +177,7 @@ export namespace ChatCompletion { /** * A chat completion message generated by the model. */ - message: ChatCompletionsAPI.ChatCompletionMessage; + message: CompletionsCompletionsAPI.ChatCompletionMessage; } export namespace Choice { @@ -130,12 +188,12 @@ export namespace ChatCompletion { /** * A list of message content tokens with log probability information. */ - content: Array | null; + content: Array | null; /** * A list of message refusal tokens with log probability information. */ - refusal: Array | null; + refusal: Array | null; } } } @@ -437,12 +495,12 @@ export namespace ChatCompletionChunk { /** * A list of message content tokens with log probability information. */ - content: Array | null; + content: Array | null; /** * A list of message refusal tokens with log probability information. */ - refusal: Array | null; + refusal: Array | null; } } } @@ -537,6 +595,23 @@ export interface ChatCompletionContentPartText { type: 'text'; } +export interface ChatCompletionDeleted { + /** + * The ID of the chat completion that was deleted. + */ + id: string; + + /** + * Whether the chat completion was deleted. + */ + deleted: boolean; + + /** + * The type of object being deleted. + */ + object: 'chat.completion.deleted'; +} + /** * Developer-provided instructions that the model should follow, regardless of * messages sent by the user. With o1 models and newer, `developer` messages @@ -758,6 +833,16 @@ export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; */ export type ChatCompletionRole = 'developer' | 'system' | 'user' | 'assistant' | 'tool' | 'function'; +/** + * A chat completion message generated by the model. + */ +export interface ChatCompletionStoreMessage extends ChatCompletionMessage { + /** + * The identifier of the chat message. + */ + id: string; +} + /** * Options for streaming response. Only set this when you set `stream: true`. */ @@ -1229,8 +1314,9 @@ export namespace ChatCompletionCreateParams { } export type ChatCompletionCreateParamsNonStreaming = - ChatCompletionsAPI.ChatCompletionCreateParamsNonStreaming; - export type ChatCompletionCreateParamsStreaming = ChatCompletionsAPI.ChatCompletionCreateParamsStreaming; + CompletionsCompletionsAPI.ChatCompletionCreateParamsNonStreaming; + export type ChatCompletionCreateParamsStreaming = + CompletionsCompletionsAPI.ChatCompletionCreateParamsStreaming; } /** @@ -1272,6 +1358,51 @@ export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreat */ export type CompletionCreateParamsStreaming = ChatCompletionCreateParamsStreaming; +export interface ChatCompletionUpdateParams { + /** + * 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; +} + +/** + * @deprecated Use ChatCompletionUpdateParams instead + */ +export type CompletionUpdateParams = ChatCompletionUpdateParams; + +export interface ChatCompletionListParams extends CursorPageParams { + /** + * A list of metadata keys to filter the chat completions by. Example: + * + * `metadata[key1]=value1&metadata[key2]=value2` + */ + metadata?: Shared.Metadata | null; + + /** + * The model used to generate the chat completions. + */ + model?: string; + + /** + * Sort order for chat completions by timestamp. Use `asc` for ascending order or + * `desc` for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; +} + +/** + * @deprecated Use ChatCompletionListParams instead + */ +export type CompletionListParams = ChatCompletionListParams; + +Completions.ChatCompletionsPage = ChatCompletionsPage; +Completions.Messages = Messages; + export declare namespace Completions { export { type ChatCompletion as ChatCompletion, @@ -1284,6 +1415,7 @@ export declare namespace Completions { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -1295,6 +1427,7 @@ export declare namespace Completions { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -1303,11 +1436,18 @@ export declare namespace Completions { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type CompletionUpdateParams as CompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, + type CompletionListParams as CompletionListParams, }; + + export { Messages as Messages, type MessageListParams as MessageListParams }; } diff --git a/src/resources/chat/completions/index.ts b/src/resources/chat/completions/index.ts new file mode 100644 index 000000000..3691f41d8 --- /dev/null +++ b/src/resources/chat/completions/index.ts @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ChatCompletionStoreMessagesPage, + ChatCompletionsPage, + Completions, + type ChatCompletion, + type ChatCompletionAssistantMessageParam, + type ChatCompletionAudio, + type ChatCompletionAudioParam, + type ChatCompletionChunk, + type ChatCompletionContentPart, + type ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText, + type ChatCompletionDeleted, + type ChatCompletionDeveloperMessageParam, + type ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam, + type ChatCompletionMessage, + type ChatCompletionMessageParam, + type ChatCompletionMessageToolCall, + type ChatCompletionModality, + type ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort, + type ChatCompletionRole, + type ChatCompletionStoreMessage, + type ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob, + type ChatCompletionTool, + type ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam, + type CreateChatCompletionRequestMessage, + type ChatCompletionCreateParams, + type CompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming, + type CompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming, + type CompletionCreateParamsStreaming, + type ChatCompletionUpdateParams, + type CompletionUpdateParams, + type ChatCompletionListParams, + type CompletionListParams, +} from './completions'; +export { Messages, type MessageListParams } from './messages'; diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts new file mode 100644 index 000000000..fc1cc5d94 --- /dev/null +++ b/src/resources/chat/completions/messages.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import * as CompletionsAPI from './completions'; +import { ChatCompletionStoreMessagesPage } from './completions'; +import { type CursorPageParams } from '../../../pagination'; + +export class Messages extends APIResource { + /** + * Get the messages in a stored chat completion. Only chat completions that have + * been created with the `store` parameter set to `true` will be returned. + */ + list( + completionId: string, + query?: MessageListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + completionId: string, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + completionId: string, + query: MessageListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list(completionId, {}, query); + } + return this._client.getAPIList( + `/chat/completions/${completionId}/messages`, + ChatCompletionStoreMessagesPage, + { query, ...options }, + ); + } +} + +export interface MessageListParams extends CursorPageParams { + /** + * Sort order for messages by timestamp. Use `asc` for ascending order or `desc` + * for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; +} + +export declare namespace Messages { + export { type MessageListParams as MessageListParams }; +} + +export { ChatCompletionStoreMessagesPage }; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index c3be19402..a9b5b46fb 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -2,6 +2,8 @@ export { Chat, type ChatModel } from './chat'; export { + ChatCompletionStoreMessagesPage, + ChatCompletionsPage, Completions, type ChatCompletion, type ChatCompletionAssistantMessageParam, @@ -13,6 +15,7 @@ export { type ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal, type ChatCompletionContentPartText, + type ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam, @@ -24,6 +27,7 @@ export { type ChatCompletionPredictionContent, type ChatCompletionReasoningEffort, type ChatCompletionRole, + type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob, @@ -38,4 +42,8 @@ export { type CompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming, type CompletionCreateParamsStreaming, -} from './completions'; + type ChatCompletionUpdateParams, + type CompletionUpdateParams, + type ChatCompletionListParams, + type CompletionListParams, +} from './completions/index'; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index be75a46f0..664e39d9d 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -4,7 +4,7 @@ import { APIResource } from '../resource'; import { APIPromise } from '../core'; import * as Core from '../core'; import * as CompletionsAPI from './completions'; -import * as ChatCompletionsAPI from './chat/completions'; +import * as CompletionsCompletionsAPI from './chat/completions/completions'; import { Stream } from '../streaming'; export class Completions extends APIResource { @@ -311,7 +311,7 @@ export interface CompletionCreateParamsBase { /** * Options for streaming response. Only set this when you set `stream: true`. */ - stream_options?: ChatCompletionsAPI.ChatCompletionStreamOptions | null; + stream_options?: CompletionsCompletionsAPI.ChatCompletionStreamOptions | null; /** * The suffix that comes after a completion of inserted text. diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index f7b16166d..86e90376d 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -75,14 +75,14 @@ export namespace Moderation { * execution of wrongdoing, or that gives advice or instruction on how to commit * illicit acts. For example, "how to shoplift" would fit this category. */ - illicit: boolean; + illicit: boolean | null; /** * Content that includes instructions or advice that facilitate the planning or * execution of wrongdoing that also includes violence, or that gives advice or * instruction on the procurement of any weapon. */ - 'illicit/violent': boolean; + 'illicit/violent': boolean | null; /** * Content that promotes, encourages, or depicts acts of self-harm, such as diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts deleted file mode 100644 index 8f1bc7d4c..000000000 --- a/tests/api-resources/chat/completions.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import OpenAI from 'openai'; -import { Response } from 'node-fetch'; - -const client = new OpenAI({ - apiKey: 'My API Key', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', -}); - -describe('resource completions', () => { - test('create: only required params', async () => { - const responsePromise = client.chat.completions.create({ - messages: [{ content: 'string', role: 'developer' }], - model: 'gpt-4o', - }); - 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('create: required and optional params', async () => { - const response = await client.chat.completions.create({ - messages: [{ content: 'string', role: 'developer', name: 'name' }], - model: 'gpt-4o', - audio: { format: 'wav', voice: 'alloy' }, - frequency_penalty: -2, - function_call: 'none', - functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], - logit_bias: { foo: 0 }, - logprobs: true, - max_completion_tokens: 0, - max_tokens: 0, - metadata: { foo: 'string' }, - modalities: ['text'], - n: 1, - parallel_tool_calls: true, - prediction: { content: 'string', type: 'content' }, - presence_penalty: -2, - reasoning_effort: 'low', - response_format: { type: 'text' }, - seed: 0, - service_tier: 'auto', - stop: 'string', - store: true, - stream: false, - stream_options: { include_usage: true }, - temperature: 1, - tool_choice: 'none', - tools: [ - { - function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, - type: 'function', - }, - ], - top_logprobs: 0, - top_p: 1, - user: 'user-1234', - }); - }); -}); diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts new file mode 100644 index 000000000..acdd631db --- /dev/null +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -0,0 +1,144 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource completions', () => { + test('create: only required params', async () => { + const responsePromise = client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-4o', + }); + 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('create: required and optional params', async () => { + const response = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer', name: 'name' }], + model: 'gpt-4o', + audio: { format: 'wav', voice: 'alloy' }, + frequency_penalty: -2, + function_call: 'none', + functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], + logit_bias: { foo: 0 }, + logprobs: true, + max_completion_tokens: 0, + max_tokens: 0, + metadata: { foo: 'string' }, + modalities: ['text'], + n: 1, + parallel_tool_calls: true, + prediction: { content: 'string', type: 'content' }, + presence_penalty: -2, + reasoning_effort: 'low', + response_format: { type: 'text' }, + seed: 0, + service_tier: 'auto', + stop: 'string', + store: true, + stream: false, + stream_options: { include_usage: true }, + temperature: 1, + tool_choice: 'none', + tools: [ + { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, + type: 'function', + }, + ], + top_logprobs: 0, + top_p: 1, + user: 'user-1234', + }); + }); + + test('retrieve', async () => { + const responsePromise = client.chat.completions.retrieve('completion_id'); + 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('retrieve: request options instead of 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.chat.completions.retrieve('completion_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('update: only required params', async () => { + const responsePromise = client.chat.completions.update('completion_id', { metadata: { foo: 'string' } }); + 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('update: required and optional params', async () => { + const response = await client.chat.completions.update('completion_id', { metadata: { foo: 'string' } }); + }); + + test('list', async () => { + const responsePromise = client.chat.completions.list(); + 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 instead of 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.chat.completions.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); + + 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.chat.completions.list( + { after: 'after', limit: 0, metadata: { foo: 'string' }, model: 'model', order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.chat.completions.del('completion_id'); + 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('del: request options instead of 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.chat.completions.del('completion_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/chat/completions/messages.test.ts b/tests/api-resources/chat/completions/messages.test.ts new file mode 100644 index 000000000..664106cb9 --- /dev/null +++ b/tests/api-resources/chat/completions/messages.test.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource messages', () => { + test('list', async () => { + const responsePromise = client.chat.completions.messages.list('completion_id'); + 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 instead of 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.chat.completions.messages.list('completion_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + 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.chat.completions.messages.list( + 'completion_id', + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); From f9897464738ddd6c3207be3530b03db7e522e52e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 19:53:06 +0000 Subject: [PATCH 173/509] release: 4.85.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 023314f41..f48cc7f57 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.84.1" + ".": "4.85.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 444430307..290b2414d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.85.0 (2025-02-13) + +Full Changelog: [v4.84.1...v4.85.0](https://github.com/openai/openai-node/compare/v4.84.1...v4.85.0) + +### Features + +* **api:** add support for storing chat completions ([#1327](https://github.com/openai/openai-node/issues/1327)) ([8d77f8e](https://github.com/openai/openai-node/commit/8d77f8e3c4801b7fa1e7c6f50b48c1de1f43f3e6)) + + +### Bug Fixes + +* **realtime:** call .toString() on WebSocket url ([#1324](https://github.com/openai/openai-node/issues/1324)) ([09bc50d](https://github.com/openai/openai-node/commit/09bc50d439679b6acfd2441e69ee5aa18c00e5d9)) + ## 4.84.1 (2025-02-13) Full Changelog: [v4.84.0...v4.84.1](https://github.com/openai/openai-node/compare/v4.84.0...v4.84.1) diff --git a/jsr.json b/jsr.json index 3148d6fca..368f86c0b 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.84.1", + "version": "4.85.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 4686e3a97..dc61af02c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.84.1", + "version": "4.85.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 767424b0e..6483fa72b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.84.1'; // x-release-please-version +export const VERSION = '4.85.0'; // x-release-please-version From 26d5868dd53045bc820a607100eab1070785f50c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Feb 2025 22:37:36 +0000 Subject: [PATCH 174/509] fix(client): fix export map for index exports (#1328) --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index dc61af02c..46f58814d 100644 --- a/package.json +++ b/package.json @@ -112,17 +112,17 @@ "default": "./dist/index.mjs" }, "./*.mjs": { - "types": "./dist/*.d.ts", - "default": "./dist/*.mjs" + "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], + "default": ["./dist/*.mjs", "./dist/*/index.mjs"] }, "./*.js": { - "types": "./dist/*.d.ts", - "default": "./dist/*.js" + "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], + "default": ["./dist/*.js", "./dist/*/index.js"] }, "./*": { - "types": "./dist/*.d.ts", - "require": "./dist/*.js", - "default": "./dist/*.mjs" + "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], + "require": ["./dist/*.js", "./dist/*/index.js"], + "default": ["./dist/*.mjs", "./dist/*/index.mjs"] } }, "bin": "./bin/cli", From 1f38cc1976f4091a90a38d49e6ddc1c22e5c39ab Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 14 Feb 2025 10:19:22 +0000 Subject: [PATCH 175/509] fix(package): add chat/completions.ts back in (#1333) --- src/resources/chat/completions.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/resources/chat/completions.ts diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts new file mode 100644 index 000000000..55b151e8b --- /dev/null +++ b/src/resources/chat/completions.ts @@ -0,0 +1 @@ +export * from './completions/completions'; From 13aab101588c2eee1250d7c50b2abfeca1c5fa3d Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 14 Feb 2025 10:30:35 +0000 Subject: [PATCH 176/509] chore(internal): add missing return type annotation (#1334) --- src/pagination.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pagination.ts b/src/pagination.ts index ad90a3a74..7a513fc44 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -77,7 +77,7 @@ export class CursorPage return this.data ?? []; } - override hasNextPage() { + override hasNextPage(): boolean { if (this.has_more === false) { return false; } From b9460fbc7ca9639df91c0b7184eea9c7631ae313 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 14 Feb 2025 10:28:44 +0000 Subject: [PATCH 177/509] CI: add ecosystem tests (#1332) --- .github/workflows/ci.yml | 33 +++++++++++++++++++++++++++++++++ .gitignore | 2 +- ecosystem-tests/cli.ts | 1 + 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6798e38a..85d792c44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,3 +64,36 @@ jobs: - name: Run tests run: ./scripts/test + + ecosystem_tests: + name: ecosystem tests (v${{ matrix.node-version }}) + runs-on: ubuntu-latest + if: github.repository == 'openai/openai-node' + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + node-version: ['20'] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '${{ matrix.node-version }}' + + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.39.0 + + - uses: oven-sh/setup-bun@v2 + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run ecosystem tests + run: | + yarn tsn ecosystem-tests/cli.ts --live --verbose --parallel --jobs=4 --retry=3 + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} diff --git a/.gitignore b/.gitignore index 81c4c41ca..3fdab1cb7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,4 @@ tmp .pack ecosystem-tests/deno/package.json ecosystem-tests/*/openai.tgz - +.dev.vars diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 4803b47c2..77faddec5 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -70,6 +70,7 @@ const projectRunners = { 'cloudflare-worker': async () => { await installPackage(); + await fs.writeFile('.dev.vars', `OPENAI_API_KEY='${process.env['OPENAI_API_KEY']}'`); await run('npm', ['run', 'tsc']); if (state.live) { From 212710db8c8c139392c6532c0eccfd13558ef2d4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Feb 2025 10:31:06 +0000 Subject: [PATCH 178/509] release: 4.85.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 +++++++++++++ jsr.json | 2 +- package.json | 37 +++++++++++++++++++++++++++-------- src/version.ts | 2 +- 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f48cc7f57..89f1ce153 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.85.0" + ".": "4.85.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 290b2414d..9850ac460 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.85.1 (2025-02-14) + +Full Changelog: [v4.85.0...v4.85.1](https://github.com/openai/openai-node/compare/v4.85.0...v4.85.1) + +### Bug Fixes + +* **client:** fix export map for index exports ([#1328](https://github.com/openai/openai-node/issues/1328)) ([647ba7a](https://github.com/openai/openai-node/commit/647ba7a52311928f604c72b2cc95698c0837887f)) +* **package:** add chat/completions.ts back in ([#1333](https://github.com/openai/openai-node/issues/1333)) ([e4b5546](https://github.com/openai/openai-node/commit/e4b554632ab1646da831f29413fefb3378c49cc1)) + + +### Chores + +* **internal:** add missing return type annotation ([#1334](https://github.com/openai/openai-node/issues/1334)) ([53e0856](https://github.com/openai/openai-node/commit/53e0856ec4d36deee4d71b5aaf436df0a59b9402)) + ## 4.85.0 (2025-02-13) Full Changelog: [v4.84.1...v4.85.0](https://github.com/openai/openai-node/compare/v4.84.1...v4.85.0) diff --git a/jsr.json b/jsr.json index 368f86c0b..0e1eea3b3 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.85.0", + "version": "4.85.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 46f58814d..45337f85d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.85.0", + "version": "4.85.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", @@ -112,17 +112,38 @@ "default": "./dist/index.mjs" }, "./*.mjs": { - "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], - "default": ["./dist/*.mjs", "./dist/*/index.mjs"] + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "default": [ + "./dist/*.mjs", + "./dist/*/index.mjs" + ] }, "./*.js": { - "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], - "default": ["./dist/*.js", "./dist/*/index.js"] + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "default": [ + "./dist/*.js", + "./dist/*/index.js" + ] }, "./*": { - "types": ["./dist/*.d.ts", "./dist/*/index.d.ts"], - "require": ["./dist/*.js", "./dist/*/index.js"], - "default": ["./dist/*.mjs", "./dist/*/index.mjs"] + "types": [ + "./dist/*.d.ts", + "./dist/*/index.d.ts" + ], + "require": [ + "./dist/*.js", + "./dist/*/index.js" + ], + "default": [ + "./dist/*.mjs", + "./dist/*/index.mjs" + ] } }, "bin": "./bin/cli", diff --git a/src/version.ts b/src/version.ts index 6483fa72b..52fb45056 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.85.0'; // x-release-please-version +export const VERSION = '4.85.1'; // x-release-please-version From b0b4189420e1c5bb5fc4bbb8925f88fe65f9b217 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 18:03:31 +0000 Subject: [PATCH 179/509] fix: optimize sse chunk reading off-by-one error (#1339) --- src/internal/decoders/line.ts | 31 +++++++ src/streaming.ts | 48 +--------- tests/internal/decoders/line.test.ts | 128 +++++++++++++++++++++++++++ tests/streaming.test.ts | 81 +---------------- 4 files changed, 161 insertions(+), 127 deletions(-) create mode 100644 tests/internal/decoders/line.test.ts diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 66f62c057..947f240b3 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -143,3 +143,34 @@ function findNewlineIndex( return null; } + +export function findDoubleNewlineIndex(buffer: Uint8Array): number { + // This function searches the buffer for the end patterns (\r\r, \n\n, \r\n\r\n) + // and returns the index right after the first occurrence of any pattern, + // or -1 if none of the patterns are found. + const newline = 0x0a; // \n + const carriage = 0x0d; // \r + + for (let i = 0; i < buffer.length - 1; i++) { + if (buffer[i] === newline && buffer[i + 1] === newline) { + // \n\n + return i + 2; + } + if (buffer[i] === carriage && buffer[i + 1] === carriage) { + // \r\r + return i + 2; + } + if ( + buffer[i] === carriage && + buffer[i + 1] === newline && + i + 3 < buffer.length && + buffer[i + 2] === carriage && + buffer[i + 3] === newline + ) { + // \r\n\r\n + return i + 4; + } + } + + return -1; +} diff --git a/src/streaming.ts b/src/streaming.ts index 1d1ae344b..52266154c 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -1,6 +1,6 @@ import { ReadableStream, type Response } from './_shims/index'; import { OpenAIError } from './error'; -import { LineDecoder } from './internal/decoders/line'; +import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line'; import { ReadableStreamToAsyncIterable } from './internal/stream-utils'; import { APIError } from './error'; @@ -259,37 +259,6 @@ async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGene } } -function findDoubleNewlineIndex(buffer: Uint8Array): number { - // This function searches the buffer for the end patterns (\r\r, \n\n, \r\n\r\n) - // and returns the index right after the first occurrence of any pattern, - // or -1 if none of the patterns are found. - const newline = 0x0a; // \n - const carriage = 0x0d; // \r - - for (let i = 0; i < buffer.length - 2; i++) { - if (buffer[i] === newline && buffer[i + 1] === newline) { - // \n\n - return i + 2; - } - if (buffer[i] === carriage && buffer[i + 1] === carriage) { - // \r\r - return i + 2; - } - if ( - buffer[i] === carriage && - buffer[i + 1] === newline && - i + 3 < buffer.length && - buffer[i + 2] === carriage && - buffer[i + 3] === newline - ) { - // \r\n\r\n - return i + 4; - } - } - - return -1; -} - class SSEDecoder { private data: string[]; private event: string | null; @@ -345,21 +314,6 @@ class SSEDecoder { } } -/** This is an internal helper function that's just used for testing */ -export function _decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { - const decoder = new LineDecoder(); - const lines: string[] = []; - for (const chunk of chunks) { - lines.push(...decoder.decode(chunk)); - } - - if (flush) { - lines.push(...decoder.flush()); - } - - return lines; -} - function partition(str: string, delimiter: string): [string, string, string] { const index = str.indexOf(delimiter); if (index !== -1) { diff --git a/tests/internal/decoders/line.test.ts b/tests/internal/decoders/line.test.ts new file mode 100644 index 000000000..e76858e55 --- /dev/null +++ b/tests/internal/decoders/line.test.ts @@ -0,0 +1,128 @@ +import { findDoubleNewlineIndex, LineDecoder } from 'openai/internal/decoders/line'; + +function decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { + const decoder = new LineDecoder(); + const lines: string[] = []; + for (const chunk of chunks) { + lines.push(...decoder.decode(chunk)); + } + + if (flush) { + lines.push(...decoder.flush()); + } + + return lines; +} + +describe('line decoder', () => { + test('basic', () => { + // baz is not included because the line hasn't ended yet + expect(decodeChunks(['foo', ' bar\nbaz'])).toEqual(['foo bar']); + }); + + test('basic with \\r', () => { + expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); + expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); + }); + + test('trailing new lines', () => { + expect(decodeChunks(['foo', ' bar', 'baz\n', 'thing\n'])).toEqual(['foo barbaz', 'thing']); + }); + + test('trailing new lines with \\r', () => { + expect(decodeChunks(['foo', ' bar', 'baz\r\n', 'thing\r\n'])).toEqual(['foo barbaz', 'thing']); + }); + + test('escaped new lines', () => { + expect(decodeChunks(['foo', ' bar\\nbaz\n'])).toEqual(['foo bar\\nbaz']); + }); + + test('escaped new lines with \\r', () => { + expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); + }); + + test('\\r & \\n split across multiple chunks', () => { + expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('single \\r', () => { + expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('double \\r', () => { + expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + // implementation detail that we don't yield the single \r line until a new \r or \n is encountered + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); + }); + + test('double \\r then \\r\\n', () => { + expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + }); + + test('double newline', () => { + expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('multi-byte characters across chunks', () => { + const decoder = new LineDecoder(); + + // bytes taken from the string 'известни' and arbitrarily split + // so that some multi-byte characters span multiple chunks + expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); + expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); + expect( + decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), + ).toHaveLength(0); + + const decoded = decoder.decode(new Uint8Array([0xa])); + expect(decoded).toEqual(['известни']); + }); + + test('flushing trailing newlines', () => { + expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('flushing empty buffer', () => { + expect(decodeChunks([], { flush: true })).toEqual([]); + }); +}); + +describe('findDoubleNewlineIndex', () => { + test('finds \\n\\n', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\n\nbar'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\n\nbar'))).toBe(2); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\n\n'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\n\n'))).toBe(2); + }); + + test('finds \\r\\r', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\rbar'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\rbar'))).toBe(2); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\r'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\r'))).toBe(2); + }); + + test('finds \\r\\n\\r\\n', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r\nbar'))).toBe(7); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\n\r\nbar'))).toBe(4); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r\n'))).toBe(7); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\n\r\n'))).toBe(4); + }); + + test('returns -1 when no double newline found', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\nbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\rbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\nbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode(''))).toBe(-1); + }); + + test('handles incomplete patterns', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n'))).toBe(-1); + }); +}); diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 8e5d0ca31..b9a38f208 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,86 +1,7 @@ import { Response } from 'node-fetch'; import { PassThrough } from 'stream'; import assert from 'assert'; -import { _iterSSEMessages, _decodeChunks as decodeChunks } from 'openai/streaming'; -import { LineDecoder } from 'openai/internal/decoders/line'; - -describe('line decoder', () => { - test('basic', () => { - // baz is not included because the line hasn't ended yet - expect(decodeChunks(['foo', ' bar\nbaz'])).toEqual(['foo bar']); - }); - - test('basic with \\r', () => { - expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); - expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); - }); - - test('trailing new lines', () => { - expect(decodeChunks(['foo', ' bar', 'baz\n', 'thing\n'])).toEqual(['foo barbaz', 'thing']); - }); - - test('trailing new lines with \\r', () => { - expect(decodeChunks(['foo', ' bar', 'baz\r\n', 'thing\r\n'])).toEqual(['foo barbaz', 'thing']); - }); - - test('escaped new lines', () => { - expect(decodeChunks(['foo', ' bar\\nbaz\n'])).toEqual(['foo bar\\nbaz']); - }); - - test('escaped new lines with \\r', () => { - expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); - }); - - test('\\r & \\n split across multiple chunks', () => { - expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); - }); - - test('single \\r', () => { - expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); - }); - - test('double \\r', () => { - expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); - expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - // implementation detail that we don't yield the single \r line until a new \r or \n is encountered - expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); - }); - - test('double \\r then \\r\\n', () => { - expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); - expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); - }); - - test('double newline', () => { - expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - }); - - test('multi-byte characters across chunks', () => { - const decoder = new LineDecoder(); - - // bytes taken from the string 'известни' and arbitrarily split - // so that some multi-byte characters span multiple chunks - expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); - expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); - expect( - decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), - ).toHaveLength(0); - - const decoded = decoder.decode(new Uint8Array([0xa])); - expect(decoded).toEqual(['известни']); - }); - - test('flushing trailing newlines', () => { - expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - }); - - test('flushing empty buffer', () => { - expect(decodeChunks([], { flush: true })).toEqual([]); - }); -}); +import { _iterSSEMessages } from 'openai/streaming'; describe('streaming decoding', () => { test('basic', async () => { From 2bce86509a45d96d17cfc837ddfd8ddc5995df8e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Feb 2025 18:04:10 +0000 Subject: [PATCH 180/509] release: 4.85.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 89f1ce153..541794534 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.85.1" + ".": "4.85.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9850ac460..70a447b0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.85.2 (2025-02-18) + +Full Changelog: [v4.85.1...v4.85.2](https://github.com/openai/openai-node/compare/v4.85.1...v4.85.2) + +### Bug Fixes + +* optimize sse chunk reading off-by-one error ([#1339](https://github.com/openai/openai-node/issues/1339)) ([c82795b](https://github.com/openai/openai-node/commit/c82795b189c73d1c0e3bc3a40d0d4a2558b0483a)) + ## 4.85.1 (2025-02-14) Full Changelog: [v4.85.0...v4.85.1](https://github.com/openai/openai-node/compare/v4.85.0...v4.85.1) diff --git a/jsr.json b/jsr.json index 0e1eea3b3..8f83c0ff2 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.85.1", + "version": "4.85.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 45337f85d..661bc2938 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.85.1", + "version": "4.85.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 52fb45056..4fdc11dc7 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.85.1'; // x-release-please-version +export const VERSION = '4.85.2'; // x-release-please-version From 6d056bf95c9be4046decf20ec4c98dfa2bea2723 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 20 Feb 2025 11:09:29 +0000 Subject: [PATCH 181/509] fix(parsing): remove tool_calls default empty array (#1341) --- src/lib/parser.ts | 17 +++++++++++++++-- src/resources/beta/chat/completions.ts | 2 +- tests/lib/ChatCompletionRunFunctions.test.ts | 20 ++++++++++---------- tests/lib/ChatCompletionStream.test.ts | 3 --- tests/lib/parser.test.ts | 6 ------ 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/lib/parser.ts b/src/lib/parser.ts index f2678e312..a750375dc 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -119,7 +119,15 @@ export function maybeParseChatCompletion< ...completion, choices: completion.choices.map((choice) => ({ ...choice, - message: { ...choice.message, parsed: null, tool_calls: choice.message.tool_calls ?? [] }, + message: { + ...choice.message, + parsed: null, + ...(choice.message.tool_calls ? + { + tool_calls: choice.message.tool_calls, + } + : undefined), + }, })), }; } @@ -144,7 +152,12 @@ export function parseChatCompletion< ...choice, message: { ...choice.message, - tool_calls: choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? [], + ...(choice.message.tool_calls ? + { + tool_calls: + choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? undefined, + } + : undefined), parsed: choice.message.content && !choice.message.refusal ? parseResponseFormat(params, choice.message.content) diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index c9360a95c..083b9914e 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -50,7 +50,7 @@ export interface ParsedFunctionToolCall extends ChatCompletionMessageToolCall { export interface ParsedChatCompletionMessage extends ChatCompletionMessage { parsed: ParsedT | null; - tool_calls: Array; + tool_calls?: Array; } export interface ParsedChoice extends ChatCompletion.Choice { diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index b684f204d..496501a86 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -628,7 +628,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([`it's raining`]); @@ -876,7 +876,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual(['3']); @@ -1125,7 +1125,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([`must be an object`, '3']); @@ -1443,7 +1443,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([ @@ -1572,7 +1572,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([`it's raining`]); @@ -1795,7 +1795,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual(['3']); @@ -1997,7 +1997,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([`must be an object`, '3']); @@ -2301,7 +2301,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([ @@ -2347,7 +2347,7 @@ describe('resource completions', () => { content: 'The weather is great today!', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }); await listener.sanityCheck(); }); @@ -2386,7 +2386,7 @@ describe('resource completions', () => { content: 'The weather is great today!', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }); await listener.sanityCheck(); }); diff --git a/tests/lib/ChatCompletionStream.test.ts b/tests/lib/ChatCompletionStream.test.ts index e5ef20c9e..34c5fd204 100644 --- a/tests/lib/ChatCompletionStream.test.ts +++ b/tests/lib/ChatCompletionStream.test.ts @@ -39,7 +39,6 @@ describe('.stream()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -198,7 +197,6 @@ describe('.stream()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -386,7 +384,6 @@ describe('.stream()', () => { "parsed": null, "refusal": "I'm very sorry, but I can't assist with that request.", "role": "assistant", - "tool_calls": [], }, } `); diff --git a/tests/lib/parser.test.ts b/tests/lib/parser.test.ts index b220e92d3..fa8123f5c 100644 --- a/tests/lib/parser.test.ts +++ b/tests/lib/parser.test.ts @@ -39,7 +39,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -154,7 +153,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); @@ -488,7 +486,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -787,7 +784,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -947,7 +943,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -1061,7 +1056,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); From d92fd953309951f4d6dcc9858d8782ea1bff4c79 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Feb 2025 11:10:00 +0000 Subject: [PATCH 182/509] release: 4.85.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 541794534..712720117 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.85.2" + ".": "4.85.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a447b0a..36debfad1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.85.3 (2025-02-20) + +Full Changelog: [v4.85.2...v4.85.3](https://github.com/openai/openai-node/compare/v4.85.2...v4.85.3) + +### Bug Fixes + +* **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([2672160](https://github.com/openai/openai-node/commit/26721608e61949daa9592483e89b79230bb9198a)) + ## 4.85.2 (2025-02-18) Full Changelog: [v4.85.1...v4.85.2](https://github.com/openai/openai-node/compare/v4.85.1...v4.85.2) diff --git a/jsr.json b/jsr.json index 8f83c0ff2..3c480dc70 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.85.2", + "version": "4.85.3", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 661bc2938..5fdd39fdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.85.2", + "version": "4.85.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 4fdc11dc7..679cac2c7 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.85.2'; // x-release-please-version +export const VERSION = '4.85.3'; // x-release-please-version From f3d708390a36427206edfc67875a7987eb483e55 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 10 Feb 2025 20:06:40 +0000 Subject: [PATCH 183/509] fix: correctly decode multi-byte characters over multiple chunks --- src/internal/decoders/line.ts | 107 ++++++++++++++++++++++------------ src/streaming.ts | 6 +- tests/streaming.test.ts | 53 ++++++++++++++++- 3 files changed, 126 insertions(+), 40 deletions(-) diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 1760f1030..6a896db5f 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -13,8 +13,8 @@ export class LineDecoder { static NEWLINE_CHARS = new Set(['\n', '\r']); static NEWLINE_REGEXP = /\r\n|[\n\r]/g; - buffer: string[]; - trailingCR: boolean; + buffer: Uint8Array; + #carriageReturnIndex: number | null; textDecoder: | undefined | { @@ -22,47 +22,53 @@ export class LineDecoder { }; constructor() { - this.buffer = []; - this.trailingCR = false; + this.buffer = new Uint8Array(); + this.#carriageReturnIndex = null; } decode(chunk: Bytes): string[] { - let text = this.decodeText(chunk); - - if (this.trailingCR) { - text = '\r' + text; - this.trailingCR = false; - } - if (text.endsWith('\r')) { - this.trailingCR = true; - text = text.slice(0, -1); - } - - if (!text) { + if (chunk == null) { return []; } - const trailingNewline = LineDecoder.NEWLINE_CHARS.has(text[text.length - 1] || ''); - let lines = text.split(LineDecoder.NEWLINE_REGEXP); + const binaryChunk = + chunk instanceof ArrayBuffer ? new Uint8Array(chunk) + : typeof chunk === 'string' ? new TextEncoder().encode(chunk) + : chunk; + + let newData = new Uint8Array(this.buffer.length + binaryChunk.length); + newData.set(this.buffer); + newData.set(binaryChunk, this.buffer.length); + this.buffer = newData; + + const lines: string[] = []; + let patternIndex; + while ((patternIndex = findNewlineIndex(this.buffer, this.#carriageReturnIndex)) != null) { + if (patternIndex.carriage && this.#carriageReturnIndex == null) { + // skip until we either get a corresponding `\n`, a new `\r` or nothing + this.#carriageReturnIndex = patternIndex.index; + continue; + } - // if there is a trailing new line then the last entry will be an empty - // string which we don't care about - if (trailingNewline) { - lines.pop(); - } + // we got double \r or \rtext\n + if ( + this.#carriageReturnIndex != null && + (patternIndex.index !== this.#carriageReturnIndex + 1 || patternIndex.carriage) + ) { + lines.push(this.decodeText(this.buffer.slice(0, this.#carriageReturnIndex - 1))); + this.buffer = this.buffer.slice(this.#carriageReturnIndex); + this.#carriageReturnIndex = null; + continue; + } - if (lines.length === 1 && !trailingNewline) { - this.buffer.push(lines[0]!); - return []; - } + const endIndex = + this.#carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding; - if (this.buffer.length > 0) { - lines = [this.buffer.join('') + lines[0], ...lines.slice(1)]; - this.buffer = []; - } + const line = this.decodeText(this.buffer.slice(0, endIndex)); + lines.push(line); - if (!trailingNewline) { - this.buffer = [lines.pop() || '']; + this.buffer = this.buffer.slice(patternIndex.index); + this.#carriageReturnIndex = null; } return lines; @@ -106,13 +112,38 @@ export class LineDecoder { } flush(): string[] { - if (!this.buffer.length && !this.trailingCR) { + if (!this.buffer.length) { return []; } + return this.decode('\n'); + } +} - const lines = [this.buffer.join('')]; - this.buffer = []; - this.trailingCR = false; - return lines; +/** + * This function searches the buffer for the end patterns, (\r or \n) + * and returns an object with the index preceding the matched newline and the + * index after the newline char. `null` is returned if no new line is found. + * + * ```ts + * findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 } + * ``` + */ +function findNewlineIndex( + buffer: Uint8Array, + startIndex: number | null, +): { preceding: number; index: number; carriage: boolean } | null { + const newline = 0x0a; // \n + const carriage = 0x0d; // \r + + for (let i = startIndex ?? 0; i < buffer.length; i++) { + if (buffer[i] === newline) { + return { preceding: i, index: i + 1, carriage: false }; + } + + if (buffer[i] === carriage) { + return { preceding: i, index: i + 1, carriage: true }; + } } + + return null; } diff --git a/src/streaming.ts b/src/streaming.ts index a5e901d35..b1308793d 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -358,13 +358,17 @@ class SSEDecoder { } /** This is an internal helper function that's just used for testing */ -export function _decodeChunks(chunks: string[]): string[] { +export function _decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { const decoder = new LineDecoder(); const lines: string[] = []; for (const chunk of chunks) { lines.push(...decoder.decode(chunk)); } + if (flush) { + lines.push(...decoder.flush()); + } + return lines; } diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 1bbdc861d..0a630f45c 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,6 +1,7 @@ import { PassThrough } from 'stream'; import assert from 'assert'; import { _iterSSEMessages, _decodeChunks as decodeChunks } from 'openai/streaming'; +import { LineDecoder } from 'openai/internal/decoders/line'; describe('line decoder', () => { test('basic', () => { @@ -9,8 +10,8 @@ describe('line decoder', () => { }); test('basic with \\r', () => { - // baz is not included because the line hasn't ended yet expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); + expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); }); test('trailing new lines', () => { @@ -28,6 +29,56 @@ describe('line decoder', () => { test('escaped new lines with \\r', () => { expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); }); + + test('\\r & \\n split across multiple chunks', () => { + expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('single \\r', () => { + expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('double \\r', () => { + expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + // implementation detail that we don't yield the single \r line until a new \r or \n is encountered + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); + }); + + test('double \\r then \\r\\n', () => { + expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + }); + + test('double newline', () => { + expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('multi-byte characters across chunks', () => { + const decoder = new LineDecoder(); + + // bytes taken from the string 'известни' and arbitrarily split + // so that some multi-byte characters span multiple chunks + expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); + expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); + expect( + decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), + ).toHaveLength(0); + + const decoded = decoder.decode(new Uint8Array([0xa])); + expect(decoded).toEqual(['известни']); + }); + + test('flushing trailing newlines', () => { + expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('flushing empty buffer', () => { + expect(decodeChunks([], { flush: true })).toEqual([]); + }); }); describe('streaming decoding', () => { From 59da1771b93158d5d89efc9e63e1ef9c09a634f3 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 13 Feb 2025 19:41:54 +0000 Subject: [PATCH 184/509] feat(api): add support for storing chat completions --- .eslintrc.js | 29 - .stats.yml | 4 +- api.md | 70 +- eslint.config.mjs | 42 ++ package.json | 11 +- scripts/format | 2 +- scripts/lint | 2 +- src/client.ts | 44 +- src/pagination.ts | 1 - src/resources/chat/chat.ts | 14 +- .../chat/{ => completions}/completions.ts | 149 +++- src/resources/chat/completions/index.ts | 43 ++ src/resources/chat/completions/messages.ts | 40 ++ src/resources/chat/index.ts | 8 +- src/resources/completions.ts | 4 +- src/resources/moderations.ts | 4 +- tests/api-resources/chat/completions.test.ts | 64 -- .../chat/completions/completions.test.ts | 122 ++++ .../chat/completions/messages.test.ts | 32 + tests/qs/utils.test.ts | 2 +- yarn.lock | 680 +++++++----------- 21 files changed, 767 insertions(+), 600 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs rename src/resources/chat/{ => completions}/completions.ts (89%) create mode 100644 src/resources/chat/completions/index.ts create mode 100644 src/resources/chat/completions/messages.ts delete mode 100644 tests/api-resources/chat/completions.test.ts create mode 100644 tests/api-resources/chat/completions/completions.test.ts create mode 100644 tests/api-resources/chat/completions/messages.test.ts diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 64ffc67b1..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,29 +0,0 @@ -module.exports = { - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'unused-imports', 'prettier'], - rules: { - 'no-unused-vars': 'off', - 'prettier/prettier': 'error', - 'unused-imports/no-unused-imports': 'error', - 'no-restricted-imports': [ - 'error', - { - patterns: [ - { - group: ['openai', 'openai/*'], - message: 'Use a relative import, not a package import.', - }, - ], - }, - ], - }, - overrides: [ - { - files: ['tests/**', 'examples/**', 'ecosystem-tests/**'], - rules: { - 'no-restricted-imports': 'off', - }, - }, - ], - root: true, -}; diff --git a/.stats.yml b/.stats.yml index d59a86d22..658877d3b 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-dfb00c627f58e5180af7a9b29ed2f2aa0764a3b9daa6a32a1cc45bc8e48dfe15.yml +configured_endpoints: 74 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml diff --git a/api.md b/api.md index 4d463c37e..5b5c603b7 100644 --- a/api.md +++ b/api.md @@ -32,38 +32,50 @@ Types: Types: -- ChatCompletion -- ChatCompletionAssistantMessageParam -- ChatCompletionAudio -- ChatCompletionAudioParam -- ChatCompletionChunk -- ChatCompletionContentPart -- ChatCompletionContentPartImage -- ChatCompletionContentPartInputAudio -- ChatCompletionContentPartRefusal -- ChatCompletionContentPartText -- ChatCompletionDeveloperMessageParam -- ChatCompletionFunctionCallOption -- ChatCompletionFunctionMessageParam -- ChatCompletionMessage -- ChatCompletionMessageParam -- ChatCompletionMessageToolCall -- ChatCompletionModality -- ChatCompletionNamedToolChoice -- ChatCompletionPredictionContent -- ChatCompletionReasoningEffort -- ChatCompletionRole -- ChatCompletionStreamOptions -- ChatCompletionSystemMessageParam -- ChatCompletionTokenLogprob -- ChatCompletionTool -- ChatCompletionToolChoiceOption -- ChatCompletionToolMessageParam -- ChatCompletionUserMessageParam +- ChatCompletion +- ChatCompletionAssistantMessageParam +- ChatCompletionAudio +- ChatCompletionAudioParam +- ChatCompletionChunk +- ChatCompletionContentPart +- ChatCompletionContentPartImage +- ChatCompletionContentPartInputAudio +- ChatCompletionContentPartRefusal +- ChatCompletionContentPartText +- ChatCompletionDeleted +- ChatCompletionDeveloperMessageParam +- ChatCompletionFunctionCallOption +- ChatCompletionFunctionMessageParam +- ChatCompletionMessage +- ChatCompletionMessageParam +- ChatCompletionMessageToolCall +- ChatCompletionModality +- ChatCompletionNamedToolChoice +- ChatCompletionPredictionContent +- ChatCompletionReasoningEffort +- ChatCompletionRole +- ChatCompletionStoreMessage +- ChatCompletionStreamOptions +- ChatCompletionSystemMessageParam +- ChatCompletionTokenLogprob +- ChatCompletionTool +- ChatCompletionToolChoiceOption +- ChatCompletionToolMessageParam +- ChatCompletionUserMessageParam Methods: -- client.chat.completions.create({ ...params }) -> ChatCompletion +- client.chat.completions.create({ ...params }) -> ChatCompletion +- client.chat.completions.retrieve(completionID) -> ChatCompletion +- client.chat.completions.update(completionID, { ...params }) -> ChatCompletion +- client.chat.completions.list({ ...params }) -> ChatCompletionsPage +- client.chat.completions.delete(completionID) -> ChatCompletionDeleted + +### Messages + +Methods: + +- client.chat.completions.messages.list(completionID, { ...params }) -> ChatCompletionStoreMessagesPage # Embeddings diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 000000000..90220c65f --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,42 @@ +// @ts-check +import tseslint from 'typescript-eslint'; +import unusedImports from 'eslint-plugin-unused-imports'; +import prettier from 'eslint-plugin-prettier'; + +export default tseslint.config( + { + languageOptions: { + parser: tseslint.parser, + parserOptions: { sourceType: 'module' }, + }, + files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'], + ignores: ['dist/**'], + plugins: { + '@typescript-eslint': tseslint.plugin, + 'unused-imports': unusedImports, + prettier, + }, + rules: { + 'no-unused-vars': 'off', + 'prettier/prettier': 'error', + 'unused-imports/no-unused-imports': 'error', + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + regex: '^openai(/.*)?', + message: 'Use a relative import, not a package import.', + }, + ], + }, + ], + }, + }, + { + files: ['tests/**', 'examples/**'], + rules: { + 'no-restricted-imports': 'off', + }, + }, +); diff --git a/package.json b/package.json index bd6ab9aae..cf463e4ef 100644 --- a/package.json +++ b/package.json @@ -30,11 +30,12 @@ "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", "@types/node": "^20.17.6", - "@typescript-eslint/eslint-plugin": "^6.7.0", - "@typescript-eslint/parser": "^6.0.0", - "eslint": "^8.49.0", - "eslint-plugin-prettier": "^5.0.1", - "eslint-plugin-unused-imports": "^3.0.0", + "typescript-eslint": "^8.24.0", + "@typescript-eslint/eslint-plugin": "^8.24.0", + "@typescript-eslint/parser": "^8.24.0", + "eslint": "^9.20.1", + "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-unused-imports": "^4.1.4", "execa": "^5.1.1", "fast-check": "^3.22.0", "iconv-lite": "^0.6.3", diff --git a/scripts/format b/scripts/format index a6bb9d03a..903b1ef85 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint --fix" -ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js . +./node_modules/.bin/eslint --fix . diff --git a/scripts/lint b/scripts/lint index 0096d1e51..726708c4c 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,7 +5,7 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint" -ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . +./node_modules/.bin/eslint . echo "==> Building" ./scripts/build # also checks types diff --git a/src/client.ts b/src/client.ts index 42f2a44d0..2cab4f24a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -83,6 +83,13 @@ import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat, ChatModel } from './resources/chat/chat'; +import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { + Upload, + UploadCompleteParams, + UploadCreateParams, + Uploads as UploadsAPIUploads, +} from './resources/uploads/uploads'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -97,9 +104,11 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeleted, ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, + ChatCompletionListParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, @@ -108,21 +117,17 @@ import { ChatCompletionPredictionContent, ChatCompletionReasoningEffort, ChatCompletionRole, + ChatCompletionStoreMessage, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, ChatCompletionTokenLogprob, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, + ChatCompletionUpdateParams, ChatCompletionUserMessageParam, -} from './resources/chat/completions'; -import { FineTuning } from './resources/fine-tuning/fine-tuning'; -import { - Upload, - UploadCompleteParams, - UploadCreateParams, - Uploads as UploadsAPIUploads, -} from './resources/uploads/uploads'; + ChatCompletionsPage, +} from './resources/chat/completions/completions'; const safeJSON = (text: string) => { try { @@ -378,24 +383,6 @@ export class OpenAI { return url.toString(); } - private calculateContentLength(body: unknown): string | null { - if (typeof body === 'string') { - if (typeof (globalThis as any).Buffer !== 'undefined') { - return (globalThis as any).Buffer.byteLength(body, 'utf8').toString(); - } - - if (typeof (globalThis as any).TextEncoder !== 'undefined') { - const encoder = new (globalThis as any).TextEncoder(); - const encoded = encoder.encode(body); - return encoded.length.toString(); - } - } else if (ArrayBuffer.isView(body)) { - return body.byteLength.toString(); - } - - return null; - } - /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ @@ -830,6 +817,7 @@ export declare namespace OpenAI { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -841,6 +829,7 @@ export declare namespace OpenAI { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -848,9 +837,12 @@ export declare namespace OpenAI { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, }; export { diff --git a/src/pagination.ts b/src/pagination.ts index 7a2ef53a9..1ecbe9975 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -46,7 +46,6 @@ export abstract class AbstractPage implements AsyncIterable { } async *iterPages(): AsyncGenerator { - // eslint-disable-next-line @typescript-eslint/no-this-alias let page: this = this; yield page; while (page.hasNextPage()) { diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 55097e989..0c7dae3ef 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as CompletionsAPI from './completions'; +import * as CompletionsAPI from './completions/completions'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -16,9 +16,11 @@ import { ChatCompletionCreateParams, ChatCompletionCreateParamsNonStreaming, ChatCompletionCreateParamsStreaming, + ChatCompletionDeleted, ChatCompletionDeveloperMessageParam, ChatCompletionFunctionCallOption, ChatCompletionFunctionMessageParam, + ChatCompletionListParams, ChatCompletionMessage, ChatCompletionMessageParam, ChatCompletionMessageToolCall, @@ -27,15 +29,18 @@ import { ChatCompletionPredictionContent, ChatCompletionReasoningEffort, ChatCompletionRole, + ChatCompletionStoreMessage, ChatCompletionStreamOptions, ChatCompletionSystemMessageParam, ChatCompletionTokenLogprob, ChatCompletionTool, ChatCompletionToolChoiceOption, ChatCompletionToolMessageParam, + ChatCompletionUpdateParams, ChatCompletionUserMessageParam, + ChatCompletionsPage, Completions, -} from './completions'; +} from './completions/completions'; export class Chat extends APIResource { completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client); @@ -99,6 +104,7 @@ export declare namespace Chat { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -110,6 +116,7 @@ export declare namespace Chat { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -117,8 +124,11 @@ export declare namespace Chat { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, }; } diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions/completions.ts similarity index 89% rename from src/resources/chat/completions.ts rename to src/resources/chat/completions/completions.ts index 48577e667..29c9ad390 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1,15 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as ChatCompletionsAPI from './completions'; -import * as CompletionsAPI from '../completions'; -import * as Shared from '../shared'; -import * as ChatAPI from './chat'; -import { APIPromise } from '../../api-promise'; -import { Stream } from '../../streaming'; -import { RequestOptions } from '../../internal/request-options'; +import { APIResource } from '../../../resource'; +import * as CompletionsCompletionsAPI from './completions'; +import * as CompletionsAPI from '../../completions'; +import * as Shared from '../../shared'; +import * as ChatAPI from '../chat'; +import * as MessagesAPI from './messages'; +import { MessageListParams, Messages } from './messages'; +import { APIPromise } from '../../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { Stream } from '../../../streaming'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; export class Completions extends APIResource { + messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); + /** * Creates a model response for the given chat conversation. Learn more in the * [text generation](https://platform.openai.com/docs/guides/text-generation), @@ -39,8 +45,52 @@ export class Completions extends APIResource { | APIPromise | APIPromise>; } + + /** + * Get a stored chat completion. Only chat completions that have been created with + * the `store` parameter set to `true` will be returned. + */ + retrieve(completionID: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/chat/completions/${completionID}`, options); + } + + /** + * Modify a stored chat completion. Only chat completions that have been created + * with the `store` parameter set to `true` can be modified. Currently, the only + * supported modification is to update the `metadata` field. + */ + update( + completionID: string, + body: ChatCompletionUpdateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/chat/completions/${completionID}`, { body, ...options }); + } + + /** + * List stored chat completions. Only chat completions that have been stored with + * the `store` parameter set to `true` will be returned. + */ + list( + query: ChatCompletionListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/chat/completions', CursorPage, { query, ...options }); + } + + /** + * Delete a stored chat completion. Only chat completions that have been created + * with the `store` parameter set to `true` can be deleted. + */ + delete(completionID: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/chat/completions/${completionID}`, options); + } } +export type ChatCompletionsPage = CursorPage; + +export type ChatCompletionStoreMessagesPage = CursorPage; + /** * Represents a chat completion response returned by model, based on the provided * input. @@ -116,7 +166,7 @@ export namespace ChatCompletion { /** * A chat completion message generated by the model. */ - message: ChatCompletionsAPI.ChatCompletionMessage; + message: CompletionsCompletionsAPI.ChatCompletionMessage; } export namespace Choice { @@ -127,12 +177,12 @@ export namespace ChatCompletion { /** * A list of message content tokens with log probability information. */ - content: Array | null; + content: Array | null; /** * A list of message refusal tokens with log probability information. */ - refusal: Array | null; + refusal: Array | null; } } } @@ -434,12 +484,12 @@ export namespace ChatCompletionChunk { /** * A list of message content tokens with log probability information. */ - content: Array | null; + content: Array | null; /** * A list of message refusal tokens with log probability information. */ - refusal: Array | null; + refusal: Array | null; } } } @@ -534,6 +584,23 @@ export interface ChatCompletionContentPartText { type: 'text'; } +export interface ChatCompletionDeleted { + /** + * The ID of the chat completion that was deleted. + */ + id: string; + + /** + * Whether the chat completion was deleted. + */ + deleted: boolean; + + /** + * The type of object being deleted. + */ + object: 'chat.completion.deleted'; +} + /** * Developer-provided instructions that the model should follow, regardless of * messages sent by the user. With o1 models and newer, `developer` messages @@ -755,6 +822,16 @@ export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; */ export type ChatCompletionRole = 'developer' | 'system' | 'user' | 'assistant' | 'tool' | 'function'; +/** + * A chat completion message generated by the model. + */ +export interface ChatCompletionStoreMessage extends ChatCompletionMessage { + /** + * The identifier of the chat message. + */ + id: string; +} + /** * Options for streaming response. Only set this when you set `stream: true`. */ @@ -1221,8 +1298,9 @@ export namespace ChatCompletionCreateParams { } export type ChatCompletionCreateParamsNonStreaming = - ChatCompletionsAPI.ChatCompletionCreateParamsNonStreaming; - export type ChatCompletionCreateParamsStreaming = ChatCompletionsAPI.ChatCompletionCreateParamsStreaming; + CompletionsCompletionsAPI.ChatCompletionCreateParamsNonStreaming; + export type ChatCompletionCreateParamsStreaming = + CompletionsCompletionsAPI.ChatCompletionCreateParamsStreaming; } export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase { @@ -1249,6 +1327,40 @@ export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreat stream: true; } +export interface ChatCompletionUpdateParams { + /** + * 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; +} + +export interface ChatCompletionListParams extends CursorPageParams { + /** + * A list of metadata keys to filter the chat completions by. Example: + * + * `metadata[key1]=value1&metadata[key2]=value2` + */ + metadata?: Shared.Metadata | null; + + /** + * The model used to generate the chat completions. + */ + model?: string; + + /** + * Sort order for chat completions by timestamp. Use `asc` for ascending order or + * `desc` for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; +} + +Completions.Messages = Messages; + export declare namespace Completions { export { type ChatCompletion as ChatCompletion, @@ -1261,6 +1373,7 @@ export declare namespace Completions { type ChatCompletionContentPartInputAudio as ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal as ChatCompletionContentPartRefusal, type ChatCompletionContentPartText as ChatCompletionContentPartText, + type ChatCompletionDeleted as ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam as ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption as ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam as ChatCompletionFunctionMessageParam, @@ -1272,6 +1385,7 @@ export declare namespace Completions { type ChatCompletionPredictionContent as ChatCompletionPredictionContent, type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, + type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam as ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob as ChatCompletionTokenLogprob, @@ -1279,8 +1393,13 @@ export declare namespace Completions { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming as ChatCompletionCreateParamsStreaming, + type ChatCompletionUpdateParams as ChatCompletionUpdateParams, + type ChatCompletionListParams as ChatCompletionListParams, }; + + export { Messages as Messages, type MessageListParams as MessageListParams }; } diff --git a/src/resources/chat/completions/index.ts b/src/resources/chat/completions/index.ts new file mode 100644 index 000000000..6a3fdec83 --- /dev/null +++ b/src/resources/chat/completions/index.ts @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Completions, + type ChatCompletion, + type ChatCompletionAssistantMessageParam, + type ChatCompletionAudio, + type ChatCompletionAudioParam, + type ChatCompletionChunk, + type ChatCompletionContentPart, + type ChatCompletionContentPartImage, + type ChatCompletionContentPartInputAudio, + type ChatCompletionContentPartRefusal, + type ChatCompletionContentPartText, + type ChatCompletionDeleted, + type ChatCompletionDeveloperMessageParam, + type ChatCompletionFunctionCallOption, + type ChatCompletionFunctionMessageParam, + type ChatCompletionMessage, + type ChatCompletionMessageParam, + type ChatCompletionMessageToolCall, + type ChatCompletionModality, + type ChatCompletionNamedToolChoice, + type ChatCompletionPredictionContent, + type ChatCompletionReasoningEffort, + type ChatCompletionRole, + type ChatCompletionStoreMessage, + type ChatCompletionStreamOptions, + type ChatCompletionSystemMessageParam, + type ChatCompletionTokenLogprob, + type ChatCompletionTool, + type ChatCompletionToolChoiceOption, + type ChatCompletionToolMessageParam, + type ChatCompletionUserMessageParam, + type ChatCompletionCreateParams, + type ChatCompletionCreateParamsNonStreaming, + type ChatCompletionCreateParamsStreaming, + type ChatCompletionUpdateParams, + type ChatCompletionListParams, + type ChatCompletionStoreMessagesPage, + type ChatCompletionsPage, +} from './completions'; +export { Messages, type MessageListParams } from './messages'; diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts new file mode 100644 index 000000000..f00acbdfc --- /dev/null +++ b/src/resources/chat/completions/messages.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as CompletionsAPI from './completions'; +import { ChatCompletionStoreMessagesPage } from './completions'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Messages extends APIResource { + /** + * Get the messages in a stored chat completion. Only chat completions that have + * been created with the `store` parameter set to `true` will be returned. + */ + list( + completionID: string, + query: MessageListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + path`/chat/completions/${completionID}/messages`, + CursorPage, + { query, ...options }, + ); + } +} + +export interface MessageListParams extends CursorPageParams { + /** + * Sort order for messages by timestamp. Use `asc` for ascending order or `desc` + * for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; +} + +export declare namespace Messages { + export { type MessageListParams as MessageListParams }; +} + +export { type ChatCompletionStoreMessagesPage }; diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index 4ae265190..f098e5ce7 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -13,6 +13,7 @@ export { type ChatCompletionContentPartInputAudio, type ChatCompletionContentPartRefusal, type ChatCompletionContentPartText, + type ChatCompletionDeleted, type ChatCompletionDeveloperMessageParam, type ChatCompletionFunctionCallOption, type ChatCompletionFunctionMessageParam, @@ -24,6 +25,7 @@ export { type ChatCompletionPredictionContent, type ChatCompletionReasoningEffort, type ChatCompletionRole, + type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, type ChatCompletionSystemMessageParam, type ChatCompletionTokenLogprob, @@ -34,4 +36,8 @@ export { type ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming, type ChatCompletionCreateParamsStreaming, -} from './completions'; + type ChatCompletionUpdateParams, + type ChatCompletionListParams, + type ChatCompletionStoreMessagesPage, + type ChatCompletionsPage, +} from './completions/index'; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index be9cc6051..742f682fe 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -2,7 +2,7 @@ import { APIResource } from '../resource'; import * as CompletionsAPI from './completions'; -import * as ChatCompletionsAPI from './chat/completions'; +import * as CompletionsCompletionsAPI from './chat/completions/completions'; import { APIPromise } from '../api-promise'; import { Stream } from '../streaming'; import { RequestOptions } from '../internal/request-options'; @@ -308,7 +308,7 @@ export interface CompletionCreateParamsBase { /** * Options for streaming response. Only set this when you set `stream: true`. */ - stream_options?: ChatCompletionsAPI.ChatCompletionStreamOptions | null; + stream_options?: CompletionsCompletionsAPI.ChatCompletionStreamOptions | null; /** * The suffix that comes after a completion of inserted text. diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index 63ae59d39..478850e5e 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -73,14 +73,14 @@ export namespace Moderation { * execution of wrongdoing, or that gives advice or instruction on how to commit * illicit acts. For example, "how to shoplift" would fit this category. */ - illicit: boolean; + illicit: boolean | null; /** * Content that includes instructions or advice that facilitate the planning or * execution of wrongdoing that also includes violence, or that gives advice or * instruction on the procurement of any weapon. */ - 'illicit/violent': boolean; + 'illicit/violent': boolean | null; /** * Content that promotes, encourages, or depicts acts of self-harm, such as diff --git a/tests/api-resources/chat/completions.test.ts b/tests/api-resources/chat/completions.test.ts deleted file mode 100644 index 92cae8b66..000000000 --- a/tests/api-resources/chat/completions.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import OpenAI from 'openai'; - -const client = new OpenAI({ - apiKey: 'My API Key', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', -}); - -describe('resource completions', () => { - test('create: only required params', async () => { - const responsePromise = client.chat.completions.create({ - messages: [{ content: 'string', role: 'developer' }], - model: 'gpt-4o', - }); - 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('create: required and optional params', async () => { - const response = await client.chat.completions.create({ - messages: [{ content: 'string', role: 'developer', name: 'name' }], - model: 'gpt-4o', - audio: { format: 'wav', voice: 'alloy' }, - frequency_penalty: -2, - function_call: 'none', - functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], - logit_bias: { foo: 0 }, - logprobs: true, - max_completion_tokens: 0, - max_tokens: 0, - metadata: { foo: 'string' }, - modalities: ['text'], - n: 1, - parallel_tool_calls: true, - prediction: { content: 'string', type: 'content' }, - presence_penalty: -2, - reasoning_effort: 'low', - response_format: { type: 'text' }, - seed: 0, - service_tier: 'auto', - stop: 'string', - store: true, - stream: false, - stream_options: { include_usage: true }, - temperature: 1, - tool_choice: 'none', - tools: [ - { - function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, - type: 'function', - }, - ], - top_logprobs: 0, - top_p: 1, - user: 'user-1234', - }); - }); -}); diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts new file mode 100644 index 000000000..5de69484a --- /dev/null +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -0,0 +1,122 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource completions', () => { + test('create: only required params', async () => { + const responsePromise = client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer' }], + model: 'gpt-4o', + }); + 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('create: required and optional params', async () => { + const response = await client.chat.completions.create({ + messages: [{ content: 'string', role: 'developer', name: 'name' }], + model: 'gpt-4o', + audio: { format: 'wav', voice: 'alloy' }, + frequency_penalty: -2, + function_call: 'none', + functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], + logit_bias: { foo: 0 }, + logprobs: true, + max_completion_tokens: 0, + max_tokens: 0, + metadata: { foo: 'string' }, + modalities: ['text'], + n: 1, + parallel_tool_calls: true, + prediction: { content: 'string', type: 'content' }, + presence_penalty: -2, + reasoning_effort: 'low', + response_format: { type: 'text' }, + seed: 0, + service_tier: 'auto', + stop: 'string', + store: true, + stream: false, + stream_options: { include_usage: true }, + temperature: 1, + tool_choice: 'none', + tools: [ + { + function: { name: 'name', description: 'description', parameters: { foo: 'bar' }, strict: true }, + type: 'function', + }, + ], + top_logprobs: 0, + top_p: 1, + user: 'user-1234', + }); + }); + + test('retrieve', async () => { + const responsePromise = client.chat.completions.retrieve('completion_id'); + 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('update: only required params', async () => { + const responsePromise = client.chat.completions.update('completion_id', { metadata: { foo: 'string' } }); + 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('update: required and optional params', async () => { + const response = await client.chat.completions.update('completion_id', { metadata: { foo: 'string' } }); + }); + + test('list', async () => { + const responsePromise = client.chat.completions.list(); + 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.chat.completions.list( + { after: 'after', limit: 0, metadata: { foo: 'string' }, model: 'model', order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete', async () => { + const responsePromise = client.chat.completions.delete('completion_id'); + 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); + }); +}); diff --git a/tests/api-resources/chat/completions/messages.test.ts b/tests/api-resources/chat/completions/messages.test.ts new file mode 100644 index 000000000..98dd22167 --- /dev/null +++ b/tests/api-resources/chat/completions/messages.test.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource messages', () => { + test('list', async () => { + const responsePromise = client.chat.completions.messages.list('completion_id'); + 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.chat.completions.messages.list( + 'completion_id', + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/qs/utils.test.ts b/tests/qs/utils.test.ts index 3df95e5bd..f97b125ea 100644 --- a/tests/qs/utils.test.ts +++ b/tests/qs/utils.test.ts @@ -66,7 +66,7 @@ describe('merge()', function () { // st.equal(getCount, 1); expect(setCount).toEqual(0); expect(getCount).toEqual(1); - observed[0] = observed[0]; // eslint-disable-line no-self-assign + observed[0] = observed[0]; // st.equal(setCount, 1); // st.equal(getCount, 2); expect(setCount).toEqual(1); diff --git a/yarn.lock b/yarn.lock index 88e46f311..db04ba6f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -357,54 +357,94 @@ dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.5.1": - version "4.11.1" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" - integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== +"@eslint-community/regexpp@^4.10.0", "@eslint-community/regexpp@^4.12.1": + version "4.12.1" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.12.1.tgz#cfc6cffe39df390a3841cde2abccf92eaa7ae0e0" + integrity sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ== -"@eslint-community/regexpp@^4.6.1": - version "4.6.2" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" - integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== +"@eslint/config-array@^0.19.0": + version "0.19.2" + resolved "https://registry.yarnpkg.com/@eslint/config-array/-/config-array-0.19.2.tgz#3060b809e111abfc97adb0bb1172778b90cb46aa" + integrity sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w== + dependencies: + "@eslint/object-schema" "^2.1.6" + debug "^4.3.1" + minimatch "^3.1.2" -"@eslint/eslintrc@^2.1.2": - version "2.1.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" - integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== +"@eslint/core@^0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.10.0.tgz#23727063c21b335f752dbb3a16450f6f9cbc9091" + integrity sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw== + dependencies: + "@types/json-schema" "^7.0.15" + +"@eslint/core@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@eslint/core/-/core-0.11.0.tgz#7a9226e850922e42cbd2ba71361eacbe74352a12" + integrity sha512-DWUB2pksgNEb6Bz2fggIy1wh6fGgZP4Xyy/Mt0QZPiloKKXerbqq9D3SBQTlCRYOrcRPu4vuz+CGjwdfqxnoWA== + dependencies: + "@types/json-schema" "^7.0.15" + +"@eslint/eslintrc@^3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-3.2.0.tgz#57470ac4e2e283a6bf76044d63281196e370542c" + integrity sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w== dependencies: ajv "^6.12.4" debug "^4.3.2" - espree "^9.6.0" - globals "^13.19.0" + espree "^10.0.1" + globals "^14.0.0" ignore "^5.2.0" import-fresh "^3.2.1" js-yaml "^4.1.0" minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.50.0": - version "8.50.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" - integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== +"@eslint/js@9.20.0": + version "9.20.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.20.0.tgz#7421bcbe74889fcd65d1be59f00130c289856eb4" + integrity sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ== + +"@eslint/object-schema@^2.1.6": + version "2.1.6" + resolved "https://registry.yarnpkg.com/@eslint/object-schema/-/object-schema-2.1.6.tgz#58369ab5b5b3ca117880c0f6c0b0f32f6950f24f" + integrity sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA== -"@humanwhocodes/config-array@^0.11.11": - version "0.11.11" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" - integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== +"@eslint/plugin-kit@^0.2.5": + version "0.2.5" + resolved "https://registry.yarnpkg.com/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz#ee07372035539e7847ef834e3f5e7b79f09e3a81" + integrity sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A== dependencies: - "@humanwhocodes/object-schema" "^1.2.1" - debug "^4.1.1" - minimatch "^3.0.5" + "@eslint/core" "^0.10.0" + levn "^0.4.1" + +"@humanfs/core@^0.19.1": + version "0.19.1" + resolved "https://registry.yarnpkg.com/@humanfs/core/-/core-0.19.1.tgz#17c55ca7d426733fe3c561906b8173c336b40a77" + integrity sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA== + +"@humanfs/node@^0.16.6": + version "0.16.6" + resolved "https://registry.yarnpkg.com/@humanfs/node/-/node-0.16.6.tgz#ee2a10eaabd1131987bf0488fd9b820174cd765e" + integrity sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw== + dependencies: + "@humanfs/core" "^0.19.1" + "@humanwhocodes/retry" "^0.3.0" "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== -"@humanwhocodes/object-schema@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" - integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@humanwhocodes/retry@^0.3.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.1.tgz#c72a5c76a9fbaf3488e231b13dc52c0da7bab42a" + integrity sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA== + +"@humanwhocodes/retry@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.1.tgz#9a96ce501bc62df46c4031fbd970e3cc6b10f07b" + integrity sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -666,7 +706,7 @@ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== -"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": +"@nodelib/fs.walk@^1.2.3": version "1.2.8" resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== @@ -674,17 +714,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@pkgr/utils@^2.4.2": - version "2.4.2" - resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" - integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw== - dependencies: - cross-spawn "^7.0.3" - fast-glob "^3.3.0" - is-glob "^4.0.3" - open "^9.1.0" - picocolors "^1.0.0" - tslib "^2.6.0" +"@pkgr/core@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" + integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -853,6 +886,11 @@ dependencies: "@babel/types" "^7.20.7" +"@types/estree@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== + "@types/graceful-fs@^4.1.3": version "4.1.9" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" @@ -887,7 +925,7 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/json-schema@^7.0.12": +"@types/json-schema@^7.0.15": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -906,11 +944,6 @@ dependencies: undici-types "~6.19.2" -"@types/semver@^7.5.0": - version "7.5.8" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" - integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== - "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" @@ -928,91 +961,86 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^6.7.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" - integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== +"@typescript-eslint/eslint-plugin@8.24.0", "@typescript-eslint/eslint-plugin@^8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.24.0.tgz#574a95d67660a1e4544ae131d672867a5b40abb3" + integrity sha512-aFcXEJJCI4gUdXgoo/j9udUYIHgF23MFkg09LFz2dzEmU0+1Plk4rQWv/IYKvPHAtlkkGoB3m5e6oUp+JPsNaQ== dependencies: - "@eslint-community/regexpp" "^4.5.1" - "@typescript-eslint/scope-manager" "6.21.0" - "@typescript-eslint/type-utils" "6.21.0" - "@typescript-eslint/utils" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" - debug "^4.3.4" + "@eslint-community/regexpp" "^4.10.0" + "@typescript-eslint/scope-manager" "8.24.0" + "@typescript-eslint/type-utils" "8.24.0" + "@typescript-eslint/utils" "8.24.0" + "@typescript-eslint/visitor-keys" "8.24.0" graphemer "^1.4.0" - ignore "^5.2.4" + ignore "^5.3.1" natural-compare "^1.4.0" - semver "^7.5.4" - ts-api-utils "^1.0.1" + ts-api-utils "^2.0.1" -"@typescript-eslint/parser@^6.0.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" - integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== +"@typescript-eslint/parser@8.24.0", "@typescript-eslint/parser@^8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.24.0.tgz#bba837f9ee125b78f459ad947ff9b61be8139085" + integrity sha512-MFDaO9CYiard9j9VepMNa9MTcqVvSny2N4hkY6roquzj8pdCBRENhErrteaQuu7Yjn1ppk0v1/ZF9CG3KIlrTA== dependencies: - "@typescript-eslint/scope-manager" "6.21.0" - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/typescript-estree" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/scope-manager" "8.24.0" + "@typescript-eslint/types" "8.24.0" + "@typescript-eslint/typescript-estree" "8.24.0" + "@typescript-eslint/visitor-keys" "8.24.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" - integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== +"@typescript-eslint/scope-manager@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.24.0.tgz#2e34b3eb2ce768f2ffb109474174ced5417002b1" + integrity sha512-HZIX0UByphEtdVBKaQBgTDdn9z16l4aTUz8e8zPQnyxwHBtf5vtl1L+OhH+m1FGV9DrRmoDuYKqzVrvWDcDozw== dependencies: - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/types" "8.24.0" + "@typescript-eslint/visitor-keys" "8.24.0" -"@typescript-eslint/type-utils@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" - integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== +"@typescript-eslint/type-utils@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.24.0.tgz#6ee3ec4db06f9e5e7b01ca6c2b5dd5843a9fd1e8" + integrity sha512-8fitJudrnY8aq0F1wMiPM1UUgiXQRJ5i8tFjq9kGfRajU+dbPyOuHbl0qRopLEidy0MwqgTHDt6CnSeXanNIwA== dependencies: - "@typescript-eslint/typescript-estree" "6.21.0" - "@typescript-eslint/utils" "6.21.0" + "@typescript-eslint/typescript-estree" "8.24.0" + "@typescript-eslint/utils" "8.24.0" debug "^4.3.4" - ts-api-utils "^1.0.1" + ts-api-utils "^2.0.1" -"@typescript-eslint/types@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" - integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== +"@typescript-eslint/types@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.24.0.tgz#694e7fb18d70506c317b816de9521300b0f72c8e" + integrity sha512-VacJCBTyje7HGAw7xp11q439A+zeGG0p0/p2zsZwpnMzjPB5WteaWqt4g2iysgGFafrqvyLWqq6ZPZAOCoefCw== -"@typescript-eslint/typescript-estree@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" - integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== +"@typescript-eslint/typescript-estree@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.24.0.tgz#0487349be174097bb329a58273100a9629e03c6c" + integrity sha512-ITjYcP0+8kbsvT9bysygfIfb+hBj6koDsu37JZG7xrCiy3fPJyNmfVtaGsgTUSEuTzcvME5YI5uyL5LD1EV5ZQ== dependencies: - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/visitor-keys" "6.21.0" + "@typescript-eslint/types" "8.24.0" + "@typescript-eslint/visitor-keys" "8.24.0" debug "^4.3.4" - globby "^11.1.0" + fast-glob "^3.3.2" is-glob "^4.0.3" - minimatch "9.0.3" - semver "^7.5.4" - ts-api-utils "^1.0.1" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^2.0.1" -"@typescript-eslint/utils@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" - integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== +"@typescript-eslint/utils@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.24.0.tgz#21cb1195ae79230af825bfeed59574f5cb70a749" + integrity sha512-07rLuUBElvvEb1ICnafYWr4hk8/U7X9RDCOqd9JcAMtjh/9oRmcfN4yGzbPVirgMR0+HLVHehmu19CWeh7fsmQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@types/json-schema" "^7.0.12" - "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "6.21.0" - "@typescript-eslint/types" "6.21.0" - "@typescript-eslint/typescript-estree" "6.21.0" - semver "^7.5.4" + "@typescript-eslint/scope-manager" "8.24.0" + "@typescript-eslint/types" "8.24.0" + "@typescript-eslint/typescript-estree" "8.24.0" -"@typescript-eslint/visitor-keys@6.21.0": - version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" - integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== +"@typescript-eslint/visitor-keys@8.24.0": + version "8.24.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.24.0.tgz#36ecf0b9b1d819ad88a3bd4157ab7d594cb797c9" + integrity sha512-kArLq83QxGLbuHrTMoOEWO+l2MwsNS2TGISEdx8xgqpkbytB07XmlQyQdNDrCc1ecSqx0cnmhGvpX+VBwqqSkg== dependencies: - "@typescript-eslint/types" "6.21.0" - eslint-visitor-keys "^3.4.1" + "@typescript-eslint/types" "8.24.0" + eslint-visitor-keys "^4.2.0" acorn-jsx@^5.3.2: version "5.3.2" @@ -1024,16 +1052,16 @@ acorn-walk@^8.1.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== +acorn@^8.14.0: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + acorn@^8.4.1: version "8.7.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== -acorn@^8.9.0: - version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" - integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== - aggregate-error@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" @@ -1125,11 +1153,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -array-union@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" - integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== - babel-jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" @@ -1195,18 +1218,6 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -big-integer@^1.6.44: - version "1.6.52" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" - integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== - -bplist-parser@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" - integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== - dependencies: - big-integer "^1.6.44" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1258,13 +1269,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -bundle-name@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" - integrity sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw== - dependencies: - run-applescript "^5.0.0" - callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -1438,7 +1442,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.3, cross-spawn@^7.0.6: version "7.0.6" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== @@ -1476,29 +1480,6 @@ deepmerge@^4.2.2: resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== -default-browser-id@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" - integrity sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA== - dependencies: - bplist-parser "^0.2.0" - untildify "^4.0.0" - -default-browser@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-4.0.0.tgz#53c9894f8810bf86696de117a6ce9085a3cbc7da" - integrity sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA== - dependencies: - bundle-name "^3.0.0" - default-browser-id "^3.0.0" - execa "^7.1.1" - titleize "^3.0.0" - -define-lazy-prop@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" - integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== - detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -1514,20 +1495,6 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -dir-glob@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" - integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== - dependencies: - path-type "^4.0.0" - -doctrine@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" - integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== - dependencies: - esutils "^2.0.2" - electron-to-chromium@^1.4.601: version "1.4.614" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz#2fe789d61fa09cb875569f37c309d0c2701f91c0" @@ -1580,100 +1547,95 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-plugin-prettier@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz#a3b399f04378f79f066379f544e42d6b73f11515" - integrity sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg== +eslint-plugin-prettier@^5.2.3: + version "5.2.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz#c4af01691a6fa9905207f0fbba0d7bea0902cce5" + integrity sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw== dependencies: prettier-linter-helpers "^1.0.0" - synckit "^0.8.5" - -eslint-plugin-unused-imports@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz#d25175b0072ff16a91892c3aa72a09ca3a9e69e7" - integrity sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw== - dependencies: - eslint-rule-composer "^0.3.0" + synckit "^0.9.1" -eslint-rule-composer@^0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" - integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== +eslint-plugin-unused-imports@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-4.1.4.tgz#62ddc7446ccbf9aa7b6f1f0b00a980423cda2738" + integrity sha512-YptD6IzQjDardkl0POxnnRBhU1OEePMV0nd6siHaRBbd+lyh6NAhFEobiznKU7kTsSsDeSD62Pe7kAM1b7dAZQ== -eslint-scope@^7.2.2: - version "7.2.2" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" - integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== +eslint-scope@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-8.2.0.tgz#377aa6f1cb5dc7592cfd0b7f892fd0cf352ce442" + integrity sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" -eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: +eslint-visitor-keys@^3.3.0: version "3.4.3" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.49.0: - version "8.50.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" - integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== +eslint-visitor-keys@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz#687bacb2af884fcdda8a6e7d65c606f46a14cd45" + integrity sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw== + +eslint@^9.20.1: + version "9.20.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.20.1.tgz#923924c078f5226832449bac86662dd7e53c91d6" + integrity sha512-m1mM33o6dBUjxl2qb6wv6nGNwCAsns1eKtaQ4l/NPHeTvhiUPbtdfMyktxN4B3fgHIgsYh1VT3V9txblpQHq+g== dependencies: "@eslint-community/eslint-utils" "^4.2.0" - "@eslint-community/regexpp" "^4.6.1" - "@eslint/eslintrc" "^2.1.2" - "@eslint/js" "8.50.0" - "@humanwhocodes/config-array" "^0.11.11" + "@eslint-community/regexpp" "^4.12.1" + "@eslint/config-array" "^0.19.0" + "@eslint/core" "^0.11.0" + "@eslint/eslintrc" "^3.2.0" + "@eslint/js" "9.20.0" + "@eslint/plugin-kit" "^0.2.5" + "@humanfs/node" "^0.16.6" "@humanwhocodes/module-importer" "^1.0.1" - "@nodelib/fs.walk" "^1.2.8" + "@humanwhocodes/retry" "^0.4.1" + "@types/estree" "^1.0.6" + "@types/json-schema" "^7.0.15" ajv "^6.12.4" chalk "^4.0.0" - cross-spawn "^7.0.2" + cross-spawn "^7.0.6" debug "^4.3.2" - doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.2.2" - eslint-visitor-keys "^3.4.3" - espree "^9.6.1" - esquery "^1.4.2" + eslint-scope "^8.2.0" + eslint-visitor-keys "^4.2.0" + espree "^10.3.0" + esquery "^1.5.0" esutils "^2.0.2" fast-deep-equal "^3.1.3" - file-entry-cache "^6.0.1" + file-entry-cache "^8.0.0" find-up "^5.0.0" glob-parent "^6.0.2" - globals "^13.19.0" - graphemer "^1.4.0" ignore "^5.2.0" imurmurhash "^0.1.4" is-glob "^4.0.0" - is-path-inside "^3.0.3" - js-yaml "^4.1.0" json-stable-stringify-without-jsonify "^1.0.1" - levn "^0.4.1" lodash.merge "^4.6.2" minimatch "^3.1.2" natural-compare "^1.4.0" optionator "^0.9.3" - strip-ansi "^6.0.1" - text-table "^0.2.0" -espree@^9.6.0, espree@^9.6.1: - version "9.6.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" - integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== +espree@^10.0.1, espree@^10.3.0: + version "10.3.0" + resolved "https://registry.yarnpkg.com/espree/-/espree-10.3.0.tgz#29267cf5b0cb98735b65e64ba07e0ed49d1eed8a" + integrity sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg== dependencies: - acorn "^8.9.0" + acorn "^8.14.0" acorn-jsx "^5.3.2" - eslint-visitor-keys "^3.4.1" + eslint-visitor-keys "^4.2.0" esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.4.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" - integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== +esquery@^1.5.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.6.0.tgz#91419234f804d852a82dceec3e16cdc22cf9dae7" + integrity sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg== dependencies: estraverse "^5.1.0" @@ -1709,21 +1671,6 @@ execa@^5.0.0, execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" -execa@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" - integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== - dependencies: - cross-spawn "^7.0.3" - get-stream "^6.0.1" - human-signals "^4.3.0" - is-stream "^3.0.0" - merge-stream "^2.0.0" - npm-run-path "^5.1.0" - onetime "^6.0.0" - signal-exit "^3.0.7" - strip-final-newline "^3.0.0" - exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -1757,7 +1704,7 @@ fast-diff@^1.1.2: resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.2: +fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== @@ -1797,12 +1744,12 @@ fflate@^0.8.2: resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea" integrity sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A== -file-entry-cache@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" - integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== +file-entry-cache@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-8.0.0.tgz#7787bddcf1131bffb92636c69457bbc0edd6d81f" + integrity sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ== dependencies: - flat-cache "^3.0.4" + flat-cache "^4.0.0" fill-range@^7.1.1: version "7.1.1" @@ -1827,18 +1774,18 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" -flat-cache@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" - integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== +flat-cache@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-4.0.1.tgz#0ece39fcb14ee012f4b0410bd33dd9c1f011127c" + integrity sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw== dependencies: - flatted "^3.1.0" - rimraf "^3.0.2" + flatted "^3.2.9" + keyv "^4.5.4" -flatted@^3.1.0: - version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" - integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== +flatted@^3.2.9: + version "3.3.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.2.tgz#adba1448a9841bec72b42c532ea23dbbedef1a27" + integrity sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA== fs.realpath@^1.0.0: version "1.0.0" @@ -1875,7 +1822,7 @@ get-stdin@^8.0.0: resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== -get-stream@^6.0.0, get-stream@^6.0.1: +get-stream@^6.0.0: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== @@ -1922,24 +1869,10 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -globals@^13.19.0: - version "13.20.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" - integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== - dependencies: - type-fest "^0.20.2" - -globby@^11.1.0: - version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" - integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== - dependencies: - array-union "^2.1.0" - dir-glob "^3.0.1" - fast-glob "^3.2.9" - ignore "^5.2.0" - merge2 "^1.4.1" - slash "^3.0.0" +globals@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" + integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== graceful-fs@^4.2.9: version "4.2.11" @@ -1983,11 +1916,6 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== -human-signals@^4.3.0: - version "4.3.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" - integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== - iconv-lite@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" @@ -2002,7 +1930,7 @@ ignore-walk@^5.0.1: dependencies: minimatch "^5.0.1" -ignore@^5.2.0, ignore@^5.2.4: +ignore@^5.2.0, ignore@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== @@ -2058,16 +1986,6 @@ is-core-module@^2.13.0: dependencies: hasown "^2.0.0" -is-docker@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" - integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== - -is-docker@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" - integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== - is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -2090,40 +2008,16 @@ is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: dependencies: is-extglob "^2.1.1" -is-inside-container@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" - integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== - dependencies: - is-docker "^3.0.0" - is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-path-inside@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" - integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== - is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-stream@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" - integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== - -is-wsl@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.0.0" - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -2565,6 +2459,11 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -2590,6 +2489,13 @@ jsonc-parser@^3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== +keyv@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -2698,7 +2604,7 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.3.0, merge2@^1.4.1: +merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== @@ -2716,19 +2622,7 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -mimic-fn@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" - integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== - -minimatch@9.0.3: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -2742,6 +2636,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.6: version "1.2.6" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" @@ -2830,13 +2731,6 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" -npm-run-path@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" - integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== - dependencies: - path-key "^4.0.0" - object-assign@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -2856,23 +2750,6 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" -onetime@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" - integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== - dependencies: - mimic-fn "^4.0.0" - -open@^9.1.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6" - integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg== - dependencies: - default-browser "^4.0.0" - define-lazy-prop "^3.0.0" - is-inside-container "^1.0.0" - is-wsl "^2.2.0" - optionator@^0.9.3: version "0.9.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" @@ -2981,21 +2858,11 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== -path-key@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" - integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== - path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-type@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" - integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== - picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -3141,20 +3008,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" - integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== - dependencies: - glob "^7.1.3" - -run-applescript@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-5.0.0.tgz#e11e1c932e055d5c6b40d98374e0268d9b11899c" - integrity sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg== - dependencies: - execa "^5.0.0" - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -3196,6 +3049,11 @@ semver@^7.5.4: resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== +semver@^7.6.0: + version "7.7.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" + integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -3308,11 +3166,6 @@ strip-final-newline@^2.0.0: resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== -strip-final-newline@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" - integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== - strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -3357,12 +3210,12 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.8.5: - version "0.8.6" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.6.tgz#b69b7fbce3917c2673cbdc0d87fb324db4a5b409" - integrity sha512-laHF2savN6sMeHCjLRkheIU4wo3Zg9Ln5YOjOo7sZ5dVQW8yF5pPE5SIw1dsPhq3TRp1jisKRCdPhfs/1WMqDA== +synckit@^0.9.1: + version "0.9.2" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" + integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== dependencies: - "@pkgr/utils" "^2.4.2" + "@pkgr/core" "^0.1.0" tslib "^2.6.2" test-exclude@^6.0.0: @@ -3374,11 +3227,6 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" -text-table@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== - thenify-all@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" @@ -3393,11 +3241,6 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" -titleize@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" - integrity sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ== - tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -3415,10 +3258,10 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -ts-api-utils@^1.0.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" - integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== +ts-api-utils@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-2.0.1.tgz#660729385b625b939aaa58054f45c058f33f10cd" + integrity sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w== ts-jest@^29.1.0: version "29.1.1" @@ -3477,7 +3320,7 @@ tsconfig-paths@^4.0.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.6.0, tslib@^2.6.2: +tslib@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== @@ -3499,16 +3342,20 @@ type-detect@4.0.8: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== -type-fest@^0.20.2: - version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" - integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== - type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +typescript-eslint@^8.24.0: + version "8.24.0" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.24.0.tgz#cc655e71885ecb8280342b422ad839a2e2e46a96" + integrity sha512-/lmv4366en/qbB32Vz5+kCNZEMf6xYHwh1z48suBwZvAtnXKbP+YhGe8OLE2BqC67LMqKkCNLtjejdwsdW6uOQ== + dependencies: + "@typescript-eslint/eslint-plugin" "8.24.0" + "@typescript-eslint/parser" "8.24.0" + "@typescript-eslint/utils" "8.24.0" + typescript@5.6.1-rc: version "5.6.1-rc" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.1-rc.tgz#d5e4d7d8170174fed607b74cc32aba3d77018e02" @@ -3534,11 +3381,6 @@ unicode-emoji-modifier-base@^1.0.0: resolved "https://registry.yarnpkg.com/unicode-emoji-modifier-base/-/unicode-emoji-modifier-base-1.0.0.tgz#dbbd5b54ba30f287e2a8d5a249da6c0cef369459" integrity sha512-yLSH4py7oFH3oG/9K+XWrz1pSi3dfUrWEnInbxMfArOfc1+33BlGPQtLsOYwvdMy11AwUBetYuaRxSPqgkq+8g== -untildify@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" - integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== - update-browserslist-db@^1.0.13: version "1.0.13" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" From 9416c96fdc12c9ea22da04ac317d93cb2ad94f57 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 13 Feb 2025 22:37:41 +0000 Subject: [PATCH 185/509] fix(client): fix export map for index exports, accept BunFile --- scripts/utils/postprocess-files.cjs | 8 ++++---- src/internal/uploads.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index deae575e3..d16c8641c 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -50,14 +50,14 @@ async function postprocess() { if (entry.isDirectory() && entry.name !== 'src' && entry.name !== 'internal' && entry.name !== 'bin') { const subpath = './' + entry.name; newExports[subpath + '/*.mjs'] = { - default: subpath + '/*.mjs', + default: [subpath + '/*.mjs', subpath + '/*/index.mjs'], }; newExports[subpath + '/*.js'] = { - default: subpath + '/*.js', + default: [subpath + '/*.js', subpath + '/*/index.js'], }; newExports[subpath + '/*'] = { - import: subpath + '/*.mjs', - require: subpath + '/*.js', + import: [subpath + '/*.mjs', subpath + '/*/index.mjs'], + require: [subpath + '/*.js', subpath + '/*/index.js'], }; } else if (entry.isFile() && /\.[cm]?js$/.test(entry.name)) { const { name, ext } = path.parse(entry.name); diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 1632df8a7..d89af49b1 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -52,7 +52,7 @@ interface FileLike extends BlobLike { /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ readonly lastModified: number; /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ - readonly name: string; + readonly name?: string | undefined; } declare var FileClass: { prototype: FileLike; @@ -126,7 +126,7 @@ export async function toFile( if (File && value instanceof File) { return value; } - return makeFile([await value.arrayBuffer()], value.name); + return makeFile([await value.arrayBuffer()], value.name ?? 'unknown_file'); } if (isResponseLike(value)) { From 00ce31bb6248002b0e575db2dfdd5c4bbbbcb37d Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 14 Feb 2025 10:24:19 +0000 Subject: [PATCH 186/509] chore(internal): add missing return type annotation --- src/pagination.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pagination.ts b/src/pagination.ts index 1ecbe9975..fdcc7e131 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -178,7 +178,7 @@ export class CursorPage return this.data ?? []; } - override hasNextPage() { + override hasNextPage(): boolean { if (this.has_more === false) { return false; } From 0266b41efa311205f0fc51b6dc6d29ab003254a6 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 17 Feb 2025 10:03:07 +0000 Subject: [PATCH 187/509] chore(internal): fix tests not always being type checked --- scripts/lint | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/lint b/scripts/lint index 726708c4c..3ffb78a64 100755 --- a/scripts/lint +++ b/scripts/lint @@ -8,7 +8,10 @@ echo "==> Running eslint" ./node_modules/.bin/eslint . echo "==> Building" -./scripts/build # also checks types +./scripts/build + +echo "==> Checking types" +./node_modules/typescript/bin/tsc echo "==> Running Are The Types Wrong?" ./node_modules/.bin/attw --pack dist -f json >.attw.json || true From a7effe8ba3a65a535ae082d3d4e0d639aba7b7c1 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 18 Feb 2025 18:03:39 +0000 Subject: [PATCH 188/509] fix: optimize sse chunk reading off-by-one error --- src/internal/decoders/line.ts | 31 +++++++ src/streaming.ts | 48 +--------- tests/internal/decoders/line.test.ts | 128 +++++++++++++++++++++++++++ tests/streaming.test.ts | 81 +---------------- 4 files changed, 161 insertions(+), 127 deletions(-) create mode 100644 tests/internal/decoders/line.test.ts diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 6a896db5f..335ad7e30 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -147,3 +147,34 @@ function findNewlineIndex( return null; } + +export function findDoubleNewlineIndex(buffer: Uint8Array): number { + // This function searches the buffer for the end patterns (\r\r, \n\n, \r\n\r\n) + // and returns the index right after the first occurrence of any pattern, + // or -1 if none of the patterns are found. + const newline = 0x0a; // \n + const carriage = 0x0d; // \r + + for (let i = 0; i < buffer.length - 1; i++) { + if (buffer[i] === newline && buffer[i + 1] === newline) { + // \n\n + return i + 2; + } + if (buffer[i] === carriage && buffer[i + 1] === carriage) { + // \r\r + return i + 2; + } + if ( + buffer[i] === carriage && + buffer[i + 1] === newline && + i + 3 < buffer.length && + buffer[i + 2] === carriage && + buffer[i + 3] === newline + ) { + // \r\n\r\n + return i + 4; + } + } + + return -1; +} diff --git a/src/streaming.ts b/src/streaming.ts index b1308793d..47c366071 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -1,7 +1,7 @@ import { OpenAIError } from './error'; import { type ReadableStream } from './internal/shim-types'; import { makeReadableStream } from './internal/shims'; -import { LineDecoder } from './internal/decoders/line'; +import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line'; import { ReadableStreamToAsyncIterable } from './internal/shims'; import { isAbortError } from './internal/errors'; @@ -271,37 +271,6 @@ async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGene } } -function findDoubleNewlineIndex(buffer: Uint8Array): number { - // This function searches the buffer for the end patterns (\r\r, \n\n, \r\n\r\n) - // and returns the index right after the first occurrence of any pattern, - // or -1 if none of the patterns are found. - const newline = 0x0a; // \n - const carriage = 0x0d; // \r - - for (let i = 0; i < buffer.length - 2; i++) { - if (buffer[i] === newline && buffer[i + 1] === newline) { - // \n\n - return i + 2; - } - if (buffer[i] === carriage && buffer[i + 1] === carriage) { - // \r\r - return i + 2; - } - if ( - buffer[i] === carriage && - buffer[i + 1] === newline && - i + 3 < buffer.length && - buffer[i + 2] === carriage && - buffer[i + 3] === newline - ) { - // \r\n\r\n - return i + 4; - } - } - - return -1; -} - class SSEDecoder { private data: string[]; private event: string | null; @@ -357,21 +326,6 @@ class SSEDecoder { } } -/** This is an internal helper function that's just used for testing */ -export function _decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { - const decoder = new LineDecoder(); - const lines: string[] = []; - for (const chunk of chunks) { - lines.push(...decoder.decode(chunk)); - } - - if (flush) { - lines.push(...decoder.flush()); - } - - return lines; -} - function partition(str: string, delimiter: string): [string, string, string] { const index = str.indexOf(delimiter); if (index !== -1) { diff --git a/tests/internal/decoders/line.test.ts b/tests/internal/decoders/line.test.ts new file mode 100644 index 000000000..e76858e55 --- /dev/null +++ b/tests/internal/decoders/line.test.ts @@ -0,0 +1,128 @@ +import { findDoubleNewlineIndex, LineDecoder } from 'openai/internal/decoders/line'; + +function decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] { + const decoder = new LineDecoder(); + const lines: string[] = []; + for (const chunk of chunks) { + lines.push(...decoder.decode(chunk)); + } + + if (flush) { + lines.push(...decoder.flush()); + } + + return lines; +} + +describe('line decoder', () => { + test('basic', () => { + // baz is not included because the line hasn't ended yet + expect(decodeChunks(['foo', ' bar\nbaz'])).toEqual(['foo bar']); + }); + + test('basic with \\r', () => { + expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); + expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); + }); + + test('trailing new lines', () => { + expect(decodeChunks(['foo', ' bar', 'baz\n', 'thing\n'])).toEqual(['foo barbaz', 'thing']); + }); + + test('trailing new lines with \\r', () => { + expect(decodeChunks(['foo', ' bar', 'baz\r\n', 'thing\r\n'])).toEqual(['foo barbaz', 'thing']); + }); + + test('escaped new lines', () => { + expect(decodeChunks(['foo', ' bar\\nbaz\n'])).toEqual(['foo bar\\nbaz']); + }); + + test('escaped new lines with \\r', () => { + expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); + }); + + test('\\r & \\n split across multiple chunks', () => { + expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('single \\r', () => { + expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); + }); + + test('double \\r', () => { + expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + // implementation detail that we don't yield the single \r line until a new \r or \n is encountered + expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); + }); + + test('double \\r then \\r\\n', () => { + expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); + }); + + test('double newline', () => { + expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('multi-byte characters across chunks', () => { + const decoder = new LineDecoder(); + + // bytes taken from the string 'известни' and arbitrarily split + // so that some multi-byte characters span multiple chunks + expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); + expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); + expect( + decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), + ).toHaveLength(0); + + const decoded = decoder.decode(new Uint8Array([0xa])); + expect(decoded).toEqual(['известни']); + }); + + test('flushing trailing newlines', () => { + expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); + }); + + test('flushing empty buffer', () => { + expect(decodeChunks([], { flush: true })).toEqual([]); + }); +}); + +describe('findDoubleNewlineIndex', () => { + test('finds \\n\\n', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\n\nbar'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\n\nbar'))).toBe(2); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\n\n'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\n\n'))).toBe(2); + }); + + test('finds \\r\\r', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\rbar'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\rbar'))).toBe(2); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\r'))).toBe(5); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\r'))).toBe(2); + }); + + test('finds \\r\\n\\r\\n', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r\nbar'))).toBe(7); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\n\r\nbar'))).toBe(4); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r\n'))).toBe(7); + expect(findDoubleNewlineIndex(new TextEncoder().encode('\r\n\r\n'))).toBe(4); + }); + + test('returns -1 when no double newline found', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\nbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\rbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\nbar'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode(''))).toBe(-1); + }); + + test('handles incomplete patterns', () => { + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n\r'))).toBe(-1); + expect(findDoubleNewlineIndex(new TextEncoder().encode('foo\r\n'))).toBe(-1); + }); +}); diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 0a630f45c..5397c9dcb 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,85 +1,6 @@ import { PassThrough } from 'stream'; import assert from 'assert'; -import { _iterSSEMessages, _decodeChunks as decodeChunks } from 'openai/streaming'; -import { LineDecoder } from 'openai/internal/decoders/line'; - -describe('line decoder', () => { - test('basic', () => { - // baz is not included because the line hasn't ended yet - expect(decodeChunks(['foo', ' bar\nbaz'])).toEqual(['foo bar']); - }); - - test('basic with \\r', () => { - expect(decodeChunks(['foo', ' bar\r\nbaz'])).toEqual(['foo bar']); - expect(decodeChunks(['foo', ' bar\r\nbaz'], { flush: true })).toEqual(['foo bar', 'baz']); - }); - - test('trailing new lines', () => { - expect(decodeChunks(['foo', ' bar', 'baz\n', 'thing\n'])).toEqual(['foo barbaz', 'thing']); - }); - - test('trailing new lines with \\r', () => { - expect(decodeChunks(['foo', ' bar', 'baz\r\n', 'thing\r\n'])).toEqual(['foo barbaz', 'thing']); - }); - - test('escaped new lines', () => { - expect(decodeChunks(['foo', ' bar\\nbaz\n'])).toEqual(['foo bar\\nbaz']); - }); - - test('escaped new lines with \\r', () => { - expect(decodeChunks(['foo', ' bar\\r\\nbaz\n'])).toEqual(['foo bar\\r\\nbaz']); - }); - - test('\\r & \\n split across multiple chunks', () => { - expect(decodeChunks(['foo\r', '\n', 'bar'], { flush: true })).toEqual(['foo', 'bar']); - }); - - test('single \\r', () => { - expect(decodeChunks(['foo\r', 'bar'], { flush: true })).toEqual(['foo', 'bar']); - }); - - test('double \\r', () => { - expect(decodeChunks(['foo\r', 'bar\r'], { flush: true })).toEqual(['foo', 'bar']); - expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - // implementation detail that we don't yield the single \r line until a new \r or \n is encountered - expect(decodeChunks(['foo\r', '\r', 'bar'], { flush: false })).toEqual(['foo']); - }); - - test('double \\r then \\r\\n', () => { - expect(decodeChunks(['foo\r', '\r', '\r', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); - expect(decodeChunks(['foo\n', '\n', '\n', 'bar', '\n'])).toEqual(['foo', '', '', 'bar']); - }); - - test('double newline', () => { - expect(decodeChunks(['foo\n\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo', '\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - expect(decodeChunks(['foo', '\n', '\n', 'bar'], { flush: true })).toEqual(['foo', '', 'bar']); - }); - - test('multi-byte characters across chunks', () => { - const decoder = new LineDecoder(); - - // bytes taken from the string 'известни' and arbitrarily split - // so that some multi-byte characters span multiple chunks - expect(decoder.decode(new Uint8Array([0xd0]))).toHaveLength(0); - expect(decoder.decode(new Uint8Array([0xb8, 0xd0, 0xb7, 0xd0]))).toHaveLength(0); - expect( - decoder.decode(new Uint8Array([0xb2, 0xd0, 0xb5, 0xd1, 0x81, 0xd1, 0x82, 0xd0, 0xbd, 0xd0, 0xb8])), - ).toHaveLength(0); - - const decoded = decoder.decode(new Uint8Array([0xa])); - expect(decoded).toEqual(['известни']); - }); - - test('flushing trailing newlines', () => { - expect(decodeChunks(['foo\n', '\nbar'], { flush: true })).toEqual(['foo', '', 'bar']); - }); - - test('flushing empty buffer', () => { - expect(decodeChunks([], { flush: true })).toEqual([]); - }); -}); +import { _iterSSEMessages } from 'openai/streaming'; describe('streaming decoding', () => { test('basic', async () => { From a2714bb5253ade80cb15455ceb8f6dbea63cb1d0 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Feb 2025 11:19:35 +0000 Subject: [PATCH 189/509] fix(assistants): handle `thread.run.incomplete` event --- src/lib/AssistantStream.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index df7dc419d..b9226bf3a 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -368,6 +368,7 @@ export class AssistantStream case 'thread.run.in_progress': case 'thread.run.requires_action': case 'thread.run.completed': + case 'thread.run.incomplete': case 'thread.run.failed': case 'thread.run.cancelling': case 'thread.run.cancelled': @@ -398,6 +399,8 @@ export class AssistantStream throw new Error( 'Encountered an error event in event processing - errors should be processed earlier', ); + default: + assertNever(event); } } @@ -769,3 +772,5 @@ export class AssistantStream return await this._createToolAssistantStream(runs, runId, params, options); } } + +function assertNever(_x: never) {} From ee34833b6d097bda278ea07d261527e0bf51bf65 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 14 Feb 2025 10:19:22 +0000 Subject: [PATCH 190/509] fix(package): add chat/completions.ts back in (#1333) --- src/resources/chat/completions.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/resources/chat/completions.ts diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts new file mode 100644 index 000000000..55b151e8b --- /dev/null +++ b/src/resources/chat/completions.ts @@ -0,0 +1 @@ +export * from './completions/completions'; From 40e8dd2de0329c6cff53717d49c6e07852b352e2 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 20 Feb 2025 11:09:29 +0000 Subject: [PATCH 191/509] fix(parsing): remove tool_calls default empty array (#1341) --- src/lib/parser.ts | 17 +++++++++++++++-- src/resources/beta/chat/completions.ts | 2 +- tests/lib/ChatCompletionRunFunctions.test.ts | 20 ++++++++++---------- tests/lib/ChatCompletionStream.test.ts | 3 --- tests/lib/parser.test.ts | 6 ------ 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/lib/parser.ts b/src/lib/parser.ts index f2678e312..a750375dc 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -119,7 +119,15 @@ export function maybeParseChatCompletion< ...completion, choices: completion.choices.map((choice) => ({ ...choice, - message: { ...choice.message, parsed: null, tool_calls: choice.message.tool_calls ?? [] }, + message: { + ...choice.message, + parsed: null, + ...(choice.message.tool_calls ? + { + tool_calls: choice.message.tool_calls, + } + : undefined), + }, })), }; } @@ -144,7 +152,12 @@ export function parseChatCompletion< ...choice, message: { ...choice.message, - tool_calls: choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? [], + ...(choice.message.tool_calls ? + { + tool_calls: + choice.message.tool_calls?.map((toolCall) => parseToolCall(params, toolCall)) ?? undefined, + } + : undefined), parsed: choice.message.content && !choice.message.refusal ? parseResponseFormat(params, choice.message.content) diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index e2423d553..15ec3f7e4 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -47,7 +47,7 @@ export interface ParsedFunctionToolCall extends ChatCompletionMessageToolCall { export interface ParsedChatCompletionMessage extends ChatCompletionMessage { parsed: ParsedT | null; - tool_calls: Array; + tool_calls?: Array; } export interface ParsedChoice extends ChatCompletion.Choice { diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index dcdc086de..35f5cc532 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -627,7 +627,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([`it's raining`]); @@ -875,7 +875,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual(['3']); @@ -1124,7 +1124,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([`must be an object`, '3']); @@ -1442,7 +1442,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.functionCallResults).toEqual([ @@ -1571,7 +1571,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([`it's raining`]); @@ -1794,7 +1794,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual(['3']); @@ -1996,7 +1996,7 @@ describe('resource completions', () => { content: 'there are 3 properties in {"a": 1, "b": 2, "c": 3}', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([`must be an object`, '3']); @@ -2300,7 +2300,7 @@ describe('resource completions', () => { content: "it's raining", parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }, ]); expect(listener.eventFunctionCallResults).toEqual([ @@ -2346,7 +2346,7 @@ describe('resource completions', () => { content: 'The weather is great today!', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }); await listener.sanityCheck(); }); @@ -2385,7 +2385,7 @@ describe('resource completions', () => { content: 'The weather is great today!', parsed: null, refusal: null, - tool_calls: [], + tool_calls: undefined, }); await listener.sanityCheck(); }); diff --git a/tests/lib/ChatCompletionStream.test.ts b/tests/lib/ChatCompletionStream.test.ts index e5ef20c9e..34c5fd204 100644 --- a/tests/lib/ChatCompletionStream.test.ts +++ b/tests/lib/ChatCompletionStream.test.ts @@ -39,7 +39,6 @@ describe('.stream()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -198,7 +197,6 @@ describe('.stream()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -386,7 +384,6 @@ describe('.stream()', () => { "parsed": null, "refusal": "I'm very sorry, but I can't assist with that request.", "role": "assistant", - "tool_calls": [], }, } `); diff --git a/tests/lib/parser.test.ts b/tests/lib/parser.test.ts index b220e92d3..fa8123f5c 100644 --- a/tests/lib/parser.test.ts +++ b/tests/lib/parser.test.ts @@ -39,7 +39,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], }, } `); @@ -154,7 +153,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); @@ -488,7 +486,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -787,7 +784,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -947,7 +943,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); @@ -1061,7 +1056,6 @@ describe('.parse()', () => { }, "refusal": null, "role": "assistant", - "tool_calls": [], } `); }); From 77e118082334710cab361efb95934422e4db6b18 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 21 Jan 2025 15:35:13 +0000 Subject: [PATCH 192/509] fix(jsr): export zod helpers --- jsr.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jsr.json b/jsr.json index bc854dbcd..b87e40dc5 100644 --- a/jsr.json +++ b/jsr.json @@ -1,7 +1,10 @@ { "name": "@openai/openai", "version": "5.0.0-alpha.0", - "exports": "./index.ts", + "exports": { + ".": "./index.ts", + "./helpers/zod": "./helpers/zod.ts" + }, "publish": { "exclude": [ "!." From 0eda70adc3c88c12792c1eee9c3279579a86d412 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 20 Feb 2025 14:44:31 +0000 Subject: [PATCH 193/509] fix(azure/audio): use model param for deployments --- src/azure.ts | 2 +- src/internal/request-options.ts | 1 + src/resources/audio/transcriptions.ts | 2 +- src/resources/audio/translations.ts | 2 +- tests/lib/azure.test.ts | 8 ++++---- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/azure.ts b/src/azure.ts index 72924707d..57bb21d72 100644 --- a/src/azure.ts +++ b/src/azure.ts @@ -132,7 +132,7 @@ export class AzureOpenAI extends OpenAI { if (!isObj(options.body)) { throw new Error('Expected request body to be an object'); } - const model = this._deployment || options.body['model']; + const model = this._deployment || options.body['model'] || options.__metadata?.['model']; if (model !== undefined && !this.baseURL.includes('/deployments')) { options.path = `/deployments/${model}${options.path}`; } diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index d46c3b33f..1c7a81e0b 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -22,6 +22,7 @@ export type RequestOptions = { signal?: AbortSignal | undefined | null; idempotencyKey?: string; + __metadata?: Record; __binaryResponse?: boolean | undefined; __streamClass?: typeof Stream; }; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index a7dc61c34..253bd1e40 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -30,7 +30,7 @@ export class Transcriptions extends APIResource { ): APIPromise { return this._client.post( '/audio/transcriptions', - multipartFormRequestOptions({ body, ...options }, this._client), + multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client), ); } } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 7f983713e..4c309e441 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -28,7 +28,7 @@ export class Translations extends APIResource { ): APIPromise { return this._client.post( '/audio/translations', - multipartFormRequestOptions({ body, ...options }, this._client), + multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client), ); } } diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 9f0ddd311..472ea567f 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -505,25 +505,25 @@ describe('azure request building', () => { }); }); - test('Audio translations is not handled', async () => { + test('handles audio translations', async () => { expect( await client.audio.translations.create({ model: deployment, file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ - url: `https://example.com/openai/audio/translations?api-version=${apiVersion}`, + url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, }); }); - test('Audio transcriptions is not handled', async () => { + test('handles audio transcriptions', async () => { expect( await client.audio.transcriptions.create({ model: deployment, file: { url: 'https://example.com/', blob: async () => new Blob([]) }, }), ).toMatchObject({ - url: `https://example.com/openai/audio/transcriptions?api-version=${apiVersion}`, + url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, }); }); From ad5a9b6f07002df70764f1b9e5d6cd675eba87ea Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 21 Feb 2025 11:49:06 +0000 Subject: [PATCH 194/509] chore(internal): fix eslint ignores --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 90220c65f..e44b82f24 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -10,7 +10,7 @@ export default tseslint.config( parserOptions: { sourceType: 'module' }, }, files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'], - ignores: ['dist/**'], + ignores: ['dist/**', 'ecosystem-tests/**'], plugins: { '@typescript-eslint': tseslint.plugin, 'unused-imports': unusedImports, From 20f179db1bb681db5d1a91adcaab16012d6ffcdf Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 21 Feb 2025 11:49:12 +0000 Subject: [PATCH 195/509] chore: fix example types --- examples/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/types.ts b/examples/types.ts index 482e1f6be..e9de3911c 100755 --- a/examples/types.ts +++ b/examples/types.ts @@ -7,7 +7,7 @@ const openai = new OpenAI(); async function main() { // Explicit non streaming params type: - const params: OpenAI.Chat.CompletionCreateParams = { + const params: OpenAI.Chat.ChatCompletionCreateParams = { model: 'gpt-4', messages: [{ role: 'user', content: 'Say this is a test!' }], }; @@ -15,7 +15,7 @@ async function main() { console.log(completion.choices[0]?.message?.content); // Explicit streaming params type: - const streaming_params: OpenAI.Chat.CompletionCreateParams = { + const streaming_params: OpenAI.Chat.ChatCompletionCreateParams = { model: 'gpt-4', messages: [{ role: 'user', content: 'Say this is a test!' }], stream: true, From 7737d2547c5c6c45004fe281b8122c9e2adc0efb Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 21 Feb 2025 11:54:47 +0000 Subject: [PATCH 196/509] feat(client): add Realtime API support --- README.md | 14 +++ examples/{azure.ts => azure/chat.ts} | 3 +- examples/azure/realtime/websocket.ts | 60 +++++++++++ examples/azure/realtime/ws.ts | 60 +++++++++++ examples/package.json | 8 +- examples/realtime/websocket.ts | 48 +++++++++ examples/realtime/ws.ts | 48 +++++++++ package.json | 6 ++ realtime.md | 86 ++++++++++++++++ src/azure.ts | 9 +- src/beta/realtime/index.ts | 1 + src/beta/realtime/internal-base.ts | 93 +++++++++++++++++ src/beta/realtime/websocket.ts | 143 +++++++++++++++++++++++++++ src/beta/realtime/ws.ts | 96 ++++++++++++++++++ src/lib/EventEmitter.ts | 98 ++++++++++++++++++ yarn.lock | 12 +++ 16 files changed, 777 insertions(+), 8 deletions(-) rename examples/{azure.ts => azure/chat.ts} (91%) create mode 100644 examples/azure/realtime/websocket.ts create mode 100644 examples/azure/realtime/ws.ts create mode 100644 examples/realtime/websocket.ts create mode 100644 examples/realtime/ws.ts create mode 100644 realtime.md create mode 100644 src/beta/realtime/index.ts create mode 100644 src/beta/realtime/internal-base.ts create mode 100644 src/beta/realtime/websocket.ts create mode 100644 src/beta/realtime/ws.ts create mode 100644 src/lib/EventEmitter.ts diff --git a/README.md b/README.md index f9ae98eb3..6d7dfd696 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,20 @@ const { data: stream, request_id } = await openai.chat.completions .withResponse(); ``` +## Realtime API Beta + +The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. + +```ts +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + +rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); +``` + +For more information see [realtime.md](realtime.md). + ## Microsoft Azure OpenAI To use this library with [Azure OpenAI](https://learn.microsoft.com/azure/ai-services/openai/overview), use the `AzureOpenAI` diff --git a/examples/azure.ts b/examples/azure/chat.ts similarity index 91% rename from examples/azure.ts rename to examples/azure/chat.ts index 5fe1718fa..46df820f8 100755 --- a/examples/azure.ts +++ b/examples/azure/chat.ts @@ -2,6 +2,7 @@ import { AzureOpenAI } from 'openai'; import { getBearerTokenProvider, DefaultAzureCredential } from '@azure/identity'; +import 'dotenv/config'; // Corresponds to your Model deployment within your OpenAI resource, e.g. gpt-4-1106-preview // Navigate to the Azure OpenAI Studio to deploy a model. @@ -13,7 +14,7 @@ const azureADTokenProvider = getBearerTokenProvider(credential, scope); // Make sure to set AZURE_OPENAI_ENDPOINT with the endpoint of your Azure resource. // You can find it in the Azure Portal. -const openai = new AzureOpenAI({ azureADTokenProvider }); +const openai = new AzureOpenAI({ azureADTokenProvider, apiVersion: '2024-10-01-preview' }); async function main() { console.log('Non-streaming:'); diff --git a/examples/azure/realtime/websocket.ts b/examples/azure/realtime/websocket.ts new file mode 100644 index 000000000..bec74e654 --- /dev/null +++ b/examples/azure/realtime/websocket.ts @@ -0,0 +1,60 @@ +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; +import { AzureOpenAI } from 'openai'; +import { DefaultAzureCredential, getBearerTokenProvider } from '@azure/identity'; +import 'dotenv/config'; + +async function main() { + const cred = new DefaultAzureCredential(); + const scope = 'https://cognitiveservices.azure.com/.default'; + const deploymentName = 'gpt-4o-realtime-preview-1001'; + const azureADTokenProvider = getBearerTokenProvider(cred, scope); + const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, + }); + const rt = await OpenAIRealtimeWebSocket.azure(client); + + // access the underlying `ws.WebSocket` instance + rt.socket.addEventListener('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts new file mode 100644 index 000000000..6ab7b742a --- /dev/null +++ b/examples/azure/realtime/ws.ts @@ -0,0 +1,60 @@ +import { DefaultAzureCredential, getBearerTokenProvider } from '@azure/identity'; +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; +import { AzureOpenAI } from 'openai'; +import 'dotenv/config'; + +async function main() { + const cred = new DefaultAzureCredential(); + const scope = 'https://cognitiveservices.azure.com/.default'; + const deploymentName = 'gpt-4o-realtime-preview-1001'; + const azureADTokenProvider = getBearerTokenProvider(cred, scope); + const client = new AzureOpenAI({ + azureADTokenProvider, + apiVersion: '2024-10-01-preview', + deployment: deploymentName, + }); + const rt = await OpenAIRealtimeWS.azure(client); + + // access the underlying `ws.WebSocket` instance + rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.on('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/package.json b/examples/package.json index c8a5f7087..70ec2c523 100644 --- a/examples/package.json +++ b/examples/package.json @@ -6,14 +6,16 @@ "license": "MIT", "private": true, "dependencies": { + "@azure/identity": "^4.2.0", + "dotenv": "^16.4.7", "express": "^4.18.2", "next": "^14.1.1", "openai": "file:..", - "zod-to-json-schema": "^3.21.4", - "@azure/identity": "^4.2.0" + "zod-to-json-schema": "^3.21.4" }, "devDependencies": { "@types/body-parser": "^1.19.3", - "@types/express": "^4.17.19" + "@types/express": "^4.17.19", + "@types/web": "^0.0.194" } } diff --git a/examples/realtime/websocket.ts b/examples/realtime/websocket.ts new file mode 100644 index 000000000..0da131bc3 --- /dev/null +++ b/examples/realtime/websocket.ts @@ -0,0 +1,48 @@ +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +async function main() { + const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + + // access the underlying `ws.WebSocket` instance + rt.socket.addEventListener('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts new file mode 100644 index 000000000..08c6fbcb6 --- /dev/null +++ b/examples/realtime/ws.ts @@ -0,0 +1,48 @@ +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; + +async function main() { + const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + + // access the underlying `ws.WebSocket` instance + rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); + }); + + rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; + }); + + rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); + }); + + rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); + rt.on('response.text.done', () => console.log()); + + rt.on('response.done', () => rt.close()); + + rt.socket.on('close', () => console.log('\nConnection closed!')); +} + +main(); diff --git a/package.json b/package.json index cf463e4ef..93749e2f8 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@swc/core": "^1.3.102", "@swc/jest": "^0.2.29", "@types/jest": "^29.4.0", + "@types/ws": "^8.5.13", "@types/node": "^20.17.6", "typescript-eslint": "^8.24.0", "@typescript-eslint/eslint-plugin": "^8.24.0", @@ -47,6 +48,7 @@ "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "typescript": "^4.8.2", + "ws": "^8.18.0", "zod": "^3.23.8" }, "imports": { @@ -71,9 +73,13 @@ }, "bin": "./bin/cli", "peerDependencies": { + "ws": "^8.18.0", "zod": "^3.23.8" }, "peerDependenciesMeta": { + "ws": { + "optional": true + }, "zod": { "optional": true } diff --git a/realtime.md b/realtime.md new file mode 100644 index 000000000..339dfd847 --- /dev/null +++ b/realtime.md @@ -0,0 +1,86 @@ +## Realtime API beta + +The Realtime API enables you to build low-latency, multi-modal conversational experiences. It currently supports text and audio as both input and output, as well as [function calling](https://platform.openai.com/docs/guides/function-calling) through a `WebSocket` connection. + +The Realtime API works through a combination of client-sent events and server-sent events. Clients can send events to do things like update session configuration or send text and audio inputs. Server events confirm when audio responses have completed, or when a text response from the model has been received. A full event reference can be found [here](https://platform.openai.com/docs/api-reference/realtime-client-events) and a guide can be found [here](https://platform.openai.com/docs/guides/realtime). + +This SDK supports accessing the Realtime API through the [WebSocket API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket) or with [ws](https://github.com/websockets/ws). + +Basic text based example with `ws`: + +```ts +// requires `yarn add ws @types/ws` +import { OpenAIRealtimeWS } from 'openai/beta/realtime/ws'; + +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); + +// access the underlying `ws.WebSocket` instance +rt.socket.on('open', () => { + console.log('Connection opened!'); + rt.send({ + type: 'session.update', + session: { + modalities: ['text'], + model: 'gpt-4o-realtime-preview', + }, + }); + + rt.send({ + type: 'conversation.item.create', + item: { + type: 'message', + role: 'user', + content: [{ type: 'input_text', text: 'Say a couple paragraphs!' }], + }, + }); + + rt.send({ type: 'response.create' }); +}); + +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); + +rt.on('session.created', (event) => { + console.log('session created!', event.session); + console.log(); +}); + +rt.on('response.text.delta', (event) => process.stdout.write(event.delta)); +rt.on('response.text.done', () => console.log()); + +rt.on('response.done', () => rt.close()); + +rt.socket.on('close', () => console.log('\nConnection closed!')); +``` + +To use the web API `WebSocket` implementation, replace `OpenAIRealtimeWS` with `OpenAIRealtimeWebSocket` and adjust any `rt.socket` access: + +```ts +import { OpenAIRealtimeWebSocket } from 'openai/beta/realtime/websocket'; + +const rt = new OpenAIRealtimeWebSocket({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +// ... +rt.socket.addEventListener('open', () => { + // ... +}); +``` + +A full example can be found [here](https://github.com/openai/openai-node/blob/master/examples/realtime/websocket.ts). + +### Realtime error handling + +When an error is encountered, either on the client side or returned from the server through the [`error` event](https://platform.openai.com/docs/guides/realtime-model-capabilities#error-handling), the `error` event listener will be fired. However, if you haven't registered an `error` event listener then an `unhandled Promise rejection` error will be thrown. + +It is **highly recommended** that you register an `error` event listener and handle errors approriately as typically the underlying connection is still usable. + +```ts +const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); +rt.on('error', (err) => { + // in a real world scenario this should be logged somewhere as you + // likely want to continue procesing events regardless of any errors + throw err; +}); +``` diff --git a/src/azure.ts b/src/azure.ts index 57bb21d72..661f288af 100644 --- a/src/azure.ts +++ b/src/azure.ts @@ -38,8 +38,9 @@ export interface AzureClientOptions extends ClientOptions { /** API Client for interfacing with the Azure OpenAI API. */ export class AzureOpenAI extends OpenAI { private _azureADTokenProvider: (() => Promise) | undefined; - private _deployment: string | undefined; + deploymentName: string | undefined; apiVersion: string = ''; + /** * API Client for interfacing with the Azure OpenAI API. * @@ -121,7 +122,7 @@ export class AzureOpenAI extends OpenAI { this._azureADTokenProvider = azureADTokenProvider; this.apiVersion = apiVersion; - this._deployment = deployment; + this.deploymentName = deployment; } override buildRequest( @@ -132,7 +133,7 @@ export class AzureOpenAI extends OpenAI { if (!isObj(options.body)) { throw new Error('Expected request body to be an object'); } - const model = this._deployment || options.body['model'] || options.__metadata?.['model']; + const model = this.deploymentName || options.body['model'] || options.__metadata?.['model']; if (model !== undefined && !this.baseURL.includes('/deployments')) { options.path = `/deployments/${model}${options.path}`; } @@ -140,7 +141,7 @@ export class AzureOpenAI extends OpenAI { return super.buildRequest(options, props); } - private async _getAzureADToken(): Promise { + async _getAzureADToken(): Promise { if (typeof this._azureADTokenProvider === 'function') { const token = await this._azureADTokenProvider(); if (!token || typeof token !== 'string') { diff --git a/src/beta/realtime/index.ts b/src/beta/realtime/index.ts new file mode 100644 index 000000000..75f0f3088 --- /dev/null +++ b/src/beta/realtime/index.ts @@ -0,0 +1 @@ +export { OpenAIRealtimeError } from './internal-base'; diff --git a/src/beta/realtime/internal-base.ts b/src/beta/realtime/internal-base.ts new file mode 100644 index 000000000..b704812ee --- /dev/null +++ b/src/beta/realtime/internal-base.ts @@ -0,0 +1,93 @@ +import { RealtimeClientEvent, RealtimeServerEvent, ErrorEvent } from '../../resources/beta/realtime/realtime'; +import { EventEmitter } from '../../lib/EventEmitter'; +import { OpenAIError } from '../../error'; +import OpenAI, { AzureOpenAI } from '../../index'; + +export class OpenAIRealtimeError extends OpenAIError { + /** + * The error data that the API sent back in an `error` event. + */ + error?: ErrorEvent.Error | undefined; + + /** + * The unique ID of the server event. + */ + event_id?: string | undefined; + + constructor(message: string, event: ErrorEvent | null) { + super(message); + + this.error = event?.error; + this.event_id = event?.event_id; + } +} + +type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; + +type RealtimeEvents = Simplify< + { + event: (event: RealtimeServerEvent) => void; + error: (error: OpenAIRealtimeError) => void; + } & { + [EventType in Exclude]: ( + event: Extract, + ) => unknown; + } +>; + +export abstract class OpenAIRealtimeEmitter extends EventEmitter { + /** + * Send an event to the API. + */ + abstract send(event: RealtimeClientEvent): void; + + /** + * Close the websocket connection. + */ + abstract close(props?: { code: number; reason: string }): void; + + protected _onError(event: null, message: string, cause: any): void; + protected _onError(event: ErrorEvent, message?: string | undefined): void; + protected _onError(event: ErrorEvent | null, message?: string | undefined, cause?: any): void { + message = + event?.error ? + `${event.error.message} code=${event.error.code} param=${event.error.param} type=${event.error.type} event_id=${event.error.event_id}` + : message ?? 'unknown error'; + + if (!this._hasListener('error')) { + const error = new OpenAIRealtimeError( + message + + `\n\nTo resolve these unhandled rejection errors you should bind an \`error\` callback, e.g. \`rt.on('error', (error) => ...)\` `, + event, + ); + // @ts-ignore + error.cause = cause; + Promise.reject(error); + return; + } + + const error = new OpenAIRealtimeError(message, event); + // @ts-ignore + error.cause = cause; + + this._emit('error', error); + } +} + +export function isAzure(client: Pick): client is AzureOpenAI { + return client instanceof AzureOpenAI; +} + +export function buildRealtimeURL(client: Pick, model: string): URL { + const path = '/realtime'; + const baseURL = client.baseURL; + const url = new URL(baseURL + (baseURL.endsWith('/') ? path.slice(1) : path)); + url.protocol = 'wss'; + if (isAzure(client)) { + url.searchParams.set('api-version', client.apiVersion); + url.searchParams.set('deployment', model); + } else { + url.searchParams.set('model', model); + } + return url; +} diff --git a/src/beta/realtime/websocket.ts b/src/beta/realtime/websocket.ts new file mode 100644 index 000000000..2bf0b75d5 --- /dev/null +++ b/src/beta/realtime/websocket.ts @@ -0,0 +1,143 @@ +import { AzureOpenAI, OpenAI } from '../../index'; +import { OpenAIError } from '../../error'; +import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; +import { OpenAIRealtimeEmitter, buildRealtimeURL, isAzure } from './internal-base'; +import { isRunningInBrowser } from '../../internal/detect-platform'; + +interface MessageEvent { + data: string; +} + +type _WebSocket = + typeof globalThis extends ( + { + WebSocket: infer ws extends abstract new (...args: any) => any; + } + ) ? + // @ts-ignore + InstanceType + : any; + +export class OpenAIRealtimeWebSocket extends OpenAIRealtimeEmitter { + url: URL; + socket: _WebSocket; + + constructor( + props: { + model: string; + dangerouslyAllowBrowser?: boolean; + /** + * Callback to mutate the URL, needed for Azure. + * @internal + */ + onURL?: (url: URL) => void; + }, + client?: Pick, + ) { + super(); + + const dangerouslyAllowBrowser = + props.dangerouslyAllowBrowser ?? + (client as any)?._options?.dangerouslyAllowBrowser ?? + (client?.apiKey.startsWith('ek_') ? true : null); + + if (!dangerouslyAllowBrowser && isRunningInBrowser()) { + throw new OpenAIError( + "It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\n\nYou can avoid this error by creating an ephemeral session token:\nhttps://platform.openai.com/docs/api-reference/realtime-sessions\n", + ); + } + + client ??= new OpenAI({ dangerouslyAllowBrowser }); + + this.url = buildRealtimeURL(client, props.model); + props.onURL?.(this.url); + + // @ts-ignore + this.socket = new WebSocket(this.url.toString(), [ + 'realtime', + ...(isAzure(client) ? [] : [`openai-insecure-api-key.${client.apiKey}`]), + 'openai-beta.realtime-v1', + ]); + + this.socket.addEventListener('message', (websocketEvent: MessageEvent) => { + const event = (() => { + try { + return JSON.parse(websocketEvent.data.toString()) as RealtimeServerEvent; + } catch (err) { + this._onError(null, 'could not parse websocket event', err); + return null; + } + })(); + + if (event) { + this._emit('event', event); + + if (event.type === 'error') { + this._onError(event); + } else { + // @ts-expect-error TS isn't smart enough to get the relationship right here + this._emit(event.type, event); + } + } + }); + + this.socket.addEventListener('error', (event: any) => { + this._onError(null, event.message, null); + }); + + if (isAzure(client)) { + if (this.url.searchParams.get('Authorization') !== null) { + this.url.searchParams.set('Authorization', ''); + } else { + this.url.searchParams.set('api-key', ''); + } + } + } + + static async azure( + client: Pick, + options: { deploymentName?: string; dangerouslyAllowBrowser?: boolean } = {}, + ): Promise { + const token = await client._getAzureADToken(); + function onURL(url: URL) { + if (client.apiKey !== '') { + url.searchParams.set('api-key', client.apiKey); + } else { + if (token) { + url.searchParams.set('Authorization', `Bearer ${token}`); + } else { + throw new Error('AzureOpenAI is not instantiated correctly. No API key or token provided.'); + } + } + } + const deploymentName = options.deploymentName ?? client.deploymentName; + if (!deploymentName) { + throw new Error('No deployment name provided'); + } + const { dangerouslyAllowBrowser } = options; + return new OpenAIRealtimeWebSocket( + { + model: deploymentName, + onURL, + ...(dangerouslyAllowBrowser ? { dangerouslyAllowBrowser } : {}), + }, + client, + ); + } + + send(event: RealtimeClientEvent) { + try { + this.socket.send(JSON.stringify(event)); + } catch (err) { + this._onError(null, 'could not send data', err); + } + } + + close(props?: { code: number; reason: string }) { + try { + this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK'); + } catch (err) { + this._onError(null, 'could not close the connection', err); + } + } +} diff --git a/src/beta/realtime/ws.ts b/src/beta/realtime/ws.ts new file mode 100644 index 000000000..3f51dfc4b --- /dev/null +++ b/src/beta/realtime/ws.ts @@ -0,0 +1,96 @@ +import * as WS from 'ws'; +import { AzureOpenAI, OpenAI } from '../../index'; +import type { RealtimeClientEvent, RealtimeServerEvent } from '../../resources/beta/realtime/realtime'; +import { OpenAIRealtimeEmitter, buildRealtimeURL, isAzure } from './internal-base'; + +export class OpenAIRealtimeWS extends OpenAIRealtimeEmitter { + url: URL; + socket: WS.WebSocket; + + constructor( + props: { model: string; options?: WS.ClientOptions | undefined }, + client?: Pick, + ) { + super(); + client ??= new OpenAI(); + + this.url = buildRealtimeURL(client, props.model); + this.socket = new WS.WebSocket(this.url, { + ...props.options, + headers: { + ...props.options?.headers, + ...(isAzure(client) ? {} : { Authorization: `Bearer ${client.apiKey}` }), + 'OpenAI-Beta': 'realtime=v1', + }, + }); + + this.socket.on('message', (wsEvent) => { + const event = (() => { + try { + return JSON.parse(wsEvent.toString()) as RealtimeServerEvent; + } catch (err) { + this._onError(null, 'could not parse websocket event', err); + return null; + } + })(); + + if (event) { + this._emit('event', event); + + if (event.type === 'error') { + this._onError(event); + } else { + // @ts-expect-error TS isn't smart enough to get the relationship right here + this._emit(event.type, event); + } + } + }); + + this.socket.on('error', (err) => { + this._onError(null, err.message, err); + }); + } + + static async azure( + client: Pick, + options: { deploymentName?: string; options?: WS.ClientOptions | undefined } = {}, + ): Promise { + const deploymentName = options.deploymentName ?? client.deploymentName; + if (!deploymentName) { + throw new Error('No deployment name provided'); + } + return new OpenAIRealtimeWS( + { model: deploymentName, options: { headers: await getAzureHeaders(client) } }, + client, + ); + } + + send(event: RealtimeClientEvent) { + try { + this.socket.send(JSON.stringify(event)); + } catch (err) { + this._onError(null, 'could not send data', err); + } + } + + close(props?: { code: number; reason: string }) { + try { + this.socket.close(props?.code ?? 1000, props?.reason ?? 'OK'); + } catch (err) { + this._onError(null, 'could not close the connection', err); + } + } +} + +async function getAzureHeaders(client: Pick) { + if (client.apiKey !== '') { + return { 'api-key': client.apiKey }; + } else { + const token = await client._getAzureADToken(); + if (token) { + return { Authorization: `Bearer ${token}` }; + } else { + throw new Error('AzureOpenAI is not instantiated correctly. No API key or token provided.'); + } + } +} diff --git a/src/lib/EventEmitter.ts b/src/lib/EventEmitter.ts new file mode 100644 index 000000000..9adeebdc3 --- /dev/null +++ b/src/lib/EventEmitter.ts @@ -0,0 +1,98 @@ +type EventListener = Events[EventType]; + +type EventListeners = Array<{ + listener: EventListener; + once?: boolean; +}>; + +export type EventParameters = { + [Event in EventType]: EventListener extends (...args: infer P) => any ? P : never; +}[EventType]; + +export class EventEmitter any>> { + #listeners: { + [Event in keyof EventTypes]?: EventListeners; + } = {}; + + /** + * Adds the listener function to the end of the listeners array for the event. + * No checks are made to see if the listener has already been added. Multiple calls passing + * the same combination of event and listener will result in the listener being added, and + * called, multiple times. + * @returns this, so that calls can be chained + */ + on(event: Event, listener: EventListener): this { + const listeners: EventListeners = + this.#listeners[event] || (this.#listeners[event] = []); + listeners.push({ listener }); + return this; + } + + /** + * Removes the specified listener from the listener array for the event. + * off() will remove, at most, one instance of a listener from the listener array. If any single + * listener has been added multiple times to the listener array for the specified event, then + * off() must be called multiple times to remove each instance. + * @returns this, so that calls can be chained + */ + off(event: Event, listener: EventListener): this { + const listeners = this.#listeners[event]; + if (!listeners) return this; + const index = listeners.findIndex((l) => l.listener === listener); + if (index >= 0) listeners.splice(index, 1); + return this; + } + + /** + * Adds a one-time listener function for the event. The next time the event is triggered, + * this listener is removed and then invoked. + * @returns this, so that calls can be chained + */ + once(event: Event, listener: EventListener): this { + const listeners: EventListeners = + this.#listeners[event] || (this.#listeners[event] = []); + listeners.push({ listener, once: true }); + return this; + } + + /** + * This is similar to `.once()`, but returns a Promise that resolves the next time + * the event is triggered, instead of calling a listener callback. + * @returns a Promise that resolves the next time given event is triggered, + * or rejects if an error is emitted. (If you request the 'error' event, + * returns a promise that resolves with the error). + * + * Example: + * + * const message = await stream.emitted('message') // rejects if the stream errors + */ + emitted( + event: Event, + ): Promise< + EventParameters extends [infer Param] ? Param + : EventParameters extends [] ? void + : EventParameters + > { + return new Promise((resolve, reject) => { + // TODO: handle errors + this.once(event, resolve as any); + }); + } + + protected _emit( + this: EventEmitter, + event: Event, + ...args: EventParameters + ) { + const listeners: EventListeners | undefined = this.#listeners[event]; + if (listeners) { + this.#listeners[event] = listeners.filter((l) => !l.once) as any; + listeners.forEach(({ listener }: any) => listener(...(args as any))); + } + } + + protected _hasListener(event: keyof EventTypes): boolean { + const listeners = this.#listeners[event]; + return listeners && listeners.length > 0; + } +} diff --git a/yarn.lock b/yarn.lock index db04ba6f5..c16fb37a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -949,6 +949,13 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/ws@^8.5.13": + version "8.5.14" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.14.tgz#93d44b268c9127d96026cf44353725dd9b6c3c21" + integrity sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.3" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" @@ -3456,6 +3463,11 @@ write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" +ws@^8.18.0: + version "8.18.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== + y18n@^5.0.5: version "5.0.8" resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" From 04e30c03ce0496a718aebf4cc2daac82ebba1ddb Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 21 Jan 2025 22:36:52 +0000 Subject: [PATCH 197/509] fix(jsr): correct zod config --- jsr.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsr.json b/jsr.json index b87e40dc5..900b0a1f1 100644 --- a/jsr.json +++ b/jsr.json @@ -5,6 +5,9 @@ ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts" }, + "imports": { + "zod": "npm:zod@3" + }, "publish": { "exclude": [ "!." From 0ea64eb2bde99e243761ea2e3d9d3c294c9f7fbc Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 21 Jan 2025 15:35:13 +0000 Subject: [PATCH 198/509] fix(jsr): export realtime helpers --- jsr.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jsr.json b/jsr.json index 900b0a1f1..dca12b1ff 100644 --- a/jsr.json +++ b/jsr.json @@ -3,7 +3,8 @@ "version": "5.0.0-alpha.0", "exports": { ".": "./index.ts", - "./helpers/zod": "./helpers/zod.ts" + "./helpers/zod": "./helpers/zod.ts", + "./beta/realtime/websocket": "./beta/realtime/websocket.ts" }, "imports": { "zod": "npm:zod@3" From ead0ba4dc9f51c35007c5fe20f9954855f558652 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 21 Feb 2025 11:24:08 +0000 Subject: [PATCH 199/509] feat(client): improve logging --- README.md | 76 ++++++++++----- src/client.ts | 176 +++++++++++++++++++++++++++-------- src/internal/errors.ts | 11 +++ src/internal/parse.ts | 78 +++++++++------- src/internal/shims.ts | 18 ++++ src/internal/utils/log.ts | 93 +++++++++++++----- src/internal/utils/values.ts | 2 +- tests/index.test.ts | 52 ++++++++++- tests/responses.test.ts | 9 ++ 9 files changed, 397 insertions(+), 118 deletions(-) diff --git a/README.md b/README.md index 6d7dfd696..2b85f3553 100644 --- a/README.md +++ b/README.md @@ -527,6 +527,59 @@ console.log(raw.headers.get('X-My-Header')); console.log(chatCompletion); ``` +### Logging + +> [!IMPORTANT] +> All log messages are intended for debugging only. The format and content of log messages +> may change between releases. + +#### Log levels + +The log level can be configured in two ways: + +1. Via the `OPENAI_LOG` environment variable +2. Using the `logLevel` client option (overrides the environment variable if set) + +```ts +import OpenAI from 'openai'; + +const client = new OpenAI({ + logLevel: 'debug', // Show all log messages +}); +``` + +Available log levels, from most to least verbose: + +- `'debug'` - Show debug messages, info, warnings, and errors +- `'info'` - Show info messages, warnings, and errors +- `'warn'` - Show warnings and errors (default) +- `'error'` - Show only errors +- `'off'` - Disable all logging + +At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies. +Some authentication-related headers are redacted, but sensitive data in request and response bodies +may still be visible. + +#### Custom logger + +By default, this library logs to `globalThis.console`. You can also provide a custom logger. +Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue. + +When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages +below the configured level will not be sent to your logger. + +```ts +import OpenAI from 'openai'; +import pino from 'pino'; + +const logger = pino(); + +const client = new OpenAI({ + logger: logger.child({ name: 'OpenAI' }), + logLevel: 'debug', // Send all messages to pino, allowing it to filter +}); +``` + ### Making custom/undocumented requests This library is typed for convenient access to the documented API. If you need to access undocumented @@ -586,33 +639,12 @@ globalThis.fetch = fetch; Or pass it to the client: ```ts +import OpenAI from 'openai'; import fetch from 'my-fetch'; const client = new OpenAI({ fetch }); ``` -### Logging and middleware - -You may also provide a custom `fetch` function when instantiating the client, -which can be used to inspect or alter the `Request` or `Response` before/after each request: - -```ts -import { fetch } from 'undici'; // as one example -import OpenAI from 'openai'; - -const client = new OpenAI({ - fetch: async (url: RequestInfo, init?: RequestInit): Promise => { - console.log('About to make a request', url, init); - const response = await fetch(url, init); - console.log('Got response', response); - return response; - }, -}); -``` - -Note that if given a `OPENAI_LOG=debug` environment variable, this library will log all requests and responses automatically. -This is intended for debugging purposes only and may change in the future without notice. - ### Fetch options If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.) diff --git a/src/client.ts b/src/client.ts index 2cab4f24a..478729321 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3,7 +3,7 @@ import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; import type { HTTPMethod, PromiseOrValue, MergedRequestInit } from './internal/types'; import { uuid4 } from './internal/utils/uuid'; -import { validatePositiveInteger, isAbsoluteURL } from './internal/utils/values'; +import { validatePositiveInteger, isAbsoluteURL, hasOwn } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; import { castToError, isAbortError } from './internal/errors'; import type { APIResponseProps } from './internal/parse'; @@ -78,7 +78,7 @@ import { Moderations, } from './resources/moderations'; import { readEnv } from './internal/utils/env'; -import { logger } from './internal/utils/log'; +import { formatRequestDetails, loggerFor } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; @@ -145,7 +145,14 @@ export type Logger = { debug: LogFn; }; export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug'; -const isLogLevel = (key: string | undefined): key is LogLevel => { +const parseLogLevel = ( + maybeLevel: string | undefined, + sourceName: string, + client: OpenAI, +): LogLevel | undefined => { + if (!maybeLevel) { + return undefined; + } const levels: Record = { off: true, error: true, @@ -153,7 +160,15 @@ const isLogLevel = (key: string | undefined): key is LogLevel => { info: true, debug: true, }; - return key! in levels; + if (hasOwn(levels, maybeLevel)) { + return maybeLevel; + } + loggerFor(client).warn( + `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify( + Object.keys(levels), + )}`, + ); + return undefined; }; export interface ClientOptions { @@ -233,16 +248,16 @@ export interface ClientOptions { /** * Set the log level. * - * Defaults to process.env['OPENAI_LOG']. + * Defaults to process.env['OPENAI_LOG'] or 'warn' if it isn't set. */ - logLevel?: LogLevel | undefined | null; + logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ - logger?: Logger | undefined | null; + logger?: Logger | undefined; } type FinalizedRequestInit = RequestInit & { headers: Headers }; @@ -312,14 +327,13 @@ export class OpenAI { this.baseURL = options.baseURL!; this.timeout = options.timeout ?? OpenAI.DEFAULT_TIMEOUT /* 10 minutes */; this.logger = options.logger ?? console; - if (options.logLevel != null) { - this.logLevel = options.logLevel; - } else { - const envLevel = readEnv('OPENAI_LOG'); - if (isLogLevel(envLevel)) { - this.logLevel = envLevel; - } - } + const defaultLogLevel = 'warn'; + // Set default logLevel early so that we can log a warning in parseLogLevel. + this.logLevel = defaultLogLevel; + this.logLevel = + parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? + parseLogLevel(readEnv('OPENAI_LOG'), "process.env['OPENAI_LOG']", this) ?? + defaultLogLevel; this.fetchOptions = options.fetchOptions; this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); @@ -435,12 +449,13 @@ export class OpenAI { options: PromiseOrValue, remainingRetries: number | null = null, ): APIPromise { - return new APIPromise(this, this.makeRequest(options, remainingRetries)); + return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined)); } private async makeRequest( optionsInput: PromiseOrValue, retriesRemaining: number | null, + retryOfRequestLogID: string | undefined, ): Promise { const options = await optionsInput; const maxRetries = options.maxRetries ?? this.maxRetries; @@ -454,7 +469,21 @@ export class OpenAI { await this.prepareRequest(req, { url, options }); - logger(this).debug('request', url, options, req.headers); + /** Not an API request ID, just for correlating local log entries. */ + const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0'); + const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`; + const startTime = Date.now(); + + loggerFor(this).debug( + `[${requestLogID}] sending request`, + formatRequestDetails({ + retryOfRequestLogID, + method: options.method, + url, + options, + headers: req.headers, + }), + ); if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); @@ -462,52 +491,124 @@ export class OpenAI { const controller = new AbortController(); const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); + const headersTime = Date.now(); if (response instanceof Error) { + const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); } - if (retriesRemaining) { - return this.retryRequest(options, retriesRemaining); - } - if (isAbortError(response)) { - throw new Errors.APIConnectionTimeoutError(); - } // detect native connection timeout errors // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)" // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)" // others do not provide enough information to distinguish timeouts from other connection errors - if (/timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : ''))) { + const isTimeout = + isAbortError(response) || + /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : '')); + if (retriesRemaining) { + loggerFor(this).info( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`, + ); + loggerFor(this).debug( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url, + durationMs: headersTime - startTime, + message: response.message, + }), + ); + return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID); + } + loggerFor(this).info( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`, + ); + loggerFor(this).debug( + `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, + formatRequestDetails({ + retryOfRequestLogID, + url, + durationMs: headersTime - startTime, + message: response.message, + }), + ); + if (isTimeout) { throw new Errors.APIConnectionTimeoutError(); } throw new Errors.APIConnectionError({ cause: response }); } + const specialHeaders = [...response.headers.entries()] + .filter(([name]) => name === 'x-request-id') + .map(([name, value]) => ', ' + name + ': ' + JSON.stringify(value)) + .join(''); + const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${ + response.ok ? 'succeeded' : 'failed' + } with status ${response.status} in ${headersTime - startTime}ms`; + if (!response.ok) { - if (retriesRemaining && this.shouldRetry(response)) { + const shouldRetry = this.shouldRetry(response); + if (retriesRemaining && shouldRetry) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; - logger(this).debug(`response (error; ${retryMessage})`, response.status, url, response.headers); - return this.retryRequest(options, retriesRemaining, response.headers); + + // We don't need the body of this response. + await Shims.CancelReadableStream(response.body); + loggerFor(this).info(`${responseInfo} - ${retryMessage}`); + loggerFor(this).debug( + `[${requestLogID}] response error (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + durationMs: headersTime - startTime, + }), + ); + return this.retryRequest( + options, + retriesRemaining, + retryOfRequestLogID ?? requestLogID, + response.headers, + ); } + const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`; + + loggerFor(this).info(`${responseInfo} - ${retryMessage}`); + const errText = await response.text().catch((err: any) => castToError(err).message); const errJSON = safeJSON(errText); const errMessage = errJSON ? undefined : errText; - const retryMessage = retriesRemaining ? `(error; no more retries left)` : `(error; not retryable)`; - logger(this).debug( - `response (error; ${retryMessage})`, - response.status, - url, - response.headers, - errMessage, + loggerFor(this).debug( + `[${requestLogID}] response error (${retryMessage})`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + message: errMessage, + durationMs: Date.now() - startTime, + }), ); const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); throw err; } - return { response, options, controller }; + loggerFor(this).info(responseInfo); + loggerFor(this).debug( + `[${requestLogID}] response start`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + headers: response.headers, + durationMs: headersTime - startTime, + }), + ); + + return { response, options, controller, requestLogID, retryOfRequestLogID, startTime }; } getAPIList = Pagination.AbstractPage>( @@ -525,7 +626,7 @@ export class OpenAI { Page: new (...args: ConstructorParameters) => PageClass, options: FinalRequestOptions, ): Pagination.PagePromise { - const request = this.makeRequest(options, null); + const request = this.makeRequest(options, null, undefined); return new Pagination.PagePromise(this as any as OpenAI, request, Page); } @@ -588,6 +689,7 @@ export class OpenAI { private async retryRequest( options: FinalRequestOptions, retriesRemaining: number, + requestLogID: string, responseHeaders?: Headers | undefined, ): Promise { let timeoutMillis: number | undefined; @@ -620,7 +722,7 @@ export class OpenAI { } await sleep(timeoutMillis); - return this.makeRequest(options, retriesRemaining - 1); + return this.makeRequest(options, retriesRemaining - 1, requestLogID); } private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number { diff --git a/src/internal/errors.ts b/src/internal/errors.ts index 2e625bda1..653a6ecb2 100644 --- a/src/internal/errors.ts +++ b/src/internal/errors.ts @@ -14,6 +14,17 @@ export function isAbortError(err: unknown) { export const castToError = (err: any): Error => { if (err instanceof Error) return err; if (typeof err === 'object' && err !== null) { + try { + if (Object.prototype.toString.call(err) === '[object Error]') { + // @ts-ignore - not all envs have native support for cause yet + const error = new Error(err.message, err.cause ? { cause: err.cause } : {}); + if (err.stack) error.stack = err.stack; + // @ts-ignore - not all envs have native support for cause yet + if (err.cause && !error.cause) error.cause = err.cause; + if (err.name) error.name = err.name; + throw error; + } + } catch {} try { return new Error(JSON.stringify(err)); } catch {} diff --git a/src/internal/parse.ts b/src/internal/parse.ts index c1f75ec45..f4ffca569 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -3,58 +3,70 @@ import type { FinalRequestOptions } from './request-options'; import { Stream } from '../streaming'; import { type OpenAI } from '../client'; -import { logger } from './utils/log'; +import { formatRequestDetails, loggerFor } from './utils/log'; import type { AbstractPage } from '../pagination'; export type APIResponseProps = { response: Response; options: FinalRequestOptions; controller: AbortController; + requestLogID: string; + retryOfRequestLogID: string | undefined; + startTime: number; }; export async function defaultParseResponse( client: OpenAI, props: APIResponseProps, ): Promise> { - const { response } = props; - if (props.options.stream) { - logger(client).debug('response', response.status, response.url, response.headers, response.body); + const { response, requestLogID, retryOfRequestLogID, startTime } = props; + const body = await (async () => { + if (props.options.stream) { + loggerFor(client).debug('response', response.status, response.url, response.headers, response.body); - // Note: there is an invariant here that isn't represented in the type system - // that if you set `stream: true` the response type must also be `Stream` + // Note: there is an invariant here that isn't represented in the type system + // that if you set `stream: true` the response type must also be `Stream` - if (props.options.__streamClass) { - return props.options.__streamClass.fromSSEResponse(response, props.controller) as any; - } - - return Stream.fromSSEResponse(response, props.controller) as any; - } - - // fetch refuses to read the body when the status code is 204. - if (response.status === 204) { - return null as WithRequestID; - } - - if (props.options.__binaryResponse) { - return response as unknown as WithRequestID; - } + if (props.options.__streamClass) { + return props.options.__streamClass.fromSSEResponse(response, props.controller) as any; + } - const contentType = response.headers.get('content-type'); - const isJSON = - contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); - if (isJSON) { - const json = await response.json(); + return Stream.fromSSEResponse(response, props.controller) as any; + } - logger(client).debug('response', response.status, response.url, response.headers, json); + // fetch refuses to read the body when the status code is 204. + if (response.status === 204) { + return null as T; + } - return addRequestID(json as T, response); - } + if (props.options.__binaryResponse) { + return response as unknown as T; + } - const text = await response.text(); - logger(client).debug('response', response.status, response.url, response.headers, text); + const contentType = response.headers.get('content-type'); + const isJSON = + contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); + if (isJSON) { + const json = await response.json(); + return addRequestID(json as T, response); + } - // TODO handle blob, arraybuffer, other content types, etc. - return text as unknown as WithRequestID; + const text = await response.text(); + + // TODO handle blob, arraybuffer, other content types, etc. + return text as unknown as T; + })(); + loggerFor(client).debug( + `[${requestLogID}] response parsed`, + formatRequestDetails({ + retryOfRequestLogID, + url: response.url, + status: response.status, + body, + durationMs: Date.now() - startTime, + }), + ); + return body; } export type WithRequestID = diff --git a/src/internal/shims.ts b/src/internal/shims.ts index ede4c8852..e084d8925 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -143,3 +143,21 @@ export function ReadableStreamToAsyncIterable(stream: any): AsyncIterableIter }, }; } + +/** + * Cancels a ReadableStream we don't need to consume. + * See https://undici.nodejs.org/#/?id=garbage-collection + */ +export async function CancelReadableStream(stream: any): Promise { + if (stream === null || typeof stream !== 'object') return; + + if (stream[Symbol.asyncIterator]) { + await stream[Symbol.asyncIterator]().return?.(); + return; + } + + const reader = stream.getReader(); + const cancelPromise = reader.cancel(); + reader.releaseLock(); + await cancelPromise; +} diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 0cfaf7cc4..f75d46bba 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -2,6 +2,7 @@ import type { LogLevel, Logger } from '../../client'; import { type OpenAI } from '../../client'; +import { RequestOptions } from '../request-options'; const levelNumbers = { off: 0, @@ -13,37 +14,85 @@ const levelNumbers = { function noop() {} -function logFn(logger: Logger | undefined, clientLevel: LogLevel | undefined, level: keyof Logger) { - if (!logger || levelNumbers[level] > levelNumbers[clientLevel!]!) { +function makeLogFn(fnLevel: keyof Logger, logger: Logger | undefined, logLevel: LogLevel) { + if (!logger || levelNumbers[fnLevel] > levelNumbers[logLevel]) { return noop; } else { // Don't wrap logger functions, we want the stacktrace intact! - return logger[level].bind(logger); + return logger[fnLevel].bind(logger); } } -let lastLogger: { deref(): Logger } | undefined; -let lastLevel: LogLevel | undefined; -let lastLevelLogger: Logger; +const noopLogger = { + error: noop, + warn: noop, + info: noop, + debug: noop, +}; + +let cachedLoggers = new WeakMap(); + +export function loggerFor(client: OpenAI): Logger { + const logger = client.logger; + const logLevel = client.logLevel ?? 'off'; + if (!logger) { + return noopLogger; + } -export function logger(client: OpenAI): Logger { - let { logger, logLevel: clientLevel } = client; - if (lastLevel === clientLevel && (logger === lastLogger || logger === lastLogger?.deref())) { - return lastLevelLogger; + const cachedLogger = cachedLoggers.get(logger); + if (cachedLogger && cachedLogger[0] === logLevel) { + return cachedLogger[1]; } + const levelLogger = { - error: logFn(logger, clientLevel, 'error'), - warn: logFn(logger, clientLevel, 'warn'), - info: logFn(logger, clientLevel, 'info'), - debug: logFn(logger, clientLevel, 'debug'), + error: makeLogFn('error', logger, logLevel), + warn: makeLogFn('warn', logger, logLevel), + info: makeLogFn('info', logger, logLevel), + debug: makeLogFn('debug', logger, logLevel), }; - const { WeakRef } = globalThis as any; - lastLogger = - logger ? - WeakRef ? new WeakRef(logger) - : { deref: () => logger } - : undefined; - lastLevel = clientLevel; - lastLevelLogger = levelLogger; + + cachedLoggers.set(logger, [logLevel, levelLogger]); + return levelLogger; } + +export const formatRequestDetails = (details: { + options?: RequestOptions | undefined; + headers?: Headers | Record | undefined; + retryOfRequestLogID?: string | undefined; + retryOf?: string | undefined; + url?: string | undefined; + status?: number | undefined; + method?: string | undefined; + durationMs?: number | undefined; + message?: unknown; + body?: unknown; +}) => { + if (details.options) { + details.options = { ...details.options }; + delete details.options['headers']; // redundant + leaks internals + } + if (details.headers) { + details.headers = Object.fromEntries( + (details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map( + ([name, value]) => [ + name, + ( + name.toLowerCase() === 'authorization' || + name.toLowerCase() === 'cookie' || + name.toLowerCase() === 'set-cookie' + ) ? + '***' + : value, + ], + ), + ); + } + if ('retryOfRequestLogID' in details) { + if (details.retryOfRequestLogID) { + details.retryOf = details.retryOfRequestLogID; + } + delete details.retryOfRequestLogID; + } + return details; +}; diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts index 25decb1f8..bb66cfdc1 100644 --- a/src/internal/utils/values.ts +++ b/src/internal/utils/values.ts @@ -26,7 +26,7 @@ export function isEmptyObj(obj: Object | null | undefined): boolean { } // https://eslint.org/docs/latest/rules/no-prototype-builtins -export function hasOwn(obj: Object, key: string): boolean { +export function hasOwn(obj: T, key: PropertyKey): key is keyof T { return Object.prototype.hasOwnProperty.call(obj, key); } diff --git a/tests/index.test.ts b/tests/index.test.ts index f4dbc7b51..07c99ba87 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -13,8 +13,6 @@ describe('instantiate client', () => { beforeEach(() => { jest.resetModules(); process.env = { ...env }; - - console.warn = jest.fn(); }); afterEach(() => { @@ -52,16 +50,26 @@ describe('instantiate client', () => { }); }); describe('logging', () => { - afterEach(() => { + const env = process.env; + + beforeEach(() => { + process.env = { ...env }; process.env['OPENAI_LOG'] = undefined; }); + afterEach(() => { + process.env = env; + }); + const forceAPIResponseForClient = async (client: OpenAI) => { await new APIPromise( client, Promise.resolve({ response: new Response(), controller: new AbortController(), + requestLogID: 'log_000000', + retryOfRequestLogID: undefined, + startTime: Date.now(), options: { method: 'get', path: '/', @@ -85,6 +93,11 @@ describe('instantiate client', () => { expect(debugMock).toHaveBeenCalled(); }); + test('default logLevel is warn', async () => { + const client = new OpenAI({ apiKey: 'My API Key' }); + expect(client.logLevel).toBe('warn'); + }); + test('debug logs are skipped when log level is info', async () => { const debugMock = jest.fn(); const logger = { @@ -111,11 +124,29 @@ describe('instantiate client', () => { process.env['OPENAI_LOG'] = 'debug'; const client = new OpenAI({ logger: logger, apiKey: 'My API Key' }); + expect(client.logLevel).toBe('debug'); await forceAPIResponseForClient(client); expect(debugMock).toHaveBeenCalled(); }); + test('warn when env var level is invalid', async () => { + const warnMock = jest.fn(); + const logger = { + debug: jest.fn(), + info: jest.fn(), + warn: warnMock, + error: jest.fn(), + }; + + process.env['OPENAI_LOG'] = 'not a log level'; + const client = new OpenAI({ logger: logger, apiKey: 'My API Key' }); + expect(client.logLevel).toBe('warn'); + expect(warnMock).toHaveBeenCalledWith( + 'process.env[\'OPENAI_LOG\'] was set to "not a log level", expected one of ["off","error","warn","info","debug"]', + ); + }); + test('client log level overrides env var', async () => { const debugMock = jest.fn(); const logger = { @@ -131,6 +162,21 @@ describe('instantiate client', () => { await forceAPIResponseForClient(client); expect(debugMock).not.toHaveBeenCalled(); }); + + test('no warning logged for invalid env var level + valid client level', async () => { + const warnMock = jest.fn(); + const logger = { + debug: jest.fn(), + info: jest.fn(), + warn: warnMock, + error: jest.fn(), + }; + + process.env['OPENAI_LOG'] = 'not a log level'; + const client = new OpenAI({ logger: logger, logLevel: 'debug', apiKey: 'My API Key' }); + expect(client.logLevel).toBe('debug'); + expect(warnMock).not.toHaveBeenCalled(); + }); }); describe('defaultQuery', () => { diff --git a/tests/responses.test.ts b/tests/responses.test.ts index fe741673c..3cb73f4e4 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -64,6 +64,9 @@ describe('request id', () => { }), controller: {} as any, options: {} as any, + requestLogID: 'log_...', + retryOfRequestLogID: undefined, + startTime: Date.now(), }; })(), )._thenUnwrap((d) => d.data); @@ -97,6 +100,9 @@ describe('request id', () => { }), controller: {} as any, options: {} as any, + requestLogID: 'log_...', + retryOfRequestLogID: undefined, + startTime: Date.now(), }; })(), ); @@ -117,6 +123,9 @@ describe('request id', () => { }), controller: {} as any, options: {} as any, + requestLogID: 'log_...', + retryOfRequestLogID: undefined, + startTime: Date.now(), }; })(), ); From 9485f5d4d6718bff7f579223c9aa528898451533 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:08:12 +0000 Subject: [PATCH 200/509] chore(internal): fix devcontainers setup (#1343) --- .devcontainer/Dockerfile | 23 ----------------------- .devcontainer/devcontainer.json | 27 ++++++++++++--------------- 2 files changed, 12 insertions(+), 38 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 8ea34be96..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM debian:bookworm-slim AS stainless - -RUN apt-get update && apt-get install -y \ - nodejs \ - npm \ - yarnpkg \ - && apt-get clean autoclean - -# Ensure UTF-8 encoding -ENV LANG=C.UTF-8 -ENV LC_ALL=C.UTF-8 - -# Yarn -RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn - -WORKDIR /workspace - -COPY package.json yarn.lock /workspace/ - -RUN yarn install - -COPY . /workspace diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d55fc4d67..763462fad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,17 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/debian { - "name": "Debian", - "build": { - "dockerfile": "Dockerfile" + "name": "Development", + "image": "mcr.microsoft.com/devcontainers/typescript-node:latest", + "features": { + "ghcr.io/devcontainers/features/node:1": {} + }, + "postCreateCommand": "yarn install", + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode" + ] + } } - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" } From a1a125349ba9c9c2bb602c8c8f368e086c41ac1e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 05:06:15 +0000 Subject: [PATCH 201/509] release: 4.85.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 712720117..6fc92ed1e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.85.3" + ".": "4.85.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 36debfad1..e2f920af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.85.4 (2025-02-22) + +Full Changelog: [v4.85.3...v4.85.4](https://github.com/openai/openai-node/compare/v4.85.3...v4.85.4) + +### Chores + +* **internal:** fix devcontainers setup ([#1343](https://github.com/openai/openai-node/issues/1343)) ([cb1ec90](https://github.com/openai/openai-node/commit/cb1ec907832e325bc29abe94ae325e0477cb87d1)) + ## 4.85.3 (2025-02-20) Full Changelog: [v4.85.2...v4.85.3](https://github.com/openai/openai-node/compare/v4.85.2...v4.85.3) diff --git a/jsr.json b/jsr.json index 3c480dc70..7ced58a9c 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.85.3", + "version": "4.85.4", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 5fdd39fdc..38572079f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.85.3", + "version": "4.85.4", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 679cac2c7..ebfb680f1 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.85.3'; // x-release-please-version +export const VERSION = '4.85.4'; // x-release-please-version From 873e273b8c4e4e7f45feec466896b7e5ce0d8577 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 21 Feb 2025 15:08:17 +0000 Subject: [PATCH 202/509] chore(internal): fix devcontainers setup --- .devcontainer/Dockerfile | 23 ----------------------- .devcontainer/devcontainer.json | 27 ++++++++++++--------------- 2 files changed, 12 insertions(+), 38 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 8ea34be96..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,23 +0,0 @@ -# syntax=docker/dockerfile:1 -FROM debian:bookworm-slim AS stainless - -RUN apt-get update && apt-get install -y \ - nodejs \ - npm \ - yarnpkg \ - && apt-get clean autoclean - -# Ensure UTF-8 encoding -ENV LANG=C.UTF-8 -ENV LC_ALL=C.UTF-8 - -# Yarn -RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn - -WORKDIR /workspace - -COPY package.json yarn.lock /workspace/ - -RUN yarn install - -COPY . /workspace diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d55fc4d67..763462fad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,20 +1,17 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/debian { - "name": "Debian", - "build": { - "dockerfile": "Dockerfile" + "name": "Development", + "image": "mcr.microsoft.com/devcontainers/typescript-node:latest", + "features": { + "ghcr.io/devcontainers/features/node:1": {} + }, + "postCreateCommand": "yarn install", + "customizations": { + "vscode": { + "extensions": [ + "esbenp.prettier-vscode" + ] + } } - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" } From b55321e2d0713d41b4050e8ccf0ac4eefb45be3a Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Fri, 21 Feb 2025 15:17:10 +0000 Subject: [PATCH 203/509] chore(internal): remove unnecessary todo --- src/internal/errors.ts | 2 +- src/internal/parse.ts | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/internal/errors.ts b/src/internal/errors.ts index 653a6ecb2..82c7b14d5 100644 --- a/src/internal/errors.ts +++ b/src/internal/errors.ts @@ -22,7 +22,7 @@ export const castToError = (err: any): Error => { // @ts-ignore - not all envs have native support for cause yet if (err.cause && !error.cause) error.cause = err.cause; if (err.name) error.name = err.name; - throw error; + return error; } } catch {} try { diff --git a/src/internal/parse.ts b/src/internal/parse.ts index f4ffca569..173991a55 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -52,8 +52,6 @@ export async function defaultParseResponse( } const text = await response.text(); - - // TODO handle blob, arraybuffer, other content types, etc. return text as unknown as T; })(); loggerFor(client).debug( From cfd2088219464381077dec62d38d1830ab0b43f3 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 24 Feb 2025 20:32:55 +0000 Subject: [PATCH 204/509] feat: add migration guide --- MIGRATION.md | 380 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 380 insertions(+) create mode 100644 MIGRATION.md diff --git a/MIGRATION.md b/MIGRATION.md new file mode 100644 index 000000000..c9c07887c --- /dev/null +++ b/MIGRATION.md @@ -0,0 +1,380 @@ +# Migration guide + +This guide outlines the changes and steps needed to migrate your codebase to the latest version of the OpenAI TypeScript and JavaScript SDK. + +The main changes are that the SDK now relies on the [builtin Web fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) instead of `node-fetch` and has zero dependencies. + +## Environment requirements + +The minimum supported runtime and tooling versions are now: + +- Node.js 18.x last LTS (Required for built-in fetch support) + - This was previously documented as the minimum supported Node.js version but Node.js 16.x mostly worked at runtime; now it will not. +- TypeScript 4.9 +- Jest 28 + +## Minimum types requirements + +### DOM + +`tsconfig.json` + +```jsonc +{ + "target": "ES2015", // note: we recommend ES2020 or higher + "lib": ["DOM", "DOM.Iterable", "ES2018"] +} +``` + +### Node.js + +`tsconfig.json` + +```jsonc +{ + "target": "ES2015" // note: we recommend ES2020 or higher +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@types/node": ">= 18.18.7" + } +} +``` + +### Cloudflare Workers + +`tsconfig.json` + +```jsonc +{ + "target": "ES2015", // note: we recommend ES2020 or higher + "lib": ["ES2020"], // <- needed by @cloudflare/workers-types + "types": ["@cloudflare/workers-types"] +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@cloudflare/workers-types": ">= 0.20221111.0" + } +} +``` + +### Bun + +`tsconfig.json` + +```jsonc +{ + "target": "ES2015" // note: we recommend ES2020 or higher +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@types/bun": ">= 1.2.0" + } +} +``` + +### Deno + +No config needed! + +## Breaking changes + +### Named path parameters + +Methods that take multiple path parameters typically now use named instead of positional arguments for better clarity and to prevent a footgun where it was easy to accidentally pass arguments in the incorrect order. + +For example, for a method that would call an endpoint at `/v1/parents/{parent_id}/children/{child_id}`, only the _last_ path parameter is positional and the rest must be passed as named arguments. + +```ts +// Before +client.parents.children.create('p_123', 'c_456'); + +// After +client.example.create('c_456', { parent_id: 'p_123' }); +``` + +This affects the following methods: + +- `client.beta.vectorStores.files.retrieve()` +- `client.beta.vectorStores.files.delete()` +- `client.beta.vectorStores.fileBatches.retrieve()` +- `client.beta.vectorStores.fileBatches.cancel()` +- `client.beta.vectorStores.fileBatches.listFiles()` +- `client.beta.threads.runs.retrieve()` +- `client.beta.threads.runs.update()` +- `client.beta.threads.runs.cancel()` +- `client.beta.threads.runs.submitToolOutputs()` +- `client.beta.threads.runs.steps.retrieve()` +- `client.beta.threads.runs.steps.list()` +- `client.beta.threads.messages.retrieve()` +- `client.beta.threads.messages.update()` +- `client.beta.threads.messages.delete()` + +### URI encoded path parameters + +Path params are now properly encoded by default. If you were manually encoding path parameters before giving them to the SDK, you must now stop doing that and pass the +param without any encoding applied. + +For example: + +```diff +- client.example.retrieve(encodeURIComponent('string/with/slash')) ++ client.example.retrieve('string/with/slash') // renders example/string%2Fwith%2Fslash +``` + +Previously without the `encodeURIComponent()` call we would have used the path `/example/string/with/slash`; now we'll use `/example/string%2Fwith%2Fslash`. + +### Removed `httpAgent` in favor of `fetchOptions` + +The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options). +This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation. + +If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies). + +Before: + +```ts +import OpenAI from 'openai'; +import http from 'http'; +import { HttpsProxyAgent } from 'https-proxy-agent'; + +// Configure the default for all requests: +const client = new OpenAI({ + httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), +}); +``` + +After: + +```ts +import OpenAI from 'openai'; +import * as undici from 'undici'; + +const proxyAgent = new undici.ProxyAgent(process.env.PROXY_URL); +const client = new OpenAI({ + fetchOptions: { + dispatcher: proxyAgent, + }, +}); +``` + +### HTTP method naming + +Some methods could not be named intuitively due to an internal naming conflict. This has been resolved and the methods are now correctly named. + +```ts +// Before +client.chat.completions.del(); +client.files.del(); +client.models.del(); +client.beta.vectorStores.del(); +client.beta.vectorStores.files.del(); +client.beta.assistants.del(); +client.beta.threads.del(); +client.beta.threads.messages.del(); + +// After +client.chat.completions.delete(); +client.files.delete(); +client.models.delete(); +client.beta.vectorStores.delete(); +client.beta.vectorStores.files.delete(); +client.beta.assistants.delete(); +client.beta.threads.delete(); +client.beta.threads.messages.delete(); +``` + +### Removed request options overloads + +When making requests with no required body, query or header parameters, you must now explicitly pass `null`, `undefined` or an empty object `{}` to the params argument in order to customise request options. + +```diff +client.example.list(); +client.example.list({}, { headers: { ... } }); +client.example.list(null, { headers: { ... } }); +client.example.list(undefined, { headers: { ... } }); +- client.example.list({ headers: { ... } }); ++ client.example.list({}, { headers: { ... } }); +``` + +This affects the following methods: + +- `client.chat.completions.list()` +- `client.chat.completions.messages.list()` +- `client.files.list()` +- `client.fineTuning.jobs.list()` +- `client.fineTuning.jobs.listEvents()` +- `client.fineTuning.jobs.checkpoints.list()` +- `client.beta.vectorStores.list()` +- `client.beta.vectorStores.files.list()` +- `client.beta.assistants.list()` +- `client.beta.threads.create()` +- `client.beta.threads.runs.list()` +- `client.beta.threads.messages.list()` +- `client.batches.list()` + +### Pagination changes + +Note that the `for await` syntax is _not_ affected. This still works as-is: + +```ts +// Automatically fetches more pages as needed. +for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob); +} +``` + +#### Simplified interface + +The pagination interface has been simplified: + +```ts +// Before +page.nextPageParams(); +page.nextPageInfo(); +// Required manually handling { url } | { params } type + +// After +page.nextPageRequestOptions(); +``` + +#### Removed unnecessary classes + +Page classes for individual methods are now type aliases: + +```ts +// Before +export class FineTuningJobsPage extends CursorPage {} + +// After +export type FineTuningJobsPage = CursorPage; +``` + +If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level. + +### File handling + +The deprecated `fileFromPath` helper has been removed in favor of native Node.js streams: + +```ts +// Before +OpenAI.fileFromPath('path/to/file'); + +// After +import fs from 'fs'; +fs.createReadStream('path/to/file'); +``` + +Note that this function previously only worked on Node.j. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead. + +### Shims removal + +Previously you could configure the types that the SDK used like this: + +```ts +// Tell TypeScript and the package to use the global Web fetch instead of node-fetch. +import 'openai/shims/web'; +import OpenAI from 'openai'; +``` + +The `openai/shims` imports have been removed. Your global types must now be [correctly configured](#minimum-types-requirements). + +### `openai/src` directory removed + +Previously IDEs may have auto-completed imports from the `openai/src` directory, however this +directory was only included for an improved go-to-definition experience and should not have been used at runtime. + +If you have any `openai/src` imports, you must replace it with `openai`. + +```ts +// Before +import OpenAI from 'openai/src'; + +// After +import OpenAI from 'openai'; +``` + +### Headers + +The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record`. + +### Removed exports + +#### `Response` + +```typescript +// Before +import { Response } from 'openai'; + +// After +// `Response` must now come from the builtin types +``` + +#### Resource classes + +If you were importing resource classes from the root package then you must now import them from the file they are defined in: + +```typescript +// Before +import { Completions } from 'openai'; + +// After +import { Completions } from 'openai/resources/completions'; +``` + +#### `openai/core` + +The `openai/core` file was intended to be internal-only but it was publicly accessible, as such it has been refactored and split up into internal files. + +If you were relying on anything that was only exported from `openai/core` and is also not accessible anywhere else, please open an issue and we'll consider adding it to the public API. + +#### `APIClient` + +The `APIClient` base client class has been removed as it is no longer needed. If you were importing this class then you must now import the main client class: + +```typescript +// Before +import { APIClient } from 'openai/core'; + +// After +import { OpenAI } from 'openai'; +``` + +#### Cleaned up `openai/uploads` exports + +The following exports have been removed from `openai/uploads` as they were not intended to be a part of the public API: + +- `fileFromPath` +- `BlobPart` +- `BlobLike` +- `FileLike` +- `ResponseLike` +- `isResponseLike` +- `isBlobLike` +- `isFileLike` +- `isUploadable` +- `isMultipartBody` +- `maybeMultipartFormRequestOptions` +- `multipartFormRequestOptions` +- `createForm` + +Note that `Uploadable` & `toFile` **are** still exported: + +```typescript +import { type Uploadable, toFile } from 'openai/uploads'; +``` From 317a04d8d189ee33a9dd5308668296a708b391a8 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 25 Feb 2025 20:55:39 +0000 Subject: [PATCH 205/509] fix(tests): stop using node:stream --- tests/streaming.test.ts | 44 ++++++++++------------------------------- 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 5397c9dcb..857cf4620 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,6 +1,6 @@ -import { PassThrough } from 'stream'; import assert from 'assert'; import { _iterSSEMessages } from 'openai/streaming'; +import { ReadableStreamFrom } from 'openai/internal/shims'; describe('streaming decoding', () => { test('basic', async () => { @@ -10,7 +10,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -28,7 +28,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -47,7 +47,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -68,7 +68,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -96,7 +96,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -125,7 +125,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -146,7 +146,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -171,7 +171,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -204,7 +204,7 @@ describe('streaming decoding', () => { yield Buffer.from('\n'); } - const stream = _iterSSEMessages(new Response(await iteratorToStream(body())), new AbortController())[ + const stream = _iterSSEMessages(new Response(ReadableStreamFrom(body())), new AbortController())[ Symbol.asyncIterator ](); @@ -217,27 +217,3 @@ describe('streaming decoding', () => { expect(event.done).toBeTruthy(); }); }); - -async function iteratorToStream(iterator: AsyncGenerator): Promise { - const parts: unknown[] = []; - - for await (const chunk of iterator) { - parts.push(chunk); - } - - let index = 0; - - const stream = new PassThrough({ - read() { - const value = parts[index]; - if (value === undefined) { - stream.end(); - } else { - index += 1; - stream.write(value); - } - }, - }); - - return stream; -} From 0b77c7c9da64962fd50854be06661cdce549d326 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 26 Feb 2025 10:27:10 +0000 Subject: [PATCH 206/509] fix(threads): remove unused duplicative types --- src/resources/beta/threads/runs/runs.ts | 685 +----------------------- src/resources/beta/threads/threads.ts | 332 +----------- 2 files changed, 16 insertions(+), 1001 deletions(-) diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index b9708dc34..1aafffc92 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -938,13 +938,16 @@ export interface RunCancelParams { thread_id: string; } +export type RunCreateAndPollParams = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; + +export type RunCreateAndStreamParams = RunCreateParamsBaseStream; + +export type RunStreamParams = RunCreateParamsBaseStream; + export type RunSubmitToolOutputsParams = | RunSubmitToolOutputsParamsNonStreaming | RunSubmitToolOutputsParamsStreaming; -// TODO -// RunCreateAndPollParams - export interface RunSubmitToolOutputsParamsBase { /** * Path param: The ID of the @@ -956,630 +959,13 @@ export interface RunSubmitToolOutputsParamsBase { /** * Body param: A list of tools for which the outputs are being submitted. */ - additional_instructions?: string | null; - - /** - * Body param: If `true`, returns a stream of events that happen during the Run as - * server-sent events, terminating when the Run enters a terminal state with a - * `data: [DONE]` message. - */ - additional_messages?: Array | null; - - /** - * Overrides the - * [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) - * of the assistant. This is useful for modifying the behavior on a per-run basis. - */ - instructions?: string | null; - - /** - * The maximum number of completion tokens that may be used over the course of the - * run. The run will make a best effort to use only the number of completion tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_completion_tokens?: number | null; - - /** - * The maximum number of prompt tokens that may be used over the course of the run. - * The run will make a best effort to use only the number of prompt tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * prompt tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_prompt_tokens?: number | null; - - /** - * 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. - */ - metadata?: unknown | null; - - /** - * The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to - * be used to execute this run. If a value is provided here, it will override the - * model associated with the assistant. If not, the model associated with the - * assistant will be used. - */ - model?: - | (string & {}) - | 'gpt-4o' - | 'gpt-4o-2024-05-13' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - - /** - * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), - * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. - * - * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. - */ - response_format?: ThreadsAPI.AssistantResponseFormatOption | null; - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - * make the output more random, while lower values like 0.2 will make it more - * focused and deterministic. - */ - temperature?: number | null; - - /** - * Controls which (if any) tool is called by the model. `none` means the model will - * not call any tools and instead generates a message. `auto` is the default value - * and means the model can pick between generating a message or calling one or more - * tools. `required` means the model must call one or more tools before responding - * to the user. Specifying a particular tool like `{"type": "file_search"}` or - * `{"type": "function", "function": {"name": "my_function"}}` forces the model to - * call that tool. - */ - tool_choice?: ThreadsAPI.AssistantToolChoiceOption | null; - - /** - * Override the tools the assistant can use for this run. This is useful for - * modifying the behavior on a per-run basis. - */ - tools?: Array | null; - - /** - * An alternative to sampling with temperature, called nucleus sampling, where the - * model considers the results of the tokens with top_p probability mass. So 0.1 - * means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - top_p?: number | null; - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - truncation_strategy?: RunCreateAndPollParams.TruncationStrategy | null; -} - -export namespace RunCreateAndPollParams { - export interface AdditionalMessage { - /** - * The text contents of the message. - */ - content: string | Array; - - /** - * The role of the entity that is creating the message. Allowed values include: - * - * - `user`: Indicates the message is sent by an actual user and should be used in - * most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the assistant. Use this - * value to insert messages from the assistant into the conversation. - */ - role: 'user' | 'assistant'; - - /** - * A list of files attached to the message, and the tools they should be added to. - */ - attachments?: Array | null; - - /** - * 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. - */ - metadata?: unknown | null; - } - - export namespace AdditionalMessage { - export interface Attachment { - /** - * The ID of the file to attach to the message. - */ - file_id?: string; - - /** - * The tools to add this file to. - */ - tools?: Array; - } - } + tool_outputs: Array; /** * Body param: If `true`, returns a stream of events that happen during the Run as * server-sent events, terminating when the Run enters a terminal state with a * `data: [DONE]` message. */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } -} - -export interface RunCreateAndStreamParams { - /** - * The ID of the - * [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to - * execute this run. - */ - assistant_id: string; - /** - * Appends additional instructions at the end of the instructions for the run. This - * is useful for modifying the behavior on a per-run basis without overriding other - * instructions. - */ - additional_instructions?: string | null; - - /** - * Adds additional messages to the thread before creating the run. - */ - additional_messages?: Array | null; - - /** - * Overrides the - * [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) - * of the assistant. This is useful for modifying the behavior on a per-run basis. - */ - instructions?: string | null; - - /** - * The maximum number of completion tokens that may be used over the course of the - * run. The run will make a best effort to use only the number of completion tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_completion_tokens?: number | null; - - /** - * The maximum number of prompt tokens that may be used over the course of the run. - * The run will make a best effort to use only the number of prompt tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * prompt tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_prompt_tokens?: number | null; - - /** - * 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. - */ - metadata?: unknown | null; - - /** - * The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to - * be used to execute this run. If a value is provided here, it will override the - * model associated with the assistant. If not, the model associated with the - * assistant will be used. - */ - model?: - | (string & {}) - | 'gpt-4o' - | 'gpt-4o-2024-05-13' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - - /** - * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), - * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. - * - * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. - */ - response_format?: ThreadsAPI.AssistantResponseFormatOption | null; - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - * make the output more random, while lower values like 0.2 will make it more - * focused and deterministic. - */ - temperature?: number | null; - - /** - * Controls which (if any) tool is called by the model. `none` means the model will - * not call any tools and instead generates a message. `auto` is the default value - * and means the model can pick between generating a message or calling one or more - * tools. `required` means the model must call one or more tools before responding - * to the user. Specifying a particular tool like `{"type": "file_search"}` or - * `{"type": "function", "function": {"name": "my_function"}}` forces the model to - * call that tool. - */ - tool_choice?: ThreadsAPI.AssistantToolChoiceOption | null; - - /** - * Override the tools the assistant can use for this run. This is useful for - * modifying the behavior on a per-run basis. - */ - tools?: Array | null; - - /** - * An alternative to sampling with temperature, called nucleus sampling, where the - * model considers the results of the tokens with top_p probability mass. So 0.1 - * means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - top_p?: number | null; - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - truncation_strategy?: RunCreateAndStreamParams.TruncationStrategy | null; -} - -export namespace RunCreateAndStreamParams { - export interface AdditionalMessage { - /** - * The text contents of the message. - */ - content: string | Array; - - /** - * The role of the entity that is creating the message. Allowed values include: - * - * - `user`: Indicates the message is sent by an actual user and should be used in - * most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the assistant. Use this - * value to insert messages from the assistant into the conversation. - */ - role: 'user' | 'assistant'; - - /** - * A list of files attached to the message, and the tools they should be added to. - */ - attachments?: Array | null; - - /** - * 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. - */ - metadata?: unknown | null; - } - - export namespace AdditionalMessage { - export interface Attachment { - /** - * The ID of the file to attach to the message. - */ - file_id?: string; - - /** - * The tools to add this file to. - */ - tools?: Array; - } - } - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } -} - -export interface RunStreamParams { - /** - * The ID of the - * [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to - * execute this run. - */ - assistant_id: string; - - /** - * Appends additional instructions at the end of the instructions for the run. This - * is useful for modifying the behavior on a per-run basis without overriding other - * instructions. - */ - additional_instructions?: string | null; - - /** - * Adds additional messages to the thread before creating the run. - */ - additional_messages?: Array | null; - - /** - * Overrides the - * [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) - * of the assistant. This is useful for modifying the behavior on a per-run basis. - */ - instructions?: string | null; - - /** - * The maximum number of completion tokens that may be used over the course of the - * run. The run will make a best effort to use only the number of completion tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_completion_tokens?: number | null; - - /** - * The maximum number of prompt tokens that may be used over the course of the run. - * The run will make a best effort to use only the number of prompt tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * prompt tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_prompt_tokens?: number | null; - - /** - * 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. - */ - metadata?: unknown | null; - - /** - * The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to - * be used to execute this run. If a value is provided here, it will override the - * model associated with the assistant. If not, the model associated with the - * assistant will be used. - */ - model?: - | (string & {}) - | 'gpt-4o' - | 'gpt-4o-2024-05-13' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - - /** - * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), - * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. - * - * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. - */ - response_format?: ThreadsAPI.AssistantResponseFormatOption | null; - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - * make the output more random, while lower values like 0.2 will make it more - * focused and deterministic. - */ - temperature?: number | null; - - /** - * Controls which (if any) tool is called by the model. `none` means the model will - * not call any tools and instead generates a message. `auto` is the default value - * and means the model can pick between generating a message or calling one or more - * tools. `required` means the model must call one or more tools before responding - * to the user. Specifying a particular tool like `{"type": "file_search"}` or - * `{"type": "function", "function": {"name": "my_function"}}` forces the model to - * call that tool. - */ - tool_choice?: ThreadsAPI.AssistantToolChoiceOption | null; - - /** - * Override the tools the assistant can use for this run. This is useful for - * modifying the behavior on a per-run basis. - */ - tools?: Array | null; - - /** - * An alternative to sampling with temperature, called nucleus sampling, where the - * model considers the results of the tokens with top_p probability mass. So 0.1 - * means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - top_p?: number | null; - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - truncation_strategy?: RunStreamParams.TruncationStrategy | null; -} - -export namespace RunStreamParams { - export interface AdditionalMessage { - /** - * The text contents of the message. - */ - content: string | Array; - - /** - * The role of the entity that is creating the message. Allowed values include: - * - * - `user`: Indicates the message is sent by an actual user and should be used in - * most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the assistant. Use this - * value to insert messages from the assistant into the conversation. - */ - role: 'user' | 'assistant'; - - /** - * A list of files attached to the message, and the tools they should be added to. - */ - attachments?: Array | null; - - /** - * 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. - */ - metadata?: unknown | null; - } - - export namespace AdditionalMessage { - export interface Attachment { - /** - * The ID of the file to attach to the message. - */ - file_id?: string; - - /** - * The tools to add this file to. - */ - tools?: Array; - } - } - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } -} - -export interface RunSubmitToolOutputsParamsBase { - /** - * A list of tools for which the outputs are being submitted. - */ - tool_outputs: Array; - - /** - * If `true`, returns a stream of events that happen during the Run as server-sent - * events, terminating when the Run enters a terminal state with a `data: [DONE]` - * message. - */ stream?: boolean | null; } @@ -1603,65 +989,24 @@ export namespace RunSubmitToolOutputsParams { export interface RunSubmitToolOutputsParamsNonStreaming extends RunSubmitToolOutputsParamsBase { /** - * If `true`, returns a stream of events that happen during the Run as server-sent - * events, terminating when the Run enters a terminal state with a `data: [DONE]` - * message. + * Body param: If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. */ stream?: false | null; } export interface RunSubmitToolOutputsParamsStreaming extends RunSubmitToolOutputsParamsBase { /** - * If `true`, returns a stream of events that happen during the Run as server-sent - * events, terminating when the Run enters a terminal state with a `data: [DONE]` - * message. + * Body param: If `true`, returns a stream of events that happen during the Run as + * server-sent events, terminating when the Run enters a terminal state with a + * `data: [DONE]` message. */ stream: true; } -export interface RunSubmitToolOutputsAndPollParams { - /** - * A list of tools for which the outputs are being submitted. - */ - tool_outputs: Array; -} - -export namespace RunSubmitToolOutputsAndPollParams { - export interface ToolOutput { - /** - * The output of the tool call to be submitted to continue the run. - */ - output?: string; - - /** - * The ID of the tool call in the `required_action` object within the run object - * the output is being submitted for. - */ - tool_call_id?: string; - } -} - -export interface RunSubmitToolOutputsStreamParams { - /** - * A list of tools for which the outputs are being submitted. - */ - tool_outputs: Array; -} - -export namespace RunSubmitToolOutputsStreamParams { - export interface ToolOutput { - /** - * The output of the tool call to be submitted to continue the run. - */ - output?: string; - - /** - * The ID of the tool call in the `required_action` object within the run object - * the output is being submitted for. - */ - tool_call_id?: string; - } -} +export type RunSubmitToolOutputsAndPollParams = RunSubmitToolOutputsParamsNonStreaming; +export type RunSubmitToolOutputsStreamParams = RunSubmitToolOutputsParamsStream; Runs.Steps = Steps; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index b7ae889a6..be1014f68 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -1223,337 +1223,7 @@ export namespace ThreadCreateAndRunPollParams { } } -export interface ThreadCreateAndRunStreamParams { - /** - * The ID of the - * [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to - * execute this run. - */ - assistant_id: string; - - /** - * Override the default system message of the assistant. This is useful for - * modifying the behavior on a per-run basis. - */ - instructions?: string | null; - - /** - * The maximum number of completion tokens that may be used over the course of the - * run. The run will make a best effort to use only the number of completion tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * completion tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_completion_tokens?: number | null; - - /** - * The maximum number of prompt tokens that may be used over the course of the run. - * The run will make a best effort to use only the number of prompt tokens - * specified, across multiple turns of the run. If the run exceeds the number of - * prompt tokens specified, the run will end with status `incomplete`. See - * `incomplete_details` for more info. - */ - max_prompt_tokens?: number | null; - - /** - * 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. - */ - metadata?: unknown | null; - - /** - * The ID of the [Model](https://platform.openai.com/docs/api-reference/models) to - * be used to execute this run. If a value is provided here, it will override the - * model associated with the assistant. If not, the model associated with the - * assistant will be used. - */ - model?: - | (string & {}) - | 'gpt-4o' - | 'gpt-4o-2024-05-13' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613' - | null; - - /** - * Specifies the format that the model must output. Compatible with - * [GPT-4o](https://platform.openai.com/docs/models/gpt-4o), - * [GPT-4 Turbo](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4), - * and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. - * - * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. - */ - response_format?: AssistantResponseFormatOption | null; - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will - * make the output more random, while lower values like 0.2 will make it more - * focused and deterministic. - */ - temperature?: number | null; - - /** - * If no thread is provided, an empty thread will be created. - */ - thread?: ThreadCreateAndRunStreamParams.Thread; - - /** - * Controls which (if any) tool is called by the model. `none` means the model will - * not call any tools and instead generates a message. `auto` is the default value - * and means the model can pick between generating a message or calling one or more - * tools. `required` means the model must call one or more tools before responding - * to the user. Specifying a particular tool like `{"type": "file_search"}` or - * `{"type": "function", "function": {"name": "my_function"}}` forces the model to - * call that tool. - */ - tool_choice?: AssistantToolChoiceOption | null; - - /** - * A set of resources that are used by the assistant's tools. The resources are - * specific to the type of tool. For example, the `code_interpreter` tool requires - * a list of file IDs, while the `file_search` tool requires a list of vector store - * IDs. - */ - tool_resources?: ThreadCreateAndRunStreamParams.ToolResources | null; - - /** - * Override the tools the assistant can use for this run. This is useful for - * modifying the behavior on a per-run basis. - */ - tools?: Array< - AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool - > | null; - - /** - * An alternative to sampling with temperature, called nucleus sampling, where the - * model considers the results of the tokens with top_p probability mass. So 0.1 - * means only the tokens comprising the top 10% probability mass are considered. - * - * We generally recommend altering this or temperature but not both. - */ - top_p?: number | null; - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - truncation_strategy?: ThreadCreateAndRunStreamParams.TruncationStrategy | null; -} - -export namespace ThreadCreateAndRunStreamParams { - /** - * If no thread is provided, an empty thread will be created. - */ - export interface Thread { - /** - * A list of [messages](https://platform.openai.com/docs/api-reference/messages) to - * start the thread with. - */ - messages?: Array; - - /** - * 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. - */ - metadata?: unknown | null; - - /** - * A set of resources that are made available to the assistant's tools in this - * thread. The resources are specific to the type of tool. For example, the - * `code_interpreter` tool requires a list of file IDs, while the `file_search` - * tool requires a list of vector store IDs. - */ - tool_resources?: Thread.ToolResources | null; - } - - export namespace Thread { - export interface Message { - /** - * The text contents of the message. - */ - content: string | Array; - - /** - * The role of the entity that is creating the message. Allowed values include: - * - * - `user`: Indicates the message is sent by an actual user and should be used in - * most cases to represent user-generated messages. - * - `assistant`: Indicates the message is generated by the assistant. Use this - * value to insert messages from the assistant into the conversation. - */ - role: 'user' | 'assistant'; - - /** - * A list of files attached to the message, and the tools they should be added to. - */ - attachments?: Array | null; - - /** - * 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. - */ - metadata?: unknown | null; - } - - export namespace Message { - export interface Attachment { - /** - * The ID of the file to attach to the message. - */ - file_id?: string; - - /** - * The tools to add this file to. - */ - tools?: Array; - } - } - - /** - * A set of resources that are made available to the assistant's tools in this - * thread. The resources are specific to the type of tool. For example, the - * `code_interpreter` tool requires a list of file IDs, while the `file_search` - * tool requires a list of vector store IDs. - */ - export interface ToolResources { - code_interpreter?: ToolResources.CodeInterpreter; - - file_search?: ToolResources.FileSearch; - } - - export namespace ToolResources { - export interface CodeInterpreter { - /** - * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made - * available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - file_ids?: Array; - } - - export interface FileSearch { - /** - * The - * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) - * attached to this thread. There can be a maximum of 1 vector store attached to - * the thread. - */ - vector_store_ids?: Array; - - /** - * A helper to create a - * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) - * with file_ids and attach it to this thread. There can be a maximum of 1 vector - * store attached to the thread. - */ - vector_stores?: Array; - } - - export namespace FileSearch { - export interface VectorStore { - /** - * 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. - */ - 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. - */ - metadata?: unknown; - } - } - } - } - - /** - * A set of resources that are used by the assistant's tools. The resources are - * specific to the type of tool. For example, the `code_interpreter` tool requires - * a list of file IDs, while the `file_search` tool requires a list of vector store - * IDs. - */ - export interface ToolResources { - code_interpreter?: ToolResources.CodeInterpreter; - - file_search?: ToolResources.FileSearch; - } - - export namespace ToolResources { - export interface CodeInterpreter { - /** - * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made - * available to the `code_interpreter` tool. There can be a maximum of 20 files - * associated with the tool. - */ - file_ids?: Array; - } - - export interface FileSearch { - /** - * The ID of the - * [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) - * attached to this assistant. There can be a maximum of 1 vector store attached to - * the assistant. - */ - vector_store_ids?: Array; - } - } - - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } -} +export type ThreadCreateAndRunStreamParams = ThreadCreateAndRunParamsBaseStream; Threads.Runs = Runs; Threads.Messages = Messages; From bb269a1a6fda11c533fb88fa1250a342a5a11ed0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 20:05:21 +0000 Subject: [PATCH 207/509] feat(api): add gpt-4.5-preview (#1349) --- .stats.yml | 2 +- src/resources/beta/assistants.ts | 2 ++ src/resources/beta/realtime/realtime.ts | 24 +++++++++++++++++------- src/resources/beta/realtime/sessions.ts | 24 ++++++++++++++++++++++-- src/resources/chat/chat.ts | 2 ++ src/resources/files.ts | 5 +++++ src/resources/uploads/uploads.ts | 2 +- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 658877d3b..163146e38 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 74 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0cc63d691..919bf53b3 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1310,6 +1310,8 @@ export interface AssistantUpdateParams { | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-0125-preview' diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index e46dcdaaf..5e2b1c833 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -1796,11 +1796,14 @@ export interface SessionCreatedEvent { /** * Send this event to update the session’s default configuration. The client may - * send this event at any time to update the session configuration, and any field - * may be updated at any time, except for "voice". The server will respond with a - * `session.updated` event that shows the full effective configuration. Only fields - * that are present are updated, thus the correct way to clear a field like - * "instructions" is to pass an empty string. + * send this event at any time to update any field, except for `voice`. However, + * note that once a session has been initialized with a particular `model`, it + * can’t be changed to another model using `session.update`. + * + * When the server receives a `session.update`, it will respond with a + * `session.updated` event showing the full, effective configuration. Only the + * fields that are present are updated. To clear a field like `instructions`, pass + * an empty string. */ export interface SessionUpdateEvent { /** @@ -1982,11 +1985,18 @@ export namespace SessionUpdateEvent { */ export interface TurnDetection { /** - * Whether or not to automatically generate a response when VAD is enabled. `true` - * by default. + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. */ create_response?: boolean; + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index d2afa25b1..a99c9e045 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -168,6 +168,19 @@ export namespace Session { * volume and respond at the end of user speech. */ export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. + */ + create_response?: boolean; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. @@ -532,11 +545,18 @@ export namespace SessionCreateParams { */ export interface TurnDetection { /** - * Whether or not to automatically generate a response when VAD is enabled. `true` - * by default. + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. */ create_response?: boolean; + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 5bceec45a..627b4fc23 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -61,6 +61,8 @@ export type ChatModel = | 'o1-preview-2024-09-12' | 'o1-mini' | 'o1-mini-2024-09-12' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' | 'gpt-4o' | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' diff --git a/src/resources/files.ts b/src/resources/files.ts index 67bc95469..f5f23dcad 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -173,6 +173,11 @@ export interface FileObject { */ status: 'uploaded' | 'processed' | 'error'; + /** + * The Unix timestamp (in seconds) for when the file will expire. + */ + expires_at?: number; + /** * @deprecated Deprecated. For details on why a fine-tuning training file failed * validation, see the `error` field on `fine_tuning.job`. diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index bfe752cd7..f977e18f6 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -86,7 +86,7 @@ export interface Upload { created_at: number; /** - * The Unix timestamp (in seconds) for when the Upload was created. + * The Unix timestamp (in seconds) for when the Upload will expire. */ expires_at: number; From f93c5bc81d2b58dd821b9c11a789d2750951837d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 20:05:52 +0000 Subject: [PATCH 208/509] release: 4.86.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6fc92ed1e..28ebbc3ab 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.85.4" + ".": "4.86.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e2f920af7..48445f98a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.86.0 (2025-02-27) + +Full Changelog: [v4.85.4...v4.86.0](https://github.com/openai/openai-node/compare/v4.85.4...v4.86.0) + +### Features + +* **api:** add gpt-4.5-preview ([#1349](https://github.com/openai/openai-node/issues/1349)) ([2a1d36b](https://github.com/openai/openai-node/commit/2a1d36b560323fca058f98607775642370e90a47)) + ## 4.85.4 (2025-02-22) Full Changelog: [v4.85.3...v4.85.4](https://github.com/openai/openai-node/compare/v4.85.3...v4.85.4) diff --git a/jsr.json b/jsr.json index 7ced58a9c..28a13dd6b 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.85.4", + "version": "4.86.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 38572079f..be7052b15 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.85.4", + "version": "4.86.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index ebfb680f1..d342ca5d3 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.85.4'; // x-release-please-version +export const VERSION = '4.86.0'; // x-release-please-version From 634a209a6025640e2849133f6997af8faa28d4d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:00:53 +0000 Subject: [PATCH 209/509] docs: update URLs from stainlessapi.com to stainless.com (#1352) More details at https://www.stainless.com/changelog/stainless-com --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index c54acaf33..3b3bd8a66 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure From 0d3045ea19e34712fb395000545fcce3f9201149 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Feb 2025 22:01:25 +0000 Subject: [PATCH 210/509] release: 4.86.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 28ebbc3ab..92b3782ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.86.0" + ".": "4.86.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 48445f98a..9dd57c5ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.86.1 (2025-02-27) + +Full Changelog: [v4.86.0...v4.86.1](https://github.com/openai/openai-node/compare/v4.86.0...v4.86.1) + +### Documentation + +* update URLs from stainlessapi.com to stainless.com ([#1352](https://github.com/openai/openai-node/issues/1352)) ([8294e9e](https://github.com/openai/openai-node/commit/8294e9ef57ed98722105b56d205ebea9d028f671)) + ## 4.86.0 (2025-02-27) Full Changelog: [v4.85.4...v4.86.0](https://github.com/openai/openai-node/compare/v4.85.4...v4.86.0) diff --git a/jsr.json b/jsr.json index 28a13dd6b..c3addf639 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.86.0", + "version": "4.86.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index be7052b15..236815732 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.86.0", + "version": "4.86.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index d342ca5d3..759b28a99 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.86.0'; // x-release-please-version +export const VERSION = '4.86.1'; // x-release-please-version From 1d4478d7935028e20a9d9d11ff29ff8b991c44f9 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 27 Feb 2025 20:05:26 +0000 Subject: [PATCH 211/509] feat(api): add gpt-4.5-preview --- .stats.yml | 2 +- src/resources/beta/assistants.ts | 2 ++ src/resources/beta/realtime/realtime.ts | 24 +++++++++++++++++------- src/resources/beta/realtime/sessions.ts | 24 ++++++++++++++++++++++-- src/resources/chat/chat.ts | 2 ++ src/resources/files.ts | 5 +++++ src/resources/uploads/uploads.ts | 2 +- 7 files changed, 50 insertions(+), 11 deletions(-) diff --git a/.stats.yml b/.stats.yml index 658877d3b..163146e38 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 74 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4aa6ee65ba9efc789e05e6a5ef0883b2cadf06def8efd863dbf75e9e233067e1.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index f6f8f4297..0e109deed 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1300,6 +1300,8 @@ export interface AssistantUpdateParams { | 'gpt-4o-2024-05-13' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-0125-preview' diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index e46dcdaaf..5e2b1c833 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -1796,11 +1796,14 @@ export interface SessionCreatedEvent { /** * Send this event to update the session’s default configuration. The client may - * send this event at any time to update the session configuration, and any field - * may be updated at any time, except for "voice". The server will respond with a - * `session.updated` event that shows the full effective configuration. Only fields - * that are present are updated, thus the correct way to clear a field like - * "instructions" is to pass an empty string. + * send this event at any time to update any field, except for `voice`. However, + * note that once a session has been initialized with a particular `model`, it + * can’t be changed to another model using `session.update`. + * + * When the server receives a `session.update`, it will respond with a + * `session.updated` event showing the full, effective configuration. Only the + * fields that are present are updated. To clear a field like `instructions`, pass + * an empty string. */ export interface SessionUpdateEvent { /** @@ -1982,11 +1985,18 @@ export namespace SessionUpdateEvent { */ export interface TurnDetection { /** - * Whether or not to automatically generate a response when VAD is enabled. `true` - * by default. + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. */ create_response?: boolean; + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 8d9140bf9..0ece95bcd 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -170,6 +170,19 @@ export namespace Session { * volume and respond at the end of user speech. */ export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. + */ + create_response?: boolean; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. @@ -534,11 +547,18 @@ export namespace SessionCreateParams { */ export interface TurnDetection { /** - * Whether or not to automatically generate a response when VAD is enabled. `true` - * by default. + * Whether or not to automatically generate a response when a VAD stop event + * occurs. `true` by default. */ create_response?: boolean; + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. `true` by default. + */ + interrupt_response?: boolean; + /** * Amount of audio to include before the VAD detected speech (in milliseconds). * Defaults to 300ms. diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 0c7dae3ef..40358c331 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -55,6 +55,8 @@ export type ChatModel = | 'o1-preview-2024-09-12' | 'o1-mini' | 'o1-mini-2024-09-12' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' | 'gpt-4o' | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' diff --git a/src/resources/files.ts b/src/resources/files.ts index 759cc9cb2..56bafc224 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -162,6 +162,11 @@ export interface FileObject { */ status: 'uploaded' | 'processed' | 'error'; + /** + * The Unix timestamp (in seconds) for when the file will expire. + */ + expires_at?: number; + /** * @deprecated Deprecated. For details on why a fine-tuning training file failed * validation, see the `error` field on `fine_tuning.job`. diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 8bd783c4d..a2f1b5250 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -84,7 +84,7 @@ export interface Upload { created_at: number; /** - * The Unix timestamp (in seconds) for when the Upload was created. + * The Unix timestamp (in seconds) for when the Upload will expire. */ expires_at: number; From e4e737d90718d077c266e4c382a1535fc4bf1c69 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 27 Feb 2025 22:00:58 +0000 Subject: [PATCH 212/509] docs: update URLs from stainlessapi.com to stainless.com More details at https://www.stainless.com/changelog/stainless-com --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index c54acaf33..3b3bd8a66 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Reporting Security Issues -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. -To report a security issue, please contact the Stainless team at security@stainlessapi.com. +To report a security issue, please contact the Stainless team at security@stainless.com. ## Responsible Disclosure From ebd464f5ad07f440ad476c0a7ce733947da414e2 Mon Sep 17 00:00:00 2001 From: Em Date: Thu, 27 Feb 2025 19:59:34 -0500 Subject: [PATCH 213/509] chore(tests): stop using node-fetch, don't directly upload FormDataFile --- .../cloudflare-worker/package-lock.json | 87 ------- .../cloudflare-worker/package.json | 3 - .../cloudflare-worker/tests/test.js | 2 - ecosystem-tests/deno/package-lock.json | 98 -------- ecosystem-tests/node-js/package-lock.json | 235 +----------------- ecosystem-tests/node-js/package.json | 5 +- .../node-ts-cjs-auto/package-lock.json | 112 --------- ecosystem-tests/node-ts-cjs-auto/package.json | 2 - .../node-ts-cjs-auto/tests/test.ts | 24 +- .../node-ts-cjs-web/package-lock.json | 211 +++++++--------- ecosystem-tests/node-ts-cjs-web/package.json | 10 +- .../node-ts-cjs-web/tests/test-jsdom.ts | 5 +- ecosystem-tests/node-ts-cjs/package-lock.json | 197 +++++++++------ ecosystem-tests/node-ts-cjs/package.json | 18 +- .../node-ts-cjs/tests/test-jsdom.ts | 7 +- .../node-ts-cjs/tests/test-node.ts | 40 +-- ecosystem-tests/node-ts-cjs/tsconfig.json | 2 +- .../node-ts-cjs/tsconfig.nodenext.json | 4 +- .../node-ts-esm-auto/package-lock.json | 69 +---- ecosystem-tests/node-ts-esm-auto/package.json | 3 +- .../node-ts-esm-auto/tests/test.ts | 25 +- .../node-ts-esm-web/package-lock.json | 69 +---- ecosystem-tests/node-ts-esm-web/package.json | 3 +- ecosystem-tests/node-ts-esm/package-lock.json | 69 +---- ecosystem-tests/node-ts-esm/package.json | 3 +- .../node-ts-esm/tests/test-esnext.ts | 1 - ecosystem-tests/node-ts-esm/tests/test.ts | 25 +- .../node-ts4.5-jest28/package-lock.json | 112 --------- .../node-ts4.5-jest28/package.json | 2 - .../node-ts4.5-jest28/tests/test.ts | 25 +- ecosystem-tests/vercel-edge/tests/test.ts | 5 +- 31 files changed, 303 insertions(+), 1170 deletions(-) delete mode 100644 ecosystem-tests/deno/package-lock.json diff --git a/ecosystem-tests/cloudflare-worker/package-lock.json b/ecosystem-tests/cloudflare-worker/package-lock.json index e359caaf0..51cd6aee3 100644 --- a/ecosystem-tests/cloudflare-worker/package-lock.json +++ b/ecosystem-tests/cloudflare-worker/package-lock.json @@ -7,9 +7,6 @@ "": { "name": "cfw", "version": "0.0.0", - "dependencies": { - "node-fetch": "^3.3.1" - }, "devDependencies": { "@cloudflare/workers-types": "^4.20230419.0", "fastest-levenshtein": "^1.0.16", @@ -2279,14 +2276,6 @@ "node": ">= 8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -2572,28 +2561,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2653,17 +2620,6 @@ "node": ">= 6" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/from": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", @@ -4023,41 +3979,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -5018,14 +4939,6 @@ "makeerror": "1.0.12" } }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/ecosystem-tests/cloudflare-worker/package.json b/ecosystem-tests/cloudflare-worker/package.json index 64fa0ad25..bec1aab03 100644 --- a/ecosystem-tests/cloudflare-worker/package.json +++ b/ecosystem-tests/cloudflare-worker/package.json @@ -18,8 +18,5 @@ "ts-jest": "^29.1.0", "typescript": "5.0.4", "wrangler": "^3.74.0" - }, - "dependencies": { - "node-fetch": "^3.3.1" } } diff --git a/ecosystem-tests/cloudflare-worker/tests/test.js b/ecosystem-tests/cloudflare-worker/tests/test.js index 3a1ca3ea1..69981a0bb 100644 --- a/ecosystem-tests/cloudflare-worker/tests/test.js +++ b/ecosystem-tests/cloudflare-worker/tests/test.js @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - it( 'works', async () => { diff --git a/ecosystem-tests/deno/package-lock.json b/ecosystem-tests/deno/package-lock.json deleted file mode 100644 index 99ead654a..000000000 --- a/ecosystem-tests/deno/package-lock.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "deno", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/.deno/asynckit@0.4.0/node_modules/asynckit": { - "version": "0.4.0", - "extraneous": true, - "license": "MIT", - "devDependencies": { - "browserify": "^13.0.0", - "browserify-istanbul": "^2.0.0", - "coveralls": "^2.11.9", - "eslint": "^2.9.0", - "istanbul": "^0.4.3", - "obake": "^0.1.2", - "phantomjs-prebuilt": "^2.1.7", - "pre-commit": "^1.1.3", - "reamde": "^1.1.0", - "rimraf": "^2.5.2", - "size-table": "^0.2.0", - "tap-spec": "^4.1.1", - "tape": "^4.5.1" - } - }, - "node_modules/.deno/axios@0.26.1": {}, - "node_modules/.deno/combined-stream@1.0.8": {}, - "node_modules/.deno/delayed-stream@1.0.0/node_modules/delayed-stream": { - "version": "1.0.0", - "extraneous": true, - "license": "MIT", - "devDependencies": { - "fake": "0.2.0", - "far": "0.0.1" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/.deno/follow-redirects@1.15.2/node_modules/follow-redirects": { - "version": "1.15.2", - "extraneous": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "devDependencies": { - "concat-stream": "^2.0.0", - "eslint": "^5.16.0", - "express": "^4.16.4", - "lolex": "^3.1.0", - "mocha": "^6.0.2", - "nyc": "^14.1.1" - }, - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/.deno/form-data@4.0.0": {}, - "node_modules/.deno/mime-db@1.52.0/node_modules/mime-db": { - "version": "1.52.0", - "extraneous": true, - "license": "MIT", - "devDependencies": { - "bluebird": "3.7.2", - "co": "4.6.0", - "cogent": "1.0.1", - "csv-parse": "4.16.3", - "eslint": "7.32.0", - "eslint-config-standard": "15.0.1", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-markdown": "2.2.1", - "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "5.1.1", - "eslint-plugin-standard": "4.1.0", - "gnode": "0.1.2", - "media-typer": "1.1.0", - "mocha": "9.2.1", - "nyc": "15.1.0", - "raw-body": "2.5.0", - "stream-to-array": "2.3.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/.deno/mime-types@2.1.35": {}, - "node_modules/.deno/openai@3.3.0": {} - } -} diff --git a/ecosystem-tests/node-js/package-lock.json b/ecosystem-tests/node-js/package-lock.json index bb59ccb92..064116bdb 100644 --- a/ecosystem-tests/node-js/package-lock.json +++ b/ecosystem-tests/node-js/package-lock.json @@ -5,240 +5,9 @@ "requires": true, "packages": { "": { - "name": "foo", + "name": "node-js", "version": "1.0.0", - "license": "ISC", - "dependencies": { - "openai": "^4.40.1" - } - }, - "node_modules/@types/node": { - "version": "18.19.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.31.tgz", - "integrity": "sha512-ArgCD39YpyyrtFKIqMDvjz79jto5fcI/SVUs2HwB+f0dAzq68yqOdyaSivLiLugSziTpNXLQrVb7RZFmdZzbhA==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/agentkeepalive": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", - "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", - "dependencies": { - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "engines": { - "node": ">=6" - } - }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==" - }, - "node_modules/formdata-node": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", - "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.3" - }, - "engines": { - "node": ">= 12.20" - } - }, - "node_modules/formdata-node/node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", - "engines": { - "node": ">= 14" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/openai": { - "version": "4.40.1", - "resolved": "https://registry.npmjs.org/openai/-/openai-4.40.1.tgz", - "integrity": "sha512-mS7LerF4fY1/we0aKGGwIWtosTJFLKuNbBWMBR/G1TAZUHoktAdod0dqIrlQvSD39uS6jNEEbT7jRsXmzfEPBw==", - "dependencies": { - "@types/node": "^18.11.18", - "@types/node-fetch": "^2.6.4", - "abort-controller": "^3.0.0", - "agentkeepalive": "^4.2.1", - "form-data-encoder": "1.7.2", - "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7", - "web-streams-polyfill": "^3.2.1" - }, - "bin": { - "openai": "bin/cli" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - }, - "node_modules/web-streams-polyfill": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", - "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", - "engines": { - "node": ">= 8" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } + "license": "ISC" } } } diff --git a/ecosystem-tests/node-js/package.json b/ecosystem-tests/node-js/package.json index 63f858014..eeb432712 100644 --- a/ecosystem-tests/node-js/package.json +++ b/ecosystem-tests/node-js/package.json @@ -7,8 +7,5 @@ "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", - "license": "ISC", - "dependencies": { - "openai": "^4.40.1" - } + "license": "ISC" } diff --git a/ecosystem-tests/node-ts-cjs-auto/package-lock.json b/ecosystem-tests/node-ts-cjs-auto/package-lock.json index c3880beb2..68233e13b 100644 --- a/ecosystem-tests/node-ts-cjs-auto/package-lock.json +++ b/ecosystem-tests/node-ts-cjs-auto/package-lock.json @@ -9,12 +9,10 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { "@types/node": "^20.4.2", - "@types/node-fetch": "^2.6.1", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", "jest": "^28.1.3", @@ -1101,16 +1099,6 @@ "undici-types": "~5.26.4" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "dev": true, - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, "node_modules/@types/prettier": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", @@ -1208,12 +1196,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, "node_modules/babel-jest": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-28.1.3.tgz", @@ -1524,18 +1506,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1594,15 +1564,6 @@ "node": ">=0.10.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -1782,20 +1743,6 @@ "node": ">=8" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/formdata-node": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", @@ -2886,27 +2833,6 @@ "node": ">=8.6" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -2966,25 +2892,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3551,11 +3458,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/ts-jest": { "version": "28.0.8", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-28.0.8.tgz", @@ -3754,20 +3656,6 @@ "node": ">= 14" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/ecosystem-tests/node-ts-cjs-auto/package.json b/ecosystem-tests/node-ts-cjs-auto/package.json index 17e4ae9e6..44f55d778 100644 --- a/ecosystem-tests/node-ts-cjs-auto/package.json +++ b/ecosystem-tests/node-ts-cjs-auto/package.json @@ -9,12 +9,10 @@ }, "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { "@types/node": "^20.4.2", - "@types/node-fetch": "^2.6.1", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", "jest": "^28.1.3", diff --git a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts index e99ca56b6..7782ae1d2 100644 --- a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts +++ b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts @@ -1,6 +1,5 @@ import OpenAI, { APIUserAbortError, toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; -import fetch from 'node-fetch'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; @@ -154,17 +153,6 @@ it(`aborting ChatCompletionStream works`, async function () { expect(contents.length).toBeGreaterThan(0); }); -it('handles formdata-node File', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - .then((x) => new FormDataFile([x], filename)); - - const params: TranscriptionCreateParams = { file, model }; - - const result = await client.audio.transcriptions.create(params); - expect(result.text).toBeSimilarTo(correctAnswer, 12); -}); - it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) @@ -238,4 +226,16 @@ describe('toFile', () => { }); expect(result.filename).toEqual('finetune.jsonl'); }); + it('handles formdata-node File', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => toFile(new FormDataFile([x], filename))); + + expect(file.name).toEqual(filename); + + const params: TranscriptionCreateParams = { file, model }; + + const result = await client.audio.transcriptions.create(params); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); }); diff --git a/ecosystem-tests/node-ts-cjs-web/package-lock.json b/ecosystem-tests/node-ts-cjs-web/package-lock.json index b1624036b..48980c2f8 100644 --- a/ecosystem-tests/node-ts-cjs-web/package-lock.json +++ b/ecosystem-tests/node-ts-cjs-web/package-lock.json @@ -9,21 +9,15 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { "@types/node": "^18.0.0", - "@types/node-fetch": "^2.6.1", "fastest-levenshtein": "^1.0.16", - "formdata-polyfill": "^4.0.10", "jest": "^29.5.0", - "jest-environment-jsdom": "^29.7.0", - "text-encoding-polyfill": "^0.6.7", + "jest-fixed-jsdom": "^0.0.9", "ts-jest": "^29.1.0", - "typescript": "4.7.4", - "web-streams-polyfill": "^3.2.1", - "whatwg-fetch": "^3.6.19" + "typescript": "4.7.4" } }, "node_modules/@ampproject/remapping": { @@ -1047,6 +1041,7 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", "dev": true, + "peer": true, "engines": { "node": ">= 10" } @@ -1130,6 +1125,7 @@ "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", "dev": true, + "peer": true, "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", @@ -1146,16 +1142,6 @@ "undici-types": "~5.26.4" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "dev": true, - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, "node_modules/@types/stack-utils": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", @@ -1166,7 +1152,8 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.3.tgz", "integrity": "sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/yargs": { "version": "17.0.24", @@ -1187,13 +1174,15 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1206,6 +1195,7 @@ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", "dev": true, + "peer": true, "dependencies": { "acorn": "^8.1.0", "acorn-walk": "^8.0.2" @@ -1216,6 +1206,7 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -1225,6 +1216,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "peer": true, "dependencies": { "debug": "4" }, @@ -1297,7 +1289,8 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "dev": true, + "peer": true }, "node_modules/babel-jest": { "version": "29.7.0", @@ -1630,6 +1623,7 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -1688,13 +1682,15 @@ "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", "dev": true, + "peer": true, "dependencies": { "cssom": "~0.3.6" }, @@ -1706,13 +1702,15 @@ "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", "dev": true, + "peer": true, "dependencies": { "abab": "^2.0.6", "whatwg-mimetype": "^3.0.0", @@ -1727,6 +1725,7 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "dev": true, + "peer": true, "dependencies": { "punycode": "^2.1.1" }, @@ -1739,6 +1738,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -1748,6 +1748,7 @@ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", "dev": true, + "peer": true, "dependencies": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -1777,7 +1778,8 @@ "version": "10.4.3", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/dedent": { "version": "1.5.1", @@ -1807,6 +1809,7 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -1834,6 +1837,7 @@ "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", "dev": true, + "peer": true, "dependencies": { "webidl-conversions": "^7.0.0" }, @@ -1846,6 +1850,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -1879,6 +1884,7 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, + "peer": true, "engines": { "node": ">=0.12" }, @@ -1918,6 +1924,7 @@ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "dev": true, + "peer": true, "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -1952,6 +1959,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "peer": true, "engines": { "node": ">=4.0" } @@ -1961,6 +1969,7 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -2037,29 +2046,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2090,6 +2076,7 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, + "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -2119,18 +2106,6 @@ "node": ">= 14" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dev": true, - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2260,6 +2235,7 @@ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", "dev": true, + "peer": true, "dependencies": { "whatwg-encoding": "^2.0.0" }, @@ -2278,6 +2254,7 @@ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", "dev": true, + "peer": true, "dependencies": { "@tootallnate/once": "2", "agent-base": "6", @@ -2292,6 +2269,7 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, + "peer": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -2314,6 +2292,7 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -2414,7 +2393,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/is-stream": { "version": "2.0.1", @@ -2730,6 +2710,7 @@ "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", "dev": true, + "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/fake-timers": "^29.7.0", @@ -2769,6 +2750,19 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-fixed-jsdom": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/jest-fixed-jsdom/-/jest-fixed-jsdom-0.0.9.tgz", + "integrity": "sha512-KPfqh2+sn5q2B+7LZktwDcwhCpOpUSue8a1I+BcixWLOQoEVyAjAGfH+IYZGoxZsziNojoHGRTC8xRbB1wDD4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "jest-environment-jsdom": ">=28.0.0" + } + }, "node_modules/jest-get-type": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", @@ -3172,6 +3166,7 @@ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", "dev": true, + "peer": true, "dependencies": { "abab": "^2.0.6", "acorn": "^8.8.1", @@ -3217,6 +3212,7 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "dev": true, + "peer": true, "dependencies": { "punycode": "^2.1.1" }, @@ -3229,6 +3225,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -3238,6 +3235,7 @@ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", "dev": true, + "peer": true, "dependencies": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -3413,6 +3411,7 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, + "peer": true, "engines": { "node": ">= 0.6" } @@ -3422,6 +3421,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, + "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -3488,25 +3488,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3544,7 +3525,8 @@ "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/once": { "version": "1.4.0", @@ -3644,6 +3626,7 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", "dev": true, + "peer": true, "dependencies": { "entities": "^4.4.0" }, @@ -3766,13 +3749,15 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true + "dev": true, + "peer": true }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, + "peer": true, "engines": { "node": ">=6" } @@ -3797,7 +3782,8 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/react-is": { "version": "18.2.0", @@ -3818,7 +3804,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/resolve": { "version": "1.22.8", @@ -3871,13 +3858,15 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, + "peer": true, "dependencies": { "xmlchars": "^2.2.0" }, @@ -4070,7 +4059,8 @@ "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/test-exclude": { "version": "6.0.0", @@ -4086,12 +4076,6 @@ "node": ">=8" } }, - "node_modules/text-encoding-polyfill": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/text-encoding-polyfill/-/text-encoding-polyfill-0.6.7.tgz", - "integrity": "sha512-/DZ1XJqhbqRkCop6s9ZFu8JrFRwmVuHg4quIRm+ziFkR3N3ec6ck6yBvJ1GYeEQZhLVwRW0rZE+C3SSJpy0RTg==", - "dev": true - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4124,6 +4108,7 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, + "peer": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -4134,11 +4119,6 @@ "node": ">=6" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/ts-jest": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", @@ -4282,6 +4262,7 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true, + "peer": true, "engines": { "node": ">= 4.0.0" } @@ -4321,6 +4302,7 @@ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dev": true, + "peer": true, "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -4345,6 +4327,7 @@ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", "dev": true, + "peer": true, "dependencies": { "xml-name-validator": "^4.0.0" }, @@ -4361,25 +4344,12 @@ "makeerror": "1.0.12" } }, - "node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, "node_modules/whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", "dev": true, + "peer": true, "dependencies": { "iconv-lite": "0.6.3" }, @@ -4387,30 +4357,16 @@ "node": ">=12" } }, - "node_modules/whatwg-fetch": { - "version": "3.6.20", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", - "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==", - "dev": true - }, "node_modules/whatwg-mimetype": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", "dev": true, + "peer": true, "engines": { "node": ">=12" } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4467,6 +4423,7 @@ "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", "dev": true, + "peer": true, "engines": { "node": ">=10.0.0" }, @@ -4488,6 +4445,7 @@ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -4496,7 +4454,8 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/y18n": { "version": "5.0.8", diff --git a/ecosystem-tests/node-ts-cjs-web/package.json b/ecosystem-tests/node-ts-cjs-web/package.json index 3673778bc..6683953fd 100644 --- a/ecosystem-tests/node-ts-cjs-web/package.json +++ b/ecosystem-tests/node-ts-cjs-web/package.json @@ -9,20 +9,14 @@ }, "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { + "jest-fixed-jsdom": "^0.0.9", "@types/node": "^18.0.0", - "@types/node-fetch": "^2.6.1", "fastest-levenshtein": "^1.0.16", - "formdata-polyfill": "^4.0.10", "jest": "^29.5.0", - "jest-environment-jsdom": "^29.7.0", - "text-encoding-polyfill": "^0.6.7", "ts-jest": "^29.1.0", - "typescript": "4.7.4", - "web-streams-polyfill": "^3.2.1", - "whatwg-fetch": "^3.6.19" + "typescript": "4.7.4" } } diff --git a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts b/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts index d4619ab0c..d156fcbfd 100644 --- a/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts +++ b/ecosystem-tests/node-ts-cjs-web/tests/test-jsdom.ts @@ -1,12 +1,9 @@ /** - * @jest-environment jsdom + * @jest-environment jest-fixed-jsdom */ -import 'whatwg-fetch'; import OpenAI, { toFile } from 'openai'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; -// @ts-ignore -import { TextEncoder } from 'text-encoding-polyfill'; const url = 'https://audio-samples.github.io/samples/mp3/blizzard_biased/sample-1.mp3'; const filename = 'sample-1.mp3'; diff --git a/ecosystem-tests/node-ts-cjs/package-lock.json b/ecosystem-tests/node-ts-cjs/package-lock.json index 2f5374e35..dcbda28e4 100644 --- a/ecosystem-tests/node-ts-cjs/package-lock.json +++ b/ecosystem-tests/node-ts-cjs/package-lock.json @@ -9,19 +9,17 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", - "tsconfig-paths": "^4.0.0" + "tsconfig-paths": "^4.0.0", + "typescript": "^5.7.3", + "undici": "^7.2.0" }, "devDependencies": { - "@types/node": "20.4.2", - "@types/node-fetch": "^2.6.1", + "@types/node": "^20.14.8", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", "jest": "^29.5.0", - "jest-environment-jsdom": "^29.7.0", - "text-encoding-polyfill": "^0.6.7", - "ts-jest": "^29.1.0", - "typescript": "4.7.4" + "jest-fixed-jsdom": "^0.0.9", + "ts-jest": "^29.1.0" } }, "node_modules/@ampproject/remapping": { @@ -1045,6 +1043,7 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", "dev": true, + "peer": true, "engines": { "node": ">= 10" } @@ -1128,6 +1127,7 @@ "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", "dev": true, + "peer": true, "dependencies": { "@types/node": "*", "@types/tough-cookie": "*", @@ -1135,19 +1135,13 @@ } }, "node_modules/@types/node": { - "version": "20.4.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", - "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==", - "dev": true - }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", + "version": "20.17.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.19.tgz", + "integrity": "sha512-LEwC7o1ifqg/6r2gn9Dns0f1rhK+fPFDoMiceTJ6kWmVk6bgXBI/9IOWfVan4WiAavK9pIVWdX0/e3J+eEUh5A==", "dev": true, + "license": "MIT", "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" + "undici-types": "~6.19.2" } }, "node_modules/@types/stack-utils": { @@ -1160,7 +1154,8 @@ "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.3.tgz", "integrity": "sha512-THo502dA5PzG/sfQH+42Lw3fvmYkceefOspdCwpHRul8ik2Jv1K8I5OZz1AT3/rs46kwgMCe9bSBmDLYkkOMGg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/@types/ws": { "version": "8.5.10", @@ -1190,13 +1185,15 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1209,6 +1206,7 @@ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", "dev": true, + "peer": true, "dependencies": { "acorn": "^8.1.0", "acorn-walk": "^8.0.2" @@ -1219,6 +1217,7 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "dev": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -1228,6 +1227,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "peer": true, "dependencies": { "debug": "4" }, @@ -1300,7 +1300,8 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "dev": true, + "peer": true }, "node_modules/babel-jest": { "version": "29.7.0", @@ -1633,6 +1634,7 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "peer": true, "dependencies": { "delayed-stream": "~1.0.0" }, @@ -1691,13 +1693,15 @@ "version": "0.5.0", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/cssstyle": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", "dev": true, + "peer": true, "dependencies": { "cssom": "~0.3.6" }, @@ -1709,13 +1713,15 @@ "version": "0.3.8", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/data-urls": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", "dev": true, + "peer": true, "dependencies": { "abab": "^2.0.6", "whatwg-mimetype": "^3.0.0", @@ -1730,6 +1736,7 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "dev": true, + "peer": true, "dependencies": { "punycode": "^2.1.1" }, @@ -1742,6 +1749,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -1751,6 +1759,7 @@ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", "dev": true, + "peer": true, "dependencies": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -1780,7 +1789,8 @@ "version": "10.4.3", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true + "dev": true, + "peer": true }, "node_modules/dedent": { "version": "1.5.1", @@ -1810,6 +1820,7 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, + "peer": true, "engines": { "node": ">=0.4.0" } @@ -1837,6 +1848,7 @@ "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", "dev": true, + "peer": true, "dependencies": { "webidl-conversions": "^7.0.0" }, @@ -1849,6 +1861,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -1882,6 +1895,7 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, + "peer": true, "engines": { "node": ">=0.12" }, @@ -1921,6 +1935,7 @@ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "dev": true, + "peer": true, "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -1955,6 +1970,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "peer": true, "engines": { "node": ">=4.0" } @@ -1964,6 +1980,7 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -2070,6 +2087,7 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", "dev": true, + "peer": true, "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -2220,6 +2238,7 @@ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", "dev": true, + "peer": true, "dependencies": { "whatwg-encoding": "^2.0.0" }, @@ -2238,6 +2257,7 @@ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", "dev": true, + "peer": true, "dependencies": { "@tootallnate/once": "2", "agent-base": "6", @@ -2252,6 +2272,7 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, + "peer": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -2274,6 +2295,7 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", "dev": true, + "peer": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -2374,7 +2396,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/is-stream": { "version": "2.0.1", @@ -2690,6 +2713,7 @@ "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz", "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", "dev": true, + "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/fake-timers": "^29.7.0", @@ -2729,6 +2753,19 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jest-fixed-jsdom": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/jest-fixed-jsdom/-/jest-fixed-jsdom-0.0.9.tgz", + "integrity": "sha512-KPfqh2+sn5q2B+7LZktwDcwhCpOpUSue8a1I+BcixWLOQoEVyAjAGfH+IYZGoxZsziNojoHGRTC8xRbB1wDD4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "jest-environment-jsdom": ">=28.0.0" + } + }, "node_modules/jest-get-type": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", @@ -3132,6 +3169,7 @@ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", "dev": true, + "peer": true, "dependencies": { "abab": "^2.0.6", "acorn": "^8.8.1", @@ -3177,6 +3215,7 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", "dev": true, + "peer": true, "dependencies": { "punycode": "^2.1.1" }, @@ -3189,6 +3228,7 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -3198,6 +3238,7 @@ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", "dev": true, + "peer": true, "dependencies": { "tr46": "^3.0.0", "webidl-conversions": "^7.0.0" @@ -3373,6 +3414,7 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, + "peer": true, "engines": { "node": ">= 0.6" } @@ -3382,6 +3424,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, + "peer": true, "dependencies": { "mime-db": "1.52.0" }, @@ -3448,25 +3491,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -3504,7 +3528,8 @@ "version": "2.2.7", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/once": { "version": "1.4.0", @@ -3604,6 +3629,7 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", "dev": true, + "peer": true, "dependencies": { "entities": "^4.4.0" }, @@ -3726,13 +3752,15 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", - "dev": true + "dev": true, + "peer": true }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true, + "peer": true, "engines": { "node": ">=6" } @@ -3757,7 +3785,8 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/react-is": { "version": "18.2.0", @@ -3778,7 +3807,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true + "dev": true, + "peer": true }, "node_modules/resolve": { "version": "1.22.8", @@ -3831,13 +3861,15 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "dev": true, + "peer": true }, "node_modules/saxes": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", "dev": true, + "peer": true, "dependencies": { "xmlchars": "^2.2.0" }, @@ -4030,7 +4062,8 @@ "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/test-exclude": { "version": "6.0.0", @@ -4046,12 +4079,6 @@ "node": ">=8" } }, - "node_modules/text-encoding-polyfill": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/text-encoding-polyfill/-/text-encoding-polyfill-0.6.7.tgz", - "integrity": "sha512-/DZ1XJqhbqRkCop6s9ZFu8JrFRwmVuHg4quIRm+ziFkR3N3ec6ck6yBvJ1GYeEQZhLVwRW0rZE+C3SSJpy0RTg==", - "dev": true - }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -4084,6 +4111,7 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", "dev": true, + "peer": true, "dependencies": { "psl": "^1.1.33", "punycode": "^2.1.1", @@ -4094,11 +4122,6 @@ "node": ">=6" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/ts-jest": { "version": "29.1.2", "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", @@ -4218,23 +4241,40 @@ } }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true, + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" + } + }, + "node_modules/undici": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.2.0.tgz", + "integrity": "sha512-klt+0S55GBViA9nsq48/NSCo4YX5mjydjypxD7UmHh/brMu8h/Mhd/F7qAeoH2NOO8SDTk6kjnTFc4WpzmfYpQ==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" } }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true, + "license": "MIT" + }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", "dev": true, + "peer": true, "engines": { "node": ">= 4.0.0" } @@ -4274,6 +4314,7 @@ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", "dev": true, + "peer": true, "dependencies": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -4298,6 +4339,7 @@ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", "dev": true, + "peer": true, "dependencies": { "xml-name-validator": "^4.0.0" }, @@ -4322,16 +4364,12 @@ "node": ">= 14" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, "node_modules/whatwg-encoding": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", "dev": true, + "peer": true, "dependencies": { "iconv-lite": "0.6.3" }, @@ -4344,19 +4382,11 @@ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", "dev": true, + "peer": true, "engines": { "node": ">=12" } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4413,6 +4443,7 @@ "resolved": "https://registry.npmjs.org/ws/-/ws-8.14.1.tgz", "integrity": "sha512-4OOseMUq8AzRBI/7SLMUwO+FEDnguetSk7KMb1sHwvF2w2Wv5Hoj0nlifx8vtGsftE/jWHojPy8sMMzYLJ2G/A==", "dev": true, + "peer": true, "engines": { "node": ">=10.0.0" }, @@ -4434,6 +4465,7 @@ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", "dev": true, + "peer": true, "engines": { "node": ">=12" } @@ -4442,7 +4474,8 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", - "dev": true + "dev": true, + "peer": true }, "node_modules/y18n": { "version": "5.0.8", diff --git a/ecosystem-tests/node-ts-cjs/package.json b/ecosystem-tests/node-ts-cjs/package.json index c675b8f31..7946e8eae 100644 --- a/ecosystem-tests/node-ts-cjs/package.json +++ b/ecosystem-tests/node-ts-cjs/package.json @@ -9,21 +9,17 @@ }, "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", - "tsconfig-paths": "^4.0.0" + "tsconfig-paths": "^4.0.0", + "typescript": "^5.7.3", + "undici": "^7.2.0" }, "devDependencies": { - "@types/node": "20.4.2", - "@types/node-fetch": "^2.6.1", + "@types/node": "^20.14.8", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", "jest": "^29.5.0", - "jest-environment-jsdom": "^29.7.0", - "text-encoding-polyfill": "^0.6.7", - "ts-jest": "^29.1.0", - "typescript": "4.7.4" + "jest-fixed-jsdom": "^0.0.9", + "ts-jest": "^29.1.0" }, - "overrides": { - "@types/node": "20.4.2" - } + "type": "commonjs" } diff --git a/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts b/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts index ddf782aee..e9c59f1c2 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-jsdom.ts @@ -1,11 +1,8 @@ /** - * @jest-environment jsdom + * @jest-environment jest-fixed-jsdom */ import OpenAI, { toFile } from 'openai'; -import fetch from 'node-fetch'; import { distance } from 'fastest-levenshtein'; -// @ts-ignore -import { TextEncoder } from 'text-encoding-polyfill'; const url = 'https://audio-samples.github.io/samples/mp3/blizzard_biased/sample-1.mp3'; const filename = 'sample-1.mp3'; @@ -17,8 +14,6 @@ const model = 'whisper-1'; const client = new OpenAI({ apiKey: process.env['OPENAI_API_KEY'], dangerouslyAllowBrowser: true, - // @ts-expect-error node-fetch types are not compatible - fetch, }); async function typeTests() { diff --git a/ecosystem-tests/node-ts-cjs/tests/test-node.ts b/ecosystem-tests/node-ts-cjs/tests/test-node.ts index 2e27de0f3..59ed83478 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-node.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-node.ts @@ -5,7 +5,6 @@ import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; import { ChatCompletion } from 'openai/resources/chat/completions'; -import type { ReadableStream as WebReadableStream } from 'node:stream/web'; const url = 'https://audio-samples.github.io/samples/mp3/blizzard_biased/sample-1.mp3'; const filename = 'sample-1.mp3'; @@ -65,12 +64,9 @@ it(`raw response`, async function () { }) .asResponse(); - // As far as I can tell, we need to cast because the jest-jsdom types - const body = response.body as WebReadableStream; - const decoder = new TextDecoder(); const chunks: string[] = []; - for await (const chunk of body) { + for await (const chunk of response.body!) { chunks.push(decoder.decode(chunk)); } @@ -91,15 +87,18 @@ it(`streaming works`, async function () { expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); }); -it('handles formdata-node File', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - .then((x) => new FormDataFile([x], filename)); - - const params: TranscriptionCreateParams = { file, model }; - - const result = await client.audio.transcriptions.create(params); - expect(result.text).toBeSimilarTo(correctAnswer, 12); +test(`proxied request`, async function () { + const dispatcher = new undici.ProxyAgent(process.env['ECOSYSTEM_TESTS_PROXY']!); + const client = new OpenAI({ + fetchOptions: { + dispatcher, + }, + }); + const completion = await client.chat.completions.create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + }); + expect(completion.choices[0]?.message?.content).toBeSimilarTo('This is a test', 10); }); it('handles builtinFile', async function () { @@ -175,4 +174,17 @@ describe('toFile', () => { }); expect(result.filename).toEqual('finetune.jsonl'); }); + + it('handles formdata-node File', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => toFile(new FormDataFile([x], filename))); + + expect(file.name).toEqual(filename); + + const params: TranscriptionCreateParams = { file, model }; + + const result = await client.audio.transcriptions.create(params); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); }); diff --git a/ecosystem-tests/node-ts-cjs/tsconfig.json b/ecosystem-tests/node-ts-cjs/tsconfig.json index d1ad90efd..ef91fa3f0 100644 --- a/ecosystem-tests/node-ts-cjs/tsconfig.json +++ b/ecosystem-tests/node-ts-cjs/tsconfig.json @@ -9,7 +9,7 @@ /* Language and Environment */ "target": "ES2015", - "lib": ["ES2015"], + "lib": ["ES2015", "DOM.AsyncIterable"], "jsx": "react", /* Modules */ diff --git a/ecosystem-tests/node-ts-cjs/tsconfig.nodenext.json b/ecosystem-tests/node-ts-cjs/tsconfig.nodenext.json index 0efe77b4e..a5c7de8cb 100644 --- a/ecosystem-tests/node-ts-cjs/tsconfig.nodenext.json +++ b/ecosystem-tests/node-ts-cjs/tsconfig.nodenext.json @@ -9,11 +9,11 @@ /* Language and Environment */ "target": "ES2015", - "lib": ["ES2015"], + "lib": ["ES2015", "DOM.AsyncIterable"], "jsx": "react", /* Modules */ - "module": "commonjs", + "module": "NodeNext", "rootDir": "./", "moduleResolution": "NodeNext", "baseUrl": "./", diff --git a/ecosystem-tests/node-ts-esm-auto/package-lock.json b/ecosystem-tests/node-ts-esm-auto/package-lock.json index 3e4438d05..729b0f2e9 100644 --- a/ecosystem-tests/node-ts-esm-auto/package-lock.json +++ b/ecosystem-tests/node-ts-esm-auto/package-lock.json @@ -8,8 +8,7 @@ "name": "node-ts-esm-auto", "version": "0.0.1", "dependencies": { - "formdata-node": "^5.0.1", - "node-fetch": "^3.0.0" + "formdata-node": "^5.0.1" }, "devDependencies": { "@types/node": "^20.3.1", @@ -1653,14 +1652,6 @@ "node": ">= 8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1864,36 +1855,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/fetch-blob/node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1931,17 +1892,6 @@ "node": ">= 14.17" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3108,23 +3058,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/ecosystem-tests/node-ts-esm-auto/package.json b/ecosystem-tests/node-ts-esm-auto/package.json index 7c227166c..28cf518c7 100644 --- a/ecosystem-tests/node-ts-esm-auto/package.json +++ b/ecosystem-tests/node-ts-esm-auto/package.json @@ -9,8 +9,7 @@ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js" }, "dependencies": { - "formdata-node": "^5.0.1", - "node-fetch": "^3.0.0" + "formdata-node": "^5.0.1" }, "devDependencies": { "@types/node": "^20.3.1", diff --git a/ecosystem-tests/node-ts-esm-auto/tests/test.ts b/ecosystem-tests/node-ts-esm-auto/tests/test.ts index ae5db37e6..5e9c8f961 100644 --- a/ecosystem-tests/node-ts-esm-auto/tests/test.ts +++ b/ecosystem-tests/node-ts-esm-auto/tests/test.ts @@ -1,6 +1,5 @@ import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; -import fetch from 'node-fetch'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; @@ -87,17 +86,6 @@ it(`streaming works`, async function () { expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); }); -it('handles formdata-node File', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - .then((x) => new FormDataFile([x], filename)); - - const params: TranscriptionCreateParams = { file, model }; - - const result = await client.audio.transcriptions.create(params); - expect(result.text).toBeSimilarTo(correctAnswer, 12); -}); - it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) @@ -171,4 +159,17 @@ describe('toFile', () => { }); expect(result.filename).toEqual('finetune.jsonl'); }); + + it('handles formdata-node File', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => toFile(new FormDataFile([x], filename))); + + expect(file.name).toEqual(filename); + + const params: TranscriptionCreateParams = { file, model }; + + const result = await client.audio.transcriptions.create(params); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); }); diff --git a/ecosystem-tests/node-ts-esm-web/package-lock.json b/ecosystem-tests/node-ts-esm-web/package-lock.json index 118bf0909..695441ae3 100644 --- a/ecosystem-tests/node-ts-esm-web/package-lock.json +++ b/ecosystem-tests/node-ts-esm-web/package-lock.json @@ -8,8 +8,7 @@ "name": "node-ts-esm-web", "version": "0.0.1", "dependencies": { - "formdata-node": "^5.0.1", - "node-fetch": "^3.0.0" + "formdata-node": "^5.0.1" }, "devDependencies": { "@types/node": "^20.3.1", @@ -1653,14 +1652,6 @@ "node": ">= 8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1864,36 +1855,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/fetch-blob/node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1931,17 +1892,6 @@ "node": ">= 14.17" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3108,23 +3058,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/ecosystem-tests/node-ts-esm-web/package.json b/ecosystem-tests/node-ts-esm-web/package.json index 97a2309f8..f458a97a0 100644 --- a/ecosystem-tests/node-ts-esm-web/package.json +++ b/ecosystem-tests/node-ts-esm-web/package.json @@ -9,8 +9,7 @@ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js" }, "dependencies": { - "formdata-node": "^5.0.1", - "node-fetch": "^3.0.0" + "formdata-node": "^5.0.1" }, "devDependencies": { "@types/node": "^20.3.1", diff --git a/ecosystem-tests/node-ts-esm/package-lock.json b/ecosystem-tests/node-ts-esm/package-lock.json index dd1b7d3c3..7b167e3e7 100644 --- a/ecosystem-tests/node-ts-esm/package-lock.json +++ b/ecosystem-tests/node-ts-esm/package-lock.json @@ -9,8 +9,7 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^5.0.1", - "import-in-the-middle": "^1.11.2", - "node-fetch": "^3.0.0" + "import-in-the-middle": "^1.11.2" }, "devDependencies": { "@types/node": "^20.3.1", @@ -1661,14 +1660,6 @@ "node": ">= 8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "engines": { - "node": ">= 12" - } - }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -1872,36 +1863,6 @@ "bser": "2.1.1" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, - "node_modules/fetch-blob/node_modules/web-streams-polyfill": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", - "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", - "engines": { - "node": ">= 8" - } - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1939,17 +1900,6 @@ "node": ">= 14.17" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3134,23 +3084,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/ecosystem-tests/node-ts-esm/package.json b/ecosystem-tests/node-ts-esm/package.json index 68239e747..198615c6f 100644 --- a/ecosystem-tests/node-ts-esm/package.json +++ b/ecosystem-tests/node-ts-esm/package.json @@ -10,8 +10,7 @@ }, "dependencies": { "formdata-node": "^5.0.1", - "import-in-the-middle": "^1.11.2", - "node-fetch": "^3.0.0" + "import-in-the-middle": "^1.11.2" }, "devDependencies": { "@types/node": "^20.3.1", diff --git a/ecosystem-tests/node-ts-esm/tests/test-esnext.ts b/ecosystem-tests/node-ts-esm/tests/test-esnext.ts index a9a7c21f5..0b34026fa 100644 --- a/ecosystem-tests/node-ts-esm/tests/test-esnext.ts +++ b/ecosystem-tests/node-ts-esm/tests/test-esnext.ts @@ -51,7 +51,6 @@ it(`raw response`, async function () { }) .asResponse(); - // test that we can use node-fetch Response API const chunks: string[] = []; if (!response.body) throw new Error(`expected response.body to be defined`); diff --git a/ecosystem-tests/node-ts-esm/tests/test.ts b/ecosystem-tests/node-ts-esm/tests/test.ts index d3f15f9fb..8bbabca11 100644 --- a/ecosystem-tests/node-ts-esm/tests/test.ts +++ b/ecosystem-tests/node-ts-esm/tests/test.ts @@ -1,6 +1,5 @@ import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; -import fetch from 'node-fetch'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; @@ -68,17 +67,6 @@ it(`streaming works`, async function () { expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); }); -it('handles formdata-node File', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - .then((x) => new FormDataFile([x], filename)); - - const params: TranscriptionCreateParams = { file, model }; - - const result = await client.audio.transcriptions.create(params); - expect(result.text).toBeSimilarTo(correctAnswer, 12); -}); - if (typeof File !== 'undefined') { it('handles builtinFile', async function () { const file = await fetch(url) @@ -154,4 +142,17 @@ describe('toFile', () => { }); expect(result.filename).toEqual('finetune.jsonl'); }); + + it('handles formdata-node File', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => toFile(new FormDataFile([x], filename))); + + expect(file.name).toEqual(filename); + + const params: TranscriptionCreateParams = { file, model }; + + const result = await client.audio.transcriptions.create(params); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); }); diff --git a/ecosystem-tests/node-ts4.5-jest28/package-lock.json b/ecosystem-tests/node-ts4.5-jest28/package-lock.json index 4b98e5836..1944471b4 100644 --- a/ecosystem-tests/node-ts4.5-jest28/package-lock.json +++ b/ecosystem-tests/node-ts4.5-jest28/package-lock.json @@ -9,13 +9,11 @@ "version": "0.0.1", "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { "@types/jest": "27.5.2", "@types/node": "20.11.20", - "@types/node-fetch": "^2.6.1", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", "jest": "28.1.3", @@ -1089,16 +1087,6 @@ "undici-types": "~5.26.4" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==", - "dev": true, - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } - }, "node_modules/@types/prettier": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", @@ -1196,12 +1184,6 @@ "sprintf-js": "~1.0.2" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, "node_modules/babel-jest": { "version": "28.1.3", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-28.1.3.tgz", @@ -1515,18 +1497,6 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1585,15 +1555,6 @@ "node": ">=0.10.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -1854,20 +1815,6 @@ "node": ">=8" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dev": true, - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/formdata-node": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", @@ -3287,27 +3234,6 @@ "node": ">=8.6" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -3367,44 +3293,6 @@ "node": ">=10.5.0" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", diff --git a/ecosystem-tests/node-ts4.5-jest28/package.json b/ecosystem-tests/node-ts4.5-jest28/package.json index c378a6fdc..a083e09f3 100644 --- a/ecosystem-tests/node-ts4.5-jest28/package.json +++ b/ecosystem-tests/node-ts4.5-jest28/package.json @@ -9,12 +9,10 @@ }, "dependencies": { "formdata-node": "^4.4.1", - "node-fetch": "^2.6.1", "tsconfig-paths": "^4.0.0" }, "devDependencies": { "@types/node": "20.11.20", - "@types/node-fetch": "^2.6.1", "@types/jest": "27.5.2", "@types/ws": "^8.5.4", "fastest-levenshtein": "^1.0.16", diff --git a/ecosystem-tests/node-ts4.5-jest28/tests/test.ts b/ecosystem-tests/node-ts4.5-jest28/tests/test.ts index ae5db37e6..5e9c8f961 100644 --- a/ecosystem-tests/node-ts4.5-jest28/tests/test.ts +++ b/ecosystem-tests/node-ts4.5-jest28/tests/test.ts @@ -1,6 +1,5 @@ import OpenAI, { toFile } from 'openai'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; -import fetch from 'node-fetch'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; @@ -87,17 +86,6 @@ it(`streaming works`, async function () { expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); }); -it('handles formdata-node File', async function () { - const file = await fetch(url) - .then((x) => x.arrayBuffer()) - .then((x) => new FormDataFile([x], filename)); - - const params: TranscriptionCreateParams = { file, model }; - - const result = await client.audio.transcriptions.create(params); - expect(result.text).toBeSimilarTo(correctAnswer, 12); -}); - it('handles builtinFile', async function () { const file = await fetch(url) .then((x) => x.arrayBuffer()) @@ -171,4 +159,17 @@ describe('toFile', () => { }); expect(result.filename).toEqual('finetune.jsonl'); }); + + it('handles formdata-node File', async function () { + const file = await fetch(url) + .then((x) => x.arrayBuffer()) + .then((x) => toFile(new FormDataFile([x], filename))); + + expect(file.name).toEqual(filename); + + const params: TranscriptionCreateParams = { file, model }; + + const result = await client.audio.transcriptions.create(params); + expect(result.text).toBeSimilarTo(correctAnswer, 12); + }); }); diff --git a/ecosystem-tests/vercel-edge/tests/test.ts b/ecosystem-tests/vercel-edge/tests/test.ts index 36a7ea0bf..02414ff7b 100644 --- a/ecosystem-tests/vercel-edge/tests/test.ts +++ b/ecosystem-tests/vercel-edge/tests/test.ts @@ -1,5 +1,3 @@ -import fetch from 'node-fetch'; - const baseUrl = process.env.TEST_BASE_URL || 'http://localhost:3000/'; console.log(baseUrl); @@ -18,3 +16,6 @@ it( }, 3 * 60000, ); + +// make isolatedModules happy +export {}; From 45a372ca0436f2f79c2387665b1c1bc04fd3bfed Mon Sep 17 00:00:00 2001 From: Em Date: Thu, 27 Feb 2025 20:06:48 -0500 Subject: [PATCH 214/509] chore(internal): fix lint --- tests/lib/ChatCompletionRunFunctions.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index 35f5cc532..f2ce1c029 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -4,9 +4,9 @@ import { PassThrough } from 'stream'; import { ParsingToolFunction, type ChatCompletionRunner, - type ChatCompletionFunctionRunnerParams, + type ChatCompletionToolRunnerParams, ChatCompletionStreamingRunner, - type ChatCompletionStreamingFunctionRunnerParams, + type ChatCompletionStreamingToolRunnerParams, } from 'openai/resources/beta/chat/completions'; import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions'; import { isAssistantMessage } from '../../src/lib/chatCompletionUtils'; @@ -18,12 +18,12 @@ function mockChatCompletionFetch() { const { fetch, handleRequest: handleRawRequest } = mockFetch(); function handleRequest( - handler: (body: ChatCompletionFunctionRunnerParams) => Promise, + handler: (body: ChatCompletionToolRunnerParams) => Promise, ): Promise { return handleRawRequest(async (req, init) => { const rawBody = init?.body; if (typeof rawBody !== 'string') throw new Error(`expected init.body to be a string`); - const body: ChatCompletionFunctionRunnerParams = JSON.parse(rawBody); + const body: ChatCompletionToolRunnerParams = JSON.parse(rawBody); return new Response(JSON.stringify(await handler(body)), { headers: { 'Content-Type': 'application/json' }, }); @@ -39,13 +39,13 @@ function mockStreamingChatCompletionFetch() { function handleRequest( handler: ( - body: ChatCompletionStreamingFunctionRunnerParams, + body: ChatCompletionStreamingToolRunnerParams, ) => AsyncIterable, ): Promise { return handleRawRequest(async (req, init) => { const rawBody = init?.body; if (typeof rawBody !== 'string') throw new Error(`expected init.body to be a string`); - const body: ChatCompletionStreamingFunctionRunnerParams = JSON.parse(rawBody); + const body: ChatCompletionStreamingToolRunnerParams = JSON.parse(rawBody); const stream = new PassThrough(); (async () => { for await (const chunk of handler(body)) { From f18ced883e4b5d689e0569d9b163b1958688b669 Mon Sep 17 00:00:00 2001 From: Em Date: Thu, 27 Feb 2025 21:07:00 -0500 Subject: [PATCH 215/509] chore(docs): update zod tool call example, fix azure tests --- examples/package.json | 3 +- examples/tool-call-helpers-zod.ts | 48 ++++++------------------------- tests/lib/azure.test.ts | 12 ++++---- 3 files changed, 16 insertions(+), 47 deletions(-) diff --git a/examples/package.json b/examples/package.json index 70ec2c523..65b3216b2 100644 --- a/examples/package.json +++ b/examples/package.json @@ -11,7 +11,8 @@ "express": "^4.18.2", "next": "^14.1.1", "openai": "file:..", - "zod-to-json-schema": "^3.21.4" + "zod-to-json-schema": "^3.21.4", + "@azure/identity": "^4.2.0" }, "devDependencies": { "@types/body-parser": "^1.19.3", diff --git a/examples/tool-call-helpers-zod.ts b/examples/tool-call-helpers-zod.ts index 700f401a6..0d31b4933 100755 --- a/examples/tool-call-helpers-zod.ts +++ b/examples/tool-call-helpers-zod.ts @@ -1,10 +1,8 @@ #!/usr/bin/env -S npm run tsn -T import OpenAI from 'openai'; -import { RunnableToolFunctionWithParse } from 'openai/lib/RunnableFunction'; -import { JSONSchema } from 'openai/lib/jsonschema'; -import { ZodSchema, z } from 'zod'; -import { zodToJsonSchema } from 'zod-to-json-schema'; +import { zodFunction } from 'openai/helpers/zod'; +import { z } from 'zod'; // gets API Key from environment variable OPENAI_API_KEY const openai = new OpenAI(); @@ -42,18 +40,21 @@ async function main() { stream: true, tools: [ zodFunction({ + name: 'listBooks', function: listBooks, - schema: ListParams, + parameters: ListParams, description: 'List queries books by genre, and returns a list of names of books', }), zodFunction({ + name: 'searchBooks', function: searchBooks, - schema: SearchParams, + parameters: SearchParams, description: 'Search queries books by their name and returns a list of book names and their ids', }), zodFunction({ + name: 'getBook', function: getBook, - schema: GetParams, + parameters: GetParams, description: "Get returns a book's detailed information based on the id of the book. Note that this does not accept names, and only IDs, which you can get by using search.", }), @@ -108,37 +109,4 @@ But Kya is not what they say. A born naturalist with just one day of school, she }, ]; -/** - * A generic utility function that returns a RunnableFunction - * you can pass to `.runTools()`, - * with a fully validated, typesafe parameters schema. - * - * You are encouraged to copy/paste this into your codebase! - */ -function zodFunction({ - function: fn, - schema, - description = '', - name, -}: { - function: (args: T) => Promise; - schema: ZodSchema; - description?: string; - name?: string; -}): RunnableToolFunctionWithParse { - return { - type: 'function', - function: { - function: fn, - name: name ?? fn.name, - description: description, - parameters: zodToJsonSchema(schema) as JSONSchema, - parse(input: string): T { - const obj = JSON.parse(input); - return schema.parse(obj); - }, - }, - }; -} - main(); diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 472ea567f..bffd04371 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -376,7 +376,7 @@ describe('azure request building', () => { expect( await client.audio.translations.create({ model, - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, @@ -387,7 +387,7 @@ describe('azure request building', () => { expect( await client.audio.transcriptions.create({ model, - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, @@ -432,7 +432,7 @@ describe('azure request building', () => { test('handles files', async () => { expect( await client.files.create({ - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), purpose: 'assistants', }), ).toMatchObject({ @@ -509,7 +509,7 @@ describe('azure request building', () => { expect( await client.audio.translations.create({ model: deployment, - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, @@ -520,7 +520,7 @@ describe('azure request building', () => { expect( await client.audio.transcriptions.create({ model: deployment, - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), }), ).toMatchObject({ url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, @@ -565,7 +565,7 @@ describe('azure request building', () => { test('handles files', async () => { expect( await client.files.create({ - file: { url: 'https://example.com/', blob: async () => new Blob([]) }, + file: new File([], ''), purpose: 'assistants', }), ).toMatchObject({ From d94b41a58e24c82c3f7369bd1360b394e93cf1dd Mon Sep 17 00:00:00 2001 From: Em Date: Thu, 27 Feb 2025 21:13:43 -0500 Subject: [PATCH 216/509] chore(internal): update @types/bun --- ecosystem-tests/bun/bun.lockb | Bin 2070 -> 3172 bytes ecosystem-tests/bun/package.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ecosystem-tests/bun/bun.lockb b/ecosystem-tests/bun/bun.lockb index 4ece80c92f6623b82b55d2a0188549558d764dea..529d137af15c21fff677bd36b374f14929e4518e 100755 GIT binary patch delta 1140 zcmbOx@I+#Qp5_$mE7!SM7rxLszPY!_PkZ^B^CfAA?_{@rR=YO$P+j?iE8GlVz&+`HpYpw)FdbBNA;?0wYB8Tw>kDIaMtd{r)N~o&$^V! zI9ZU%o|Oq?$YfSV8x}CbmC;55Y%BxA86a&1GzDlF14tDMP`$b&SUr#@1r)Xf%8CKm zygHYBKwdufD%h!Qm>adCm-- zi%8~z!wPCP%de0t7yd-X)iSRScHE+OqyFQOvMWs4pSOGK`d8jjZFn`=@Yw$=yyqS# zu-RUE6|+u#>s)c>m&I;Rif0H|Cqz&A$b@7t$p0|FVy-tKJvn)IuKwYWiL!6+elyK` z#Z>q3?LUK4S-W>-2~WKIGF#XyT<-V72{YD(#OkY^jc4|3e4Xr2KYi`r#i6IW%#aL* z1t`dHmfZU{M7Hh=lyE$A^xb;7rx7xJyWbQC-(Qkn620JcTx`Sr=-1glrbT_fyvZ#2 zgo$J0-xbAL8}*7$-PzxvzGUV`f5yp*jAD$y^uVY;`2%ysSpn5o{08I9SGkWfh6N5cIh0fuq!#O!7eg6&`6;QBcd|)qA@TKf^+CeAMn-yu#z25Co@PkLtQ{YMuPXh{^P00WCI+*WFP>U6vN13`hpK~$ zGd%+GCz~?buz(q*j5Z=522l145L+=YG=LOxOm<|`pS*=hV)7a$1xAL+vdj@cvWz(# zNSdkQ8DZ+ zF!O=*As|Ns*{2{$kRUd(i62ZRyRc2++5t7;49nzFb~~wm{~-WmEXe&opwcX?lh3j1 zaT&0JBp4WMKwKp;kP0Rs23b%5mD Date: Tue, 4 Mar 2025 21:17:33 +0000 Subject: [PATCH 217/509] chore(internal): run example files in CI (#1357) --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85d792c44..fe24c0dcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,6 +65,26 @@ jobs: - name: Run tests run: ./scripts/test + examples: + name: examples + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install dependencies + run: | + yarn install + + - env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + run: | + yarn tsn examples/demo.ts + ecosystem_tests: name: ecosystem tests (v${{ matrix.node-version }}) runs-on: ubuntu-latest From 6e00ac242554d5f2b86852a082cab2538c605bc9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 05:07:14 +0000 Subject: [PATCH 218/509] release: 4.86.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 92b3782ff..a889d24b4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.86.1" + ".": "4.86.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dd57c5ae..38d54fdc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.86.2 (2025-03-05) + +Full Changelog: [v4.86.1...v4.86.2](https://github.com/openai/openai-node/compare/v4.86.1...v4.86.2) + +### Chores + +* **internal:** run example files in CI ([#1357](https://github.com/openai/openai-node/issues/1357)) ([88d0050](https://github.com/openai/openai-node/commit/88d0050336749deb3810b4cb43473de1f84e42bd)) + ## 4.86.1 (2025-02-27) Full Changelog: [v4.86.0...v4.86.1](https://github.com/openai/openai-node/compare/v4.86.0...v4.86.1) diff --git a/jsr.json b/jsr.json index c3addf639..1c0948aaa 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.86.1", + "version": "4.86.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 236815732..78afb8946 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.86.1", + "version": "4.86.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 759b28a99..c43a3c320 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.86.1'; // x-release-please-version +export const VERSION = '4.86.2'; // x-release-please-version From 06122424a4d783aff07b7089b64986fb35bc24e4 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Mar 2025 11:29:02 -0400 Subject: [PATCH 219/509] feat(api): add /v1/responses and built-in tools [platform.openai.com/docs/changelog](http://platform.openai.com/docs/changelog) --- .stats.yml | 4 +- README.md | 151 +- api.md | 224 +- examples/responses/stream.ts | 24 + examples/responses/streaming-tools.ts | 52 + .../responses/structured-outputs-tools.ts | 60 + examples/responses/structured-outputs.ts | 32 + examples/yarn.lock | 0 scripts/bootstrap | 2 +- src/core.ts | 4 +- src/helpers/zod.ts | 46 + src/index.ts | 58 +- src/lib/ResponsesParser.ts | 262 ++ src/lib/parser.ts | 28 + src/lib/responses/EventTypes.ts | 76 + src/lib/responses/ResponseStream.ts | 298 ++ src/resources/beta/assistants.ts | 55 +- src/resources/beta/beta.ts | 37 - src/resources/beta/index.ts | 16 - src/resources/beta/threads/runs/runs.ts | 7 +- src/resources/beta/threads/threads.ts | 90 +- src/resources/chat/chat.ts | 46 +- src/resources/chat/completions/completions.ts | 290 +- src/resources/chat/completions/index.ts | 1 - src/resources/chat/completions/messages.ts | 2 +- src/resources/chat/index.ts | 3 +- src/resources/files.ts | 26 +- src/resources/index.ts | 20 + src/resources/responses/index.ts | 9 + src/resources/responses/input-items.ts | 276 ++ src/resources/responses/responses.ts | 2761 +++++++++++++++++ src/resources/shared.ts | 156 +- src/resources/uploads/uploads.ts | 7 +- .../{beta => }/vector-stores/file-batches.ts | 23 +- .../{beta => }/vector-stores/files.ts | 89 +- .../{beta => }/vector-stores/index.ts | 6 + .../{beta => }/vector-stores/vector-stores.ts | 130 +- src/streaming.ts | 2 +- .../chat/completions/completions.test.ts | 11 +- .../responses/input-items.test.ts | 40 + .../responses.test.ts} | 68 +- .../vector-stores/file-batches.test.ts | 21 +- .../api-resources/vector-stores/files.test.ts | 132 + .../vector-stores/vector-stores.test.ts | 39 +- 44 files changed, 5226 insertions(+), 458 deletions(-) create mode 100755 examples/responses/stream.ts create mode 100755 examples/responses/streaming-tools.ts create mode 100755 examples/responses/structured-outputs-tools.ts create mode 100755 examples/responses/structured-outputs.ts create mode 100644 examples/yarn.lock create mode 100644 src/lib/ResponsesParser.ts create mode 100644 src/lib/responses/EventTypes.ts create mode 100644 src/lib/responses/ResponseStream.ts create mode 100644 src/resources/responses/index.ts create mode 100644 src/resources/responses/input-items.ts create mode 100644 src/resources/responses/responses.ts rename src/resources/{beta => }/vector-stores/file-batches.ts (92%) rename src/resources/{beta => }/vector-stores/files.ts (74%) rename src/resources/{beta => }/vector-stores/index.ts (82%) rename src/resources/{beta => }/vector-stores/vector-stores.ts (77%) create mode 100644 tests/api-resources/responses/input-items.test.ts rename tests/api-resources/{beta/vector-stores/files.test.ts => responses/responses.test.ts} (58%) rename tests/api-resources/{beta => }/vector-stores/file-batches.test.ts (81%) create mode 100644 tests/api-resources/vector-stores/files.test.ts rename tests/api-resources/{beta => }/vector-stores/vector-stores.test.ts (71%) diff --git a/.stats.yml b/.stats.yml index 163146e38..455874212 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 74 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml +configured_endpoints: 81 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-be834d63e326a82494e819085137f5eb15866f3fc787db1f3afe7168d419e18a.yml diff --git a/README.md b/README.md index 166e35e22..8515c81ed 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ -> [!IMPORTANT] -> We're actively working on a new alpha version that migrates from `node-fetch` to builtin fetch. -> -> Please try it out and let us know if you run into any issues! -> https://community.openai.com/t/your-feedback-requested-node-js-sdk-5-0-0-alpha/1063774 - # OpenAI TypeScript and JavaScript API Library [![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) @@ -27,9 +21,7 @@ deno add jsr:@openai/openai npx jsr add @openai/openai ``` -These commands will make the module importable from the `@openai/openai` scope: - -You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime: +These commands will make the module importable from the `@openai/openai` scope. You can also [import directly from JSR](https://jsr.io/docs/using-packages#importing-with-jsr-specifiers) without an install step if you're using the Deno JavaScript runtime: ```ts import OpenAI from 'jsr:@openai/openai'; @@ -37,9 +29,10 @@ import OpenAI from 'jsr:@openai/openai'; ## Usage -The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples). The code below shows how to get started using the chat completions API. +The full API of this library can be found in [api.md file](api.md) along with many [code examples](https://github.com/openai/openai-node/tree/master/examples). + +The primary API for interacting with OpenAI models is the [Responses API](https://platform.openai.com/docs/api-reference/responses). You can generate text from the model with the code below. - ```ts import OpenAI from 'openai'; @@ -47,100 +40,55 @@ const client = new OpenAI({ apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted }); -async function main() { - const chatCompletion = await client.chat.completions.create({ - messages: [{ role: 'user', content: 'Say this is a test' }], - model: 'gpt-4o', - }); -} +const response = await client.responses.create({ + model: 'gpt-4o', + instructions: 'You are a coding assistant that talks like a pirate', + input: 'Are semicolons optional in JavaScript?', +}); -main(); +console.log(response.output_text); ``` -## Streaming responses - -We provide support for streaming responses using Server Sent Events (SSE). +The previous standard (supported indefinitely) for generating text is the [Chat Completions API](https://platform.openai.com/docs/api-reference/chat). You can use that API to generate text from the model with the code below. ```ts import OpenAI from 'openai'; -const client = new OpenAI(); +const client = new OpenAI({ + apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted +}); -async function main() { - const stream = await client.chat.completions.create({ - model: 'gpt-4o', - messages: [{ role: 'user', content: 'Say this is a test' }], - stream: true, - }); - for await (const chunk of stream) { - process.stdout.write(chunk.choices[0]?.delta?.content || ''); - } -} +const completion = await client.chat.completions.create({ + model: 'gpt-4o', + messages: [ + { role: 'developer', content: 'Talk like a pirate.' }, + { role: 'user', content: 'Are semicolons optional in JavaScript?' }, + ], +}); -main(); +console.log(completion.choices[0].message.content); ``` -If you need to cancel a stream, you can `break` from the loop or call `stream.controller.abort()`. - -### Chat Completion streaming helpers +## Streaming responses -This library also provides several conveniences for streaming chat completions, for example: +We provide support for streaming responses using Server Sent Events (SSE). ```ts import OpenAI from 'openai'; -const openai = new OpenAI(); - -async function main() { - const stream = await openai.beta.chat.completions.stream({ - model: 'gpt-4o', - messages: [{ role: 'user', content: 'Say this is a test' }], - stream: true, - }); - - stream.on('content', (delta, snapshot) => { - process.stdout.write(delta); - }); - - // or, equivalently: - for await (const chunk of stream) { - process.stdout.write(chunk.choices[0]?.delta?.content || ''); - } - - const chatCompletion = await stream.finalChatCompletion(); - console.log(chatCompletion); // {id: "…", choices: […], …} -} - -main(); -``` - -See [helpers.md](helpers.md#chat-events) for more details. - -### Request & Response types - -This library includes TypeScript definitions for all request params and response fields. You may import and use them like so: - - -```ts -import OpenAI from 'openai'; +const client = new OpenAI(); -const client = new OpenAI({ - apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted +const stream = await client.responses.create({ + model: 'gpt-4o', + input: 'Say "Sheep sleep deep" ten times fast!', + stream: true, }); -async function main() { - const params: OpenAI.Chat.ChatCompletionCreateParams = { - messages: [{ role: 'user', content: 'Say this is a test' }], - model: 'gpt-4o', - }; - const chatCompletion: OpenAI.Chat.ChatCompletion = await client.chat.completions.create(params); +for await (const event of stream) { + console.log(event); } - -main(); ``` -Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors. - ## File uploads Request parameters that correspond to file uploads can be passed in many different forms: @@ -265,17 +213,17 @@ Note that requests which time out will be [retried twice by default](#retries). All object responses in the SDK provide a `_request_id` property which is added from the `x-request-id` response header so that you can quickly log failing requests and report them back to OpenAI. ```ts -const completion = await client.chat.completions.create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }); -console.log(completion._request_id) // req_123 +const response = await client.responses.create({ model: 'gpt-4o', input: 'testing 123' }); +console.log(response._request_id) // req_123 ``` You can also access the Request ID using the `.withResponse()` method: ```ts -const { data: stream, request_id } = await openai.chat.completions +const { data: stream, request_id } = await openai.responses .create({ - model: 'gpt-4', - messages: [{ role: 'user', content: 'Say this is a test' }], + model: 'gpt-4o', + input: 'Say this is a test', stream: true, }) .withResponse(); @@ -355,12 +303,6 @@ console.log(result.choices[0]!.message?.content); For more information on support for the Azure API, see [azure.md](azure.md). -## Automated function calls - -We provide the `openai.beta.chat.completions.runTools({…})` convenience helper for using function tool calls with the `/chat/completions` endpoint which automatically call the JavaScript functions you provide and sends their results back to the `/chat/completions` endpoint, looping as long as the model requests tool calls. - -For more information see [helpers.md](helpers.md#automated-function-calls). - ## Advanced Usage ### Accessing raw Response data (e.g., headers) @@ -373,17 +315,19 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi ```ts const client = new OpenAI(); -const response = await client.chat.completions - .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }) +const httpResponse = await client.responses + .create({ model: 'gpt-4o', input: 'say this is a test.' }) .asResponse(); -console.log(response.headers.get('X-My-Header')); -console.log(response.statusText); // access the underlying Response object -const { data: chatCompletion, response: raw } = await client.chat.completions - .create({ messages: [{ role: 'user', content: 'Say this is a test' }], model: 'gpt-4o' }) +// access the underlying web standard Response object +console.log(httpResponse.headers.get('X-My-Header')); +console.log(httpResponse.statusText); + +const { data: modelResponse, response: raw } = await client.responses + .create({ model: 'gpt-4o', input: 'say this is a test.' }) .withResponse(); console.log(raw.headers.get('X-My-Header')); -console.log(chatCompletion); +console.log(modelResponse); ``` ### Making custom/undocumented requests @@ -432,6 +376,11 @@ validate or strip extra properties from the response from the API. ### Customizing the fetch client +> We're actively working on a new alpha version that migrates from `node-fetch` to builtin fetch. +> +> Please try it out and let us know if you run into any issues! +> https://community.openai.com/t/your-feedback-requested-node-js-sdk-5-0-0-alpha/1063774 + By default, this library uses `node-fetch` in Node, and expects a global `fetch` function in other environments. If you would prefer to use a global, web-standards-compliant `fetch` function even in a Node environment, diff --git a/api.md b/api.md index 63f239628..b21ac2d5f 100644 --- a/api.md +++ b/api.md @@ -2,10 +2,15 @@ Types: +- ChatModel +- ComparisonFilter +- CompoundFilter - ErrorObject - FunctionDefinition - FunctionParameters - Metadata +- Reasoning +- ReasoningEffort - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText @@ -52,7 +57,6 @@ Types: - ChatCompletionModality - ChatCompletionNamedToolChoice - ChatCompletionPredictionContent -- ChatCompletionReasoningEffort - ChatCompletionRole - ChatCompletionStoreMessage - ChatCompletionStreamOptions @@ -63,6 +67,7 @@ Types: - ChatCompletionToolMessageParam - ChatCompletionUserMessageParam - CreateChatCompletionRequestMessage +- ChatCompletionReasoningEffort Methods: @@ -224,6 +229,67 @@ Methods: - client.fineTuning.jobs.checkpoints.list(fineTuningJobId, { ...params }) -> FineTuningJobCheckpointsPage +# VectorStores + +Types: + +- AutoFileChunkingStrategyParam +- FileChunkingStrategy +- FileChunkingStrategyParam +- OtherFileChunkingStrategyObject +- StaticFileChunkingStrategy +- StaticFileChunkingStrategyObject +- StaticFileChunkingStrategyObjectParam +- VectorStore +- VectorStoreDeleted +- VectorStoreSearchResponse + +Methods: + +- client.vectorStores.create({ ...params }) -> VectorStore +- client.vectorStores.retrieve(vectorStoreId) -> VectorStore +- client.vectorStores.update(vectorStoreId, { ...params }) -> VectorStore +- client.vectorStores.list({ ...params }) -> VectorStoresPage +- client.vectorStores.del(vectorStoreId) -> VectorStoreDeleted +- client.vectorStores.search(vectorStoreId, { ...params }) -> VectorStoreSearchResponsesPage + +## Files + +Types: + +- VectorStoreFile +- VectorStoreFileDeleted +- FileContentResponse + +Methods: + +- client.vectorStores.files.create(vectorStoreId, { ...params }) -> VectorStoreFile +- client.vectorStores.files.retrieve(vectorStoreId, fileId) -> VectorStoreFile +- client.vectorStores.files.update(vectorStoreId, fileId, { ...params }) -> VectorStoreFile +- client.vectorStores.files.list(vectorStoreId, { ...params }) -> VectorStoreFilesPage +- client.vectorStores.files.del(vectorStoreId, fileId) -> VectorStoreFileDeleted +- client.vectorStores.files.content(vectorStoreId, fileId) -> FileContentResponsesPage +- client.beta.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> +- client.beta.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> +- client.beta.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> +- client.beta.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> + +## FileBatches + +Types: + +- VectorStoreFileBatch + +Methods: + +- client.vectorStores.fileBatches.create(vectorStoreId, { ...params }) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.retrieve(vectorStoreId, batchId) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.cancel(vectorStoreId, batchId) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.listFiles(vectorStoreId, batchId, { ...params }) -> VectorStoreFilesPage +- client.beta.vectorStores.fileBatches.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFileBatch> +- client.beta.vectorStores.fileBatches.poll(vectorStoreId, batchId, options?) -> Promise<VectorStoreFileBatch> +- client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options?) -> Promise<VectorStoreFileBatch> + # Beta ## Realtime @@ -287,72 +353,6 @@ Methods: - client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse -## VectorStores - -Types: - -- AutoFileChunkingStrategyParam -- FileChunkingStrategy -- FileChunkingStrategyParam -- OtherFileChunkingStrategyObject -- StaticFileChunkingStrategy -- StaticFileChunkingStrategyObject -- StaticFileChunkingStrategyObjectParam -- VectorStore -- VectorStoreDeleted - -Methods: - -- client.beta.vectorStores.create({ ...params }) -> VectorStore -- client.beta.vectorStores.retrieve(vectorStoreId) -> VectorStore -- client.beta.vectorStores.update(vectorStoreId, { ...params }) -> VectorStore -- client.beta.vectorStores.list({ ...params }) -> VectorStoresPage -- client.beta.vectorStores.del(vectorStoreId) -> VectorStoreDeleted - -### Files - -Types: - -- VectorStoreFile -- VectorStoreFileDeleted - -Methods: - -- client.beta.vectorStores.files.create(vectorStoreId, { ...params }) -> VectorStoreFile -- client.beta.vectorStores.files.retrieve(vectorStoreId, fileId) -> VectorStoreFile -- client.beta.vectorStores.files.list(vectorStoreId, { ...params }) -> VectorStoreFilesPage -- client.beta.vectorStores.files.del(vectorStoreId, fileId) -> VectorStoreFileDeleted -- client.beta.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> - -### FileBatches - -Types: - -- VectorStoreFileBatch - -Methods: - -- client.beta.vectorStores.fileBatches.create(vectorStoreId, { ...params }) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.retrieve(vectorStoreId, batchId) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.cancel(vectorStoreId, batchId) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.listFiles(vectorStoreId, batchId, { ...params }) -> VectorStoreFilesPage -- client.beta.vectorStores.fileBatches.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFileBatch> -- client.beta.vectorStores.fileBatches.poll(vectorStoreId, batchId, options?) -> Promise<VectorStoreFileBatch> -- client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options?) -> Promise<VectorStoreFileBatch> - -## Chat - -### Completions - -Methods: - -- client.beta.chat.completions.runFunctions(body, options?) -> ChatCompletionRunner | ChatCompletionStreamingRunner -- client.beta.chat.completions.runTools(body, options?) -> ChatCompletionRunner | ChatCompletionStreamingRunner -- client.beta.chat.completions.stream(body, options?) -> ChatCompletionStream - ## Assistants Types: @@ -526,3 +526,93 @@ Types: Methods: - client.uploads.parts.create(uploadId, { ...params }) -> UploadPart + +# Responses + +Types: + +- ComputerTool +- EasyInputMessage +- FileSearchTool +- FunctionTool +- Response +- ResponseAudioDeltaEvent +- ResponseAudioDoneEvent +- ResponseAudioTranscriptDeltaEvent +- ResponseAudioTranscriptDoneEvent +- ResponseCodeInterpreterCallCodeDeltaEvent +- ResponseCodeInterpreterCallCodeDoneEvent +- ResponseCodeInterpreterCallCompletedEvent +- ResponseCodeInterpreterCallInProgressEvent +- ResponseCodeInterpreterCallInterpretingEvent +- ResponseCodeInterpreterToolCall +- ResponseCompletedEvent +- ResponseComputerToolCall +- ResponseContent +- ResponseContentPartAddedEvent +- ResponseContentPartDoneEvent +- ResponseCreatedEvent +- ResponseError +- ResponseErrorEvent +- ResponseFailedEvent +- ResponseFileSearchCallCompletedEvent +- ResponseFileSearchCallInProgressEvent +- ResponseFileSearchCallSearchingEvent +- ResponseFileSearchToolCall +- ResponseFormatTextConfig +- ResponseFormatTextJSONSchemaConfig +- ResponseFunctionCallArgumentsDeltaEvent +- ResponseFunctionCallArgumentsDoneEvent +- ResponseFunctionToolCall +- ResponseFunctionWebSearch +- ResponseInProgressEvent +- ResponseIncludable +- ResponseIncompleteEvent +- ResponseInput +- ResponseInputAudio +- ResponseInputContent +- ResponseInputFile +- ResponseInputImage +- ResponseInputItem +- ResponseInputMessageContentList +- ResponseInputText +- ResponseOutputAudio +- ResponseOutputItem +- ResponseOutputItemAddedEvent +- ResponseOutputItemDoneEvent +- ResponseOutputMessage +- ResponseOutputRefusal +- ResponseOutputText +- ResponseRefusalDeltaEvent +- ResponseRefusalDoneEvent +- ResponseStatus +- ResponseStreamEvent +- ResponseTextAnnotationDeltaEvent +- ResponseTextConfig +- ResponseTextDeltaEvent +- ResponseTextDoneEvent +- ResponseUsage +- ResponseWebSearchCallCompletedEvent +- ResponseWebSearchCallInProgressEvent +- ResponseWebSearchCallSearchingEvent +- Tool +- ToolChoiceFunction +- ToolChoiceOptions +- ToolChoiceTypes +- WebSearchTool + +Methods: + +- client.responses.create({ ...params }) -> Response +- client.responses.retrieve(responseId, { ...params }) -> Response +- client.responses.del(responseId) -> void + +## InputItems + +Types: + +- ResponseItemList + +Methods: + +- client.responses.inputItems.list(responseId, { ...params }) -> ResponseItemListDataPage diff --git a/examples/responses/stream.ts b/examples/responses/stream.ts new file mode 100755 index 000000000..ea3d0849e --- /dev/null +++ b/examples/responses/stream.ts @@ -0,0 +1,24 @@ +#!/usr/bin/env -S npm run tsn -T + +import OpenAI from 'openai'; + +const openai = new OpenAI(); + +async function main() { + const runner = openai.responses + .stream({ + model: 'gpt-4o-2024-08-06', + input: 'solve 8x + 31 = 2', + }) + .on('event', (event) => console.log(event)) + .on('response.output_text.delta', (diff) => process.stdout.write(diff.delta)); + + for await (const event of runner) { + console.log('event', event); + } + + const result = await runner.finalResponse(); + console.log(result); +} + +main(); diff --git a/examples/responses/streaming-tools.ts b/examples/responses/streaming-tools.ts new file mode 100755 index 000000000..87a48d0c3 --- /dev/null +++ b/examples/responses/streaming-tools.ts @@ -0,0 +1,52 @@ +#!/usr/bin/env -S npm run tsn -T + +import { OpenAI } from 'openai'; +import { zodResponsesFunction } from 'openai/helpers/zod'; +import { z } from 'zod'; + +const Table = z.enum(['orders', 'customers', 'products']); +const Column = z.enum([ + 'id', + 'status', + 'expected_delivery_date', + 'delivered_at', + 'shipped_at', + 'ordered_at', + 'canceled_at', +]); +const Operator = z.enum(['=', '>', '<', '<=', '>=', '!=']); +const OrderBy = z.enum(['asc', 'desc']); +const DynamicValue = z.object({ + column_name: Column, +}); + +const Condition = z.object({ + column: Column, + operator: Operator, + value: z.union([z.string(), z.number(), DynamicValue]), +}); + +const Query = z.object({ + table_name: Table, + columns: z.array(Column), + conditions: z.array(Condition), + order_by: OrderBy, +}); + +async function main() { + const client = new OpenAI(); + + const tool = zodResponsesFunction({ name: 'query', parameters: Query }); + + const stream = client.responses.stream({ + model: 'gpt-4o-2024-08-06', + input: 'look up all my orders in november of last year that were fulfilled but not delivered on time', + tools: [tool], + }); + + for await (const event of stream) { + console.dir(event, { depth: 10 }); + } +} + +main(); diff --git a/examples/responses/structured-outputs-tools.ts b/examples/responses/structured-outputs-tools.ts new file mode 100755 index 000000000..29eaabf93 --- /dev/null +++ b/examples/responses/structured-outputs-tools.ts @@ -0,0 +1,60 @@ +#!/usr/bin/env -S npm run tsn -T + +import { OpenAI } from 'openai'; +import { zodResponsesFunction } from 'openai/helpers/zod'; +import { z } from 'zod'; + +const Table = z.enum(['orders', 'customers', 'products']); +const Column = z.enum([ + 'id', + 'status', + 'expected_delivery_date', + 'delivered_at', + 'shipped_at', + 'ordered_at', + 'canceled_at', +]); +const Operator = z.enum(['=', '>', '<', '<=', '>=', '!=']); +const OrderBy = z.enum(['asc', 'desc']); +const DynamicValue = z.object({ + column_name: Column, +}); + +const Condition = z.object({ + column: Column, + operator: Operator, + value: z.union([z.string(), z.number(), DynamicValue]), +}); + +const Query = z.object({ + table_name: Table, + columns: z.array(Column), + conditions: z.array(Condition), + order_by: OrderBy, +}); + +async function main() { + const client = new OpenAI(); + + const tool = zodResponsesFunction({ name: 'query', parameters: Query }); + + const rsp = await client.responses.parse({ + model: 'gpt-4o-2024-08-06', + input: 'look up all my orders in november of last year that were fulfilled but not delivered on time', + tools: [tool], + }); + + console.log(rsp); + + const functionCall = rsp.output[0]!; + + if (functionCall.type !== 'function_call') { + throw new Error('Expected function call'); + } + + const query = functionCall.parsed_arguments; + + console.log(query); +} + +main(); diff --git a/examples/responses/structured-outputs.ts b/examples/responses/structured-outputs.ts new file mode 100755 index 000000000..07ff93a60 --- /dev/null +++ b/examples/responses/structured-outputs.ts @@ -0,0 +1,32 @@ +#!/usr/bin/env -S npm run tsn -T + +import { OpenAI } from 'openai'; +import { zodTextFormat } from 'openai/helpers/zod'; +import { z } from 'zod'; + +const Step = z.object({ + explanation: z.string(), + output: z.string(), +}); + +const MathResponse = z.object({ + steps: z.array(Step), + final_answer: z.string(), +}); + +const client = new OpenAI(); + +async function main() { + const rsp = await client.responses.parse({ + input: 'solve 8x + 31 = 2', + model: 'gpt-4o-2024-08-06', + text: { + format: zodTextFormat(MathResponse, 'math_response'), + }, + }); + + console.log(rsp.output_parsed); + console.log('answer: ', rsp.output_parsed?.final_answer); +} + +main().catch(console.error); diff --git a/examples/yarn.lock b/examples/yarn.lock new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/bootstrap b/scripts/bootstrap index 033156d3a..f107c3a24 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle diff --git a/src/core.ts b/src/core.ts index 6578c0781..a41eaa3fa 100644 --- a/src/core.ts +++ b/src/core.ts @@ -62,8 +62,8 @@ async function defaultParseResponse(props: APIResponseProps): Promise { return _zodToJsonSchema(schema, { @@ -74,6 +78,23 @@ export function zodResponseFormat( ); } +export function zodTextFormat( + zodObject: ZodInput, + name: string, + props?: Omit, +): AutoParseableTextFormat> { + return makeParseableTextFormat( + { + type: 'json_schema', + ...props, + name, + strict: true, + schema: zodToJsonSchema(zodObject, { name }), + }, + (content) => zodObject.parse(JSON.parse(content)), + ); +} + /** * Creates a chat completion `function` tool that can be invoked * automatically by the chat completion `.runTools()` method or automatically @@ -106,3 +127,28 @@ export function zodFunction(options: { }, ); } + +export function zodResponsesFunction(options: { + name: string; + parameters: Parameters; + function?: ((args: zodInfer) => unknown | Promise) | undefined; + description?: string | undefined; +}): AutoParseableResponseTool<{ + arguments: Parameters; + name: string; + function: (args: zodInfer) => unknown; +}> { + return makeParseableResponseTool( + { + type: 'function', + name: options.name, + parameters: zodToJsonSchema(options.parameters, { name: options.name }), + strict: true, + ...(options.description ? { description: options.description } : undefined), + }, + { + callback: options.function, + parser: (args) => options.parameters.parse(JSON.parse(args)), + }, + ); +} diff --git a/src/index.ts b/src/index.ts index debefce8c..c3abed2db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -65,14 +65,34 @@ import { } from './resources/moderations'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; -import { Chat, ChatModel } from './resources/chat/chat'; +import { Chat } from './resources/chat/chat'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { Responses } from './resources/responses/responses'; import { Upload, UploadCompleteParams, UploadCreateParams, Uploads as UploadsAPIUploads, } from './resources/uploads/uploads'; +import { + AutoFileChunkingStrategyParam, + FileChunkingStrategy, + FileChunkingStrategyParam, + OtherFileChunkingStrategyObject, + StaticFileChunkingStrategy, + StaticFileChunkingStrategyObject, + StaticFileChunkingStrategyObjectParam, + VectorStore, + VectorStoreCreateParams, + VectorStoreDeleted, + VectorStoreListParams, + VectorStoreSearchParams, + VectorStoreSearchResponse, + VectorStoreSearchResponsesPage, + VectorStoreUpdateParams, + VectorStores, + VectorStoresPage, +} from './resources/vector-stores/vector-stores'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -98,7 +118,6 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, - ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStoreMessage, ChatCompletionStreamOptions, @@ -267,9 +286,11 @@ export class OpenAI extends Core.APIClient { moderations: API.Moderations = new API.Moderations(this); models: API.Models = new API.Models(this); fineTuning: API.FineTuning = new API.FineTuning(this); + vectorStores: API.VectorStores = new API.VectorStores(this); beta: API.Beta = new API.Beta(this); batches: API.Batches = new API.Batches(this); uploads: API.Uploads = new API.Uploads(this); + responses: API.Responses = new API.Responses(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -325,10 +346,14 @@ OpenAI.Moderations = Moderations; OpenAI.Models = Models; OpenAI.ModelsPage = ModelsPage; OpenAI.FineTuning = FineTuning; +OpenAI.VectorStores = VectorStores; +OpenAI.VectorStoresPage = VectorStoresPage; +OpenAI.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage; OpenAI.Beta = Beta; OpenAI.Batches = Batches; OpenAI.BatchesPage = BatchesPage; OpenAI.Uploads = UploadsAPIUploads; +OpenAI.Responses = Responses; export declare namespace OpenAI { export type RequestOptions = Core.RequestOptions; @@ -350,7 +375,6 @@ export declare namespace OpenAI { export { Chat as Chat, - type ChatModel as ChatModel, type ChatCompletion as ChatCompletion, type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, type ChatCompletionAudio as ChatCompletionAudio, @@ -371,7 +395,6 @@ export declare namespace OpenAI { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -440,6 +463,26 @@ export declare namespace OpenAI { export { FineTuning as FineTuning }; + export { + VectorStores as VectorStores, + type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, + type FileChunkingStrategy as FileChunkingStrategy, + type FileChunkingStrategyParam as FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy as StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, + type VectorStore as VectorStore, + type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreSearchResponse as VectorStoreSearchResponse, + VectorStoresPage as VectorStoresPage, + VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, + type VectorStoreCreateParams as VectorStoreCreateParams, + type VectorStoreUpdateParams as VectorStoreUpdateParams, + type VectorStoreListParams as VectorStoreListParams, + type VectorStoreSearchParams as VectorStoreSearchParams, + }; + export { Beta as Beta }; export { @@ -459,10 +502,17 @@ export declare namespace OpenAI { type UploadCompleteParams as UploadCompleteParams, }; + export { Responses as Responses }; + + export type ChatModel = API.ChatModel; + export type ComparisonFilter = API.ComparisonFilter; + export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; + export type Reasoning = API.Reasoning; + export type ReasoningEffort = API.ReasoningEffort; export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; export type ResponseFormatText = API.ResponseFormatText; diff --git a/src/lib/ResponsesParser.ts b/src/lib/ResponsesParser.ts new file mode 100644 index 000000000..780b779ff --- /dev/null +++ b/src/lib/ResponsesParser.ts @@ -0,0 +1,262 @@ +import { OpenAIError } from '../error'; +import { type ChatCompletionTool } from '../resources'; +import { + type FunctionTool, + type ParsedContent, + type ParsedResponse, + type ParsedResponseFunctionToolCall, + type ParsedResponseOutputItem, + type Response, + type ResponseCreateParamsBase, + type ResponseCreateParamsNonStreaming, + type ResponseFunctionToolCall, + type Tool, +} from '../resources/responses/responses'; +import { type AutoParseableTextFormat, isAutoParsableResponseFormat } from '../lib/parser'; + +type ParseableToolsParams = Array | ChatCompletionTool | null; + +export type ResponseCreateParamsWithTools = ResponseCreateParamsBase & { + tools?: ParseableToolsParams; +}; + +export type ExtractParsedContentFromParams = + NonNullable['format'] extends AutoParseableTextFormat ? P : null; + +export function maybeParseResponse< + Params extends ResponseCreateParamsBase | null, + ParsedT = Params extends null ? null : ExtractParsedContentFromParams>, +>(response: Response, params: Params): ParsedResponse { + if (!params || !hasAutoParseableInput(params)) { + return { + ...response, + output_parsed: null, + output: response.output.map((item) => { + if (item.type === 'function_call') { + return { + ...item, + parsed_arguments: null, + }; + } + + if (item.type === 'message') { + return { + ...item, + content: item.content.map((content) => ({ + ...content, + parsed: null, + })), + }; + } else { + return item; + } + }), + }; + } + + return parseResponse(response, params); +} + +export function parseResponse< + Params extends ResponseCreateParamsBase, + ParsedT = ExtractParsedContentFromParams, +>(response: Response, params: Params): ParsedResponse { + const output: Array> = response.output.map( + (item): ParsedResponseOutputItem => { + if (item.type === 'function_call') { + return { + ...item, + parsed_arguments: parseToolCall(params, item), + }; + } + if (item.type === 'message') { + const content: Array> = item.content.map((content) => { + if (content.type === 'output_text') { + return { + ...content, + parsed: parseTextFormat(params, content.text), + }; + } + + return content; + }); + + return { + ...item, + content, + }; + } + + return item; + }, + ); + + const parsed: Omit, 'output_parsed'> = Object.assign({}, response, { output }); + if (!Object.getOwnPropertyDescriptor(response, 'output_text')) { + addOutputText(parsed); + } + + Object.defineProperty(parsed, 'output_parsed', { + enumerable: true, + get() { + for (const output of parsed.output) { + if (output.type !== 'message') { + continue; + } + + for (const content of output.content) { + if (content.type === 'output_text' && content.parsed !== null) { + return content.parsed; + } + } + } + + return null; + }, + }); + + return parsed as ParsedResponse; +} + +function parseTextFormat< + Params extends ResponseCreateParamsBase, + ParsedT = ExtractParsedContentFromParams, +>(params: Params, content: string): ParsedT | null { + if (params.text?.format?.type !== 'json_schema') { + return null; + } + + if ('$parseRaw' in params.text?.format) { + const text_format = params.text?.format as unknown as AutoParseableTextFormat; + return text_format.$parseRaw(content); + } + + return JSON.parse(content); +} + +export function hasAutoParseableInput(params: ResponseCreateParamsWithTools): boolean { + if (isAutoParsableResponseFormat(params.text?.format)) { + return true; + } + + return false; +} + +type ToolOptions = { + name: string; + arguments: any; + function?: ((args: any) => any) | undefined; +}; + +export type AutoParseableResponseTool< + OptionsT extends ToolOptions, + HasFunction = OptionsT['function'] extends Function ? true : false, +> = FunctionTool & { + __arguments: OptionsT['arguments']; // type-level only + __name: OptionsT['name']; // type-level only + + $brand: 'auto-parseable-tool'; + $callback: ((args: OptionsT['arguments']) => any) | undefined; + $parseRaw(args: string): OptionsT['arguments']; +}; + +export function makeParseableResponseTool( + tool: FunctionTool, + { + parser, + callback, + }: { + parser: (content: string) => OptionsT['arguments']; + callback: ((args: any) => any) | undefined; + }, +): AutoParseableResponseTool { + const obj = { ...tool }; + + Object.defineProperties(obj, { + $brand: { + value: 'auto-parseable-tool', + enumerable: false, + }, + $parseRaw: { + value: parser, + enumerable: false, + }, + $callback: { + value: callback, + enumerable: false, + }, + }); + + return obj as AutoParseableResponseTool; +} + +export function isAutoParsableTool(tool: any): tool is AutoParseableResponseTool { + return tool?.['$brand'] === 'auto-parseable-tool'; +} + +function getInputToolByName(input_tools: Array, name: string): FunctionTool | undefined { + return input_tools.find((tool) => tool.type === 'function' && tool.name === name) as + | FunctionTool + | undefined; +} + +function parseToolCall( + params: Params, + toolCall: ResponseFunctionToolCall, +): ParsedResponseFunctionToolCall { + const inputTool = getInputToolByName(params.tools ?? [], toolCall.name); + + return { + ...toolCall, + ...toolCall, + parsed_arguments: + isAutoParsableTool(inputTool) ? inputTool.$parseRaw(toolCall.arguments) + : inputTool?.strict ? JSON.parse(toolCall.arguments) + : null, + }; +} + +export function shouldParseToolCall( + params: ResponseCreateParamsNonStreaming | null | undefined, + toolCall: ResponseFunctionToolCall, +): boolean { + if (!params) { + return false; + } + + const inputTool = getInputToolByName(params.tools ?? [], toolCall.name); + return isAutoParsableTool(inputTool) || inputTool?.strict || false; +} + +export function validateInputTools(tools: ChatCompletionTool[] | undefined) { + for (const tool of tools ?? []) { + if (tool.type !== 'function') { + throw new OpenAIError( + `Currently only \`function\` tool types support auto-parsing; Received \`${tool.type}\``, + ); + } + + if (tool.function.strict !== true) { + throw new OpenAIError( + `The \`${tool.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`, + ); + } + } +} + +export function addOutputText(rsp: Response): void { + const texts: string[] = []; + for (const output of rsp.output) { + if (output.type !== 'message') { + continue; + } + + for (const content of output.content) { + if (content.type === 'output_text') { + texts.push(content.text); + } + } + } + + rsp.output_text = texts.join(''); +} diff --git a/src/lib/parser.ts b/src/lib/parser.ts index a750375dc..d75d32a40 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -14,6 +14,7 @@ import { } from '../resources/beta/chat/completions'; import { ResponseFormatJSONSchema } from '../resources/shared'; import { ContentFilterFinishReasonError, LengthFinishReasonError, OpenAIError } from '../error'; +import { type ResponseFormatTextJSONSchemaConfig } from '../resources/responses/responses'; type AnyChatCompletionCreateParams = | ChatCompletionCreateParams @@ -51,6 +52,33 @@ export function makeParseableResponseFormat( return obj as AutoParseableResponseFormat; } +export type AutoParseableTextFormat = ResponseFormatTextJSONSchemaConfig & { + __output: ParsedT; // type-level only + + $brand: 'auto-parseable-response-format'; + $parseRaw(content: string): ParsedT; +}; + +export function makeParseableTextFormat( + response_format: ResponseFormatTextJSONSchemaConfig, + parser: (content: string) => ParsedT, +): AutoParseableTextFormat { + const obj = { ...response_format }; + + Object.defineProperties(obj, { + $brand: { + value: 'auto-parseable-response-format', + enumerable: false, + }, + $parseRaw: { + value: parser, + enumerable: false, + }, + }); + + return obj as AutoParseableTextFormat; +} + export function isAutoParsableResponseFormat( response_format: any, ): response_format is AutoParseableResponseFormat { diff --git a/src/lib/responses/EventTypes.ts b/src/lib/responses/EventTypes.ts new file mode 100644 index 000000000..fc1620988 --- /dev/null +++ b/src/lib/responses/EventTypes.ts @@ -0,0 +1,76 @@ +import { + ResponseAudioDeltaEvent, + ResponseAudioDoneEvent, + ResponseAudioTranscriptDeltaEvent, + ResponseAudioTranscriptDoneEvent, + ResponseCodeInterpreterCallCodeDeltaEvent, + ResponseCodeInterpreterCallCodeDoneEvent, + ResponseCodeInterpreterCallCompletedEvent, + ResponseCodeInterpreterCallInProgressEvent, + ResponseCodeInterpreterCallInterpretingEvent, + ResponseCompletedEvent, + ResponseContentPartAddedEvent, + ResponseContentPartDoneEvent, + ResponseCreatedEvent, + ResponseErrorEvent, + ResponseFailedEvent, + ResponseFileSearchCallCompletedEvent, + ResponseFileSearchCallInProgressEvent, + ResponseFileSearchCallSearchingEvent, + ResponseFunctionCallArgumentsDeltaEvent as RawResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseInProgressEvent, + ResponseOutputItemAddedEvent, + ResponseOutputItemDoneEvent, + ResponseRefusalDeltaEvent, + ResponseRefusalDoneEvent, + ResponseTextAnnotationDeltaEvent, + ResponseTextDeltaEvent as RawResponseTextDeltaEvent, + ResponseTextDoneEvent, + ResponseIncompleteEvent, + ResponseWebSearchCallCompletedEvent, + ResponseWebSearchCallInProgressEvent, + ResponseWebSearchCallSearchingEvent, +} from '../../resources/responses/responses'; + +export type ResponseFunctionCallArgumentsDeltaEvent = RawResponseFunctionCallArgumentsDeltaEvent & { + snapshot: string; +}; + +export type ResponseTextDeltaEvent = RawResponseTextDeltaEvent & { + snapshot: string; +}; + +export type ParsedResponseStreamEvent = + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseCodeInterpreterCallCodeDeltaEvent + | ResponseCodeInterpreterCallCodeDoneEvent + | ResponseCodeInterpreterCallCompletedEvent + | ResponseCodeInterpreterCallInProgressEvent + | ResponseCodeInterpreterCallInterpretingEvent + | ResponseCompletedEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent + | ResponseCreatedEvent + | ResponseErrorEvent + | ResponseFileSearchCallCompletedEvent + | ResponseFileSearchCallInProgressEvent + | ResponseFileSearchCallSearchingEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent + | ResponseInProgressEvent + | ResponseFailedEvent + | ResponseIncompleteEvent + | ResponseOutputItemAddedEvent + | ResponseOutputItemDoneEvent + | ResponseRefusalDeltaEvent + | ResponseRefusalDoneEvent + | ResponseTextAnnotationDeltaEvent + | ResponseTextDeltaEvent + | ResponseTextDoneEvent + | ResponseWebSearchCallCompletedEvent + | ResponseWebSearchCallInProgressEvent + | ResponseWebSearchCallSearchingEvent; diff --git a/src/lib/responses/ResponseStream.ts b/src/lib/responses/ResponseStream.ts new file mode 100644 index 000000000..0d6cd47dd --- /dev/null +++ b/src/lib/responses/ResponseStream.ts @@ -0,0 +1,298 @@ +import { + type ParsedResponse, + type Response, + type ResponseCreateParamsBase, + type ResponseCreateParamsStreaming, + type ResponseStreamEvent, +} from 'openai/resources/responses/responses'; +import * as Core from '../../core'; +import { APIUserAbortError, OpenAIError } from '../../error'; +import OpenAI from '../../index'; +import { type BaseEvents, EventStream } from '../EventStream'; +import { type ResponseFunctionCallArgumentsDeltaEvent, type ResponseTextDeltaEvent } from './EventTypes'; +import { maybeParseResponse } from '../ResponsesParser'; + +export type ResponseStreamParams = Omit & { + stream?: true; +}; + +type ResponseEvents = BaseEvents & + Omit< + { + [K in ResponseStreamEvent['type']]: (event: Extract) => void; + }, + 'response.output_text.delta' | 'response.function_call_arguments.delta' + > & { + event: (event: ResponseStreamEvent) => void; + 'response.output_text.delta': (event: ResponseTextDeltaEvent) => void; + 'response.function_call_arguments.delta': (event: ResponseFunctionCallArgumentsDeltaEvent) => void; + }; + +export type ResponseStreamingParams = Omit & { + stream?: true; +}; + +export class ResponseStream + extends EventStream + implements AsyncIterable +{ + #params: ResponseStreamingParams | null; + #currentResponseSnapshot: Response | undefined; + #finalResponse: ParsedResponse | undefined; + + constructor(params: ResponseStreamingParams | null) { + super(); + this.#params = params; + } + + static createResponse( + client: OpenAI, + params: ResponseStreamParams, + options?: Core.RequestOptions, + ): ResponseStream { + const runner = new ResponseStream(params as ResponseCreateParamsStreaming); + runner._run(() => + runner._createResponse(client, params, { + ...options, + headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'stream' }, + }), + ); + return runner; + } + + #beginRequest() { + if (this.ended) return; + this.#currentResponseSnapshot = undefined; + } + + #addEvent(this: ResponseStream, event: ResponseStreamEvent) { + if (this.ended) return; + + const response = this.#accumulateResponse(event); + this._emit('event', event); + + switch (event.type) { + case 'response.output_text.delta': { + const output = response.output[event.output_index]; + if (!output) { + throw new OpenAIError(`missing output at index ${event.output_index}`); + } + if (output.type === 'message') { + const content = output.content[event.content_index]; + if (!content) { + throw new OpenAIError(`missing content at index ${event.content_index}`); + } + if (content.type !== 'output_text') { + throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`); + } + + this._emit('response.output_text.delta', { + ...event, + snapshot: content.text, + }); + } + break; + } + case 'response.function_call_arguments.delta': { + const output = response.output[event.output_index]; + if (!output) { + throw new OpenAIError(`missing output at index ${event.output_index}`); + } + if (output.type === 'function_call') { + this._emit('response.function_call_arguments.delta', { + ...event, + snapshot: output.arguments, + }); + } + break; + } + default: + // @ts-ignore + this._emit(event.type, event); + break; + } + } + + #endRequest(): ParsedResponse { + if (this.ended) { + throw new OpenAIError(`stream has ended, this shouldn't happen`); + } + const snapshot = this.#currentResponseSnapshot; + if (!snapshot) { + throw new OpenAIError(`request ended without sending any events`); + } + this.#currentResponseSnapshot = undefined; + const parsedResponse = finalizeResponse(snapshot, this.#params); + this.#finalResponse = parsedResponse; + + return parsedResponse; + } + + protected async _createResponse( + client: OpenAI, + params: ResponseStreamingParams, + options?: Core.RequestOptions, + ): Promise> { + const signal = options?.signal; + if (signal) { + if (signal.aborted) this.controller.abort(); + signal.addEventListener('abort', () => this.controller.abort()); + } + this.#beginRequest(); + + const stream = await client.responses.create( + { ...params, stream: true }, + { ...options, signal: this.controller.signal }, + ); + this._connected(); + for await (const event of stream) { + this.#addEvent(event); + } + if (stream.controller.signal?.aborted) { + throw new APIUserAbortError(); + } + return this.#endRequest(); + } + + #accumulateResponse(event: ResponseStreamEvent): Response { + let snapshot = this.#currentResponseSnapshot; + if (!snapshot) { + if (event.type !== 'response.created') { + throw new OpenAIError( + `When snapshot hasn't been set yet, expected 'response.created' event, got ${event.type}`, + ); + } + snapshot = this.#currentResponseSnapshot = event.response; + return snapshot; + } + + switch (event.type) { + case 'response.output_item.added': { + snapshot.output.push(event.item); + break; + } + case 'response.content_part.added': { + const output = snapshot.output[event.output_index]; + if (!output) { + throw new OpenAIError(`missing output at index ${event.output_index}`); + } + if (output.type === 'message') { + output.content.push(event.part); + } + break; + } + case 'response.output_text.delta': { + const output = snapshot.output[event.output_index]; + if (!output) { + throw new OpenAIError(`missing output at index ${event.output_index}`); + } + if (output.type === 'message') { + const content = output.content[event.content_index]; + if (!content) { + throw new OpenAIError(`missing content at index ${event.content_index}`); + } + if (content.type !== 'output_text') { + throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`); + } + content.text += event.delta; + } + break; + } + case 'response.function_call_arguments.delta': { + const output = snapshot.output[event.output_index]; + if (!output) { + throw new OpenAIError(`missing output at index ${event.output_index}`); + } + if (output.type === 'function_call') { + output.arguments += event.delta; + } + break; + } + case 'response.completed': { + this.#currentResponseSnapshot = event.response; + break; + } + } + + return snapshot; + } + + [Symbol.asyncIterator](this: ResponseStream): AsyncIterator { + const pushQueue: ResponseStreamEvent[] = []; + const readQueue: { + resolve: (event: ResponseStreamEvent | undefined) => void; + reject: (err: unknown) => void; + }[] = []; + let done = false; + + this.on('event', (event) => { + const reader = readQueue.shift(); + if (reader) { + reader.resolve(event); + } else { + pushQueue.push(event); + } + }); + + this.on('end', () => { + done = true; + for (const reader of readQueue) { + reader.resolve(undefined); + } + readQueue.length = 0; + }); + + this.on('abort', (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + + this.on('error', (err) => { + done = true; + for (const reader of readQueue) { + reader.reject(err); + } + readQueue.length = 0; + }); + + return { + next: async (): Promise> => { + if (!pushQueue.length) { + if (done) { + return { value: undefined, done: true }; + } + return new Promise((resolve, reject) => + readQueue.push({ resolve, reject }), + ).then((event) => (event ? { value: event, done: false } : { value: undefined, done: true })); + } + const event = pushQueue.shift()!; + return { value: event, done: false }; + }, + return: async () => { + this.abort(); + return { value: undefined, done: true }; + }, + }; + } + + /** + * @returns a promise that resolves with the final Response, or rejects + * if an error occurred or the stream ended prematurely without producing a REsponse. + */ + async finalResponse(): Promise> { + await this.done(); + const response = this.#finalResponse; + if (!response) throw new OpenAIError('stream ended without producing a ChatCompletion'); + return response; + } +} + +function finalizeResponse( + snapshot: Response, + params: ResponseStreamingParams | null, +): ParsedResponse { + return maybeParseResponse(snapshot, params); +} diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 919bf53b3..0668dcf54 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -4,10 +4,8 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; -import * as ChatAPI from '../chat/chat'; import * as MessagesAPI from './threads/messages'; import * as ThreadsAPI from './threads/threads'; -import * as VectorStoresAPI from './vector-stores/vector-stores'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; import { CursorPage, type CursorPageParams } from '../../pagination'; @@ -1105,7 +1103,7 @@ export interface AssistantCreateParams { * [Model overview](https://platform.openai.com/docs/models) for descriptions of * them. */ - model: (string & {}) | ChatAPI.ChatModel; + model: (string & {}) | Shared.ChatModel; /** * The description of the assistant. The maximum length is 512 characters. @@ -1134,14 +1132,14 @@ export interface AssistantCreateParams { name?: string | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Specifies the format that the model must output. Compatible with @@ -1244,9 +1242,9 @@ export namespace AssistantCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -1265,6 +1263,45 @@ export namespace AssistantCreateParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } @@ -1337,14 +1374,14 @@ export interface AssistantUpdateParams { name?: string | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Specifies the format that the model must output. Compatible with diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index df929b2f7..0b909de18 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -40,36 +40,16 @@ import { ThreadUpdateParams, Threads, } from './threads/threads'; -import * as VectorStoresAPI from './vector-stores/vector-stores'; -import { - AutoFileChunkingStrategyParam, - FileChunkingStrategy, - FileChunkingStrategyParam, - OtherFileChunkingStrategyObject, - StaticFileChunkingStrategy, - StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyObjectParam, - VectorStore, - VectorStoreCreateParams, - VectorStoreDeleted, - VectorStoreListParams, - VectorStoreUpdateParams, - VectorStores, - VectorStoresPage, -} from './vector-stores/vector-stores'; import { Chat } from './chat/chat'; export class Beta extends APIResource { realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client); - vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client); chat: ChatAPI.Chat = new ChatAPI.Chat(this._client); assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client); threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } Beta.Realtime = Realtime; -Beta.VectorStores = VectorStores; -Beta.VectorStoresPage = VectorStoresPage; Beta.Assistants = Assistants; Beta.AssistantsPage = AssistantsPage; Beta.Threads = Threads; @@ -77,23 +57,6 @@ Beta.Threads = Threads; export declare namespace Beta { export { Realtime as Realtime }; - export { - VectorStores as VectorStores, - type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, - type FileChunkingStrategy as FileChunkingStrategy, - type FileChunkingStrategyParam as FileChunkingStrategyParam, - type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, - type StaticFileChunkingStrategy as StaticFileChunkingStrategy, - type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, - type VectorStore as VectorStore, - type VectorStoreDeleted as VectorStoreDeleted, - VectorStoresPage as VectorStoresPage, - type VectorStoreCreateParams as VectorStoreCreateParams, - type VectorStoreUpdateParams as VectorStoreUpdateParams, - type VectorStoreListParams as VectorStoreListParams, - }; - export { Chat }; export { diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index babca0016..b9cef17cb 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -37,19 +37,3 @@ export { type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, } from './threads/index'; -export { - VectorStoresPage, - VectorStores, - type AutoFileChunkingStrategyParam, - type FileChunkingStrategy, - type FileChunkingStrategyParam, - type OtherFileChunkingStrategyObject, - type StaticFileChunkingStrategy, - type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyObjectParam, - type VectorStore, - type VectorStoreDeleted, - type VectorStoreCreateParams, - type VectorStoreUpdateParams, - type VectorStoreListParams, -} from './vector-stores/index'; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 8ab94cc99..15bfb4204 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -10,7 +10,6 @@ import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStrea 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'; import * as ThreadsAPI from '../threads'; import * as StepsAPI from './steps'; @@ -722,7 +721,7 @@ export interface RunCreateParamsBase { * associated with the assistant. If not, the model associated with the assistant * will be used. */ - model?: (string & {}) | ChatAPI.ChatModel | null; + model?: (string & {}) | Shared.ChatModel | null; /** * Body param: Whether to enable @@ -732,14 +731,14 @@ export interface RunCreateParamsBase { parallel_tool_calls?: boolean; /** - * Body param: **o1 and o3-mini models only** + * Body param: **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Body param: Specifies the format that the model must output. Compatible with diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 3f69c6e60..8075ba0ac 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -8,7 +8,6 @@ import * as Core from '../../../core'; import * as ThreadsAPI from './threads'; import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; -import * as ChatAPI from '../../chat/chat'; import * as MessagesAPI from './messages'; import { Annotation, @@ -45,7 +44,6 @@ import { TextDelta, TextDeltaBlock, } from './messages'; -import * as VectorStoresAPI from '../vector-stores/vector-stores'; import * as RunsAPI from './runs/runs'; import { RequiredActionFunctionToolCall, @@ -441,9 +439,9 @@ export namespace ThreadCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -462,6 +460,45 @@ export namespace ThreadCreateParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } @@ -573,7 +610,7 @@ export interface ThreadCreateAndRunParamsBase { * model associated with the assistant. If not, the model associated with the * assistant will be used. */ - model?: (string & {}) | ChatAPI.ChatModel | null; + model?: (string & {}) | Shared.ChatModel | null; /** * Whether to enable @@ -800,9 +837,9 @@ export namespace ThreadCreateAndRunParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -821,6 +858,45 @@ export namespace ThreadCreateAndRunParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 627b4fc23..9dbc636d8 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as Shared from '../shared'; import * as CompletionsAPI from './completions/completions'; import { ChatCompletion, @@ -52,48 +53,7 @@ export class Chat extends APIResource { completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client); } -export type ChatModel = - | 'o3-mini' - | 'o3-mini-2025-01-31' - | 'o1' - | 'o1-2024-12-17' - | 'o1-preview' - | 'o1-preview-2024-09-12' - | 'o1-mini' - | 'o1-mini-2024-09-12' - | 'gpt-4.5-preview' - | 'gpt-4.5-preview-2025-02-27' - | 'gpt-4o' - | 'gpt-4o-2024-11-20' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-audio-preview' - | 'gpt-4o-audio-preview-2024-10-01' - | 'gpt-4o-audio-preview-2024-12-17' - | 'gpt-4o-mini-audio-preview' - | 'gpt-4o-mini-audio-preview-2024-12-17' - | 'chatgpt-4o-latest' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0301' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613'; +export type ChatModel = Shared.ChatModel; Chat.Completions = Completions; Chat.ChatCompletionsPage = ChatCompletionsPage; @@ -123,7 +83,6 @@ export declare namespace Chat { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -134,6 +93,7 @@ export declare namespace Chat { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 3af4a3a1d..7b1c353e2 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -7,7 +7,6 @@ import * as Core from '../../../core'; import * as CompletionsCompletionsAPI from './completions'; import * as CompletionsAPI from '../../completions'; import * as Shared from '../../shared'; -import * as ChatAPI from '../chat'; import * as MessagesAPI from './messages'; import { MessageListParams, Messages } from './messages'; import { CursorPage, type CursorPageParams } from '../../../pagination'; @@ -17,6 +16,13 @@ export class Completions extends APIResource { messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); /** + * **Starting a new project?** We recommend trying + * [Responses](https://platform.openai.com/docs/api-reference/responses) to take + * advantage of the latest OpenAI platform features. Compare + * [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses). + * + * --- + * * Creates a model response for the given chat conversation. Learn more in the * [text generation](https://platform.openai.com/docs/guides/text-generation), * [vision](https://platform.openai.com/docs/guides/vision), and @@ -50,7 +56,7 @@ export class Completions extends APIResource { } /** - * Get a stored chat completion. Only chat completions that have been created with + * Get a stored chat completion. Only Chat Completions that have been created with * the `store` parameter set to `true` will be returned. */ retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise { @@ -58,7 +64,7 @@ export class Completions extends APIResource { } /** - * Modify a stored chat completion. Only chat completions that have been created + * Modify a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be modified. Currently, the only * supported modification is to update the `metadata` field. */ @@ -71,7 +77,7 @@ export class Completions extends APIResource { } /** - * List stored chat completions. Only chat completions that have been stored with + * List stored Chat Completions. Only Chat Completions that have been stored with * the `store` parameter set to `true` will be returned. */ list( @@ -90,7 +96,7 @@ export class Completions extends APIResource { } /** - * Delete a stored chat completion. Only chat completions that have been created + * Delete a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be deleted. */ del(completionId: string, options?: Core.RequestOptions): Core.APIPromise { @@ -316,16 +322,16 @@ export interface ChatCompletionAudioParam { format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** - * The voice the model uses to respond. Supported voices are `ash`, `ballad`, - * `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, - * `echo`, and `shimmer`; these voices are less expressive). + * The voice the model uses to respond. Supported voices are `alloy`, `ash`, + * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. */ voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; } /** - * Represents a streamed chunk of a chat completion response returned by model, + * Represents a streamed chunk of a chat completion response returned by the model, * based on the provided input. + * [Learn more](https://platform.openai.com/docs/guides/streaming-responses). */ export interface ChatCompletionChunk { /** @@ -512,7 +518,43 @@ export namespace ChatCompletionChunk { export type ChatCompletionContentPart = | ChatCompletionContentPartText | ChatCompletionContentPartImage - | ChatCompletionContentPartInputAudio; + | ChatCompletionContentPartInputAudio + | ChatCompletionContentPart.File; + +export namespace ChatCompletionContentPart { + /** + * Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text + * generation. + */ + export interface File { + file: File.File; + + /** + * The type of the content part. Always `file`. + */ + type: 'file'; + } + + export namespace File { + export interface File { + /** + * The base64 encoded file data, used when passing the file to the model as a + * string. + */ + file_data?: string; + + /** + * The ID of an uploaded file to use as input. + */ + file_id?: string; + + /** + * The name of the file, used when passing the file to the model as a string. + */ + file_name?: string; + } + } +} /** * Learn about [image inputs](https://platform.openai.com/docs/guides/vision). @@ -685,6 +727,12 @@ export interface ChatCompletionMessage { */ role: 'assistant'; + /** + * Annotations for the message, when applicable, as when using the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + annotations?: Array; + /** * If the audio output modality is requested, this object contains data about the * audio response from the model. @@ -705,6 +753,48 @@ export interface ChatCompletionMessage { } export namespace ChatCompletionMessage { + /** + * A URL citation when using web search. + */ + export interface Annotation { + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * A URL citation when using web search. + */ + url_citation: Annotation.URLCitation; + } + + export namespace Annotation { + /** + * A URL citation when using web search. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The URL of the web resource. + */ + url: string; + } + } + /** * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a * function that should be called, as generated by the model. @@ -818,16 +908,6 @@ export interface ChatCompletionPredictionContent { type: 'content'; } -/** - * **o1 and o3-mini models only** - * - * Constrains effort on reasoning for - * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently - * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can - * result in faster responses and fewer tokens used on reasoning in a response. - */ -export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; - /** * The role of the author of a message */ @@ -998,6 +1078,8 @@ export interface ChatCompletionUserMessageParam { */ export type CreateChatCompletionRequestMessage = ChatCompletionMessageParam; +export type ChatCompletionReasoningEffort = Shared.ReasoningEffort | null; + export type ChatCompletionCreateParams = | ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming; @@ -1014,11 +1096,13 @@ export interface ChatCompletionCreateParamsBase { messages: Array; /** - * ID of the model to use. See the - * [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility) - * table for details on which models work with the Chat API. + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. */ - model: (string & {}) | ChatAPI.ChatModel; + model: (string & {}) | Shared.ChatModel; /** * Parameters for audio output. Required when audio output is requested with @@ -1107,8 +1191,8 @@ export interface ChatCompletionCreateParamsBase { metadata?: Shared.Metadata | null; /** - * Output types that you would like the model to generate for this request. Most - * models are capable of generating text, which is the default: + * Output types that you would like the model to generate. Most models are capable + * of generating text, which is the default: * * `["text"]` * @@ -1118,7 +1202,7 @@ export interface ChatCompletionCreateParamsBase { * * `["text", "audio"]` */ - modalities?: Array | null; + modalities?: Array<'text' | 'audio'> | null; /** * How many chat completion choices to generate for each input message. Note that @@ -1148,14 +1232,14 @@ export interface ChatCompletionCreateParamsBase { presence_penalty?: number | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: ChatCompletionReasoningEffort | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * An object specifying the format that the model must output. @@ -1165,21 +1249,14 @@ export interface ChatCompletionCreateParamsBase { * in the * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). * - * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. */ response_format?: | Shared.ResponseFormatText - | Shared.ResponseFormatJSONObject - | Shared.ResponseFormatJSONSchema; + | Shared.ResponseFormatJSONSchema + | Shared.ResponseFormatJSONObject; /** * This feature is in Beta. If specified, our system will make a best effort to @@ -1198,15 +1275,19 @@ 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 guarantee. + * latency guarentee. * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarantee. + * tier with a lower uptime SLA and no latency guarentee. * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ service_tier?: 'auto' | 'default' | null; /** - * Up to 4 sequences where the API will stop generating further tokens. + * Up to 4 sequences where the API will stop generating further tokens. The + * returned text will not contain the stop sequence. */ stop?: string | null | Array; @@ -1218,12 +1299,14 @@ export interface ChatCompletionCreateParamsBase { store?: boolean | null; /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream?: boolean | null; @@ -1282,6 +1365,13 @@ export interface ChatCompletionCreateParamsBase { * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; + + /** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + web_search_options?: ChatCompletionCreateParams.WebSearchOptions; } export namespace ChatCompletionCreateParams { @@ -1313,6 +1403,70 @@ export namespace ChatCompletionCreateParams { parameters?: Shared.FunctionParameters; } + /** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + export interface WebSearchOptions { + /** + * 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. + */ + search_context_size?: 'low' | 'medium' | 'high'; + + /** + * Approximate location parameters for the search. + */ + user_location?: WebSearchOptions.UserLocation | null; + } + + export namespace WebSearchOptions { + /** + * Approximate location parameters for the search. + */ + export interface UserLocation { + /** + * Approximate location parameters for the search. + */ + approximate: UserLocation.Approximate; + + /** + * The type of location approximation. Always `approximate`. + */ + type: 'approximate'; + } + + export namespace UserLocation { + /** + * Approximate location parameters for the search. + */ + export interface Approximate { + /** + * Free text input for the city of the user, e.g. `San Francisco`. + */ + city?: string; + + /** + * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of + * the user, e.g. `US`. + */ + country?: string; + + /** + * Free text input for the region of the user, e.g. `California`. + */ + region?: string; + + /** + * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the + * user, e.g. `America/Los_Angeles`. + */ + timezone?: string; + } + } + } + export type ChatCompletionCreateParamsNonStreaming = CompletionsCompletionsAPI.ChatCompletionCreateParamsNonStreaming; export type ChatCompletionCreateParamsStreaming = @@ -1326,12 +1480,14 @@ export type CompletionCreateParams = ChatCompletionCreateParams; export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase { /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream?: false | null; } @@ -1343,12 +1499,14 @@ export type CompletionCreateParamsNonStreaming = ChatCompletionCreateParamsNonSt export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase { /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream: true; } @@ -1377,19 +1535,19 @@ export type CompletionUpdateParams = ChatCompletionUpdateParams; export interface ChatCompletionListParams extends CursorPageParams { /** - * A list of metadata keys to filter the chat completions by. Example: + * A list of metadata keys to filter the Chat Completions by. Example: * * `metadata[key1]=value1&metadata[key2]=value2` */ metadata?: Shared.Metadata | null; /** - * The model used to generate the chat completions. + * The model used to generate the Chat Completions. */ model?: string; /** - * Sort order for chat completions by timestamp. Use `asc` for ascending order or + * Sort order for Chat Completions by timestamp. Use `asc` for ascending order or * `desc` for descending order. Defaults to `asc`. */ order?: 'asc' | 'desc'; @@ -1425,7 +1583,6 @@ export declare namespace Completions { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -1436,6 +1593,7 @@ export declare namespace Completions { type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type CompletionCreateParams as CompletionCreateParams, diff --git a/src/resources/chat/completions/index.ts b/src/resources/chat/completions/index.ts index 3691f41d8..994d6f880 100644 --- a/src/resources/chat/completions/index.ts +++ b/src/resources/chat/completions/index.ts @@ -24,7 +24,6 @@ export { type ChatCompletionModality, type ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort, type ChatCompletionRole, type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index fc1cc5d94..519a33aff 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -9,7 +9,7 @@ import { type CursorPageParams } from '../../../pagination'; export class Messages extends APIResource { /** - * Get the messages in a stored chat completion. Only chat completions that have + * Get the messages in a stored chat completion. Only Chat Completions that have * been created with the `store` parameter set to `true` will be returned. */ list( diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index a9b5b46fb..62ca758e0 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Chat, type ChatModel } from './chat'; +export { Chat } from './chat'; export { ChatCompletionStoreMessagesPage, ChatCompletionsPage, @@ -25,7 +25,6 @@ export { type ChatCompletionModality, type ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort, type ChatCompletionRole, type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, diff --git a/src/resources/files.ts b/src/resources/files.ts index f5f23dcad..723ac4cde 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -186,16 +186,12 @@ export interface FileObject { } /** - * The intended purpose of the uploaded file. - * - * Use "assistants" for - * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and - * [Message](https://platform.openai.com/docs/api-reference/messages) files, - * "vision" for Assistants image file inputs, "batch" for - * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for - * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning). + * The intended purpose of the uploaded file. One of: - `assistants`: Used in the + * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for + * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: + * Flexible file type for any purpose - `evals`: Used for eval data sets */ -export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision'; +export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision' | 'user_data' | 'evals'; export interface FileCreateParams { /** @@ -204,14 +200,10 @@ export interface FileCreateParams { file: Core.Uploadable; /** - * The intended purpose of the uploaded file. - * - * Use "assistants" for - * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and - * [Message](https://platform.openai.com/docs/api-reference/messages) files, - * "vision" for Assistants image file inputs, "batch" for - * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for - * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning). + * The intended purpose of the uploaded file. One of: - `assistants`: Used in the + * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for + * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: + * Flexible file type for any purpose - `evals`: Used for eval data sets */ purpose: FilePurpose; } diff --git a/src/resources/index.ts b/src/resources/index.ts index ad0302357..04c2c887b 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -60,4 +60,24 @@ export { type ModerationCreateResponse, type ModerationCreateParams, } from './moderations'; +export { Responses } from './responses/responses'; export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from './uploads/uploads'; +export { + VectorStoresPage, + VectorStoreSearchResponsesPage, + VectorStores, + type AutoFileChunkingStrategyParam, + type FileChunkingStrategy, + type FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyObjectParam, + type VectorStore, + type VectorStoreDeleted, + type VectorStoreSearchResponse, + type VectorStoreCreateParams, + type VectorStoreUpdateParams, + type VectorStoreListParams, + type VectorStoreSearchParams, +} from './vector-stores/vector-stores'; diff --git a/src/resources/responses/index.ts b/src/resources/responses/index.ts new file mode 100644 index 000000000..84f761a93 --- /dev/null +++ b/src/resources/responses/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ResponseItemListDataPage, + InputItems, + type ResponseItemList, + type InputItemListParams, +} from './input-items'; +export { Responses } from './responses'; diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts new file mode 100644 index 000000000..9704be89a --- /dev/null +++ b/src/resources/responses/input-items.ts @@ -0,0 +1,276 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; +import * as ResponsesAPI from './responses'; +import { CursorPage, type CursorPageParams } from '../../pagination'; + +export class InputItems extends APIResource { + /** + * Returns a list of input items for a given response. + */ + list( + responseId: string, + query?: InputItemListParams, + options?: Core.RequestOptions, + ): Core.PagePromise< + ResponseItemListDataPage, + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + >; + list( + responseId: string, + options?: Core.RequestOptions, + ): Core.PagePromise< + ResponseItemListDataPage, + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + >; + list( + responseId: string, + query: InputItemListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise< + ResponseItemListDataPage, + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + > { + if (isRequestOptions(query)) { + return this.list(responseId, {}, query); + } + return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemListDataPage, { + query, + ...options, + }); + } +} + +export class ResponseItemListDataPage extends CursorPage< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput +> {} + +/** + * A list of Response items. + */ +export interface ResponseItemList { + /** + * A list of items used to generate this response. + */ + data: Array< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + >; + + /** + * The ID of the first item in the list. + */ + first_id: string; + + /** + * Whether there are more items available. + */ + has_more: boolean; + + /** + * The ID of the last item in the list. + */ + last_id: string; + + /** + * The type of object returned, must be `list`. + */ + object: 'list'; +} + +export namespace ResponseItemList { + export interface Message { + /** + * The unique ID of the message input. + */ + id: string; + + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponsesAPI.ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; + } + + export interface ComputerCallOutput { + /** + * The unique ID of the computer call tool output. + */ + id: string; + + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ComputerCallOutput.Output; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace ComputerCallOutput { + /** + * A computer screenshot image used with the computer use tool. + */ + export interface Output { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; + } + + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } + } + + export interface FunctionCallOutput { + /** + * The unique ID of the function call tool output. + */ + id: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } +} + +export interface InputItemListParams extends CursorPageParams { + /** + * An item ID to list items before, used in pagination. + */ + before?: string; + + /** + * The order to return the input items in. Default is `asc`. + * + * - `asc`: Return the input items in ascending order. + * - `desc`: Return the input items in descending order. + */ + order?: 'asc' | 'desc'; +} + +InputItems.ResponseItemListDataPage = ResponseItemListDataPage; + +export declare namespace InputItems { + export { + type ResponseItemList as ResponseItemList, + ResponseItemListDataPage as ResponseItemListDataPage, + type InputItemListParams as InputItemListParams, + }; +} diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts new file mode 100644 index 000000000..2ad146873 --- /dev/null +++ b/src/resources/responses/responses.ts @@ -0,0 +1,2761 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { + type ExtractParsedContentFromParams, + parseResponse, + type ResponseCreateParamsWithTools, + addOutputText, +} from '../../lib/ResponsesParser'; +import * as Core from '../../core'; +import { APIPromise, isRequestOptions } from '../../core'; +import { APIResource } from '../../resource'; +import { Stream } from '../../streaming'; +import * as Shared from '../shared'; +import * as InputItemsAPI from './input-items'; +import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items'; +import * as ResponsesAPI from './responses'; +import { ResponseStream, ResponseStreamParams } from '../../lib/responses/ResponseStream'; + +export interface ParsedResponseOutputText extends ResponseOutputText { + parsed: ParsedT | null; +} + +export type ParsedContent = ParsedResponseOutputText | ResponseOutputRefusal; + +export interface ParsedResponseOutputMessage extends ResponseOutputMessage { + content: ParsedContent[]; +} + +export interface ParsedResponseFunctionToolCall extends ResponseFunctionToolCall { + parsed_arguments: any; +} + +export type ParsedResponseOutputItem = + | ParsedResponseOutputMessage + | ParsedResponseFunctionToolCall + | ResponseFileSearchToolCall + | ResponseFunctionWebSearch + | ResponseComputerToolCall + | ResponseOutputItem.Reasoning; + +export interface ParsedResponse extends Response { + output: Array>; + + output_parsed: ParsedT | null; +} + +export type ResponseParseParams = ResponseCreateParamsNonStreaming; +export class Responses extends APIResource { + inputItems: InputItemsAPI.InputItems = new InputItemsAPI.InputItems(this._client); + + /** + * Creates a model response. Provide + * [text](https://platform.openai.com/docs/guides/text) or + * [image](https://platform.openai.com/docs/guides/images) inputs to generate + * [text](https://platform.openai.com/docs/guides/text) or + * [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have + * the model call your own + * [custom code](https://platform.openai.com/docs/guides/function-calling) or use + * built-in [tools](https://platform.openai.com/docs/guides/tools) like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search) to use + * your own data as input for the model's response. + */ + create(body: ResponseCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise; + create( + body: ResponseCreateParamsStreaming, + options?: Core.RequestOptions, + ): APIPromise>; + create( + body: ResponseCreateParamsBase, + options?: Core.RequestOptions, + ): APIPromise | Response>; + create( + body: ResponseCreateParams, + options?: Core.RequestOptions, + ): APIPromise | APIPromise> { + return ( + this._client.post('/responses', { body, ...options, stream: body.stream ?? false }) as + | APIPromise + | APIPromise> + )._thenUnwrap((rsp) => { + if ('type' in rsp && rsp.type === 'response') { + addOutputText(rsp as Response); + } + + return rsp; + }) as APIPromise | APIPromise>; + } + + /** + * Retrieves a model response with the given ID. + */ + retrieve( + responseId: string, + query?: ResponseRetrieveParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise; + retrieve( + responseId: string, + query: ResponseRetrieveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieve(responseId, {}, query); + } + return this._client.get(`/responses/${responseId}`, { query, ...options }); + } + + /** + * Deletes a model response with the given ID. + */ + del(responseId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/responses/${responseId}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + parse>( + body: Params, + options?: Core.RequestOptions, + ): Core.APIPromise> { + return this._client.responses + .create(body, options) + ._thenUnwrap((response) => parseResponse(response as Response, body)); + } + + /** + * Creates a chat completion stream + */ + stream>( + body: Params, + options?: Core.RequestOptions, + ): ResponseStream { + return ResponseStream.createResponse(this._client, body, options); + } +} + +/** + * A tool that controls a virtual computer. Learn more about the + * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + */ +export interface ComputerTool { + /** + * The height of the computer display. + */ + display_height: number; + + /** + * The width of the computer display. + */ + display_width: number; + + /** + * The type of computer environment to control. + */ + environment: 'mac' | 'windows' | 'ubuntu' | 'browser'; + + /** + * The type of the computer use tool. Always `computer_use_preview`. + */ + type: 'computer-preview'; +} + +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export interface EasyInputMessage { + /** + * Text, image, or audio input to the model, used to generate a response. Can also + * contain previous assistant responses. + */ + content: string | ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; +} + +/** + * A tool that searches for relevant content from uploaded files. Learn more about + * the + * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + */ +export interface FileSearchTool { + /** + * The type of the file search tool. Always `file_search`. + */ + type: 'file_search'; + + /** + * The IDs of the vector stores to search. + */ + vector_store_ids: Array; + + /** + * A filter to apply based on file attributes. + */ + filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + + /** + * The maximum number of results to return. This number should be between 1 and 50 + * inclusive. + */ + max_num_results?: number; + + /** + * Ranking options for search. + */ + ranking_options?: FileSearchTool.RankingOptions; +} + +export namespace FileSearchTool { + /** + * Ranking options for search. + */ + export interface RankingOptions { + /** + * The ranker to use for the file search. + */ + ranker?: 'auto' | 'default-2024-11-15'; + + /** + * The score threshold for the file search, a number between 0 and 1. Numbers + * closer to 1 will attempt to return only the most relevant results, but may + * return fewer results. + */ + score_threshold?: number; + } +} + +/** + * Defines a function in your own code the model can choose to call. Learn more + * about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ +export interface FunctionTool { + /** + * The name of the function to call. + */ + name: string; + + /** + * A JSON schema object describing the parameters of the function. + */ + parameters: Record; + + /** + * Whether to enforce strict parameter validation. Default `true`. + */ + strict: boolean; + + /** + * The type of the function tool. Always `function`. + */ + type: 'function'; + + /** + * A description of the function. Used by the model to determine whether or not to + * call the function. + */ + description?: string | null; +} + +export interface Response { + /** + * Unique identifier for this Response. + */ + id: string; + + /** + * Unix timestamp (in seconds) of when this Response was created. + */ + created_at: number; + + output_text: string; + + /** + * An error object returned when the model fails to generate a Response. + */ + error: ResponseError | null; + + /** + * Details about why the response is incomplete. + */ + incomplete_details: Response.IncompleteDetails | null; + + /** + * Inserts a system (or developer) message as the first item in the model's + * context. + * + * When using along with `previous_response_id`, the instructions from a previous + * response will be not be carried over to the next response. This makes it simple + * to swap out system (or developer) messages in new responses. + */ + instructions: string | null; + + /** + * 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; + + /** + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. + */ + model: (string & {}) | Shared.ChatModel; + + /** + * The object type of this resource - always set to `response`. + */ + object: 'response'; + + /** + * An array of content items generated by the model. + * + * - The length and order of items in the `output` array is dependent on the + * model's response. + * - Rather than accessing the first item in the `output` array and assuming it's + * an `assistant` message with the content generated by the model, you might + * consider using the `output_text` property where supported in SDKs. + */ + output: Array; + + /** + * Whether to allow the model to run tool calls in parallel. + */ + parallel_tool_calls: boolean; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will + * make the output more random, while lower values like 0.2 will make it more + * focused and deterministic. We generally recommend altering this or `top_p` but + * not both. + */ + temperature: number | null; + + /** + * How the model should select which tool (or tools) to use when generating a + * response. See the `tools` parameter to see how to specify which tools the model + * can call. + */ + tool_choice: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools: Array; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the + * model considers the results of the tokens with top_p probability mass. So 0.1 + * means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p: number | null; + + /** + * An upper bound for the number of tokens that can be generated for a response, + * including visible output tokens and + * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). + */ + max_output_tokens?: number | null; + + /** + * The unique ID of the previous response to the model. Use this to create + * multi-turn conversations. Learn more about + * [conversation state](https://platform.openai.com/docs/guides/conversation-state). + */ + previous_response_id?: string | null; + + /** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ + reasoning?: Shared.Reasoning | null; + + /** + * The status of the response generation. One of `completed`, `failed`, + * `in_progress`, or `incomplete`. + */ + status?: ResponseStatus; + + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: ResponseTextConfig; + + /** + * The truncation strategy to use for the model response. + * + * - `auto`: If the context of this response and previous ones exceeds the model's + * context window size, the model will truncate the response to fit the context + * window by dropping input items in the middle of the conversation. + * - `disabled` (default): If a model response will exceed the context window size + * for a model, the request will fail with a 400 error. + */ + truncation?: 'auto' | 'disabled' | null; + + /** + * Represents token usage details including input tokens, output tokens, a + * breakdown of output tokens, and the total tokens used. + */ + usage?: ResponseUsage; + + /** + * A unique identifier representing your end-user, which can help OpenAI to monitor + * and detect abuse. + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). + */ + user?: string; +} + +export namespace Response { + /** + * Details about why the response is incomplete. + */ + export interface IncompleteDetails { + /** + * The reason why the response is incomplete. + */ + reason?: 'max_output_tokens' | 'content_filter'; + } +} + +/** + * Emitted when there is a partial audio response. + */ +export interface ResponseAudioDeltaEvent { + /** + * A chunk of Base64 encoded response audio bytes. + */ + delta: string; + + /** + * The type of the event. Always `response.audio.delta`. + */ + type: 'response.audio.delta'; +} + +/** + * Emitted when the audio response is complete. + */ +export interface ResponseAudioDoneEvent { + /** + * The type of the event. Always `response.audio.done`. + */ + type: 'response.audio.done'; +} + +/** + * Emitted when there is a partial transcript of audio. + */ +export interface ResponseAudioTranscriptDeltaEvent { + /** + * The partial transcript of the audio response. + */ + delta: string; + + /** + * The type of the event. Always `response.audio.transcript.delta`. + */ + type: 'response.audio.transcript.delta'; +} + +/** + * Emitted when the full audio transcript is completed. + */ +export interface ResponseAudioTranscriptDoneEvent { + /** + * The type of the event. Always `response.audio.transcript.done`. + */ + type: 'response.audio.transcript.done'; +} + +/** + * Emitted when a partial code snippet is added by the code interpreter. + */ +export interface ResponseCodeInterpreterCallCodeDeltaEvent { + /** + * The partial code snippet added by the code interpreter. + */ + delta: string; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.code.delta`. + */ + type: 'response.code_interpreter_call.code.delta'; +} + +/** + * Emitted when code snippet output is finalized by the code interpreter. + */ +export interface ResponseCodeInterpreterCallCodeDoneEvent { + /** + * The final code snippet output by the code interpreter. + */ + code: string; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.code.done`. + */ + type: 'response.code_interpreter_call.code.done'; +} + +/** + * Emitted when the code interpreter call is completed. + */ +export interface ResponseCodeInterpreterCallCompletedEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.completed`. + */ + type: 'response.code_interpreter_call.completed'; +} + +/** + * Emitted when a code interpreter call is in progress. + */ +export interface ResponseCodeInterpreterCallInProgressEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.in_progress`. + */ + type: 'response.code_interpreter_call.in_progress'; +} + +/** + * Emitted when the code interpreter is actively interpreting the code snippet. + */ +export interface ResponseCodeInterpreterCallInterpretingEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.interpreting`. + */ + type: 'response.code_interpreter_call.interpreting'; +} + +/** + * A tool call to run code. + */ +export interface ResponseCodeInterpreterToolCall { + /** + * The unique ID of the code interpreter tool call. + */ + id: string; + + /** + * The code to run. + */ + code: string; + + /** + * The results of the code interpreter tool call. + */ + results: Array; + + /** + * The status of the code interpreter tool call. + */ + status: 'in_progress' | 'interpreting' | 'completed'; + + /** + * The type of the code interpreter tool call. Always `code_interpreter_call`. + */ + type: 'code_interpreter_call'; +} + +export namespace ResponseCodeInterpreterToolCall { + /** + * The output of a code interpreter tool call that is text. + */ + export interface Logs { + /** + * The logs of the code interpreter tool call. + */ + logs: string; + + /** + * The type of the code interpreter text output. Always `logs`. + */ + type: 'logs'; + } + + /** + * The output of a code interpreter tool call that is a file. + */ + export interface Files { + files: Array; + + /** + * The type of the code interpreter file output. Always `files`. + */ + type: 'files'; + } + + export namespace Files { + export interface File { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The MIME type of the file. + */ + mime_type: string; + } + } +} + +/** + * Emitted when the model response is complete. + */ +export interface ResponseCompletedEvent { + /** + * Properties of the completed response. + */ + response: Response; + + /** + * The type of the event. Always `response.completed`. + */ + type: 'response.completed'; +} + +/** + * A tool call to a computer use tool. See the + * [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) + * for more information. + */ +export interface ResponseComputerToolCall { + /** + * The unique ID of the computer call. + */ + 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. + */ + call_id: string; + + /** + * The pending safety checks for the computer call. + */ + pending_safety_checks: Array; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the computer call. Always `computer_call`. + */ + type: 'computer_call'; +} + +export namespace ResponseComputerToolCall { + /** + * 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 set to + * `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 { + /** + * A series of x/y coordinate pairs in the drag path. + */ + 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'; + } + + /** + * 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; + + /** + * Details about the pending safety check. + */ + message: string; + } +} + +/** + * Multi-modal input and output contents. + */ +export type ResponseContent = + | ResponseInputText + | ResponseInputImage + | ResponseInputFile + | ResponseOutputText + | ResponseOutputRefusal; + +/** + * Emitted when a new content part is added. + */ +export interface ResponseContentPartAddedEvent { + /** + * The index of the content part that was added. + */ + content_index: number; + + /** + * The ID of the output item that the content part was added to. + */ + item_id: string; + + /** + * The index of the output item that the content part was added to. + */ + output_index: number; + + /** + * The content part that was added. + */ + part: ResponseOutputText | ResponseOutputRefusal; + + /** + * The type of the event. Always `response.content_part.added`. + */ + type: 'response.content_part.added'; +} + +/** + * Emitted when a content part is done. + */ +export interface ResponseContentPartDoneEvent { + /** + * The index of the content part that is done. + */ + content_index: number; + + /** + * The ID of the output item that the content part was added to. + */ + item_id: string; + + /** + * The index of the output item that the content part was added to. + */ + output_index: number; + + /** + * The content part that is done. + */ + part: ResponseOutputText | ResponseOutputRefusal; + + /** + * The type of the event. Always `response.content_part.done`. + */ + type: 'response.content_part.done'; +} + +/** + * An event that is emitted when a response is created. + */ +export interface ResponseCreatedEvent { + /** + * The response that was created. + */ + response: Response; + + /** + * The type of the event. Always `response.created`. + */ + type: 'response.created'; +} + +/** + * An error object returned when the model fails to generate a Response. + */ +export interface ResponseError { + /** + * The error code for the response. + */ + code: + | 'server_error' + | 'rate_limit_exceeded' + | 'invalid_prompt' + | 'vector_store_timeout' + | 'invalid_image' + | 'invalid_image_format' + | 'invalid_base64_image' + | 'invalid_image_url' + | 'image_too_large' + | 'image_too_small' + | 'image_parse_error' + | 'image_content_policy_violation' + | 'invalid_image_mode' + | 'image_file_too_large' + | 'unsupported_image_media_type' + | 'empty_image_file' + | 'failed_to_download_image' + | 'image_file_not_found'; + + /** + * A human-readable description of the error. + */ + message: string; +} + +/** + * Emitted when an error occurs. + */ +export interface ResponseErrorEvent { + /** + * The error code. + */ + code: string | null; + + /** + * The error message. + */ + message: string; + + /** + * The error parameter. + */ + param: string | null; + + /** + * The type of the event. Always `error`. + */ + type: 'error'; +} + +/** + * An event that is emitted when a response fails. + */ +export interface ResponseFailedEvent { + /** + * The response that failed. + */ + response: Response; + + /** + * The type of the event. Always `response.failed`. + */ + type: 'response.failed'; +} + +/** + * Emitted when a file search call is completed (results found). + */ +export interface ResponseFileSearchCallCompletedEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is initiated. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.completed`. + */ + type: 'response.file_search_call.completed'; +} + +/** + * Emitted when a file search call is initiated. + */ +export interface ResponseFileSearchCallInProgressEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is initiated. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.in_progress`. + */ + type: 'response.file_search_call.in_progress'; +} + +/** + * Emitted when a file search is currently searching. + */ +export interface ResponseFileSearchCallSearchingEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is searching. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.searching`. + */ + type: 'response.file_search_call.searching'; +} + +/** + * The results of a file search tool call. See the + * [file search guide](https://platform.openai.com/docs/guides/tools-file-search) + * for more information. + */ +export interface ResponseFileSearchToolCall { + /** + * The unique ID of the file search tool call. + */ + id: string; + + /** + * The queries used to search for files. + */ + queries: Array; + + /** + * The status of the file search tool call. One of `in_progress`, `searching`, + * `incomplete` or `failed`, + */ + status: 'in_progress' | 'searching' | 'completed' | 'incomplete' | 'failed'; + + /** + * The type of the file search tool call. Always `file_search_call`. + */ + type: 'file_search_call'; + + /** + * The results of the file search tool call. + */ + results?: Array | null; +} + +export namespace ResponseFileSearchToolCall { + export interface Result { + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + + /** + * The unique ID of the file. + */ + file_id?: string; + + /** + * The name of the file. + */ + filename?: string; + + /** + * The relevance score of the file - a value between 0 and 1. + */ + score?: number; + + /** + * The text that was retrieved from the file. + */ + text?: string; + } +} + +/** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ +export type ResponseFormatTextConfig = + | Shared.ResponseFormatText + | ResponseFormatTextJSONSchemaConfig + | Shared.ResponseFormatJSONObject; + +/** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). + */ +export interface ResponseFormatTextJSONSchemaConfig { + /** + * The schema for the response format, described as a JSON Schema object. Learn how + * to build JSON schemas [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of response format being defined. Always `json_schema`. + */ + type: 'json_schema'; + + /** + * A description of what the response format is for, used by the model to determine + * how to respond in the format. + */ + description?: string; + + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores + * and dashes, with a maximum length of 64. + */ + name?: string; + + /** + * Whether to enable strict schema adherence when generating the output. If set to + * true, the model will always follow the exact schema defined in the `schema` + * field. Only a subset of JSON Schema is supported when `strict` is `true`. To + * learn more, read the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + */ + strict?: boolean | null; +} + +/** + * Emitted when there is a partial function-call arguments delta. + */ +export interface ResponseFunctionCallArgumentsDeltaEvent { + /** + * The function-call arguments delta that is added. + */ + delta: string; + + /** + * The ID of the output item that the function-call arguments delta is added to. + */ + item_id: string; + + /** + * The index of the output item that the function-call arguments delta is added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.function_call_arguments.delta`. + */ + type: 'response.function_call_arguments.delta'; +} + +/** + * Emitted when function-call arguments are finalized. + */ +export interface ResponseFunctionCallArgumentsDoneEvent { + /** + * The function-call arguments. + */ + arguments: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item. + */ + output_index: number; + + type: 'response.function_call_arguments.done'; +} + +/** + * A tool call to run a function. See the + * [function calling guide](https://platform.openai.com/docs/guides/function-calling) + * for more information. + */ +export interface ResponseFunctionToolCall { + /** + * The unique ID of the function tool call. + */ + id: string; + + /** + * A JSON string of the arguments to pass to the function. + */ + arguments: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * The name of the function to run. + */ + name: string; + + /** + * The type of the function tool call. Always `function_call`. + */ + type: 'function_call'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +/** + * The results of a web search tool call. See the + * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for + * more information. + */ +export interface ResponseFunctionWebSearch { + /** + * The unique ID of the web search tool call. + */ + id: string; + + /** + * The status of the web search tool call. + */ + status: 'in_progress' | 'searching' | 'completed' | 'failed'; + + /** + * The type of the web search tool call. Always `web_search_call`. + */ + type: 'web_search_call'; +} + +/** + * Emitted when the response is in progress. + */ +export interface ResponseInProgressEvent { + /** + * The response that is in progress. + */ + response: Response; + + /** + * The type of the event. Always `response.in_progress`. + */ + type: 'response.in_progress'; +} + +/** + * Specify additional output data to include in the model response. Currently + * supported values are: + * + * - `file_search_call.results`: Include the search results of the file search tool + * call. + * - `message.input_image.image_url`: Include image urls from the input message. + * - `computer_call_output.output.image_url`: Include image urls from the computer + * call output. + */ +export type ResponseIncludable = + | 'file_search_call.results' + | 'message.input_image.image_url' + | 'computer_call_output.output.image_url'; + +/** + * An event that is emitted when a response finishes as incomplete. + */ +export interface ResponseIncompleteEvent { + /** + * The response that was incomplete. + */ + response: Response; + + /** + * The type of the event. Always `response.incomplete`. + */ + type: 'response.incomplete'; +} + +/** + * A list of one or many input items to the model, containing different content + * types. + */ +export type ResponseInput = Array; + +/** + * An audio input to the model. + */ +export interface ResponseInputAudio { + /** + * Base64-encoded audio data. + */ + data: string; + + /** + * The format of the audio data. Currently supported formats are `mp3` and `wav`. + */ + format: 'mp3' | 'wav'; + + /** + * The type of the input item. Always `input_audio`. + */ + type: 'input_audio'; +} + +/** + * A text input to the model. + */ +export type ResponseInputContent = ResponseInputText | ResponseInputImage | ResponseInputFile; + +/** + * A file input to the model. + */ +export interface ResponseInputFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The content of the file to be sent to the model. + */ + file_data?: string; + + /** + * The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; +} + +/** + * An image input to the model. Learn about + * [image inputs](https://platform.openai.com/docs/guides/vision). + */ +export interface ResponseInputImage { + /** + * The detail level of the image to be sent to the model. One of `high`, `low`, or + * `auto`. Defaults to `auto`. + */ + detail: 'high' | 'low' | 'auto'; + + /** + * The type of the input item. Always `input_image`. + */ + type: 'input_image'; + + /** + * The ID of the file to be sent to the model. + */ + file_id?: string | null; + + /** + * The URL of the image to be sent to the model. A fully qualified URL or base64 + * encoded image in a data URL. + */ + image_url?: string | null; +} + +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export type ResponseInputItem = + | EasyInputMessage + | ResponseInputItem.Message + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseComputerToolCall + | ResponseInputItem.ComputerCallOutput + | ResponseFunctionWebSearch + | ResponseFunctionToolCall + | ResponseInputItem.FunctionCallOutput + | ResponseInputItem.Reasoning + | ResponseInputItem.ItemReference; + +export namespace ResponseInputItem { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. + */ + export interface Message { + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponsesAPI.ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; + } + + /** + * The output of a computer tool call. + */ + export interface ComputerCallOutput { + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ComputerCallOutput.Output; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The ID of the computer tool call output. + */ + id?: string; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace ComputerCallOutput { + /** + * A computer screenshot image used with the computer use tool. + */ + export interface Output { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; + } + + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } + } + + /** + * The output of a function tool call. + */ + export interface FunctionCallOutput { + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The unique ID of the function tool call output. Populated when this item is + * returned via API. + */ + id?: string; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + /** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ + export interface Reasoning { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + content: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace Reasoning { + export interface Content { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `text`. + */ + type: 'reasoning_summary'; + } + } + + /** + * An internal identifier for an item to reference. + */ + export interface ItemReference { + /** + * The ID of the item to reference. + */ + id: string; + + /** + * The type of item to reference. Always `item_reference`. + */ + type: 'item_reference'; + } +} + +/** + * A list of one or many input items to the model, containing different content + * types. + */ +export type ResponseInputMessageContentList = Array; + +/** + * A text input to the model. + */ +export interface ResponseInputText { + /** + * The text input to the model. + */ + text: string; + + /** + * The type of the input item. Always `input_text`. + */ + type: 'input_text'; +} + +/** + * An audio output from the model. + */ +export interface ResponseOutputAudio { + /** + * Base64-encoded audio data from the model. + */ + data: string; + + /** + * The transcript of the audio data from the model. + */ + transcript: string; + + /** + * The type of the output audio. Always `output_audio`. + */ + type: 'output_audio'; +} + +/** + * An output message from the model. + */ +export type ResponseOutputItem = + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseFunctionToolCall + | ResponseFunctionWebSearch + | ResponseComputerToolCall + | ResponseOutputItem.Reasoning; + +export namespace ResponseOutputItem { + /** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ + export interface Reasoning { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + content: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace Reasoning { + export interface Content { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `text`. + */ + type: 'reasoning_summary'; + } + } +} + +/** + * Emitted when a new output item is added. + */ +export interface ResponseOutputItemAddedEvent { + /** + * The output item that was added. + */ + item: ResponseOutputItem; + + /** + * The index of the output item that was added. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_item.added`. + */ + type: 'response.output_item.added'; +} + +/** + * Emitted when an output item is marked done. + */ +export interface ResponseOutputItemDoneEvent { + /** + * The output item that was marked done. + */ + item: ResponseOutputItem; + + /** + * The index of the output item that was marked done. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_item.done`. + */ + type: 'response.output_item.done'; +} + +/** + * An output message from the model. + */ +export interface ResponseOutputMessage { + /** + * The unique ID of the output message. + */ + id: string; + + /** + * The content of the output message. + */ + content: Array; + + /** + * The role of the output message. Always `assistant`. + */ + role: 'assistant'; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the output message. Always `message`. + */ + type: 'message'; +} + +/** + * A refusal from the model. + */ +export interface ResponseOutputRefusal { + /** + * The refusal explanationfrom the model. + */ + refusal: string; + + /** + * The type of the refusal. Always `refusal`. + */ + type: 'refusal'; +} + +/** + * A text output from the model. + */ +export interface ResponseOutputText { + /** + * The annotations of the text output. + */ + annotations: Array< + ResponseOutputText.FileCitation | ResponseOutputText.URLCitation | ResponseOutputText.FilePath + >; + + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; +} + +export namespace ResponseOutputText { + /** + * A citation to a file. + */ + export interface FileCitation { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file citation. Always `file_citation`. + */ + type: 'file_citation'; + } + + /** + * A citation for a web resource used to generate a model response. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * The URL of the web resource. + */ + url: string; + } + + /** + * A path to a file. + */ + export interface FilePath { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file path. Always `file_path`. + */ + type: 'file_path'; + } +} + +/** + * Emitted when there is a partial refusal text. + */ +export interface ResponseRefusalDeltaEvent { + /** + * The index of the content part that the refusal text is added to. + */ + content_index: number; + + /** + * The refusal text that is added. + */ + delta: string; + + /** + * The ID of the output item that the refusal text is added to. + */ + item_id: string; + + /** + * The index of the output item that the refusal text is added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.refusal.delta`. + */ + type: 'response.refusal.delta'; +} + +/** + * Emitted when refusal text is finalized. + */ +export interface ResponseRefusalDoneEvent { + /** + * The index of the content part that the refusal text is finalized. + */ + content_index: number; + + /** + * The ID of the output item that the refusal text is finalized. + */ + item_id: string; + + /** + * The index of the output item that the refusal text is finalized. + */ + output_index: number; + + /** + * The refusal text that is finalized. + */ + refusal: string; + + /** + * The type of the event. Always `response.refusal.done`. + */ + type: 'response.refusal.done'; +} + +/** + * The status of the response generation. One of `completed`, `failed`, + * `in_progress`, or `incomplete`. + */ +export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete'; + +/** + * Emitted when there is a partial audio response. + */ +export type ResponseStreamEvent = + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseCodeInterpreterCallCodeDeltaEvent + | ResponseCodeInterpreterCallCodeDoneEvent + | ResponseCodeInterpreterCallCompletedEvent + | ResponseCodeInterpreterCallInProgressEvent + | ResponseCodeInterpreterCallInterpretingEvent + | ResponseCompletedEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent + | ResponseCreatedEvent + | ResponseErrorEvent + | ResponseFileSearchCallCompletedEvent + | ResponseFileSearchCallInProgressEvent + | ResponseFileSearchCallSearchingEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent + | ResponseInProgressEvent + | ResponseFailedEvent + | ResponseIncompleteEvent + | ResponseOutputItemAddedEvent + | ResponseOutputItemDoneEvent + | ResponseRefusalDeltaEvent + | ResponseRefusalDoneEvent + | ResponseTextAnnotationDeltaEvent + | ResponseTextDeltaEvent + | ResponseTextDoneEvent + | ResponseWebSearchCallCompletedEvent + | ResponseWebSearchCallInProgressEvent + | ResponseWebSearchCallSearchingEvent; + +/** + * Emitted when a text annotation is added. + */ +export interface ResponseTextAnnotationDeltaEvent { + /** + * A citation to a file. + */ + annotation: + | ResponseTextAnnotationDeltaEvent.FileCitation + | ResponseTextAnnotationDeltaEvent.URLCitation + | ResponseTextAnnotationDeltaEvent.FilePath; + + /** + * The index of the annotation that was added. + */ + annotation_index: number; + + /** + * The index of the content part that the text annotation was added to. + */ + content_index: number; + + /** + * The ID of the output item that the text annotation was added to. + */ + item_id: string; + + /** + * The index of the output item that the text annotation was added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_text.annotation.added`. + */ + type: 'response.output_text.annotation.added'; +} + +export namespace ResponseTextAnnotationDeltaEvent { + /** + * A citation to a file. + */ + export interface FileCitation { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file citation. Always `file_citation`. + */ + type: 'file_citation'; + } + + /** + * A citation for a web resource used to generate a model response. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * The URL of the web resource. + */ + url: string; + } + + /** + * A path to a file. + */ + export interface FilePath { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file path. Always `file_path`. + */ + type: 'file_path'; + } +} + +/** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ +export interface ResponseTextConfig { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponseFormatTextConfig; +} + +/** + * Emitted when there is an additional text delta. + */ +export interface ResponseTextDeltaEvent { + /** + * The index of the content part that the text delta was added to. + */ + content_index: number; + + /** + * The text delta that was added. + */ + delta: string; + + /** + * The ID of the output item that the text delta was added to. + */ + item_id: string; + + /** + * The index of the output item that the text delta was added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_text.delta`. + */ + type: 'response.output_text.delta'; +} + +/** + * Emitted when text content is finalized. + */ +export interface ResponseTextDoneEvent { + /** + * The index of the content part that the text content is finalized. + */ + content_index: number; + + /** + * The ID of the output item that the text content is finalized. + */ + item_id: string; + + /** + * The index of the output item that the text content is finalized. + */ + output_index: number; + + /** + * The text content that is finalized. + */ + text: string; + + /** + * The type of the event. Always `response.output_text.done`. + */ + type: 'response.output_text.done'; +} + +/** + * Represents token usage details including input tokens, output tokens, a + * breakdown of output tokens, and the total tokens used. + */ +export interface ResponseUsage { + /** + * The number of input tokens. + */ + input_tokens: number; + + /** + * The number of output tokens. + */ + output_tokens: number; + + /** + * A detailed breakdown of the output tokens. + */ + output_tokens_details: ResponseUsage.OutputTokensDetails; + + /** + * The total number of tokens used. + */ + total_tokens: number; +} + +export namespace ResponseUsage { + /** + * A detailed breakdown of the output tokens. + */ + export interface OutputTokensDetails { + /** + * The number of reasoning tokens. + */ + reasoning_tokens: number; + } +} + +/** + * Emitted when a web search call is completed. + */ +export interface ResponseWebSearchCallCompletedEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.completed`. + */ + type: 'response.web_search_call.completed'; +} + +/** + * Emitted when a web search call is initiated. + */ +export interface ResponseWebSearchCallInProgressEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.in_progress`. + */ + type: 'response.web_search_call.in_progress'; +} + +/** + * Emitted when a web search call is executing. + */ +export interface ResponseWebSearchCallSearchingEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.searching`. + */ + type: 'response.web_search_call.searching'; +} + +/** + * A tool that searches for relevant content from uploaded files. Learn more about + * the + * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + */ +export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool; + +/** + * Use this option to force the model to call a specific function. + */ +export interface ToolChoiceFunction { + /** + * The name of the function to call. + */ + name: string; + + /** + * For function calling, the type is always `function`. + */ + type: 'function'; +} + +/** + * Controls which (if any) tool is called by the model. + * + * `none` means the model will not call any tool and instead generates a message. + * + * `auto` means the model can pick between generating a message or calling one or + * more tools. + * + * `required` means the model must call one or more tools. + */ +export type ToolChoiceOptions = 'none' | 'auto' | 'required'; + +/** + * Indicates that the model should use a built-in tool to generate a response. + * [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools). + */ +export interface ToolChoiceTypes { + /** + * The type of hosted tool the model should to use. Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * + * Allowed values are: + * + * - `file_search` + * - `web_search_preview` + * - `computer_use_preview` + */ + type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11'; +} + +/** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search). + */ +export interface WebSearchTool { + /** + * The type of the web search tool. One of: + * + * - `web_search_preview` + * - `web_search_preview_2025_03_11` + */ + type: 'web_search_preview' | 'web_search_preview_2025_03_11'; + + /** + * 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. + */ + search_context_size?: 'low' | 'medium' | 'high'; + + user_location?: WebSearchTool.UserLocation | null; +} + +export namespace WebSearchTool { + export interface UserLocation { + /** + * The type of location approximation. Always `approximate`. + */ + type: 'approximate'; + + /** + * Free text input for the city of the user, e.g. `San Francisco`. + */ + city?: string; + + /** + * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of + * the user, e.g. `US`. + */ + country?: string; + + /** + * Free text input for the region of the user, e.g. `California`. + */ + region?: string; + + /** + * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the + * user, e.g. `America/Los_Angeles`. + */ + timezone?: string; + } +} + +export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming; + +export interface ResponseCreateParamsBase { + /** + * Text, image, or file inputs to the model, used to generate a response. + * + * Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Image inputs](https://platform.openai.com/docs/guides/images) + * - [File inputs](https://platform.openai.com/docs/guides/pdf-files) + * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) + * - [Function calling](https://platform.openai.com/docs/guides/function-calling) + */ + input: string | ResponseInput; + + /** + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. + */ + model: (string & {}) | Shared.ChatModel; + + /** + * Specify additional output data to include in the model response. Currently + * supported values are: + * + * - `file_search_call.results`: Include the search results of the file search tool + * call. + * - `message.input_image.image_url`: Include image urls from the input message. + * - `computer_call_output.output.image_url`: Include image urls from the computer + * call output. + */ + include?: Array | null; + + /** + * Inserts a system (or developer) message as the first item in the model's + * context. + * + * When using along with `previous_response_id`, the instructions from a previous + * response will be not be carried over to the next response. This makes it simple + * to swap out system (or developer) messages in new responses. + */ + instructions?: string | null; + + /** + * An upper bound for the number of tokens that can be generated for a response, + * including visible output tokens and + * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). + */ + max_output_tokens?: number | null; + + /** + * 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; + + /** + * Whether to allow the model to run tool calls in parallel. + */ + parallel_tool_calls?: boolean | null; + + /** + * The unique ID of the previous response to the model. Use this to create + * multi-turn conversations. Learn more about + * [conversation state](https://platform.openai.com/docs/guides/conversation-state). + */ + previous_response_id?: string | null; + + /** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ + reasoning?: Shared.Reasoning | null; + + /** + * Whether to store the generated model response for later retrieval via API. + */ + store?: boolean | null; + + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: boolean | null; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will + * make the output more random, while lower values like 0.2 will make it more + * focused and deterministic. We generally recommend altering this or `top_p` but + * not both. + */ + temperature?: number | null; + + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: ResponseTextConfig; + + /** + * How the model should select which tool (or tools) to use when generating a + * response. See the `tools` parameter to see how to specify which tools the model + * can call. + */ + tool_choice?: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the + * model considers the results of the tokens with top_p probability mass. So 0.1 + * means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p?: number | null; + + /** + * The truncation strategy to use for the model response. + * + * - `auto`: If the context of this response and previous ones exceeds the model's + * context window size, the model will truncate the response to fit the context + * window by dropping input items in the middle of the conversation. + * - `disabled` (default): If a model response will exceed the context window size + * for a model, the request will fail with a 400 error. + */ + truncation?: 'auto' | 'disabled' | null; + + /** + * A unique identifier representing your end-user, which can help OpenAI to monitor + * and detect abuse. + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). + */ + user?: string; +} + +export namespace ResponseCreateParams { + export type ResponseCreateParamsNonStreaming = ResponsesAPI.ResponseCreateParamsNonStreaming; + export type ResponseCreateParamsStreaming = ResponsesAPI.ResponseCreateParamsStreaming; +} + +export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: false | null; +} + +export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream: true; +} + +export interface ResponseRetrieveParams { + /** + * Additional fields to include in the response. See the `include` parameter for + * Response creation above for more information. + */ + include?: Array; +} + +Responses.InputItems = InputItems; +Responses.ResponseItemListDataPage = ResponseItemListDataPage; + +export declare namespace Responses { + export { + InputItems as InputItems, + type ResponseItemList as ResponseItemList, + ResponseItemListDataPage as ResponseItemListDataPage, + type InputItemListParams as InputItemListParams, + }; +} diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 3bb11582f..86b2d2dee 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,96 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export type ChatModel = + | 'o3-mini' + | 'o3-mini-2025-01-31' + | 'o1' + | 'o1-2024-12-17' + | 'o1-preview' + | 'o1-preview-2024-09-12' + | 'o1-mini' + | 'o1-mini-2024-09-12' + | 'computer-use-preview' + | 'computer-use-preview-2025-02-04' + | 'computer-use-preview-2025-03-11' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' + | 'gpt-4o' + | 'gpt-4o-2024-11-20' + | 'gpt-4o-2024-08-06' + | 'gpt-4o-2024-05-13' + | 'gpt-4o-audio-preview' + | 'gpt-4o-audio-preview-2024-10-01' + | 'gpt-4o-audio-preview-2024-12-17' + | 'gpt-4o-mini-audio-preview' + | 'gpt-4o-mini-audio-preview-2024-12-17' + | 'chatgpt-4o-latest' + | 'gpt-4o-mini' + | 'gpt-4o-mini-2024-07-18' + | 'gpt-4-turbo' + | 'gpt-4-turbo-2024-04-09' + | 'gpt-4-0125-preview' + | 'gpt-4-turbo-preview' + | 'gpt-4-1106-preview' + | 'gpt-4-vision-preview' + | 'gpt-4' + | 'gpt-4-0314' + | 'gpt-4-0613' + | 'gpt-4-32k' + | 'gpt-4-32k-0314' + | 'gpt-4-32k-0613' + | 'gpt-3.5-turbo' + | 'gpt-3.5-turbo-16k' + | 'gpt-3.5-turbo-0301' + | 'gpt-3.5-turbo-0613' + | 'gpt-3.5-turbo-1106' + | 'gpt-3.5-turbo-0125' + | 'gpt-3.5-turbo-16k-0613'; + +/** + * A filter used to compare a specified attribute key to a given value using a + * defined comparison operation. + */ +export interface ComparisonFilter { + /** + * The key to compare against the value. + */ + key: string; + + /** + * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. + * + * - `eq`: equals + * - `ne`: not equal + * - `gt`: greater than + * - `gte`: greater than or equal + * - `lt`: less than + * - `lte`: less than or equal + */ + type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; + + /** + * The value to compare against the attribute key; supports string, number, or + * boolean types. + */ + value: string | number | boolean; +} + +/** + * Combine multiple filters using `and` or `or`. + */ +export interface CompoundFilter { + /** + * Array of filters to combine. Items can be `ComparisonFilter` or + * `CompoundFilter`. + */ + filters: Array; + + /** + * Type of operation: `and` or `or`. + */ + type: 'and' | 'or'; +} + export interface ErrorObject { code: string | null; @@ -65,23 +156,76 @@ export type FunctionParameters = Record; */ export type Metadata = Record; +/** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ +export interface Reasoning { + /** + * **o-series models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + effort: ReasoningEffort | null; + + /** + * **o-series models only** + * + * A summary of the reasoning performed by the model. This can be useful for + * debugging and understanding the model's reasoning process. One of `concise` or + * `detailed`. + */ + generate_summary?: 'concise' | 'detailed' | null; +} + +/** + * **o-series models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ +export type ReasoningEffort = 'low' | 'medium' | 'high' | null; + +/** + * JSON object response format. An older method of generating JSON responses. Using + * `json_schema` is recommended for models that support it. Note that the model + * will not generate JSON without a system or user message instructing it to do so. + */ export interface ResponseFormatJSONObject { /** - * The type of response format being defined: `json_object` + * The type of response format being defined. Always `json_object`. */ type: 'json_object'; } +/** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). + */ export interface ResponseFormatJSONSchema { + /** + * Structured Outputs configuration options, including a JSON Schema. + */ json_schema: ResponseFormatJSONSchema.JSONSchema; /** - * The type of response format being defined: `json_schema` + * The type of response format being defined. Always `json_schema`. */ type: 'json_schema'; } export namespace ResponseFormatJSONSchema { + /** + * Structured Outputs configuration options, including a JSON Schema. + */ export interface JSONSchema { /** * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores @@ -96,7 +240,8 @@ export namespace ResponseFormatJSONSchema { description?: string; /** - * The schema for the response format, described as a JSON Schema object. + * The schema for the response format, described as a JSON Schema object. Learn how + * to build JSON schemas [here](https://json-schema.org/). */ schema?: Record; @@ -111,9 +256,12 @@ export namespace ResponseFormatJSONSchema { } } +/** + * Default response format. Used to generate text responses. + */ export interface ResponseFormatText { /** - * The type of response format being defined: `text` + * The type of response format being defined. Always `text`. */ type: 'text'; } diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index f977e18f6..9e046b48d 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -22,10 +22,9 @@ export class Uploads extends APIResource { * contains all the parts you uploaded. This File is usable in the rest of our * platform as a regular File object. * - * For certain `purpose`s, the correct `mime_type` must be specified. Please refer - * to documentation for the supported MIME types for your use case: - * - * - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search#supported-files) + * For certain `purpose` values, the correct `mime_type` must be specified. Please + * refer to documentation for the + * [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files). * * For guidance on the proper filename extensions for each purpose, please follow * the documentation on diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts similarity index 92% rename from src/resources/beta/vector-stores/file-batches.ts rename to src/resources/vector-stores/file-batches.ts index 2c47cb9c2..9be1d81a3 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -1,15 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import { sleep } from '../../../core'; -import { Uploadable } from '../../../core'; -import { allSettledWithThrow } from '../../../lib/Util'; -import * as Core from '../../../core'; +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import { sleep } from '../../core'; +import { Uploadable } from '../../core'; +import { allSettledWithThrow } from '../../lib/Util'; +import * as Core from '../../core'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; -import { type CursorPageParams } from '../../../pagination'; +import { type CursorPageParams } from '../../pagination'; export class FileBatches extends APIResource { /** @@ -265,6 +265,15 @@ export interface FileBatchCreateParams { */ file_ids: Array; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/vector-stores/files.ts similarity index 74% rename from src/resources/beta/vector-stores/files.ts rename to src/resources/vector-stores/files.ts index 1fda9a99b..28caf9781 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { sleep, Uploadable, isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; +import { APIResource } from '../../resource'; +import { sleep, Uploadable, isRequestOptions } from '../../core'; +import * as Core from '../../core'; import * as VectorStoresAPI from './vector-stores'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { CursorPage, type CursorPageParams, Page } from '../../pagination'; export class Files extends APIResource { /** @@ -38,6 +38,22 @@ export class Files extends APIResource { }); } + /** + * Update attributes on a vector store file. + */ + update( + vectorStoreId: string, + fileId: string, + body: FileUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/vector_stores/${vectorStoreId}/files/${fileId}`, { + body, + ...options, + headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + }); + } + /** * Returns a list of vector store files. */ @@ -167,10 +183,30 @@ export class Files extends APIResource { const fileInfo = await this.upload(vectorStoreId, file, options); return await this.poll(vectorStoreId, fileInfo.id, options); } + + /** + * Retrieve the parsed contents of a vector store file. + */ + content( + vectorStoreId: string, + fileId: string, + options?: Core.RequestOptions, + ): Core.PagePromise { + return this._client.getAPIList( + `/vector_stores/${vectorStoreId}/files/${fileId}/content`, + FileContentResponsesPage, + { ...options, headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers } }, + ); + } } export class VectorStoreFilesPage extends CursorPage {} +/** + * Note: no pagination actually occurs yet, this is for forwards-compatibility. + */ +export class FileContentResponsesPage extends Page {} + /** * A list of files attached to a vector store. */ @@ -217,6 +253,15 @@ export interface VectorStoreFile { */ vector_store_id: string; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The strategy used to chunk the file. */ @@ -249,6 +294,18 @@ export interface VectorStoreFileDeleted { object: 'vector_store.file.deleted'; } +export interface FileContentResponse { + /** + * The text content + */ + text?: string; + + /** + * The content type (currently only `"text"`) + */ + type?: string; +} + export interface FileCreateParams { /** * A [File](https://platform.openai.com/docs/api-reference/files) ID that the @@ -257,6 +314,15 @@ export interface FileCreateParams { */ file_id: string; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. @@ -264,6 +330,17 @@ export interface FileCreateParams { chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; } +export interface FileUpdateParams { + /** + * 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, booleans, or numbers. + */ + attributes: Record | null; +} + export interface FileListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -286,13 +363,17 @@ export interface FileListParams extends CursorPageParams { } Files.VectorStoreFilesPage = VectorStoreFilesPage; +Files.FileContentResponsesPage = FileContentResponsesPage; export declare namespace Files { export { type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, + type FileContentResponse as FileContentResponse, VectorStoreFilesPage as VectorStoreFilesPage, + FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, + type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, }; } diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/vector-stores/index.ts similarity index 82% rename from src/resources/beta/vector-stores/index.ts rename to src/resources/vector-stores/index.ts index d587bd160..9cbcbc0b2 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -8,14 +8,18 @@ export { } from './file-batches'; export { VectorStoreFilesPage, + FileContentResponsesPage, Files, type VectorStoreFile, type VectorStoreFileDeleted, + type FileContentResponse, type FileCreateParams, + type FileUpdateParams, type FileListParams, } from './files'; export { VectorStoresPage, + VectorStoreSearchResponsesPage, VectorStores, type AutoFileChunkingStrategyParam, type FileChunkingStrategy, @@ -26,7 +30,9 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, + type VectorStoreSearchParams, } from './vector-stores'; diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts similarity index 77% rename from src/resources/beta/vector-stores/vector-stores.ts rename to src/resources/vector-stores/vector-stores.ts index 8438b79da..7d61e7fd6 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; -import * as Shared from '../../shared'; +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, @@ -13,14 +13,17 @@ import { } from './file-batches'; import * as FilesAPI from './files'; import { + FileContentResponse, + FileContentResponsesPage, FileCreateParams, FileListParams, + FileUpdateParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage, } from './files'; -import { CursorPage, type CursorPageParams } from '../../../pagination'; +import { CursorPage, type CursorPageParams, Page } from '../../pagination'; export class VectorStores extends APIResource { files: FilesAPI.Files = new FilesAPI.Files(this._client); @@ -93,10 +96,32 @@ export class VectorStores extends APIResource { headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, }); } + + /** + * Search a vector store for relevant chunks based on a query and file attributes + * filter. + */ + search( + vectorStoreId: string, + body: VectorStoreSearchParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + return this._client.getAPIList(`/vector_stores/${vectorStoreId}/search`, VectorStoreSearchResponsesPage, { + body, + method: 'post', + ...options, + headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + }); + } } export class VectorStoresPage extends CursorPage {} +/** + * Note: no pagination actually occurs yet, this is for forwards-compatibility. + */ +export class VectorStoreSearchResponsesPage extends Page {} + /** * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of * `800` and `chunk_overlap_tokens` of `400`. @@ -155,6 +180,9 @@ export interface StaticFileChunkingStrategyObject { type: 'static'; } +/** + * Customize your own chunking strategy by setting chunk size and chunk overlap. + */ export interface StaticFileChunkingStrategyObjectParam { static: StaticFileChunkingStrategy; @@ -282,6 +310,51 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } +export interface VectorStoreSearchResponse { + /** + * 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, booleans, or numbers. + */ + attributes: Record | null; + + /** + * Content chunks from the file. + */ + content: Array; + + /** + * The ID of the vector store file. + */ + file_id: string; + + /** + * The name of the vector store file. + */ + filename: string; + + /** + * The similarity score for the result. + */ + score: number; +} + +export namespace VectorStoreSearchResponse { + export interface Content { + /** + * The text content returned from search. + */ + text: string; + + /** + * The type of content. + */ + type: 'text'; + } +} + export interface VectorStoreCreateParams { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` @@ -391,9 +464,50 @@ export interface VectorStoreListParams extends CursorPageParams { order?: 'asc' | 'desc'; } +export interface VectorStoreSearchParams { + /** + * A query string for a search + */ + query: string | Array; + + /** + * A filter to apply based on file attributes. + */ + filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + + /** + * The maximum number of results to return. This number should be between 1 and 50 + * inclusive. + */ + max_num_results?: number; + + /** + * Ranking options for search. + */ + ranking_options?: VectorStoreSearchParams.RankingOptions; + + /** + * Whether to rewrite the natural language query for vector search. + */ + rewrite_query?: boolean; +} + +export namespace VectorStoreSearchParams { + /** + * Ranking options for search. + */ + export interface RankingOptions { + ranker?: 'auto' | 'default-2024-11-15'; + + score_threshold?: number; + } +} + VectorStores.VectorStoresPage = VectorStoresPage; +VectorStores.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage; VectorStores.Files = Files; VectorStores.VectorStoreFilesPage = VectorStoreFilesPage; +VectorStores.FileContentResponsesPage = FileContentResponsesPage; VectorStores.FileBatches = FileBatches; export declare namespace VectorStores { @@ -407,18 +521,24 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, + VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, + type VectorStoreSearchParams as VectorStoreSearchParams, }; export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, + type FileContentResponse as FileContentResponse, VectorStoreFilesPage as VectorStoreFilesPage, + FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, + type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, }; diff --git a/src/streaming.ts b/src/streaming.ts index 52266154c..25b960314 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -41,7 +41,7 @@ export class Stream implements AsyncIterable { continue; } - if (sse.event === null) { + if (sse.event === null || sse.event.startsWith('response.')) { let data; try { diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts index acdd631db..eddf252b1 100644 --- a/tests/api-resources/chat/completions/completions.test.ts +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -43,9 +43,9 @@ describe('resource completions', () => { presence_penalty: -2, reasoning_effort: 'low', response_format: { type: 'text' }, - seed: 0, + seed: -9007199254740991, service_tier: 'auto', - stop: 'string', + stop: '\n', store: true, stream: false, stream_options: { include_usage: true }, @@ -60,6 +60,13 @@ describe('resource completions', () => { top_logprobs: 0, top_p: 1, user: 'user-1234', + web_search_options: { + search_context_size: 'low', + user_location: { + approximate: { city: 'city', country: 'country', region: 'region', timezone: 'timezone' }, + type: 'approximate', + }, + }, }); }); diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts new file mode 100644 index 000000000..51b86f1b3 --- /dev/null +++ b/tests/api-resources/responses/input-items.test.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource inputItems', () => { + test('list', async () => { + const responsePromise = client.responses.inputItems.list('response_id'); + 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 instead of 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.responses.inputItems.list('response_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + 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.responses.inputItems.list( + 'response_id', + { after: 'after', before: 'before', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/beta/vector-stores/files.test.ts b/tests/api-resources/responses/responses.test.ts similarity index 58% rename from tests/api-resources/beta/vector-stores/files.test.ts rename to tests/api-resources/responses/responses.test.ts index 7c14d4de3..e10722738 100644 --- a/tests/api-resources/beta/vector-stores/files.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -8,9 +8,9 @@ const client = new OpenAI({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', }); -describe('resource files', () => { +describe('resource responses', () => { test('create: only required params', async () => { - const responsePromise = client.beta.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); + const responsePromise = client.responses.create({ input: 'string', model: 'gpt-4o' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -21,14 +21,38 @@ describe('resource files', () => { }); test('create: required and optional params', async () => { - const response = await client.beta.vectorStores.files.create('vs_abc123', { - file_id: 'file_id', - chunking_strategy: { type: 'auto' }, + const response = await client.responses.create({ + input: 'string', + model: 'gpt-4o', + include: ['file_search_call.results'], + instructions: 'instructions', + max_output_tokens: 0, + metadata: { foo: 'string' }, + parallel_tool_calls: true, + previous_response_id: 'previous_response_id', + reasoning: { effort: 'low', generate_summary: 'concise' }, + store: true, + stream: false, + temperature: 1, + text: { format: { type: 'text' } }, + tool_choice: 'none', + tools: [ + { + type: 'file_search', + vector_store_ids: ['string'], + filters: { key: 'key', type: 'eq', value: 'string' }, + max_num_results: 0, + ranking_options: { ranker: 'auto', score_threshold: 0 }, + }, + ], + top_p: 1, + truncation: 'auto', + user: 'user-1234', }); }); test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.files.retrieve('vs_abc123', 'file-abc123'); + const responsePromise = client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -41,43 +65,25 @@ describe('resource files', () => { test('retrieve: request options instead of 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.beta.vectorStores.files.retrieve('vs_abc123', 'file-abc123', { + client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d', { path: '/_stainless_unknown_path', }), ).rejects.toThrow(OpenAI.NotFoundError); }); - test('list', async () => { - const responsePromise = client.beta.vectorStores.files.list('vector_store_id'); - 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 instead of 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.beta.vectorStores.files.list('vector_store_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - - test('list: request options and params are passed correctly', async () => { + test('retrieve: 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.beta.vectorStores.files.list( - 'vector_store_id', - { after: 'after', before: 'before', filter: 'in_progress', limit: 0, order: 'asc' }, + client.responses.retrieve( + 'resp_677efb5139a88190b512bc3fef8e535d', + { include: ['file_search_call.results'] }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); }); test('del', async () => { - const responsePromise = client.beta.vectorStores.files.del('vector_store_id', 'file_id'); + const responsePromise = client.responses.del('resp_677efb5139a88190b512bc3fef8e535d'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -90,7 +96,7 @@ describe('resource files', () => { test('del: request options instead of 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.beta.vectorStores.files.del('vector_store_id', 'file_id', { path: '/_stainless_unknown_path' }), + client.responses.del('resp_677efb5139a88190b512bc3fef8e535d', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(OpenAI.NotFoundError); }); }); diff --git a/tests/api-resources/beta/vector-stores/file-batches.test.ts b/tests/api-resources/vector-stores/file-batches.test.ts similarity index 81% rename from tests/api-resources/beta/vector-stores/file-batches.test.ts rename to tests/api-resources/vector-stores/file-batches.test.ts index b714049b4..c0447a838 100644 --- a/tests/api-resources/beta/vector-stores/file-batches.test.ts +++ b/tests/api-resources/vector-stores/file-batches.test.ts @@ -10,9 +10,7 @@ const client = new OpenAI({ describe('resource fileBatches', () => { test('create: only required params', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.create('vs_abc123', { - file_ids: ['string'], - }); + const responsePromise = client.vectorStores.fileBatches.create('vs_abc123', { file_ids: ['string'] }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -23,14 +21,15 @@ describe('resource fileBatches', () => { }); test('create: required and optional params', async () => { - const response = await client.beta.vectorStores.fileBatches.create('vs_abc123', { + const response = await client.vectorStores.fileBatches.create('vs_abc123', { file_ids: ['string'], + attributes: { foo: 'string' }, chunking_strategy: { type: 'auto' }, }); }); test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123'); + const responsePromise = client.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -43,14 +42,14 @@ describe('resource fileBatches', () => { test('retrieve: request options instead of 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.beta.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123', { + client.vectorStores.fileBatches.retrieve('vs_abc123', 'vsfb_abc123', { path: '/_stainless_unknown_path', }), ).rejects.toThrow(OpenAI.NotFoundError); }); test('cancel', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id'); + const responsePromise = client.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -63,14 +62,14 @@ describe('resource fileBatches', () => { test('cancel: request options instead of 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.beta.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id', { + client.vectorStores.fileBatches.cancel('vector_store_id', 'batch_id', { path: '/_stainless_unknown_path', }), ).rejects.toThrow(OpenAI.NotFoundError); }); test('listFiles', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id'); + const responsePromise = client.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -83,7 +82,7 @@ describe('resource fileBatches', () => { test('listFiles: request options instead of 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.beta.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id', { + client.vectorStores.fileBatches.listFiles('vector_store_id', 'batch_id', { path: '/_stainless_unknown_path', }), ).rejects.toThrow(OpenAI.NotFoundError); @@ -92,7 +91,7 @@ describe('resource fileBatches', () => { test('listFiles: 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.beta.vectorStores.fileBatches.listFiles( + client.vectorStores.fileBatches.listFiles( 'vector_store_id', 'batch_id', { after: 'after', before: 'before', filter: 'in_progress', limit: 0, order: 'asc' }, diff --git a/tests/api-resources/vector-stores/files.test.ts b/tests/api-resources/vector-stores/files.test.ts new file mode 100644 index 000000000..86a8f9bb4 --- /dev/null +++ b/tests/api-resources/vector-stores/files.test.ts @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource files', () => { + test('create: only required params', async () => { + const responsePromise = client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); + 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('create: required and optional params', async () => { + const response = await client.vectorStores.files.create('vs_abc123', { + file_id: 'file_id', + attributes: { foo: 'string' }, + chunking_strategy: { type: 'auto' }, + }); + }); + + test('retrieve', async () => { + const responsePromise = client.vectorStores.files.retrieve('vs_abc123', 'file-abc123'); + 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('retrieve: request options instead of 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.vectorStores.files.retrieve('vs_abc123', 'file-abc123', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('update: only required params', async () => { + const responsePromise = client.vectorStores.files.update('vs_abc123', 'file-abc123', { + attributes: { foo: 'string' }, + }); + 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('update: required and optional params', async () => { + const response = await client.vectorStores.files.update('vs_abc123', 'file-abc123', { + attributes: { foo: 'string' }, + }); + }); + + test('list', async () => { + const responsePromise = client.vectorStores.files.list('vector_store_id'); + 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 instead of 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.vectorStores.files.list('vector_store_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + 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.vectorStores.files.list( + 'vector_store_id', + { after: 'after', before: 'before', filter: 'in_progress', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.vectorStores.files.del('vector_store_id', 'file_id'); + 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('del: request options instead of 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.vectorStores.files.del('vector_store_id', 'file_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('content', async () => { + const responsePromise = client.vectorStores.files.content('vs_abc123', 'file-abc123'); + 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('content: request options instead of 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.vectorStores.files.content('vs_abc123', 'file-abc123', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/beta/vector-stores/vector-stores.test.ts b/tests/api-resources/vector-stores/vector-stores.test.ts similarity index 71% rename from tests/api-resources/beta/vector-stores/vector-stores.test.ts rename to tests/api-resources/vector-stores/vector-stores.test.ts index 806098de8..465904a00 100644 --- a/tests/api-resources/beta/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/vector-stores/vector-stores.test.ts @@ -10,7 +10,7 @@ const client = new OpenAI({ describe('resource vectorStores', () => { test('create', async () => { - const responsePromise = client.beta.vectorStores.create({}); + const responsePromise = client.vectorStores.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -21,7 +21,7 @@ describe('resource vectorStores', () => { }); test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.retrieve('vector_store_id'); + const responsePromise = client.vectorStores.retrieve('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -34,12 +34,12 @@ describe('resource vectorStores', () => { test('retrieve: request options instead of 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.beta.vectorStores.retrieve('vector_store_id', { path: '/_stainless_unknown_path' }), + client.vectorStores.retrieve('vector_store_id', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(OpenAI.NotFoundError); }); test('update', async () => { - const responsePromise = client.beta.vectorStores.update('vector_store_id', {}); + const responsePromise = client.vectorStores.update('vector_store_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -50,7 +50,7 @@ describe('resource vectorStores', () => { }); test('list', async () => { - const responsePromise = client.beta.vectorStores.list(); + const responsePromise = client.vectorStores.list(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -62,7 +62,7 @@ describe('resource vectorStores', () => { test('list: request options instead of 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.beta.vectorStores.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( + await expect(client.vectorStores.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( OpenAI.NotFoundError, ); }); @@ -70,7 +70,7 @@ describe('resource vectorStores', () => { 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.beta.vectorStores.list( + client.vectorStores.list( { after: 'after', before: 'before', limit: 0, order: 'asc' }, { path: '/_stainless_unknown_path' }, ), @@ -78,7 +78,7 @@ describe('resource vectorStores', () => { }); test('del', async () => { - const responsePromise = client.beta.vectorStores.del('vector_store_id'); + const responsePromise = client.vectorStores.del('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -91,7 +91,28 @@ describe('resource vectorStores', () => { test('del: request options instead of 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.beta.vectorStores.del('vector_store_id', { path: '/_stainless_unknown_path' }), + client.vectorStores.del('vector_store_id', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(OpenAI.NotFoundError); }); + + test('search: only required params', async () => { + const responsePromise = client.vectorStores.search('vs_abc123', { query: 'string' }); + 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('search: required and optional params', async () => { + const response = await client.vectorStores.search('vs_abc123', { + query: 'string', + filters: { key: 'key', type: 'eq', value: 'string' }, + max_num_results: 1, + ranking_options: { ranker: 'auto', score_threshold: 0 }, + rewrite_query: true, + }); + }); }); From b0930694021fb07c03782387cf3ba9d8df6fb975 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:32:03 +0000 Subject: [PATCH 220/509] release: 4.87.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a889d24b4..e8984a56c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.86.2" + ".": "4.87.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 38d54fdc1..2ec7edb2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.87.0 (2025-03-11) + +Full Changelog: [v4.86.2...v4.87.0](https://github.com/openai/openai-node/compare/v4.86.2...v4.87.0) + +### Features + +* **api:** add /v1/responses and built-in tools ([119b584](https://github.com/openai/openai-node/commit/119b5843a18b8014167c8d2031d75c08dbf400a3)) + ## 4.86.2 (2025-03-05) Full Changelog: [v4.86.1...v4.86.2](https://github.com/openai/openai-node/compare/v4.86.1...v4.86.2) diff --git a/jsr.json b/jsr.json index 1c0948aaa..4ac1601e7 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.86.2", + "version": "4.87.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 78afb8946..7cf4a385d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.86.2", + "version": "4.87.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c43a3c320..2b1fd6541 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.86.2'; // x-release-please-version +export const VERSION = '4.87.0'; // x-release-please-version From 21f210782b1ee3b33231cfed0277ab8e3a764bcb Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Mar 2025 12:42:29 -0400 Subject: [PATCH 221/509] fix: correct imports --- src/lib/ResponsesParser.ts | 2 +- src/lib/responses/ResponseStream.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/ResponsesParser.ts b/src/lib/ResponsesParser.ts index 780b779ff..8d762d5bb 100644 --- a/src/lib/ResponsesParser.ts +++ b/src/lib/ResponsesParser.ts @@ -1,5 +1,5 @@ import { OpenAIError } from '../error'; -import { type ChatCompletionTool } from '../resources'; +import type { ChatCompletionTool } from '../resources/chat/completions'; import { type FunctionTool, type ParsedContent, diff --git a/src/lib/responses/ResponseStream.ts b/src/lib/responses/ResponseStream.ts index 0d6cd47dd..d2ee80a75 100644 --- a/src/lib/responses/ResponseStream.ts +++ b/src/lib/responses/ResponseStream.ts @@ -4,7 +4,7 @@ import { type ResponseCreateParamsBase, type ResponseCreateParamsStreaming, type ResponseStreamEvent, -} from 'openai/resources/responses/responses'; +} from '../../resources/responses/responses'; import * as Core from '../../core'; import { APIUserAbortError, OpenAIError } from '../../error'; import OpenAI from '../../index'; From 0bc08d15143f63536b2331a174bec3d0411a7356 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:45:57 +0000 Subject: [PATCH 222/509] release: 4.87.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8984a56c..dab137bc4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.87.0" + ".": "4.87.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ec7edb2b..46477c290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.87.1 (2025-03-11) + +Full Changelog: [v4.87.0...v4.87.1](https://github.com/openai/openai-node/compare/v4.87.0...v4.87.1) + +### Bug Fixes + +* correct imports ([5cdf17c](https://github.com/openai/openai-node/commit/5cdf17cec33da7cf540b8bdbcfa30c0c52842dd1)) + ## 4.87.0 (2025-03-11) Full Changelog: [v4.86.2...v4.87.0](https://github.com/openai/openai-node/compare/v4.86.2...v4.87.0) diff --git a/jsr.json b/jsr.json index 4ac1601e7..beb9f5c47 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.87.0", + "version": "4.87.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 7cf4a385d..386015e42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.87.0", + "version": "4.87.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 2b1fd6541..35d1d1c0f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.87.0'; // x-release-please-version +export const VERSION = '4.87.1'; // x-release-please-version From 8ae07cc036895529a028134451fe2ab5c1661871 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Mar 2025 13:55:38 -0400 Subject: [PATCH 223/509] fix(responses): correctly add output_text --- src/resources/responses/responses.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 2ad146873..060147a2b 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -79,7 +79,7 @@ export class Responses extends APIResource { | APIPromise | APIPromise> )._thenUnwrap((rsp) => { - if ('type' in rsp && rsp.type === 'response') { + if ('object' in rsp && rsp.object === 'response') { addOutputText(rsp as Response); } From 0b33959ed9d911c73b7ea4935761c702266bec6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 17:56:33 +0000 Subject: [PATCH 224/509] release: 4.87.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index dab137bc4..464f20492 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.87.1" + ".": "4.87.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 46477c290..4a4cb5036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.87.2 (2025-03-11) + +Full Changelog: [v4.87.1...v4.87.2](https://github.com/openai/openai-node/compare/v4.87.1...v4.87.2) + +### Bug Fixes + +* **responses:** correctly add output_text ([4ceb5cc](https://github.com/openai/openai-node/commit/4ceb5cc516b8c75d46f0042534d7658796a8cd71)) + ## 4.87.1 (2025-03-11) Full Changelog: [v4.87.0...v4.87.1](https://github.com/openai/openai-node/compare/v4.87.0...v4.87.1) diff --git a/jsr.json b/jsr.json index beb9f5c47..b6857cfb0 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.87.1", + "version": "4.87.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 386015e42..2fbc060df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.87.1", + "version": "4.87.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 35d1d1c0f..854c6827d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.87.1'; // x-release-please-version +export const VERSION = '4.87.2'; // x-release-please-version From 9cb95763cab5678c5098b37ad0fe1ec83d2c1cb7 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 11 Mar 2025 17:36:01 -0400 Subject: [PATCH 225/509] fix(responses): correct reasoning output type --- api.md | 1 + src/resources/responses/responses.ts | 131 +++++++++------------------ 2 files changed, 45 insertions(+), 87 deletions(-) diff --git a/api.md b/api.md index b21ac2d5f..2fac07f38 100644 --- a/api.md +++ b/api.md @@ -583,6 +583,7 @@ Types: - ResponseOutputMessage - ResponseOutputRefusal - ResponseOutputText +- ResponseReasoningItem - ResponseRefusalDeltaEvent - ResponseRefusalDoneEvent - ResponseStatus diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 060147a2b..72adf0696 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -36,7 +36,7 @@ export type ParsedResponseOutputItem = | ResponseFileSearchToolCall | ResponseFunctionWebSearch | ResponseComputerToolCall - | ResponseOutputItem.Reasoning; + | ResponseReasoningItem; export interface ParsedResponse extends Response { output: Array>; @@ -1562,7 +1562,7 @@ export type ResponseInputItem = | ResponseFunctionWebSearch | ResponseFunctionToolCall | ResponseInputItem.FunctionCallOutput - | ResponseInputItem.Reasoning + | ResponseReasoningItem | ResponseInputItem.ItemReference; export namespace ResponseInputItem { @@ -1707,47 +1707,6 @@ export namespace ResponseInputItem { status?: 'in_progress' | 'completed' | 'incomplete'; } - /** - * A description of the chain of thought used by a reasoning model while generating - * a response. - */ - export interface Reasoning { - /** - * The unique identifier of the reasoning content. - */ - id: string; - - /** - * Reasoning text contents. - */ - content: Array; - - /** - * The type of the object. Always `reasoning`. - */ - type: 'reasoning'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace Reasoning { - export interface Content { - /** - * A short summary of the reasoning used by the model when generating the response. - */ - text: string; - - /** - * The type of the object. Always `text`. - */ - type: 'reasoning_summary'; - } - } - /** * An internal identifier for an item to reference. */ @@ -1814,50 +1773,7 @@ export type ResponseOutputItem = | ResponseFunctionToolCall | ResponseFunctionWebSearch | ResponseComputerToolCall - | ResponseOutputItem.Reasoning; - -export namespace ResponseOutputItem { - /** - * A description of the chain of thought used by a reasoning model while generating - * a response. - */ - export interface Reasoning { - /** - * The unique identifier of the reasoning content. - */ - id: string; - - /** - * Reasoning text contents. - */ - content: Array; - - /** - * The type of the object. Always `reasoning`. - */ - type: 'reasoning'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace Reasoning { - export interface Content { - /** - * A short summary of the reasoning used by the model when generating the response. - */ - text: string; - - /** - * The type of the object. Always `text`. - */ - type: 'reasoning_summary'; - } - } -} + | ResponseReasoningItem; /** * Emitted when a new output item is added. @@ -2039,6 +1955,47 @@ export namespace ResponseOutputText { } } +/** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ +export interface ResponseReasoningItem { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + summary: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +export namespace ResponseReasoningItem { + export interface Summary { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `summary_text`. + */ + type: 'summary_text'; + } +} + /** * Emitted when there is a partial refusal text. */ From be2414ce22517e3259192c751de55744649deec1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:40:08 +0000 Subject: [PATCH 226/509] release: 4.87.3 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 464f20492..0c7a85094 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.87.2" + ".": "4.87.3" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a4cb5036..46a595495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.87.3 (2025-03-11) + +Full Changelog: [v4.87.2...v4.87.3](https://github.com/openai/openai-node/compare/v4.87.2...v4.87.3) + +### Bug Fixes + +* **responses:** correct reasoning output type ([2abef57](https://github.com/openai/openai-node/commit/2abef57d7645a96a4b9a6b91483861cd568d2d4d)) + ## 4.87.2 (2025-03-11) Full Changelog: [v4.87.1...v4.87.2](https://github.com/openai/openai-node/compare/v4.87.1...v4.87.2) diff --git a/jsr.json b/jsr.json index b6857cfb0..1051fade0 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.87.2", + "version": "4.87.3", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 2fbc060df..9967a814d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.87.2", + "version": "4.87.3", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 854c6827d..e84192528 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.87.2'; // x-release-please-version +export const VERSION = '4.87.3'; // x-release-please-version From 53e35c8b10a8e3ef95c0d644d59ab915225b8114 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 3 Mar 2025 17:46:40 +0000 Subject: [PATCH 227/509] chore(client): only accept standard types for file uploads --- scripts/build | 4 +- src/client.ts | 4 +- src/internal/polyfill/file.node.d.ts | 9 - src/internal/polyfill/file.node.js | 17 -- src/internal/polyfill/file.node.mjs | 9 - src/internal/shims.ts | 56 ----- .../{polyfill => shims}/crypto.node.d.ts | 0 .../{polyfill => shims}/crypto.node.js | 0 .../{polyfill => shims}/crypto.node.mjs | 0 src/internal/shims/file.node.d.ts | 20 ++ src/internal/shims/file.node.js | 11 + src/internal/shims/file.node.mjs | 2 + src/internal/to-file.ts | 152 ++++++++++++ src/internal/uploads.ts | 220 ++++-------------- src/internal/utils/uuid.ts | 2 +- src/uploads.ts | 3 +- tests/uploads.test.ts | 38 ++- 17 files changed, 267 insertions(+), 280 deletions(-) delete mode 100644 src/internal/polyfill/file.node.d.ts delete mode 100644 src/internal/polyfill/file.node.js delete mode 100644 src/internal/polyfill/file.node.mjs rename src/internal/{polyfill => shims}/crypto.node.d.ts (100%) rename src/internal/{polyfill => shims}/crypto.node.js (100%) rename src/internal/{polyfill => shims}/crypto.node.mjs (100%) create mode 100644 src/internal/shims/file.node.d.ts create mode 100644 src/internal/shims/file.node.js create mode 100644 src/internal/shims/file.node.mjs create mode 100644 src/internal/to-file.ts diff --git a/scripts/build b/scripts/build index aadf87be6..dd2c9dd57 100755 --- a/scripts/build +++ b/scripts/build @@ -40,8 +40,8 @@ cp dist/index.d.ts dist/index.d.mts cp tsconfig.dist-src.json dist/src/tsconfig.json cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts -mkdir -p dist/internal/polyfill -cp src/internal/polyfill/*.{mjs,js,d.ts} dist/internal/polyfill +mkdir -p dist/internal/shims +cp src/internal/shims/*.{mjs,js,d.ts} dist/internal/shims node scripts/utils/postprocess-files.cjs diff --git a/src/client.ts b/src/client.ts index 478729321..9154dc496 100644 --- a/src/client.ts +++ b/src/client.ts @@ -641,7 +641,9 @@ export class OpenAI { const timeout = setTimeout(() => controller.abort(), ms); - const isReadableBody = Shims.isReadableLike(options.body); + const isReadableBody = + ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || + (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body); const fetchOptions: RequestInit = { signal: controller.signal as any, diff --git a/src/internal/polyfill/file.node.d.ts b/src/internal/polyfill/file.node.d.ts deleted file mode 100644 index b2a59bfd5..000000000 --- a/src/internal/polyfill/file.node.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file polyfills the global `File` object for you if it's not already defined - * when running on Node.js - * - * This is only needed on Node.js v18 & v19. Newer versions already define `File` - * as a global. - */ - -export {}; diff --git a/src/internal/polyfill/file.node.js b/src/internal/polyfill/file.node.js deleted file mode 100644 index eba997e1d..000000000 --- a/src/internal/polyfill/file.node.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file polyfills the global `File` object for you if it's not already defined - * when running on Node.js - * - * This is only needed on Node.js v18 & v19. Newer versions already define `File` - * as a global. - */ - -if (typeof require !== 'undefined') { - if (!globalThis.File) { - try { - // Use [require][0](...) and not require(...) so bundlers don't try to bundle the - // buffer module. - globalThis.File = [require][0]('node:buffer').File; - } catch (e) {} - } -} diff --git a/src/internal/polyfill/file.node.mjs b/src/internal/polyfill/file.node.mjs deleted file mode 100644 index 520dcb84c..000000000 --- a/src/internal/polyfill/file.node.mjs +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file polyfills the global `File` object for you if it's not already defined - * when running on Node.js - * - * This is only needed on Node.js v18 & v19. Newer versions already define `File` - * as a global. - */ - -import './file.node.js'; diff --git a/src/internal/shims.ts b/src/internal/shims.ts index e084d8925..b1196d141 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -20,62 +20,6 @@ export function getDefaultFetch(): Fetch { ); } -/** - * A minimal copy of the NodeJS `stream.Readable` class so that we can - * accept the NodeJS types in certain places, e.g. file uploads - * - * https://nodejs.org/api/stream.html#class-streamreadable - */ -export interface ReadableLike { - readable: boolean; - readonly readableEnded: boolean; - readonly readableFlowing: boolean | null; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableObjectMode: boolean; - destroyed: boolean; - read(size?: number): any; - pause(): this; - resume(): this; - isPaused(): boolean; - destroy(error?: Error): this; - [Symbol.asyncIterator](): AsyncIterableIterator; -} - -/** - * Determines if the given value looks like a NodeJS `stream.Readable` - * object and that it is readable, i.e. has not been consumed. - * - * https://nodejs.org/api/stream.html#class-streamreadable - */ -export function isReadableLike(value: any) { - // We declare our own class of Readable here, so it's not feasible to - // do an 'instanceof' check. Instead, check for Readable-like properties. - return !!value && value.readable === true && typeof value.read === 'function'; -} - -/** - * A minimal copy of the NodeJS `fs.ReadStream` class for usage within file uploads. - * - * https://nodejs.org/api/fs.html#class-fsreadstream - */ -export interface FsReadStreamLike extends ReadableLike { - path: {}; // real type is string | Buffer but we can't reference `Buffer` here -} - -/** - * Determines if the given value looks like a NodeJS `fs.ReadStream` - * object. - * - * This just checks if the object matches our `Readable` interface - * and defines a `path` property, there may be false positives. - * - * https://nodejs.org/api/fs.html#class-fsreadstream - */ -export function isFsReadStreamLike(value: any): value is FsReadStreamLike { - return isReadableLike(value) && 'path' in value; -} - type ReadableStreamArgs = ConstructorParameters; export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream { diff --git a/src/internal/polyfill/crypto.node.d.ts b/src/internal/shims/crypto.node.d.ts similarity index 100% rename from src/internal/polyfill/crypto.node.d.ts rename to src/internal/shims/crypto.node.d.ts diff --git a/src/internal/polyfill/crypto.node.js b/src/internal/shims/crypto.node.js similarity index 100% rename from src/internal/polyfill/crypto.node.js rename to src/internal/shims/crypto.node.js diff --git a/src/internal/polyfill/crypto.node.mjs b/src/internal/shims/crypto.node.mjs similarity index 100% rename from src/internal/polyfill/crypto.node.mjs rename to src/internal/shims/crypto.node.mjs diff --git a/src/internal/shims/file.node.d.ts b/src/internal/shims/file.node.d.ts new file mode 100644 index 000000000..9dc6b2fcc --- /dev/null +++ b/src/internal/shims/file.node.d.ts @@ -0,0 +1,20 @@ +// The infer is to make TS show it as a nice union type, +// instead of literally `ConstructorParameters[0]` +type FallbackBlobSource = ConstructorParameters[0] extends infer T ? T : never; +/** + * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. + */ +declare class FallbackFile extends Blob { + constructor(sources: FallbackBlobSource, fileName: string, options?: any); + /** + * The name of the `File`. + */ + readonly name: string; + /** + * The last modified date of the `File`. + */ + readonly lastModified: number; +} +export type File = InstanceType; +export const File: typeof globalThis extends { File: infer fileConstructor } ? fileConstructor +: typeof FallbackFile; diff --git a/src/internal/shims/file.node.js b/src/internal/shims/file.node.js new file mode 100644 index 000000000..3f8c2ed68 --- /dev/null +++ b/src/internal/shims/file.node.js @@ -0,0 +1,11 @@ +if (typeof require !== 'undefined') { + if (globalThis.File) { + exports.File = globalThis.File; + } else { + try { + // Use [require][0](...) and not require(...) so bundlers don't try to bundle the + // buffer module. + exports.File = [require][0]('node:buffer').File; + } catch (e) {} + } +} diff --git a/src/internal/shims/file.node.mjs b/src/internal/shims/file.node.mjs new file mode 100644 index 000000000..1f103f5d3 --- /dev/null +++ b/src/internal/shims/file.node.mjs @@ -0,0 +1,2 @@ +import * as mod from './file.node.js'; +export const File = globalThis.File || mod.File; diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts new file mode 100644 index 000000000..69b76d3a6 --- /dev/null +++ b/src/internal/to-file.ts @@ -0,0 +1,152 @@ +import { File } from './shims/file.node.js'; +import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads'; +import type { FilePropertyBag } from './builtin-types'; + +type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; + +/** + * Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc. + * Don't add arrayBuffer here, node-fetch doesn't have it + */ +interface BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ + readonly size: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ + readonly type: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ + text(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ + slice(start?: number, end?: number): BlobLike; +} + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.size === 'number' && + typeof value.type === 'string' && + typeof value.text === 'function' && + typeof value.slice === 'function' && + typeof value.arrayBuffer === 'function'; + +/** + * Intended to match DOM File, node:buffer File, undici File, etc. + */ +interface FileLike extends BlobLike { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ + readonly lastModified: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ + readonly name?: string | undefined; +} + +/** + * This check adds the arrayBuffer() method type because it is available and used at runtime + */ +const isFileLike = (value: any): value is FileLike & { arrayBuffer(): Promise } => + value != null && + typeof value === 'object' && + typeof value.name === 'string' && + typeof value.lastModified === 'number' && + isBlobLike(value); + +/** + * Intended to match DOM Response, node-fetch Response, undici Response, etc. + */ +export interface ResponseLike { + url: string; + blob(): Promise; +} + +const isResponseLike = (value: any): value is ResponseLike => + value != null && + typeof value === 'object' && + typeof value.url === 'string' && + typeof value.blob === 'function'; + +export type ToFileInput = + | FileLike + | ResponseLike + | Exclude + | AsyncIterable; + +/** + * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats + * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s + * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible + * @param {Object=} options additional properties + * @param {string=} options.type the MIME type of the content + * @param {number=} options.lastModified the last modified timestamp + * @returns a {@link File} with the given properties + */ +export async function toFile( + value: ToFileInput | PromiseLike, + name?: string | null | undefined, + options?: FilePropertyBag | undefined, +): Promise { + // If it's a promise, resolve it. + value = await value; + + // If we've been given a `File` we don't need to do anything + if (isFileLike(value)) { + if (File && value instanceof File) { + return value; + } + return makeFile([await value.arrayBuffer()], value.name); + } + + if (isResponseLike(value)) { + const blob = await value.blob(); + name ||= new URL(value.url).pathname.split(/[\\/]/).pop(); + + return makeFile(await getBytes(blob), name, options); + } + + const parts = await getBytes(value); + + name ||= getName(value); + + if (!options?.type) { + const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type); + if (typeof type === 'string') { + options = { ...options, type }; + } + } + + return makeFile(parts, name, options); +} + +async function getBytes(value: BlobLikePart | AsyncIterable): Promise> { + let parts: Array = []; + if ( + typeof value === 'string' || + ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. + value instanceof ArrayBuffer + ) { + parts.push(value); + } else if (isBlobLike(value)) { + parts.push(value instanceof Blob ? value : await value.arrayBuffer()); + } else if ( + isAsyncIterable(value) // includes Readable, ReadableStream, etc. + ) { + for await (const chunk of value) { + parts.push(...(await getBytes(chunk as BlobLikePart))); // TODO, consider validating? + } + } else { + const constructor = value?.constructor?.name; + throw new Error( + `Unexpected data type: ${typeof value}${ + constructor ? `; constructor: ${constructor}` : '' + }${propsForError(value)}`, + ); + } + + return parts; +} + +function propsForError(value: unknown): string { + if (typeof value !== 'object' || value === null) return ''; + const props = Object.getOwnPropertyNames(value); + return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; +} diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index d89af49b1..09931b988 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -1,11 +1,16 @@ import { type RequestOptions } from './request-options'; import type { FilePropertyBag, Fetch } from './builtin-types'; -import { isFsReadStreamLike, type FsReadStreamLike } from './shims'; import type { OpenAI } from '../client'; -import './polyfill/file.node.js'; +import { File } from './shims/file.node.js'; +import { ReadableStreamFrom } from './shims'; -type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; -type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; +export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; +type FsReadStream = AsyncIterable & { path: string | { toString(): string } }; + +// https://github.com/oven-sh/bun/issues/5980 +interface BunFile extends Blob { + readonly name?: string | undefined; +} /** * Typically, this is a native "File" class. @@ -16,188 +21,41 @@ type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; * For convenience, you can also pass a fetch Response, or in Node, * the result of fs.createReadStream(). */ -export type Uploadable = FileLike | ResponseLike | FsReadStreamLike; - -/** - * Intended to match DOM Blob, node-fetch Blob, node:buffer Blob, etc. - * Don't add arrayBuffer here, node-fetch doesn't have it - */ -interface BlobLike { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ - readonly size: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ - readonly type: string; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ - text(): Promise; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ - slice(start?: number, end?: number): BlobLike; -} - -/** - * This check adds the arrayBuffer() method type because it is available and used at runtime - */ -const isBlobLike = (value: any): value is BlobLike & { arrayBuffer(): Promise } => - value != null && - typeof value === 'object' && - typeof value.size === 'number' && - typeof value.type === 'string' && - typeof value.text === 'function' && - typeof value.slice === 'function' && - typeof value.arrayBuffer === 'function'; - -/** - * Intended to match DOM File, node:buffer File, undici File, etc. - */ -interface FileLike extends BlobLike { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ - readonly lastModified: number; - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ - readonly name?: string | undefined; -} -declare var FileClass: { - prototype: FileLike; - new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike; -}; - -/** - * This check adds the arrayBuffer() method type because it is available and used at runtime - */ -const isFileLike = (value: any): value is FileLike & { arrayBuffer(): Promise } => - value != null && - typeof value === 'object' && - typeof value.name === 'string' && - typeof value.lastModified === 'number' && - isBlobLike(value); - -/** - * Intended to match DOM Response, node-fetch Response, undici Response, etc. - */ -export interface ResponseLike { - url: string; - blob(): Promise; -} - -const isResponseLike = (value: any): value is ResponseLike => - value != null && - typeof value === 'object' && - typeof value.url === 'string' && - typeof value.blob === 'function'; - -const isUploadable = (value: any): value is Uploadable => { - return isFileLike(value) || isResponseLike(value) || isFsReadStreamLike(value); -}; - -type ToFileInput = Uploadable | Exclude | AsyncIterable; +export type Uploadable = File | Response | FsReadStream | BunFile; /** * Construct a `File` instance. This is used to ensure a helpful error is thrown - * for environments that don't define a global `File` yet and so that we don't - * accidentally rely on a global `File` type in our annotations. + * for environments that don't define a global `File` yet. */ -function makeFile(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): FileLike { - const File = (globalThis as any).File as typeof FileClass | undefined; +export function makeFile( + fileBits: BlobPart[], + fileName: string | undefined, + options?: FilePropertyBag, +): File { if (typeof File === 'undefined') { throw new Error('`File` is not defined as a global which is required for file uploads'); } - return new File(fileBits, fileName, options); + return new File(fileBits as any, fileName ?? 'unknown_file', options); } -/** - * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats - * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s - * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible - * @param {Object=} options additional properties - * @param {string=} options.type the MIME type of the content - * @param {number=} options.lastModified the last modified timestamp - * @returns a {@link File} with the given properties - */ -export async function toFile( - value: ToFileInput | PromiseLike, - name?: string | null | undefined, - options?: FilePropertyBag | undefined, -): Promise { - // If it's a promise, resolve it. - value = await value; - - // If we've been given a `File` we don't need to do anything - if (isFileLike(value)) { - const File = (globalThis as any).File as typeof FileClass | undefined; - if (File && value instanceof File) { - return value; - } - return makeFile([await value.arrayBuffer()], value.name ?? 'unknown_file'); - } - - if (isResponseLike(value)) { - const blob = await value.blob(); - name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file'; - - return makeFile(await getBytes(blob), name, options); - } - - const parts = await getBytes(value); - - name ||= getName(value) ?? 'unknown_file'; - - if (!options?.type) { - const type = parts.find((part) => typeof part === 'object' && 'type' in part && part.type); - if (typeof type === 'string') { - options = { ...options, type }; - } - } - - return makeFile(parts, name, options); -} - -export async function getBytes( - value: Uploadable | BlobLikePart | AsyncIterable, -): Promise> { - let parts: Array = []; - if ( - typeof value === 'string' || - ArrayBuffer.isView(value) || // includes Uint8Array, Buffer, etc. - value instanceof ArrayBuffer - ) { - parts.push(value); - } else if (isBlobLike(value)) { - parts.push(value instanceof Blob ? value : await value.arrayBuffer()); - } else if ( - isAsyncIterableIterator(value) // includes Readable, ReadableStream, etc. - ) { - for await (const chunk of value) { - parts.push(...(await getBytes(chunk as BlobLikePart))); // TODO, consider validating? - } - } else { - const constructor = value?.constructor?.name; - throw new Error( - `Unexpected data type: ${typeof value}${ - constructor ? `; constructor: ${constructor}` : '' - }${propsForError(value)}`, - ); - } - - return parts; -} - -function propsForError(value: unknown): string { - if (typeof value !== 'object' || value === null) return ''; - const props = Object.getOwnPropertyNames(value); - return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; -} - -function getName(value: unknown): string | undefined { +export function getName(value: any): string | undefined { return ( - (typeof value === 'object' && - value !== null && - (('name' in value && String(value.name)) || - ('filename' in value && String(value.filename)) || - ('path' in value && String(value.path).split(/[\\/]/).pop()))) || - undefined + ( + (typeof value === 'object' && + value !== null && + (('name' in value && value.name && String(value.name)) || + ('url' in value && value.url && String(value.url)) || + ('filename' in value && value.filename && String(value.filename)) || + ('path' in value && value.path && String(value.path)))) || + '' + ) + .split(/[\\/]/) + .pop() || undefined ); } -const isAsyncIterableIterator = (value: any): value is AsyncIterableIterator => +export const isAsyncIterable = (value: any): value is AsyncIterable => value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function'; /** @@ -268,6 +126,15 @@ export const createForm = async >( return form; }; +// We check for Blob not File because Bun.File doesn't inherit from File, +// but they both inherit from Blob and have a `name` property at runtime. +const isNamedBlob = (value: object) => value instanceof File || (value instanceof Blob && 'name' in value); + +const isUploadable = (value: unknown) => + typeof value === 'object' && + value !== null && + (value instanceof Response || isAsyncIterable(value) || isNamedBlob(value)); + const hasUploadableValue = (value: unknown): boolean => { if (isUploadable(value)) return true; if (Array.isArray(value)) return value.some(hasUploadableValue); @@ -290,9 +157,12 @@ const addFormValue = async (form: FormData, key: string, value: unknown): Promis // TODO: make nested formats configurable if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') { form.append(key, String(value)); - } else if (isUploadable(value)) { - const file = await toFile(value); - form.append(key, file as any); + } else if (value instanceof Response) { + form.append(key, makeFile([await value.blob()], getName(value))); + } else if (isAsyncIterable(value)) { + form.append(key, makeFile([await new Response(ReadableStreamFrom(value)).blob()], getName(value))); + } else if (isNamedBlob(value)) { + form.append(key, value, getName(value)); } else if (Array.isArray(value)) { await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry))); } else if (typeof value === 'object') { diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts index 6c43f81dd..1349c42c3 100644 --- a/src/internal/utils/uuid.ts +++ b/src/internal/utils/uuid.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { crypto } from '../polyfill/crypto.node'; +import { crypto } from '../shims/crypto.node.js'; /** * https://stackoverflow.com/a/2117523 diff --git a/src/uploads.ts b/src/uploads.ts index 77b65766a..79d3073ea 100644 --- a/src/uploads.ts +++ b/src/uploads.ts @@ -1 +1,2 @@ -export { type Uploadable, toFile } from './internal/uploads'; +export { type Uploadable } from './internal/uploads'; +export { toFile, type ToFileInput } from './internal/to-file'; diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 44d10769b..dbbd56ae7 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,5 +1,5 @@ import fs from 'fs'; -import type { ResponseLike } from 'openai/internal/uploads'; +import type { ResponseLike } from 'openai/internal/to-file'; import { toFile } from 'openai/uploads'; class MyClass { @@ -13,6 +13,12 @@ function mockResponse({ url, content }: { url: string; content?: Blob }): Respon }; } +beforeEach(() => { + // The file shim captures the global File object when it's first imported. + // Reset modules before each test so we can test the error thrown when it's undefined. + jest.resetModules(); +}); + describe('toFile', () => { it('throws a helpful error for mismatched types', async () => { await expect( @@ -62,15 +68,29 @@ describe('toFile', () => { expect(file.name).toEqual('input.jsonl'); expect(file.type).toBe('jsonl'); }); + + it('is assignable to File and Blob', async () => { + const input = new File(['foo'], 'input.jsonl', { type: 'jsonl' }); + const result = await toFile(input); + const file: File = result; + const blob: Blob = result; + void file, blob; + }); }); -test('missing File error message', async () => { - // @ts-ignore - globalThis.File = undefined; +describe('missing File error message', () => { + beforeEach(() => { + // @ts-ignore + globalThis.File = undefined; + require('node:buffer').File = undefined; + }); - await expect( - toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })), - ).rejects.toMatchInlineSnapshot( - `[Error: \`File\` is not defined as a global which is required for file uploads]`, - ); + test('is thrown', async () => { + const uploads = await import('openai/uploads'); + await expect( + uploads.toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })), + ).rejects.toMatchInlineSnapshot( + `[Error: \`File\` is not defined as a global which is required for file uploads]`, + ); + }); }); From c54270a58ada1d0d7878ce80c7c2093a56fed158 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 19:13:29 +0000 Subject: [PATCH 228/509] chore(internal): fix tests failing on node v18 --- tests/uploads.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index dbbd56ae7..a7f5c63fe 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import type { ResponseLike } from 'openai/internal/to-file'; import { toFile } from 'openai/uploads'; +import { File } from 'node:buffer'; class MyClass { name: string = 'foo'; From 0e980d05e8e1fb4befae443fb84b8b9fab8dbd50 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 3 Mar 2025 21:22:38 +0000 Subject: [PATCH 229/509] fix(client): fix TypeError with undefined File --- package.json | 3 +++ src/internal/uploads.ts | 3 ++- yarn.lock | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 93749e2f8..5638a355c 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,9 @@ "ws": "^8.18.0", "zod": "^3.23.8" }, + "resolutions": { + "synckit": "0.8.8" + }, "imports": { "openai": ".", "openai/*": "./src/*" diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 09931b988..2c286497c 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -128,7 +128,8 @@ export const createForm = async >( // We check for Blob not File because Bun.File doesn't inherit from File, // but they both inherit from Blob and have a `name` property at runtime. -const isNamedBlob = (value: object) => value instanceof File || (value instanceof Blob && 'name' in value); +const isNamedBlob = (value: object) => + (File && value instanceof File) || (value instanceof Blob && 'name' in value); const isUploadable = (value: unknown) => typeof value === 'object' && diff --git a/yarn.lock b/yarn.lock index c16fb37a0..b8808db07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3217,10 +3217,10 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@^0.9.1: - version "0.9.2" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.9.2.tgz#a3a935eca7922d48b9e7d6c61822ee6c3ae4ec62" - integrity sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw== +synckit@0.8.8, synckit@^0.9.1: + version "0.8.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" + integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== dependencies: "@pkgr/core" "^0.1.0" tslib "^2.6.2" From da43aa91586fe80137c6500e850dca82085936b8 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 3 Mar 2025 22:26:09 +0000 Subject: [PATCH 230/509] fix(internal): clean up undefined File test --- tests/uploads.test.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index a7f5c63fe..e331e3452 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -14,12 +14,6 @@ function mockResponse({ url, content }: { url: string; content?: Blob }): Respon }; } -beforeEach(() => { - // The file shim captures the global File object when it's first imported. - // Reset modules before each test so we can test the error thrown when it's undefined. - jest.resetModules(); -}); - describe('toFile', () => { it('throws a helpful error for mismatched types', async () => { await expect( @@ -80,11 +74,23 @@ describe('toFile', () => { }); describe('missing File error message', () => { + let prevFile: unknown; beforeEach(() => { + // The file shim captures the global File object when it's first imported. + // Reset modules before each test so we can test the error thrown when it's undefined. + jest.resetModules(); + // @ts-ignore + prevFile = globalThis.File; // @ts-ignore globalThis.File = undefined; require('node:buffer').File = undefined; }); + afterEach(() => { + // Clean up + // @ts-ignore + globalThis.File = prevFile; + jest.resetModules(); + }); test('is thrown', async () => { const uploads = await import('openai/uploads'); From 1d18ed4f90436e7041835d201c8cb1c373ded418 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 3 Mar 2025 23:03:03 +0000 Subject: [PATCH 231/509] fix(tests): manually reset node:buffer File --- tests/uploads.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index e331e3452..508fce58f 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -74,21 +74,25 @@ describe('toFile', () => { }); describe('missing File error message', () => { - let prevFile: unknown; + let prevGlobalFile: unknown; + let prevNodeFile: unknown; beforeEach(() => { // The file shim captures the global File object when it's first imported. // Reset modules before each test so we can test the error thrown when it's undefined. jest.resetModules(); + const buffer = require('node:buffer'); // @ts-ignore - prevFile = globalThis.File; + prevGlobalFile = globalThis.File; + prevNodeFile = buffer.File; // @ts-ignore globalThis.File = undefined; - require('node:buffer').File = undefined; + buffer.File = undefined; }); afterEach(() => { // Clean up // @ts-ignore - globalThis.File = prevFile; + globalThis.File = prevGlobalFile; + require('node:buffer').File = prevNodeFile; jest.resetModules(); }); From f1712cdea42e9d95d4b2dc40aae5cebc8e14c76d Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 4 Mar 2025 18:52:37 +0000 Subject: [PATCH 232/509] chore(types): improved go to definition on fetchOptions --- src/internal/types.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/internal/types.ts b/src/internal/types.ts index 50c16e9d2..c3bce5a21 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -6,14 +6,6 @@ export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; export type KeysEnum = { [P in keyof Required]: true }; type NotAny = [unknown] extends [T] ? never : T; -type Literal = PropertyKey extends T ? never : T; -type MappedLiteralKeys = T extends any ? Literal : never; -type MappedIndex = - T extends any ? - K extends keyof T ? - T[K] - : never - : never; /** * Some environments overload the global fetch function, and Parameters only gets the last signature. @@ -93,6 +85,6 @@ type RequestInits = * This type contains `RequestInit` options that may be available on the current runtime, * including per-platform extensions like `dispatcher`, `agent`, `client`, etc. */ -export type MergedRequestInit = { - [K in MappedLiteralKeys]?: MappedIndex | undefined; -}; +export type MergedRequestInit = RequestInits & + /** We don't include these in the types as they'll be overridden for every request. */ + Partial>; From 9f4c30b9bcc2f373b3087dba69bd837f96f79d81 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 4 Mar 2025 23:52:32 +0000 Subject: [PATCH 233/509] chore(docs): improve docs for withResponse/asResponse --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2b85f3553..93689e40d 100644 --- a/README.md +++ b/README.md @@ -507,8 +507,10 @@ while (page.hasNextPage()) { ### Accessing raw Response data (e.g., headers) The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return. +This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic. You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data. +Unlike `.asResponse()` this method consumes the body, returning once it is parsed. ```ts From b943a0ae4682a410172e1063a9424f5150cd9010 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 5 Mar 2025 21:21:53 +0000 Subject: [PATCH 234/509] fix(api): add missing file rank enum + more metadata --- .stats.yml | 2 +- src/resources/beta/threads/runs/steps.ts | 5 ++-- src/resources/fine-tuning/jobs/jobs.ts | 29 ++++++++++++++++++- .../fine-tuning/jobs/jobs.test.ts | 6 +++- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 163146e38..0d7e83be4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 74 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-5d30684c3118d049682ea30cdb4dbef39b97d51667da484689193dc40162af32.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b524aed1c2c5c928aa4e2c546f5dbb364e7b4d5027daf05e42e210b05a97c3c6.yml diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index adaa4c9a1..918cdde37 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -242,9 +242,10 @@ export namespace FileSearchToolCall { */ export interface RankingOptions { /** - * The ranker used for the file search. + * The ranker to use for the file search. If not specified will use the `auto` + * ranker. */ - ranker: 'default_2024_08_21'; + ranker: 'auto' | 'default_2024_08_21'; /** * The score threshold for the file search. All values must be a floating point diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 51cac957c..8a70f4e5a 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import * as Shared from '../../shared'; import * as CheckpointsAPI from './checkpoints'; import { CheckpointListParams, @@ -177,6 +178,16 @@ export interface FineTuningJob { */ integrations?: Array | null; + /** + * 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 method used for fine-tuning. */ @@ -458,6 +469,16 @@ export interface JobCreateParams { */ integrations?: Array | null; + /** + * 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 method used for fine-tuning. */ @@ -672,7 +693,13 @@ export namespace JobCreateParams { } } -export interface JobListParams extends CursorPageParams {} +export interface JobListParams extends CursorPageParams { + /** + * Optional metadata filter. To filter, use the syntax `metadata[k]=v`. + * Alternatively, set `metadata=null` to indicate no metadata. + */ + metadata?: Record | null; +} export interface JobListEventsParams extends CursorPageParams {} diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index b194ac234..0875598cf 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -33,6 +33,7 @@ describe('resource jobs', () => { wandb: { project: 'my-wandb-project', entity: 'entity', name: 'name', tags: ['custom-tag'] }, }, ], + metadata: { foo: 'string' }, method: { dpo: { hyperparameters: { @@ -78,7 +79,10 @@ describe('resource jobs', () => { 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.jobs.list({ after: 'after', limit: 0 }, { path: '/_stainless_unknown_path' }), + client.fineTuning.jobs.list( + { after: 'after', limit: 0, metadata: { foo: 'string' } }, + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(OpenAI.NotFoundError); }); From 236dbf4092fccf7697852c6341a8f38f0241770c Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 6 Mar 2025 14:49:45 +0000 Subject: [PATCH 235/509] chore: move ChatModel type to shared --- api.md | 3 +- src/client.ts | 4 +- src/resources/beta/assistants.ts | 3 +- src/resources/beta/threads/runs/runs.ts | 3 +- src/resources/beta/threads/threads.ts | 3 +- src/resources/chat/chat.ts | 44 +------------------ src/resources/chat/completions/completions.ts | 3 +- src/resources/chat/index.ts | 2 +- src/resources/fine-tuning/fine-tuning.ts | 2 +- src/resources/fine-tuning/index.ts | 2 +- src/resources/fine-tuning/jobs/index.ts | 2 +- src/resources/fine-tuning/jobs/jobs.ts | 6 +-- src/resources/shared.ts | 43 ++++++++++++++++++ 13 files changed, 60 insertions(+), 60 deletions(-) diff --git a/api.md b/api.md index 5b5c603b7..5372cbf84 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ Types: +- ChatModel - ErrorObject - FunctionDefinition - FunctionParameters @@ -200,9 +201,9 @@ Types: - FineTuningJob - FineTuningJobEvent -- FineTuningJobIntegration - FineTuningJobWandbIntegration - FineTuningJobWandbIntegrationObject +- FineTuningJobIntegration Methods: diff --git a/src/client.ts b/src/client.ts index 9154dc496..165a97484 100644 --- a/src/client.ts +++ b/src/client.ts @@ -82,7 +82,7 @@ import { formatRequestDetails, loggerFor } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; -import { Chat, ChatModel } from './resources/chat/chat'; +import { Chat } from './resources/chat/chat'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; import { Upload, @@ -910,7 +910,6 @@ export declare namespace OpenAI { export { Chat as Chat, - type ChatModel as ChatModel, type ChatCompletion as ChatCompletion, type ChatCompletionAssistantMessageParam as ChatCompletionAssistantMessageParam, type ChatCompletionAudio as ChatCompletionAudio, @@ -1019,6 +1018,7 @@ export declare namespace OpenAI { type UploadCompleteParams as UploadCompleteParams, }; + export type ChatModel = API.ChatModel; export type ErrorObject = API.ErrorObject; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0e109deed..0a32be46d 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Shared from '../shared'; -import * as ChatAPI from '../chat/chat'; import * as MessagesAPI from './threads/messages'; import * as ThreadsAPI from './threads/threads'; import * as VectorStoresAPI from './vector-stores/vector-stores'; @@ -1095,7 +1094,7 @@ export interface AssistantCreateParams { * [Model overview](https://platform.openai.com/docs/models) for descriptions of * them. */ - model: (string & {}) | ChatAPI.ChatModel; + model: (string & {}) | Shared.ChatModel; /** * The description of the assistant. The maximum length is 512 characters. diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 1aafffc92..4a75b5466 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -4,7 +4,6 @@ import { APIResource } from '../../../../resource'; 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'; import * as ThreadsAPI from '../threads'; import * as StepsAPI from './steps'; @@ -699,7 +698,7 @@ export interface RunCreateParamsBase { * associated with the assistant. If not, the model associated with the assistant * will be used. */ - model?: (string & {}) | ChatAPI.ChatModel | null; + model?: (string & {}) | Shared.ChatModel | null; /** * Body param: Whether to enable diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index be1014f68..036ed680e 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -4,7 +4,6 @@ import { APIResource } from '../../../resource'; import * as ThreadsAPI from './threads'; import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; -import * as ChatAPI from '../../chat/chat'; import * as MessagesAPI from './messages'; import { Annotation, @@ -564,7 +563,7 @@ export interface ThreadCreateAndRunParamsBase { * model associated with the assistant. If not, the model associated with the * assistant will be used. */ - model?: (string & {}) | ChatAPI.ChatModel | null; + model?: (string & {}) | Shared.ChatModel | null; /** * Whether to enable diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 40358c331..51a3606fd 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,6 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as Shared from '../shared'; import * as CompletionsAPI from './completions/completions'; import { ChatCompletion, @@ -46,48 +47,7 @@ export class Chat extends APIResource { completions: CompletionsAPI.Completions = new CompletionsAPI.Completions(this._client); } -export type ChatModel = - | 'o3-mini' - | 'o3-mini-2025-01-31' - | 'o1' - | 'o1-2024-12-17' - | 'o1-preview' - | 'o1-preview-2024-09-12' - | 'o1-mini' - | 'o1-mini-2024-09-12' - | 'gpt-4.5-preview' - | 'gpt-4.5-preview-2025-02-27' - | 'gpt-4o' - | 'gpt-4o-2024-11-20' - | 'gpt-4o-2024-08-06' - | 'gpt-4o-2024-05-13' - | 'gpt-4o-audio-preview' - | 'gpt-4o-audio-preview-2024-10-01' - | 'gpt-4o-audio-preview-2024-12-17' - | 'gpt-4o-mini-audio-preview' - | 'gpt-4o-mini-audio-preview-2024-12-17' - | 'chatgpt-4o-latest' - | 'gpt-4o-mini' - | 'gpt-4o-mini-2024-07-18' - | 'gpt-4-turbo' - | 'gpt-4-turbo-2024-04-09' - | 'gpt-4-0125-preview' - | 'gpt-4-turbo-preview' - | 'gpt-4-1106-preview' - | 'gpt-4-vision-preview' - | 'gpt-4' - | 'gpt-4-0314' - | 'gpt-4-0613' - | 'gpt-4-32k' - | 'gpt-4-32k-0314' - | 'gpt-4-32k-0613' - | 'gpt-3.5-turbo' - | 'gpt-3.5-turbo-16k' - | 'gpt-3.5-turbo-0301' - | 'gpt-3.5-turbo-0613' - | 'gpt-3.5-turbo-1106' - | 'gpt-3.5-turbo-0125' - | 'gpt-3.5-turbo-16k-0613'; +export type ChatModel = Shared.ChatModel; Chat.Completions = Completions; diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 29c9ad390..5a9e497a1 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -4,7 +4,6 @@ import { APIResource } from '../../../resource'; import * as CompletionsCompletionsAPI from './completions'; import * as CompletionsAPI from '../../completions'; import * as Shared from '../../shared'; -import * as ChatAPI from '../chat'; import * as MessagesAPI from './messages'; import { MessageListParams, Messages } from './messages'; import { APIPromise } from '../../../api-promise'; @@ -1002,7 +1001,7 @@ export interface ChatCompletionCreateParamsBase { * [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility) * table for details on which models work with the Chat API. */ - model: (string & {}) | ChatAPI.ChatModel; + model: (string & {}) | Shared.ChatModel; /** * Parameters for audio output. Required when audio output is requested with diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index f098e5ce7..8eb8cbed6 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Chat, type ChatModel } from './chat'; +export { Chat } from './chat'; export { Completions, type ChatCompletion, diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index 9d027b72d..593a4a89e 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -27,9 +27,9 @@ export declare namespace FineTuning { Jobs as Jobs, type FineTuningJob as FineTuningJob, type FineTuningJobEvent as FineTuningJobEvent, - type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, + type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobsPage as FineTuningJobsPage, type FineTuningJobEventsPage as FineTuningJobEventsPage, type JobCreateParams as JobCreateParams, diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 898f2fc89..52ef721b8 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -5,9 +5,9 @@ export { Jobs, type FineTuningJob, type FineTuningJobEvent, - type FineTuningJobIntegration, type FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject, + type FineTuningJobIntegration, type JobCreateParams, type JobListParams, type JobListEventsParams, diff --git a/src/resources/fine-tuning/jobs/index.ts b/src/resources/fine-tuning/jobs/index.ts index 4e397aea7..18a2b1a93 100644 --- a/src/resources/fine-tuning/jobs/index.ts +++ b/src/resources/fine-tuning/jobs/index.ts @@ -10,9 +10,9 @@ export { Jobs, type FineTuningJob, type FineTuningJobEvent, - type FineTuningJobIntegration, type FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject, + type FineTuningJobIntegration, type JobCreateParams, type JobListParams, type JobListEventsParams, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 8a70f4e5a..4531ec138 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -380,8 +380,6 @@ export interface FineTuningJobEvent { type?: 'message' | 'metrics'; } -export type FineTuningJobIntegration = FineTuningJobWandbIntegrationObject; - /** * The settings for your integration with Weights and Biases. This payload * specifies the project that metrics will be sent to. Optionally, you can set an @@ -430,6 +428,8 @@ export interface FineTuningJobWandbIntegrationObject { wandb: FineTuningJobWandbIntegration; } +export type FineTuningJobIntegration = FineTuningJobWandbIntegrationObject; + export interface JobCreateParams { /** * The name of the model to fine-tune. You can select one of the @@ -709,9 +709,9 @@ export declare namespace Jobs { export { type FineTuningJob as FineTuningJob, type FineTuningJobEvent as FineTuningJobEvent, - type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobWandbIntegration as FineTuningJobWandbIntegration, type FineTuningJobWandbIntegrationObject as FineTuningJobWandbIntegrationObject, + type FineTuningJobIntegration as FineTuningJobIntegration, type FineTuningJobsPage as FineTuningJobsPage, type FineTuningJobEventsPage as FineTuningJobEventsPage, type JobCreateParams as JobCreateParams, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 3bb11582f..18e2ecddc 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,48 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export type ChatModel = + | 'o3-mini' + | 'o3-mini-2025-01-31' + | 'o1' + | 'o1-2024-12-17' + | 'o1-preview' + | 'o1-preview-2024-09-12' + | 'o1-mini' + | 'o1-mini-2024-09-12' + | 'gpt-4.5-preview' + | 'gpt-4.5-preview-2025-02-27' + | 'gpt-4o' + | 'gpt-4o-2024-11-20' + | 'gpt-4o-2024-08-06' + | 'gpt-4o-2024-05-13' + | 'gpt-4o-audio-preview' + | 'gpt-4o-audio-preview-2024-10-01' + | 'gpt-4o-audio-preview-2024-12-17' + | 'gpt-4o-mini-audio-preview' + | 'gpt-4o-mini-audio-preview-2024-12-17' + | 'chatgpt-4o-latest' + | 'gpt-4o-mini' + | 'gpt-4o-mini-2024-07-18' + | 'gpt-4-turbo' + | 'gpt-4-turbo-2024-04-09' + | 'gpt-4-0125-preview' + | 'gpt-4-turbo-preview' + | 'gpt-4-1106-preview' + | 'gpt-4-vision-preview' + | 'gpt-4' + | 'gpt-4-0314' + | 'gpt-4-0613' + | 'gpt-4-32k' + | 'gpt-4-32k-0314' + | 'gpt-4-32k-0613' + | 'gpt-3.5-turbo' + | 'gpt-3.5-turbo-16k' + | 'gpt-3.5-turbo-0301' + | 'gpt-3.5-turbo-0613' + | 'gpt-3.5-turbo-1106' + | 'gpt-3.5-turbo-0125' + | 'gpt-3.5-turbo-16k-0613'; + export interface ErrorObject { code: string | null; From 7ea4a244d5b39e0745aea1a89abff940e2c3922f Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Sat, 8 Mar 2025 18:19:49 +0000 Subject: [PATCH 236/509] feat: add SKIP_BREW env var to ./scripts/bootstrap --- scripts/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 033156d3a..f107c3a24 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle From 67da9ce89ea010813779b98c18fea84d9964c7de Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Mon, 10 Mar 2025 20:04:45 +0000 Subject: [PATCH 237/509] feat(client): accept RFC6838 JSON content types --- src/internal/parse.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal/parse.ts b/src/internal/parse.ts index 173991a55..14147338d 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -44,8 +44,8 @@ export async function defaultParseResponse( } const contentType = response.headers.get('content-type'); - const isJSON = - contentType?.includes('application/json') || contentType?.includes('application/vnd.api+json'); + const mediaType = contentType?.split(';')[0]?.trim(); + const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json'); if (isJSON) { const json = await response.json(); return addRequestID(json as T, response); From d028ad7b0debb585534acb73fa5cafe6f8d90f37 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Thu, 13 Mar 2025 23:06:15 +0000 Subject: [PATCH 238/509] fix(exports): ensure resource imports don't require /index --- src/resources/audio.ts | 3 +++ src/resources/beta.ts | 3 +++ src/resources/beta/realtime.ts | 3 +++ src/resources/beta/threads.ts | 3 +++ src/resources/beta/threads/runs.ts | 3 +++ src/resources/chat.ts | 3 +++ src/resources/chat/completions.ts | 4 +++- src/resources/fine-tuning.ts | 3 +++ src/resources/fine-tuning/jobs.ts | 3 +++ src/resources/responses.ts | 3 +++ src/resources/uploads.ts | 3 +++ src/resources/vector-stores.ts | 3 +++ 12 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/resources/audio.ts create mode 100644 src/resources/beta.ts create mode 100644 src/resources/beta/realtime.ts create mode 100644 src/resources/beta/threads.ts create mode 100644 src/resources/beta/threads/runs.ts create mode 100644 src/resources/chat.ts create mode 100644 src/resources/fine-tuning.ts create mode 100644 src/resources/fine-tuning/jobs.ts create mode 100644 src/resources/responses.ts create mode 100644 src/resources/uploads.ts create mode 100644 src/resources/vector-stores.ts diff --git a/src/resources/audio.ts b/src/resources/audio.ts new file mode 100644 index 000000000..bc19b759c --- /dev/null +++ b/src/resources/audio.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './audio/index'; diff --git a/src/resources/beta.ts b/src/resources/beta.ts new file mode 100644 index 000000000..1542e942b --- /dev/null +++ b/src/resources/beta.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './beta/index'; diff --git a/src/resources/beta/realtime.ts b/src/resources/beta/realtime.ts new file mode 100644 index 000000000..1c5df27d9 --- /dev/null +++ b/src/resources/beta/realtime.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './realtime/index'; diff --git a/src/resources/beta/threads.ts b/src/resources/beta/threads.ts new file mode 100644 index 000000000..705f67016 --- /dev/null +++ b/src/resources/beta/threads.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './threads/index'; diff --git a/src/resources/beta/threads/runs.ts b/src/resources/beta/threads/runs.ts new file mode 100644 index 000000000..a3cc2bc7f --- /dev/null +++ b/src/resources/beta/threads/runs.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './runs/index'; diff --git a/src/resources/chat.ts b/src/resources/chat.ts new file mode 100644 index 000000000..b3dd87a90 --- /dev/null +++ b/src/resources/chat.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './chat/index'; diff --git a/src/resources/chat/completions.ts b/src/resources/chat/completions.ts index 55b151e8b..fe7033a94 100644 --- a/src/resources/chat/completions.ts +++ b/src/resources/chat/completions.ts @@ -1 +1,3 @@ -export * from './completions/completions'; +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './completions/index'; diff --git a/src/resources/fine-tuning.ts b/src/resources/fine-tuning.ts new file mode 100644 index 000000000..01fd61342 --- /dev/null +++ b/src/resources/fine-tuning.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './fine-tuning/index'; diff --git a/src/resources/fine-tuning/jobs.ts b/src/resources/fine-tuning/jobs.ts new file mode 100644 index 000000000..6640de1f2 --- /dev/null +++ b/src/resources/fine-tuning/jobs.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './jobs/index'; diff --git a/src/resources/responses.ts b/src/resources/responses.ts new file mode 100644 index 000000000..9d26aac0c --- /dev/null +++ b/src/resources/responses.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './responses/index'; diff --git a/src/resources/uploads.ts b/src/resources/uploads.ts new file mode 100644 index 000000000..a6ab87fbe --- /dev/null +++ b/src/resources/uploads.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './uploads/index'; diff --git a/src/resources/vector-stores.ts b/src/resources/vector-stores.ts new file mode 100644 index 000000000..e7a343120 --- /dev/null +++ b/src/resources/vector-stores.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './vector-stores/index'; From 91af47cc4f62b08a451bc39f44c64244a71c1f2c Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 11 Mar 2025 16:37:56 +0000 Subject: [PATCH 239/509] feat(api): add /v1/responses and built-in tools [platform.openai.com/docs/changelog](http://platform.openai.com/docs/changelog) --- .stats.yml | 4 +- MIGRATION.md | 28 +- api.md | 224 +- src/client.ts | 52 +- src/resources/beta/assistants.ts | 52 +- src/resources/beta/beta.ts | 38 +- src/resources/beta/index.ts | 16 - src/resources/beta/threads/runs/runs.ts | 4 +- src/resources/beta/threads/threads.ts | 87 +- src/resources/chat/chat.ts | 2 +- src/resources/chat/completions/completions.ts | 287 +- src/resources/chat/completions/index.ts | 1 - src/resources/chat/completions/messages.ts | 2 +- src/resources/chat/index.ts | 1 - src/resources/files.ts | 26 +- src/resources/index.ts | 20 + src/resources/responses/index.ts | 9 + src/resources/responses/input-items.ts | 252 ++ src/resources/responses/responses.ts | 2688 +++++++++++++++++ src/resources/shared.ts | 113 +- src/resources/uploads/uploads.ts | 7 +- .../{beta => }/vector-stores/file-batches.ts | 27 +- .../{beta => }/vector-stores/files.ts | 106 +- .../{beta => }/vector-stores/index.ts | 7 + .../{beta => }/vector-stores/vector-stores.ts | 136 +- .../chat/completions/completions.test.ts | 11 +- .../responses/input-items.test.ts | 32 + .../api-resources/responses/responses.test.ts | 85 + .../vector-stores/file-batches.test.ts | 19 +- .../{beta => }/vector-stores/files.test.ts | 55 +- .../vector-stores/vector-stores.test.ts | 33 +- 31 files changed, 4129 insertions(+), 295 deletions(-) create mode 100644 src/resources/responses/index.ts create mode 100644 src/resources/responses/input-items.ts create mode 100644 src/resources/responses/responses.ts rename src/resources/{beta => }/vector-stores/file-batches.ts (91%) rename src/resources/{beta => }/vector-stores/files.ts (71%) rename src/resources/{beta => }/vector-stores/index.ts (82%) rename src/resources/{beta => }/vector-stores/vector-stores.ts (76%) create mode 100644 tests/api-resources/responses/input-items.test.ts create mode 100644 tests/api-resources/responses/responses.test.ts rename tests/api-resources/{beta => }/vector-stores/file-batches.test.ts (79%) rename tests/api-resources/{beta => }/vector-stores/files.test.ts (57%) rename tests/api-resources/{beta => }/vector-stores/vector-stores.test.ts (68%) diff --git a/.stats.yml b/.stats.yml index 0d7e83be4..455874212 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 74 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b524aed1c2c5c928aa4e2c546f5dbb364e7b4d5027daf05e42e210b05a97c3c6.yml +configured_endpoints: 81 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-be834d63e326a82494e819085137f5eb15866f3fc787db1f3afe7168d419e18a.yml diff --git a/MIGRATION.md b/MIGRATION.md index c9c07887c..b84a1d6f9 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -110,11 +110,13 @@ client.example.create('c_456', { parent_id: 'p_123' }); This affects the following methods: -- `client.beta.vectorStores.files.retrieve()` -- `client.beta.vectorStores.files.delete()` -- `client.beta.vectorStores.fileBatches.retrieve()` -- `client.beta.vectorStores.fileBatches.cancel()` -- `client.beta.vectorStores.fileBatches.listFiles()` +- `client.vectorStores.files.retrieve()` +- `client.vectorStores.files.update()` +- `client.vectorStores.files.delete()` +- `client.vectorStores.files.content()` +- `client.vectorStores.fileBatches.retrieve()` +- `client.vectorStores.fileBatches.cancel()` +- `client.vectorStores.fileBatches.listFiles()` - `client.beta.threads.runs.retrieve()` - `client.beta.threads.runs.update()` - `client.beta.threads.runs.cancel()` @@ -182,21 +184,23 @@ Some methods could not be named intuitively due to an internal naming conflict. client.chat.completions.del(); client.files.del(); client.models.del(); -client.beta.vectorStores.del(); -client.beta.vectorStores.files.del(); +client.vectorStores.del(); +client.vectorStores.files.del(); client.beta.assistants.del(); client.beta.threads.del(); client.beta.threads.messages.del(); +client.responses.del(); // After client.chat.completions.delete(); client.files.delete(); client.models.delete(); -client.beta.vectorStores.delete(); -client.beta.vectorStores.files.delete(); +client.vectorStores.delete(); +client.vectorStores.files.delete(); client.beta.assistants.delete(); client.beta.threads.delete(); client.beta.threads.messages.delete(); +client.responses.delete(); ``` ### Removed request options overloads @@ -220,13 +224,15 @@ This affects the following methods: - `client.fineTuning.jobs.list()` - `client.fineTuning.jobs.listEvents()` - `client.fineTuning.jobs.checkpoints.list()` -- `client.beta.vectorStores.list()` -- `client.beta.vectorStores.files.list()` +- `client.vectorStores.list()` +- `client.vectorStores.files.list()` - `client.beta.assistants.list()` - `client.beta.threads.create()` - `client.beta.threads.runs.list()` - `client.beta.threads.messages.list()` - `client.batches.list()` +- `client.responses.retrieve()` +- `client.responses.inputItems.list()` ### Pagination changes diff --git a/api.md b/api.md index 5372cbf84..1cf080c91 100644 --- a/api.md +++ b/api.md @@ -3,10 +3,14 @@ Types: - ChatModel +- ComparisonFilter +- CompoundFilter - ErrorObject - FunctionDefinition - FunctionParameters - Metadata +- Reasoning +- ReasoningEffort - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText @@ -53,7 +57,6 @@ Types: - ChatCompletionModality - ChatCompletionNamedToolChoice - ChatCompletionPredictionContent -- ChatCompletionReasoningEffort - ChatCompletionRole - ChatCompletionStoreMessage - ChatCompletionStreamOptions @@ -63,6 +66,7 @@ Types: - ChatCompletionToolChoiceOption - ChatCompletionToolMessageParam - ChatCompletionUserMessageParam +- ChatCompletionReasoningEffort Methods: @@ -223,6 +227,68 @@ Methods: - client.fineTuning.jobs.checkpoints.list(fineTuningJobID, { ...params }) -> FineTuningJobCheckpointsPage +# VectorStores + +Types: + +- AutoFileChunkingStrategyParam +- FileChunkingStrategy +- FileChunkingStrategyParam +- OtherFileChunkingStrategyObject +- StaticFileChunkingStrategy +- StaticFileChunkingStrategyObject +- StaticFileChunkingStrategyObjectParam +- VectorStore +- VectorStoreDeleted +- VectorStoreSearchResponse + +Methods: + +- client.vectorStores.create({ ...params }) -> VectorStore +- client.vectorStores.retrieve(vectorStoreID) -> VectorStore +- client.vectorStores.update(vectorStoreID, { ...params }) -> VectorStore +- client.vectorStores.list({ ...params }) -> VectorStoresPage +- client.vectorStores.delete(vectorStoreID) -> VectorStoreDeleted +- client.vectorStores.search(vectorStoreID, { ...params }) -> VectorStoreSearchResponsesPage + +## Files + +Types: + +- VectorStoreFile +- VectorStoreFileDeleted +- FileContentResponse + +Methods: + +- client.vectorStores.files.create(vectorStoreId, { ...params }) -> VectorStoreFile +- client.vectorStores.files.retrieve(vectorStoreId, fileId) -> VectorStoreFile +- client.vectorStores.files.update(vectorStoreId, fileId, { ...params }) -> VectorStoreFile +- client.vectorStores.files.list(vectorStoreId, { ...params }) -> VectorStoreFilesPage +- client.vectorStores.files.del(vectorStoreId, fileId) -> VectorStoreFileDeleted +- client.vectorStores.files.content(vectorStoreId, fileId) -> FileContentResponsesPage +- client.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> + +## FileBatches + +Types: + +- VectorStoreFileBatch + +Methods: + +- client.vectorStores.fileBatches.create(vectorStoreID, { ...params }) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.retrieve(batchID, { ...params }) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.cancel(batchID, { ...params }) -> VectorStoreFileBatch +- client.vectorStores.fileBatches.listFiles(batchID, { ...params }) -> VectorStoreFilesPage +- client.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> +- client.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> + # Beta ## Realtime @@ -286,72 +352,6 @@ Methods: - client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse -## VectorStores - -Types: - -- AutoFileChunkingStrategyParam -- FileChunkingStrategy -- FileChunkingStrategyParam -- OtherFileChunkingStrategyObject -- StaticFileChunkingStrategy -- StaticFileChunkingStrategyObject -- StaticFileChunkingStrategyObjectParam -- VectorStore -- VectorStoreDeleted - -Methods: - -- client.beta.vectorStores.create({ ...params }) -> VectorStore -- client.beta.vectorStores.retrieve(vectorStoreID) -> VectorStore -- client.beta.vectorStores.update(vectorStoreID, { ...params }) -> VectorStore -- client.beta.vectorStores.list({ ...params }) -> VectorStoresPage -- client.beta.vectorStores.delete(vectorStoreID) -> VectorStoreDeleted - -### Files - -Types: - -- VectorStoreFile -- VectorStoreFileDeleted - -Methods: - -- client.beta.vectorStores.files.create(vectorStoreID, { ...params }) -> VectorStoreFile -- client.beta.vectorStores.files.retrieve(fileID, { ...params }) -> VectorStoreFile -- client.beta.vectorStores.files.list(vectorStoreID, { ...params }) -> VectorStoreFilesPage -- client.beta.vectorStores.files.delete(fileID, { ...params }) -> VectorStoreFileDeleted -- client.beta.vectorStores.files.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.poll(vectorStoreId, fileId, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> -- client.beta.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> - -### FileBatches - -Types: - -- VectorStoreFileBatch - -Methods: - -- client.beta.vectorStores.fileBatches.create(vectorStoreID, { ...params }) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.retrieve(batchID, { ...params }) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.cancel(batchID, { ...params }) -> VectorStoreFileBatch -- client.beta.vectorStores.fileBatches.listFiles(batchID, { ...params }) -> VectorStoreFilesPage -- client.beta.vectorStores.fileBatches.createAndPoll(vectorStoreId, body, options?) -> Promise<VectorStoreFileBatch> -- client.beta.vectorStores.fileBatches.poll(vectorStoreId, batchId, options?) -> Promise<VectorStoreFileBatch> -- client.beta.vectorStores.fileBatches.uploadAndPoll(vectorStoreId, { files, fileIds = [] }, options?) -> Promise<VectorStoreFileBatch> - -## Chat - -### Completions - -Methods: - -- client.beta.chat.completions.runFunctions(body, options?) -> ChatCompletionRunner | ChatCompletionStreamingRunner -- client.beta.chat.completions.runTools(body, options?) -> ChatCompletionRunner | ChatCompletionStreamingRunner -- client.beta.chat.completions.stream(body, options?) -> ChatCompletionStream - ## Assistants Types: @@ -525,3 +525,93 @@ Types: Methods: - client.uploads.parts.create(uploadID, { ...params }) -> UploadPart + +# Responses + +Types: + +- ComputerTool +- EasyInputMessage +- FileSearchTool +- FunctionTool +- Response +- ResponseAudioDeltaEvent +- ResponseAudioDoneEvent +- ResponseAudioTranscriptDeltaEvent +- ResponseAudioTranscriptDoneEvent +- ResponseCodeInterpreterCallCodeDeltaEvent +- ResponseCodeInterpreterCallCodeDoneEvent +- ResponseCodeInterpreterCallCompletedEvent +- ResponseCodeInterpreterCallInProgressEvent +- ResponseCodeInterpreterCallInterpretingEvent +- ResponseCodeInterpreterToolCall +- ResponseCompletedEvent +- ResponseComputerToolCall +- ResponseContent +- ResponseContentPartAddedEvent +- ResponseContentPartDoneEvent +- ResponseCreatedEvent +- ResponseError +- ResponseErrorEvent +- ResponseFailedEvent +- ResponseFileSearchCallCompletedEvent +- ResponseFileSearchCallInProgressEvent +- ResponseFileSearchCallSearchingEvent +- ResponseFileSearchToolCall +- ResponseFormatTextConfig +- ResponseFormatTextJSONSchemaConfig +- ResponseFunctionCallArgumentsDeltaEvent +- ResponseFunctionCallArgumentsDoneEvent +- ResponseFunctionToolCall +- ResponseFunctionWebSearch +- ResponseInProgressEvent +- ResponseIncludable +- ResponseIncompleteEvent +- ResponseInput +- ResponseInputAudio +- ResponseInputContent +- ResponseInputFile +- ResponseInputImage +- ResponseInputItem +- ResponseInputMessageContentList +- ResponseInputText +- ResponseOutputAudio +- ResponseOutputItem +- ResponseOutputItemAddedEvent +- ResponseOutputItemDoneEvent +- ResponseOutputMessage +- ResponseOutputRefusal +- ResponseOutputText +- ResponseRefusalDeltaEvent +- ResponseRefusalDoneEvent +- ResponseStatus +- ResponseStreamEvent +- ResponseTextAnnotationDeltaEvent +- ResponseTextConfig +- ResponseTextDeltaEvent +- ResponseTextDoneEvent +- ResponseUsage +- ResponseWebSearchCallCompletedEvent +- ResponseWebSearchCallInProgressEvent +- ResponseWebSearchCallSearchingEvent +- Tool +- ToolChoiceFunction +- ToolChoiceOptions +- ToolChoiceTypes +- WebSearchTool + +Methods: + +- client.responses.create({ ...params }) -> Response +- client.responses.retrieve(responseID, { ...params }) -> Response +- client.responses.delete(responseID) -> void + +## InputItems + +Types: + +- ResponseItemList + +Methods: + +- client.responses.inputItems.list(responseID, { ...params }) -> ResponseItemListDataPage diff --git a/src/client.ts b/src/client.ts index 165a97484..d7d77fc06 100644 --- a/src/client.ts +++ b/src/client.ts @@ -84,12 +84,32 @@ import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio' import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { Responses } from './resources/responses/responses'; import { Upload, UploadCompleteParams, UploadCreateParams, Uploads as UploadsAPIUploads, } from './resources/uploads/uploads'; +import { + AutoFileChunkingStrategyParam, + FileChunkingStrategy, + FileChunkingStrategyParam, + OtherFileChunkingStrategyObject, + StaticFileChunkingStrategy, + StaticFileChunkingStrategyObject, + StaticFileChunkingStrategyObjectParam, + VectorStore, + VectorStoreCreateParams, + VectorStoreDeleted, + VectorStoreListParams, + VectorStoreSearchParams, + VectorStoreSearchResponse, + VectorStoreSearchResponsesPage, + VectorStoreUpdateParams, + VectorStores, + VectorStoresPage, +} from './resources/vector-stores/vector-stores'; import { ChatCompletion, ChatCompletionAssistantMessageParam, @@ -115,7 +135,6 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, - ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStoreMessage, ChatCompletionStreamOptions, @@ -873,9 +892,11 @@ export class OpenAI { moderations: API.Moderations = new API.Moderations(this); models: API.Models = new API.Models(this); fineTuning: API.FineTuning = new API.FineTuning(this); + vectorStores: API.VectorStores = new API.VectorStores(this); beta: API.Beta = new API.Beta(this); batches: API.Batches = new API.Batches(this); uploads: API.Uploads = new API.Uploads(this); + responses: API.Responses = new API.Responses(this); } OpenAI.Completions = Completions; OpenAI.Chat = Chat; @@ -886,9 +907,11 @@ OpenAI.Audio = Audio; OpenAI.Moderations = Moderations; OpenAI.Models = Models; OpenAI.FineTuning = FineTuning; +OpenAI.VectorStores = VectorStores; OpenAI.Beta = Beta; OpenAI.Batches = Batches; OpenAI.Uploads = UploadsAPIUploads; +OpenAI.Responses = Responses; export declare namespace OpenAI { export type RequestOptions = Opts.RequestOptions; @@ -930,7 +953,6 @@ export declare namespace OpenAI { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -999,6 +1021,26 @@ export declare namespace OpenAI { export { FineTuning as FineTuning }; + export { + VectorStores as VectorStores, + type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, + type FileChunkingStrategy as FileChunkingStrategy, + type FileChunkingStrategyParam as FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy as StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, + type VectorStore as VectorStore, + type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreSearchResponse as VectorStoreSearchResponse, + type VectorStoresPage as VectorStoresPage, + type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, + type VectorStoreCreateParams as VectorStoreCreateParams, + type VectorStoreUpdateParams as VectorStoreUpdateParams, + type VectorStoreListParams as VectorStoreListParams, + type VectorStoreSearchParams as VectorStoreSearchParams, + }; + export { Beta as Beta }; export { @@ -1018,11 +1060,17 @@ export declare namespace OpenAI { type UploadCompleteParams as UploadCompleteParams, }; + export { Responses as Responses }; + export type ChatModel = API.ChatModel; + export type ComparisonFilter = API.ComparisonFilter; + export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; + export type Reasoning = API.Reasoning; + export type ReasoningEffort = API.ReasoningEffort; export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; export type ResponseFormatText = API.ResponseFormatText; diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0a32be46d..3753ee9c8 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -4,7 +4,6 @@ import { APIResource } from '../../resource'; import * as Shared from '../shared'; import * as MessagesAPI from './threads/messages'; import * as ThreadsAPI from './threads/threads'; -import * as VectorStoresAPI from './vector-stores/vector-stores'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; import { APIPromise } from '../../api-promise'; @@ -1123,14 +1122,14 @@ export interface AssistantCreateParams { name?: string | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Specifies the format that the model must output. Compatible with @@ -1233,9 +1232,9 @@ export namespace AssistantCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -1254,6 +1253,45 @@ export namespace AssistantCreateParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } @@ -1326,14 +1364,14 @@ export interface AssistantUpdateParams { name?: string | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Specifies the format that the model must output. Compatible with diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index beab540c5..f279bc835 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -40,59 +40,23 @@ import { ThreadUpdateParams, Threads, } from './threads/threads'; -import * as VectorStoresAPI from './vector-stores/vector-stores'; -import { - AutoFileChunkingStrategyParam, - FileChunkingStrategy, - FileChunkingStrategyParam, - OtherFileChunkingStrategyObject, - StaticFileChunkingStrategy, - StaticFileChunkingStrategyObject, - StaticFileChunkingStrategyObjectParam, - VectorStore, - VectorStoreCreateParams, - VectorStoreDeleted, - VectorStoreListParams, - VectorStoreUpdateParams, - VectorStores, - VectorStoresPage, -} from './vector-stores/vector-stores'; import { Chat } from './chat/chat'; export class Beta extends APIResource { realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client); - vectorStores: VectorStoresAPI.VectorStores = new VectorStoresAPI.VectorStores(this._client); chat: ChatAPI.Chat = new ChatAPI.Chat(this._client); assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client); threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } Beta.Realtime = Realtime; -Beta.VectorStores = VectorStores; Beta.Assistants = Assistants; Beta.Threads = Threads; export declare namespace Beta { export { Realtime as Realtime }; - export { - VectorStores as VectorStores, - type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, - type FileChunkingStrategy as FileChunkingStrategy, - type FileChunkingStrategyParam as FileChunkingStrategyParam, - type OtherFileChunkingStrategyObject as OtherFileChunkingStrategyObject, - type StaticFileChunkingStrategy as StaticFileChunkingStrategy, - type StaticFileChunkingStrategyObject as StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, - type VectorStore as VectorStore, - type VectorStoreDeleted as VectorStoreDeleted, - type VectorStoresPage as VectorStoresPage, - type VectorStoreCreateParams as VectorStoreCreateParams, - type VectorStoreUpdateParams as VectorStoreUpdateParams, - type VectorStoreListParams as VectorStoreListParams, - }; - - export { Chat }; + export { Chat as Chat }; export { Assistants as Assistants, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index cedb1791a..18746c1d4 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -37,19 +37,3 @@ export { type ThreadCreateAndRunPollParams, type ThreadCreateAndRunStreamParams, } from './threads/index'; -export { - VectorStores, - type AutoFileChunkingStrategyParam, - type FileChunkingStrategy, - type FileChunkingStrategyParam, - type OtherFileChunkingStrategyObject, - type StaticFileChunkingStrategy, - type StaticFileChunkingStrategyObject, - type StaticFileChunkingStrategyObjectParam, - type VectorStore, - type VectorStoreDeleted, - type VectorStoreCreateParams, - type VectorStoreUpdateParams, - type VectorStoreListParams, - type VectorStoresPage, -} from './vector-stores/index'; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 4a75b5466..401b3ec59 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -708,14 +708,14 @@ export interface RunCreateParamsBase { parallel_tool_calls?: boolean; /** - * Body param: **o1 and o3-mini models only** + * Body param: **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: 'low' | 'medium' | 'high' | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * Body param: Specifies the format that the model must output. Compatible with diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 036ed680e..22ccd7f02 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -42,7 +42,6 @@ import { TextDelta, TextDeltaBlock, } from './messages'; -import * as VectorStoresAPI from '../vector-stores/vector-stores'; import * as RunsAPI from './runs/runs'; import { RequiredActionFunctionToolCall, @@ -431,9 +430,9 @@ export namespace ThreadCreateParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -452,6 +451,45 @@ export namespace ThreadCreateParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } @@ -790,9 +828,9 @@ export namespace ThreadCreateAndRunParams { export interface VectorStore { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` - * strategy. Only applicable if `file_ids` is non-empty. + * strategy. */ - chunking_strategy?: VectorStoresAPI.FileChunkingStrategyParam; + chunking_strategy?: VectorStore.Auto | VectorStore.Static; /** * A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to @@ -811,6 +849,45 @@ export namespace ThreadCreateAndRunParams { */ metadata?: Shared.Metadata | null; } + + export namespace VectorStore { + /** + * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of + * `800` and `chunk_overlap_tokens` of `400`. + */ + export interface Auto { + /** + * Always `auto`. + */ + type: 'auto'; + } + + export interface Static { + static: Static.Static; + + /** + * Always `static`. + */ + type: 'static'; + } + + export namespace Static { + export interface Static { + /** + * The number of tokens that overlap between chunks. The default value is `400`. + * + * Note that the overlap must not exceed half of `max_chunk_size_tokens`. + */ + chunk_overlap_tokens: number; + + /** + * The maximum number of tokens in each chunk. The default value is `800`. The + * minimum value is `100` and the maximum value is `4096`. + */ + max_chunk_size_tokens: number; + } + } + } } } } diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 51a3606fd..19ddd9c2e 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -76,7 +76,6 @@ export declare namespace Chat { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -86,6 +85,7 @@ export declare namespace Chat { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 5a9e497a1..8204e2a8b 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -16,6 +16,13 @@ export class Completions extends APIResource { messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); /** + * **Starting a new project?** We recommend trying + * [Responses](https://platform.openai.com/docs/api-reference/responses) to take + * advantage of the latest OpenAI platform features. Compare + * [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses). + * + * --- + * * Creates a model response for the given chat conversation. Learn more in the * [text generation](https://platform.openai.com/docs/guides/text-generation), * [vision](https://platform.openai.com/docs/guides/vision), and @@ -46,7 +53,7 @@ export class Completions extends APIResource { } /** - * Get a stored chat completion. Only chat completions that have been created with + * Get a stored chat completion. Only Chat Completions that have been created with * the `store` parameter set to `true` will be returned. */ retrieve(completionID: string, options?: RequestOptions): APIPromise { @@ -54,7 +61,7 @@ export class Completions extends APIResource { } /** - * Modify a stored chat completion. Only chat completions that have been created + * Modify a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be modified. Currently, the only * supported modification is to update the `metadata` field. */ @@ -67,7 +74,7 @@ export class Completions extends APIResource { } /** - * List stored chat completions. Only chat completions that have been stored with + * List stored Chat Completions. Only Chat Completions that have been stored with * the `store` parameter set to `true` will be returned. */ list( @@ -78,7 +85,7 @@ export class Completions extends APIResource { } /** - * Delete a stored chat completion. Only chat completions that have been created + * Delete a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be deleted. */ delete(completionID: string, options?: RequestOptions): APIPromise { @@ -304,16 +311,16 @@ export interface ChatCompletionAudioParam { format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** - * The voice the model uses to respond. Supported voices are `ash`, `ballad`, - * `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, - * `echo`, and `shimmer`; these voices are less expressive). + * The voice the model uses to respond. Supported voices are `alloy`, `ash`, + * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. */ voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; } /** - * Represents a streamed chunk of a chat completion response returned by model, + * Represents a streamed chunk of a chat completion response returned by the model, * based on the provided input. + * [Learn more](https://platform.openai.com/docs/guides/streaming-responses). */ export interface ChatCompletionChunk { /** @@ -500,7 +507,43 @@ export namespace ChatCompletionChunk { export type ChatCompletionContentPart = | ChatCompletionContentPartText | ChatCompletionContentPartImage - | ChatCompletionContentPartInputAudio; + | ChatCompletionContentPartInputAudio + | ChatCompletionContentPart.File; + +export namespace ChatCompletionContentPart { + /** + * Learn about [file inputs](https://platform.openai.com/docs/guides/text) for text + * generation. + */ + export interface File { + file: File.File; + + /** + * The type of the content part. Always `file`. + */ + type: 'file'; + } + + export namespace File { + export interface File { + /** + * The base64 encoded file data, used when passing the file to the model as a + * string. + */ + file_data?: string; + + /** + * The ID of an uploaded file to use as input. + */ + file_id?: string; + + /** + * The name of the file, used when passing the file to the model as a string. + */ + file_name?: string; + } + } +} /** * Learn about [image inputs](https://platform.openai.com/docs/guides/vision). @@ -673,6 +716,12 @@ export interface ChatCompletionMessage { */ role: 'assistant'; + /** + * Annotations for the message, when applicable, as when using the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + annotations?: Array; + /** * If the audio output modality is requested, this object contains data about the * audio response from the model. @@ -693,6 +742,48 @@ export interface ChatCompletionMessage { } export namespace ChatCompletionMessage { + /** + * A URL citation when using web search. + */ + export interface Annotation { + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * A URL citation when using web search. + */ + url_citation: Annotation.URLCitation; + } + + export namespace Annotation { + /** + * A URL citation when using web search. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The URL of the web resource. + */ + url: string; + } + } + /** * @deprecated Deprecated and replaced by `tool_calls`. The name and arguments of a * function that should be called, as generated by the model. @@ -806,16 +897,6 @@ export interface ChatCompletionPredictionContent { type: 'content'; } -/** - * **o1 and o3-mini models only** - * - * Constrains effort on reasoning for - * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently - * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can - * result in faster responses and fewer tokens used on reasoning in a response. - */ -export type ChatCompletionReasoningEffort = 'low' | 'medium' | 'high' | null; - /** * The role of the author of a message */ @@ -981,6 +1062,8 @@ export interface ChatCompletionUserMessageParam { name?: string; } +export type ChatCompletionReasoningEffort = Shared.ReasoningEffort | null; + export type ChatCompletionCreateParams = | ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming; @@ -997,9 +1080,11 @@ export interface ChatCompletionCreateParamsBase { messages: Array; /** - * ID of the model to use. See the - * [model endpoint compatibility](https://platform.openai.com/docs/models#model-endpoint-compatibility) - * table for details on which models work with the Chat API. + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. */ model: (string & {}) | Shared.ChatModel; @@ -1090,8 +1175,8 @@ export interface ChatCompletionCreateParamsBase { metadata?: Shared.Metadata | null; /** - * Output types that you would like the model to generate for this request. Most - * models are capable of generating text, which is the default: + * Output types that you would like the model to generate. Most models are capable + * of generating text, which is the default: * * `["text"]` * @@ -1101,7 +1186,7 @@ export interface ChatCompletionCreateParamsBase { * * `["text", "audio"]` */ - modalities?: Array | null; + modalities?: Array<'text' | 'audio'> | null; /** * How many chat completion choices to generate for each input message. Note that @@ -1131,14 +1216,14 @@ export interface ChatCompletionCreateParamsBase { presence_penalty?: number | null; /** - * **o1 and o3-mini models only** + * **o-series models only** * * Constrains effort on reasoning for * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - reasoning_effort?: ChatCompletionReasoningEffort | null; + reasoning_effort?: Shared.ReasoningEffort | null; /** * An object specifying the format that the model must output. @@ -1148,21 +1233,14 @@ export interface ChatCompletionCreateParamsBase { * in the * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). * - * Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the - * message the model generates is valid JSON. - * - * **Important:** when using JSON mode, you **must** also instruct the model to - * produce JSON yourself via a system or user message. Without this, the model may - * generate an unending stream of whitespace until the generation reaches the token - * limit, resulting in a long-running and seemingly "stuck" request. Also note that - * the message content may be partially cut off if `finish_reason="length"`, which - * indicates the generation exceeded `max_tokens` or the conversation exceeded the - * max context length. + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. */ response_format?: | Shared.ResponseFormatText - | Shared.ResponseFormatJSONObject - | Shared.ResponseFormatJSONSchema; + | Shared.ResponseFormatJSONSchema + | Shared.ResponseFormatJSONObject; /** * This feature is in Beta. If specified, our system will make a best effort to @@ -1181,15 +1259,19 @@ 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 guarantee. + * latency guarentee. * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarantee. + * tier with a lower uptime SLA and no latency guarentee. * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ service_tier?: 'auto' | 'default' | null; /** - * Up to 4 sequences where the API will stop generating further tokens. + * Up to 4 sequences where the API will stop generating further tokens. The + * returned text will not contain the stop sequence. */ stop?: string | null | Array; @@ -1201,12 +1283,14 @@ export interface ChatCompletionCreateParamsBase { store?: boolean | null; /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream?: boolean | null; @@ -1265,6 +1349,13 @@ export interface ChatCompletionCreateParamsBase { * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; + + /** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + web_search_options?: ChatCompletionCreateParams.WebSearchOptions; } export namespace ChatCompletionCreateParams { @@ -1296,6 +1387,70 @@ export namespace ChatCompletionCreateParams { parameters?: Shared.FunctionParameters; } + /** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search?api-mode=chat). + */ + export interface WebSearchOptions { + /** + * 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. + */ + search_context_size?: 'low' | 'medium' | 'high'; + + /** + * Approximate location parameters for the search. + */ + user_location?: WebSearchOptions.UserLocation | null; + } + + export namespace WebSearchOptions { + /** + * Approximate location parameters for the search. + */ + export interface UserLocation { + /** + * Approximate location parameters for the search. + */ + approximate: UserLocation.Approximate; + + /** + * The type of location approximation. Always `approximate`. + */ + type: 'approximate'; + } + + export namespace UserLocation { + /** + * Approximate location parameters for the search. + */ + export interface Approximate { + /** + * Free text input for the city of the user, e.g. `San Francisco`. + */ + city?: string; + + /** + * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of + * the user, e.g. `US`. + */ + country?: string; + + /** + * Free text input for the region of the user, e.g. `California`. + */ + region?: string; + + /** + * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the + * user, e.g. `America/Los_Angeles`. + */ + timezone?: string; + } + } + } + export type ChatCompletionCreateParamsNonStreaming = CompletionsCompletionsAPI.ChatCompletionCreateParamsNonStreaming; export type ChatCompletionCreateParamsStreaming = @@ -1304,24 +1459,28 @@ export namespace ChatCompletionCreateParams { export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase { /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream?: false | null; } export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase { /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be - * sent as data-only - * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) - * as they become available, with the stream terminated by a `data: [DONE]` - * message. - * [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/chat/streaming) + * for more information, along with the + * [streaming responses](https://platform.openai.com/docs/guides/streaming-responses) + * guide for more information on how to handle the streaming events. */ stream: true; } @@ -1340,19 +1499,19 @@ export interface ChatCompletionUpdateParams { export interface ChatCompletionListParams extends CursorPageParams { /** - * A list of metadata keys to filter the chat completions by. Example: + * A list of metadata keys to filter the Chat Completions by. Example: * * `metadata[key1]=value1&metadata[key2]=value2` */ metadata?: Shared.Metadata | null; /** - * The model used to generate the chat completions. + * The model used to generate the Chat Completions. */ model?: string; /** - * Sort order for chat completions by timestamp. Use `asc` for ascending order or + * Sort order for Chat Completions by timestamp. Use `asc` for ascending order or * `desc` for descending order. Defaults to `asc`. */ order?: 'asc' | 'desc'; @@ -1382,7 +1541,6 @@ export declare namespace Completions { type ChatCompletionModality as ChatCompletionModality, type ChatCompletionNamedToolChoice as ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent as ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionRole as ChatCompletionRole, type ChatCompletionStoreMessage as ChatCompletionStoreMessage, type ChatCompletionStreamOptions as ChatCompletionStreamOptions, @@ -1392,6 +1550,7 @@ export declare namespace Completions { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, diff --git a/src/resources/chat/completions/index.ts b/src/resources/chat/completions/index.ts index 6a3fdec83..32d0eb408 100644 --- a/src/resources/chat/completions/index.ts +++ b/src/resources/chat/completions/index.ts @@ -22,7 +22,6 @@ export { type ChatCompletionModality, type ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort, type ChatCompletionRole, type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index f00acbdfc..82478a8ab 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -9,7 +9,7 @@ import { path } from '../../../internal/utils/path'; export class Messages extends APIResource { /** - * Get the messages in a stored chat completion. Only chat completions that have + * Get the messages in a stored chat completion. Only Chat Completions that have * been created with the `store` parameter set to `true` will be returned. */ list( diff --git a/src/resources/chat/index.ts b/src/resources/chat/index.ts index 8eb8cbed6..3e997dd86 100644 --- a/src/resources/chat/index.ts +++ b/src/resources/chat/index.ts @@ -23,7 +23,6 @@ export { type ChatCompletionModality, type ChatCompletionNamedToolChoice, type ChatCompletionPredictionContent, - type ChatCompletionReasoningEffort, type ChatCompletionRole, type ChatCompletionStoreMessage, type ChatCompletionStreamOptions, diff --git a/src/resources/files.ts b/src/resources/files.ts index 56bafc224..3183b87f8 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -175,16 +175,12 @@ export interface FileObject { } /** - * The intended purpose of the uploaded file. - * - * Use "assistants" for - * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and - * [Message](https://platform.openai.com/docs/api-reference/messages) files, - * "vision" for Assistants image file inputs, "batch" for - * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for - * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning). + * The intended purpose of the uploaded file. One of: - `assistants`: Used in the + * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for + * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: + * Flexible file type for any purpose - `evals`: Used for eval data sets */ -export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision'; +export type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision' | 'user_data' | 'evals'; export interface FileCreateParams { /** @@ -193,14 +189,10 @@ export interface FileCreateParams { file: Uploadable; /** - * The intended purpose of the uploaded file. - * - * Use "assistants" for - * [Assistants](https://platform.openai.com/docs/api-reference/assistants) and - * [Message](https://platform.openai.com/docs/api-reference/messages) files, - * "vision" for Assistants image file inputs, "batch" for - * [Batch API](https://platform.openai.com/docs/guides/batch), and "fine-tune" for - * [Fine-tuning](https://platform.openai.com/docs/api-reference/fine-tuning). + * The intended purpose of the uploaded file. One of: - `assistants`: Used in the + * Assistants API - `batch`: Used in the Batch API - `fine-tune`: Used for + * fine-tuning - `vision`: Images used for vision fine-tuning - `user_data`: + * Flexible file type for any purpose - `evals`: Used for eval data sets */ purpose: FilePurpose; } diff --git a/src/resources/index.ts b/src/resources/index.ts index c1d06d8ce..99a703037 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -60,4 +60,24 @@ export { type ModerationCreateResponse, type ModerationCreateParams, } from './moderations'; +export { Responses } from './responses/responses'; export { Uploads, type Upload, type UploadCreateParams, type UploadCompleteParams } from './uploads/uploads'; +export { + VectorStores, + type AutoFileChunkingStrategyParam, + type FileChunkingStrategy, + type FileChunkingStrategyParam, + type OtherFileChunkingStrategyObject, + type StaticFileChunkingStrategy, + type StaticFileChunkingStrategyObject, + type StaticFileChunkingStrategyObjectParam, + type VectorStore, + type VectorStoreDeleted, + type VectorStoreSearchResponse, + type VectorStoreCreateParams, + type VectorStoreUpdateParams, + type VectorStoreListParams, + type VectorStoreSearchParams, + type VectorStoresPage, + type VectorStoreSearchResponsesPage, +} from './vector-stores/vector-stores'; diff --git a/src/resources/responses/index.ts b/src/resources/responses/index.ts new file mode 100644 index 000000000..164665eb2 --- /dev/null +++ b/src/resources/responses/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + InputItems, + type ResponseItemList, + type InputItemListParams, + type ResponseItemListDataPage, +} from './input-items'; +export { Responses } from './responses'; diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts new file mode 100644 index 000000000..b38d1be95 --- /dev/null +++ b/src/resources/responses/input-items.ts @@ -0,0 +1,252 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as ResponsesAPI from './responses'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class InputItems extends APIResource { + /** + * Returns a list of input items for a given response. + */ + list( + responseID: string, + query: InputItemListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise< + ResponseItemListDataPage, + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + > { + return this._client.getAPIList( + path`/responses/${responseID}/input_items`, + CursorPage< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + >, + { query, ...options }, + ); + } +} + +export type ResponseItemListDataPage = CursorPage< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput +>; + +/** + * A list of Response items. + */ +export interface ResponseItemList { + /** + * A list of items used to generate this response. + */ + data: Array< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput + >; + + /** + * The ID of the first item in the list. + */ + first_id: string; + + /** + * Whether there are more items available. + */ + has_more: boolean; + + /** + * The ID of the last item in the list. + */ + last_id: string; + + /** + * The type of object returned, must be `list`. + */ + object: 'list'; +} + +export namespace ResponseItemList { + export interface Message { + /** + * The unique ID of the message input. + */ + id: string; + + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponsesAPI.ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; + } + + export interface ComputerCallOutput { + /** + * The unique ID of the computer call tool output. + */ + id: string; + + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ComputerCallOutput.Output; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace ComputerCallOutput { + /** + * A computer screenshot image used with the computer use tool. + */ + export interface Output { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; + } + + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } + } + + export interface FunctionCallOutput { + /** + * The unique ID of the function call tool output. + */ + id: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } +} + +export interface InputItemListParams extends CursorPageParams { + /** + * An item ID to list items before, used in pagination. + */ + before?: string; + + /** + * The order to return the input items in. Default is `asc`. + * + * - `asc`: Return the input items in ascending order. + * - `desc`: Return the input items in descending order. + */ + order?: 'asc' | 'desc'; +} + +export declare namespace InputItems { + export { + type ResponseItemList as ResponseItemList, + type ResponseItemListDataPage as ResponseItemListDataPage, + type InputItemListParams as InputItemListParams, + }; +} diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts new file mode 100644 index 000000000..1186cab6b --- /dev/null +++ b/src/resources/responses/responses.ts @@ -0,0 +1,2688 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as ResponsesAPI from './responses'; +import * as Shared from '../shared'; +import * as InputItemsAPI from './input-items'; +import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items'; +import { APIPromise } from '../../api-promise'; +import { Stream } from '../../streaming'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class Responses extends APIResource { + inputItems: InputItemsAPI.InputItems = new InputItemsAPI.InputItems(this._client); + + /** + * Creates a model response. Provide + * [text](https://platform.openai.com/docs/guides/text) or + * [image](https://platform.openai.com/docs/guides/images) inputs to generate + * [text](https://platform.openai.com/docs/guides/text) or + * [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have + * the model call your own + * [custom code](https://platform.openai.com/docs/guides/function-calling) or use + * built-in [tools](https://platform.openai.com/docs/guides/tools) like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search) to use + * your own data as input for the model's response. + */ + create(body: ResponseCreateParamsNonStreaming, options?: RequestOptions): APIPromise; + create( + body: ResponseCreateParamsStreaming, + options?: RequestOptions, + ): APIPromise>; + create( + body: ResponseCreateParamsBase, + options?: RequestOptions, + ): APIPromise | Response>; + create( + body: ResponseCreateParams, + options?: RequestOptions, + ): APIPromise | APIPromise> { + return this._client.post('/responses', { body, ...options, stream: body.stream ?? false }) as + | APIPromise + | APIPromise>; + } + + /** + * Retrieves a model response with the given ID. + */ + retrieve( + responseID: string, + query: ResponseRetrieveParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/responses/${responseID}`, { query, ...options }); + } + + /** + * Deletes a model response with the given ID. + */ + delete(responseID: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/responses/${responseID}`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +/** + * A tool that controls a virtual computer. Learn more about the + * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). + */ +export interface ComputerTool { + /** + * The height of the computer display. + */ + display_height: number; + + /** + * The width of the computer display. + */ + display_width: number; + + /** + * The type of computer environment to control. + */ + environment: 'mac' | 'windows' | 'ubuntu' | 'browser'; + + /** + * The type of the computer use tool. Always `computer_use_preview`. + */ + type: 'computer-preview'; +} + +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export interface EasyInputMessage { + /** + * Text, image, or audio input to the model, used to generate a response. Can also + * contain previous assistant responses. + */ + content: string | ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; +} + +/** + * A tool that searches for relevant content from uploaded files. Learn more about + * the + * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + */ +export interface FileSearchTool { + /** + * The type of the file search tool. Always `file_search`. + */ + type: 'file_search'; + + /** + * The IDs of the vector stores to search. + */ + vector_store_ids: Array; + + /** + * A filter to apply based on file attributes. + */ + filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + + /** + * The maximum number of results to return. This number should be between 1 and 50 + * inclusive. + */ + max_num_results?: number; + + /** + * Ranking options for search. + */ + ranking_options?: FileSearchTool.RankingOptions; +} + +export namespace FileSearchTool { + /** + * Ranking options for search. + */ + export interface RankingOptions { + /** + * The ranker to use for the file search. + */ + ranker?: 'auto' | 'default-2024-11-15'; + + /** + * The score threshold for the file search, a number between 0 and 1. Numbers + * closer to 1 will attempt to return only the most relevant results, but may + * return fewer results. + */ + score_threshold?: number; + } +} + +/** + * Defines a function in your own code the model can choose to call. Learn more + * about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ +export interface FunctionTool { + /** + * The name of the function to call. + */ + name: string; + + /** + * A JSON schema object describing the parameters of the function. + */ + parameters: Record; + + /** + * Whether to enforce strict parameter validation. Default `true`. + */ + strict: boolean; + + /** + * The type of the function tool. Always `function`. + */ + type: 'function'; + + /** + * A description of the function. Used by the model to determine whether or not to + * call the function. + */ + description?: string | null; +} + +export interface Response { + /** + * Unique identifier for this Response. + */ + id: string; + + /** + * Unix timestamp (in seconds) of when this Response was created. + */ + created_at: number; + + /** + * An error object returned when the model fails to generate a Response. + */ + error: ResponseError | null; + + /** + * Details about why the response is incomplete. + */ + incomplete_details: Response.IncompleteDetails | null; + + /** + * Inserts a system (or developer) message as the first item in the model's + * context. + * + * When using along with `previous_response_id`, the instructions from a previous + * response will be not be carried over to the next response. This makes it simple + * to swap out system (or developer) messages in new responses. + */ + instructions: string | null; + + /** + * 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; + + /** + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. + */ + model: (string & {}) | Shared.ChatModel; + + /** + * The object type of this resource - always set to `response`. + */ + object: 'response'; + + /** + * An array of content items generated by the model. + * + * - The length and order of items in the `output` array is dependent on the + * model's response. + * - Rather than accessing the first item in the `output` array and assuming it's + * an `assistant` message with the content generated by the model, you might + * consider using the `output_text` property where supported in SDKs. + */ + output: Array; + + /** + * Whether to allow the model to run tool calls in parallel. + */ + parallel_tool_calls: boolean; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will + * make the output more random, while lower values like 0.2 will make it more + * focused and deterministic. We generally recommend altering this or `top_p` but + * not both. + */ + temperature: number | null; + + /** + * How the model should select which tool (or tools) to use when generating a + * response. See the `tools` parameter to see how to specify which tools the model + * can call. + */ + tool_choice: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools: Array; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the + * model considers the results of the tokens with top_p probability mass. So 0.1 + * means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p: number | null; + + /** + * An upper bound for the number of tokens that can be generated for a response, + * including visible output tokens and + * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). + */ + max_output_tokens?: number | null; + + /** + * The unique ID of the previous response to the model. Use this to create + * multi-turn conversations. Learn more about + * [conversation state](https://platform.openai.com/docs/guides/conversation-state). + */ + previous_response_id?: string | null; + + /** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ + reasoning?: Shared.Reasoning | null; + + /** + * The status of the response generation. One of `completed`, `failed`, + * `in_progress`, or `incomplete`. + */ + status?: ResponseStatus; + + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: ResponseTextConfig; + + /** + * The truncation strategy to use for the model response. + * + * - `auto`: If the context of this response and previous ones exceeds the model's + * context window size, the model will truncate the response to fit the context + * window by dropping input items in the middle of the conversation. + * - `disabled` (default): If a model response will exceed the context window size + * for a model, the request will fail with a 400 error. + */ + truncation?: 'auto' | 'disabled' | null; + + /** + * Represents token usage details including input tokens, output tokens, a + * breakdown of output tokens, and the total tokens used. + */ + usage?: ResponseUsage; + + /** + * A unique identifier representing your end-user, which can help OpenAI to monitor + * and detect abuse. + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). + */ + user?: string; +} + +export namespace Response { + /** + * Details about why the response is incomplete. + */ + export interface IncompleteDetails { + /** + * The reason why the response is incomplete. + */ + reason?: 'max_output_tokens' | 'content_filter'; + } +} + +/** + * Emitted when there is a partial audio response. + */ +export interface ResponseAudioDeltaEvent { + /** + * A chunk of Base64 encoded response audio bytes. + */ + delta: string; + + /** + * The type of the event. Always `response.audio.delta`. + */ + type: 'response.audio.delta'; +} + +/** + * Emitted when the audio response is complete. + */ +export interface ResponseAudioDoneEvent { + /** + * The type of the event. Always `response.audio.done`. + */ + type: 'response.audio.done'; +} + +/** + * Emitted when there is a partial transcript of audio. + */ +export interface ResponseAudioTranscriptDeltaEvent { + /** + * The partial transcript of the audio response. + */ + delta: string; + + /** + * The type of the event. Always `response.audio.transcript.delta`. + */ + type: 'response.audio.transcript.delta'; +} + +/** + * Emitted when the full audio transcript is completed. + */ +export interface ResponseAudioTranscriptDoneEvent { + /** + * The type of the event. Always `response.audio.transcript.done`. + */ + type: 'response.audio.transcript.done'; +} + +/** + * Emitted when a partial code snippet is added by the code interpreter. + */ +export interface ResponseCodeInterpreterCallCodeDeltaEvent { + /** + * The partial code snippet added by the code interpreter. + */ + delta: string; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.code.delta`. + */ + type: 'response.code_interpreter_call.code.delta'; +} + +/** + * Emitted when code snippet output is finalized by the code interpreter. + */ +export interface ResponseCodeInterpreterCallCodeDoneEvent { + /** + * The final code snippet output by the code interpreter. + */ + code: string; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.code.done`. + */ + type: 'response.code_interpreter_call.code.done'; +} + +/** + * Emitted when the code interpreter call is completed. + */ +export interface ResponseCodeInterpreterCallCompletedEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.completed`. + */ + type: 'response.code_interpreter_call.completed'; +} + +/** + * Emitted when a code interpreter call is in progress. + */ +export interface ResponseCodeInterpreterCallInProgressEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.in_progress`. + */ + type: 'response.code_interpreter_call.in_progress'; +} + +/** + * Emitted when the code interpreter is actively interpreting the code snippet. + */ +export interface ResponseCodeInterpreterCallInterpretingEvent { + /** + * A tool call to run code. + */ + code_interpreter_call: ResponseCodeInterpreterToolCall; + + /** + * The index of the output item that the code interpreter call is in progress. + */ + output_index: number; + + /** + * The type of the event. Always `response.code_interpreter_call.interpreting`. + */ + type: 'response.code_interpreter_call.interpreting'; +} + +/** + * A tool call to run code. + */ +export interface ResponseCodeInterpreterToolCall { + /** + * The unique ID of the code interpreter tool call. + */ + id: string; + + /** + * The code to run. + */ + code: string; + + /** + * The results of the code interpreter tool call. + */ + results: Array; + + /** + * The status of the code interpreter tool call. + */ + status: 'in_progress' | 'interpreting' | 'completed'; + + /** + * The type of the code interpreter tool call. Always `code_interpreter_call`. + */ + type: 'code_interpreter_call'; +} + +export namespace ResponseCodeInterpreterToolCall { + /** + * The output of a code interpreter tool call that is text. + */ + export interface Logs { + /** + * The logs of the code interpreter tool call. + */ + logs: string; + + /** + * The type of the code interpreter text output. Always `logs`. + */ + type: 'logs'; + } + + /** + * The output of a code interpreter tool call that is a file. + */ + export interface Files { + files: Array; + + /** + * The type of the code interpreter file output. Always `files`. + */ + type: 'files'; + } + + export namespace Files { + export interface File { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The MIME type of the file. + */ + mime_type: string; + } + } +} + +/** + * Emitted when the model response is complete. + */ +export interface ResponseCompletedEvent { + /** + * Properties of the completed response. + */ + response: Response; + + /** + * The type of the event. Always `response.completed`. + */ + type: 'response.completed'; +} + +/** + * A tool call to a computer use tool. See the + * [computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) + * for more information. + */ +export interface ResponseComputerToolCall { + /** + * The unique ID of the computer call. + */ + 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. + */ + call_id: string; + + /** + * The pending safety checks for the computer call. + */ + pending_safety_checks: Array; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the computer call. Always `computer_call`. + */ + type: 'computer_call'; +} + +export namespace ResponseComputerToolCall { + /** + * 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 set to + * `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 { + /** + * A series of x/y coordinate pairs in the drag path. + */ + 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'; + } + + /** + * 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; + + /** + * Details about the pending safety check. + */ + message: string; + } +} + +/** + * Multi-modal input and output contents. + */ +export type ResponseContent = + | ResponseInputText + | ResponseInputImage + | ResponseInputFile + | ResponseOutputText + | ResponseOutputRefusal; + +/** + * Emitted when a new content part is added. + */ +export interface ResponseContentPartAddedEvent { + /** + * The index of the content part that was added. + */ + content_index: number; + + /** + * The ID of the output item that the content part was added to. + */ + item_id: string; + + /** + * The index of the output item that the content part was added to. + */ + output_index: number; + + /** + * The content part that was added. + */ + part: ResponseOutputText | ResponseOutputRefusal; + + /** + * The type of the event. Always `response.content_part.added`. + */ + type: 'response.content_part.added'; +} + +/** + * Emitted when a content part is done. + */ +export interface ResponseContentPartDoneEvent { + /** + * The index of the content part that is done. + */ + content_index: number; + + /** + * The ID of the output item that the content part was added to. + */ + item_id: string; + + /** + * The index of the output item that the content part was added to. + */ + output_index: number; + + /** + * The content part that is done. + */ + part: ResponseOutputText | ResponseOutputRefusal; + + /** + * The type of the event. Always `response.content_part.done`. + */ + type: 'response.content_part.done'; +} + +/** + * An event that is emitted when a response is created. + */ +export interface ResponseCreatedEvent { + /** + * The response that was created. + */ + response: Response; + + /** + * The type of the event. Always `response.created`. + */ + type: 'response.created'; +} + +/** + * An error object returned when the model fails to generate a Response. + */ +export interface ResponseError { + /** + * The error code for the response. + */ + code: + | 'server_error' + | 'rate_limit_exceeded' + | 'invalid_prompt' + | 'vector_store_timeout' + | 'invalid_image' + | 'invalid_image_format' + | 'invalid_base64_image' + | 'invalid_image_url' + | 'image_too_large' + | 'image_too_small' + | 'image_parse_error' + | 'image_content_policy_violation' + | 'invalid_image_mode' + | 'image_file_too_large' + | 'unsupported_image_media_type' + | 'empty_image_file' + | 'failed_to_download_image' + | 'image_file_not_found'; + + /** + * A human-readable description of the error. + */ + message: string; +} + +/** + * Emitted when an error occurs. + */ +export interface ResponseErrorEvent { + /** + * The error code. + */ + code: string | null; + + /** + * The error message. + */ + message: string; + + /** + * The error parameter. + */ + param: string | null; + + /** + * The type of the event. Always `error`. + */ + type: 'error'; +} + +/** + * An event that is emitted when a response fails. + */ +export interface ResponseFailedEvent { + /** + * The response that failed. + */ + response: Response; + + /** + * The type of the event. Always `response.failed`. + */ + type: 'response.failed'; +} + +/** + * Emitted when a file search call is completed (results found). + */ +export interface ResponseFileSearchCallCompletedEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is initiated. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.completed`. + */ + type: 'response.file_search_call.completed'; +} + +/** + * Emitted when a file search call is initiated. + */ +export interface ResponseFileSearchCallInProgressEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is initiated. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.in_progress`. + */ + type: 'response.file_search_call.in_progress'; +} + +/** + * Emitted when a file search is currently searching. + */ +export interface ResponseFileSearchCallSearchingEvent { + /** + * The ID of the output item that the file search call is initiated. + */ + item_id: string; + + /** + * The index of the output item that the file search call is searching. + */ + output_index: number; + + /** + * The type of the event. Always `response.file_search_call.searching`. + */ + type: 'response.file_search_call.searching'; +} + +/** + * The results of a file search tool call. See the + * [file search guide](https://platform.openai.com/docs/guides/tools-file-search) + * for more information. + */ +export interface ResponseFileSearchToolCall { + /** + * The unique ID of the file search tool call. + */ + id: string; + + /** + * The queries used to search for files. + */ + queries: Array; + + /** + * The status of the file search tool call. One of `in_progress`, `searching`, + * `incomplete` or `failed`, + */ + status: 'in_progress' | 'searching' | 'completed' | 'incomplete' | 'failed'; + + /** + * The type of the file search tool call. Always `file_search_call`. + */ + type: 'file_search_call'; + + /** + * The results of the file search tool call. + */ + results?: Array | null; +} + +export namespace ResponseFileSearchToolCall { + export interface Result { + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + + /** + * The unique ID of the file. + */ + file_id?: string; + + /** + * The name of the file. + */ + filename?: string; + + /** + * The relevance score of the file - a value between 0 and 1. + */ + score?: number; + + /** + * The text that was retrieved from the file. + */ + text?: string; + } +} + +/** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ +export type ResponseFormatTextConfig = + | Shared.ResponseFormatText + | ResponseFormatTextJSONSchemaConfig + | Shared.ResponseFormatJSONObject; + +/** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). + */ +export interface ResponseFormatTextJSONSchemaConfig { + /** + * The schema for the response format, described as a JSON Schema object. Learn how + * to build JSON schemas [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of response format being defined. Always `json_schema`. + */ + type: 'json_schema'; + + /** + * A description of what the response format is for, used by the model to determine + * how to respond in the format. + */ + description?: string; + + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores + * and dashes, with a maximum length of 64. + */ + name?: string; + + /** + * Whether to enable strict schema adherence when generating the output. If set to + * true, the model will always follow the exact schema defined in the `schema` + * field. Only a subset of JSON Schema is supported when `strict` is `true`. To + * learn more, read the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + */ + strict?: boolean | null; +} + +/** + * Emitted when there is a partial function-call arguments delta. + */ +export interface ResponseFunctionCallArgumentsDeltaEvent { + /** + * The function-call arguments delta that is added. + */ + delta: string; + + /** + * The ID of the output item that the function-call arguments delta is added to. + */ + item_id: string; + + /** + * The index of the output item that the function-call arguments delta is added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.function_call_arguments.delta`. + */ + type: 'response.function_call_arguments.delta'; +} + +/** + * Emitted when function-call arguments are finalized. + */ +export interface ResponseFunctionCallArgumentsDoneEvent { + /** + * The function-call arguments. + */ + arguments: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The index of the output item. + */ + output_index: number; + + type: 'response.function_call_arguments.done'; +} + +/** + * A tool call to run a function. See the + * [function calling guide](https://platform.openai.com/docs/guides/function-calling) + * for more information. + */ +export interface ResponseFunctionToolCall { + /** + * The unique ID of the function tool call. + */ + id: string; + + /** + * A JSON string of the arguments to pass to the function. + */ + arguments: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * The name of the function to run. + */ + name: string; + + /** + * The type of the function tool call. Always `function_call`. + */ + type: 'function_call'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +/** + * The results of a web search tool call. See the + * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for + * more information. + */ +export interface ResponseFunctionWebSearch { + /** + * The unique ID of the web search tool call. + */ + id: string; + + /** + * The status of the web search tool call. + */ + status: 'in_progress' | 'searching' | 'completed' | 'failed'; + + /** + * The type of the web search tool call. Always `web_search_call`. + */ + type: 'web_search_call'; +} + +/** + * Emitted when the response is in progress. + */ +export interface ResponseInProgressEvent { + /** + * The response that is in progress. + */ + response: Response; + + /** + * The type of the event. Always `response.in_progress`. + */ + type: 'response.in_progress'; +} + +/** + * Specify additional output data to include in the model response. Currently + * supported values are: + * + * - `file_search_call.results`: Include the search results of the file search tool + * call. + * - `message.input_image.image_url`: Include image urls from the input message. + * - `computer_call_output.output.image_url`: Include image urls from the computer + * call output. + */ +export type ResponseIncludable = + | 'file_search_call.results' + | 'message.input_image.image_url' + | 'computer_call_output.output.image_url'; + +/** + * An event that is emitted when a response finishes as incomplete. + */ +export interface ResponseIncompleteEvent { + /** + * The response that was incomplete. + */ + response: Response; + + /** + * The type of the event. Always `response.incomplete`. + */ + type: 'response.incomplete'; +} + +/** + * A list of one or many input items to the model, containing different content + * types. + */ +export type ResponseInput = Array; + +/** + * An audio input to the model. + */ +export interface ResponseInputAudio { + /** + * Base64-encoded audio data. + */ + data: string; + + /** + * The format of the audio data. Currently supported formats are `mp3` and `wav`. + */ + format: 'mp3' | 'wav'; + + /** + * The type of the input item. Always `input_audio`. + */ + type: 'input_audio'; +} + +/** + * A text input to the model. + */ +export type ResponseInputContent = ResponseInputText | ResponseInputImage | ResponseInputFile; + +/** + * A file input to the model. + */ +export interface ResponseInputFile { + /** + * The type of the input item. Always `input_file`. + */ + type: 'input_file'; + + /** + * The content of the file to be sent to the model. + */ + file_data?: string; + + /** + * The ID of the file to be sent to the model. + */ + file_id?: string; + + /** + * The name of the file to be sent to the model. + */ + filename?: string; +} + +/** + * An image input to the model. Learn about + * [image inputs](https://platform.openai.com/docs/guides/vision). + */ +export interface ResponseInputImage { + /** + * The detail level of the image to be sent to the model. One of `high`, `low`, or + * `auto`. Defaults to `auto`. + */ + detail: 'high' | 'low' | 'auto'; + + /** + * The type of the input item. Always `input_image`. + */ + type: 'input_image'; + + /** + * The ID of the file to be sent to the model. + */ + file_id?: string | null; + + /** + * The URL of the image to be sent to the model. A fully qualified URL or base64 + * encoded image in a data URL. + */ + image_url?: string | null; +} + +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export type ResponseInputItem = + | EasyInputMessage + | ResponseInputItem.Message + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseComputerToolCall + | ResponseInputItem.ComputerCallOutput + | ResponseFunctionWebSearch + | ResponseFunctionToolCall + | ResponseInputItem.FunctionCallOutput + | ResponseInputItem.Reasoning + | ResponseInputItem.ItemReference; + +export namespace ResponseInputItem { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. + */ + export interface Message { + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponsesAPI.ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; + } + + /** + * The output of a computer tool call. + */ + export interface ComputerCallOutput { + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ComputerCallOutput.Output; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The ID of the computer tool call output. + */ + id?: string; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace ComputerCallOutput { + /** + * A computer screenshot image used with the computer use tool. + */ + export interface Output { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; + } + + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } + } + + /** + * The output of a function tool call. + */ + export interface FunctionCallOutput { + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The unique ID of the function tool call output. Populated when this item is + * returned via API. + */ + id?: string; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + /** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ + export interface Reasoning { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + content: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace Reasoning { + export interface Content { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `text`. + */ + type: 'reasoning_summary'; + } + } + + /** + * An internal identifier for an item to reference. + */ + export interface ItemReference { + /** + * The ID of the item to reference. + */ + id: string; + + /** + * The type of item to reference. Always `item_reference`. + */ + type: 'item_reference'; + } +} + +/** + * A list of one or many input items to the model, containing different content + * types. + */ +export type ResponseInputMessageContentList = Array; + +/** + * A text input to the model. + */ +export interface ResponseInputText { + /** + * The text input to the model. + */ + text: string; + + /** + * The type of the input item. Always `input_text`. + */ + type: 'input_text'; +} + +/** + * An audio output from the model. + */ +export interface ResponseOutputAudio { + /** + * Base64-encoded audio data from the model. + */ + data: string; + + /** + * The transcript of the audio data from the model. + */ + transcript: string; + + /** + * The type of the output audio. Always `output_audio`. + */ + type: 'output_audio'; +} + +/** + * An output message from the model. + */ +export type ResponseOutputItem = + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseFunctionToolCall + | ResponseFunctionWebSearch + | ResponseComputerToolCall + | ResponseOutputItem.Reasoning; + +export namespace ResponseOutputItem { + /** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ + export interface Reasoning { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + content: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + } + + export namespace Reasoning { + export interface Content { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `text`. + */ + type: 'reasoning_summary'; + } + } +} + +/** + * Emitted when a new output item is added. + */ +export interface ResponseOutputItemAddedEvent { + /** + * The output item that was added. + */ + item: ResponseOutputItem; + + /** + * The index of the output item that was added. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_item.added`. + */ + type: 'response.output_item.added'; +} + +/** + * Emitted when an output item is marked done. + */ +export interface ResponseOutputItemDoneEvent { + /** + * The output item that was marked done. + */ + item: ResponseOutputItem; + + /** + * The index of the output item that was marked done. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_item.done`. + */ + type: 'response.output_item.done'; +} + +/** + * An output message from the model. + */ +export interface ResponseOutputMessage { + /** + * The unique ID of the output message. + */ + id: string; + + /** + * The content of the output message. + */ + content: Array; + + /** + * The role of the output message. Always `assistant`. + */ + role: 'assistant'; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the output message. Always `message`. + */ + type: 'message'; +} + +/** + * A refusal from the model. + */ +export interface ResponseOutputRefusal { + /** + * The refusal explanationfrom the model. + */ + refusal: string; + + /** + * The type of the refusal. Always `refusal`. + */ + type: 'refusal'; +} + +/** + * A text output from the model. + */ +export interface ResponseOutputText { + /** + * The annotations of the text output. + */ + annotations: Array< + ResponseOutputText.FileCitation | ResponseOutputText.URLCitation | ResponseOutputText.FilePath + >; + + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; +} + +export namespace ResponseOutputText { + /** + * A citation to a file. + */ + export interface FileCitation { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file citation. Always `file_citation`. + */ + type: 'file_citation'; + } + + /** + * A citation for a web resource used to generate a model response. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * The URL of the web resource. + */ + url: string; + } + + /** + * A path to a file. + */ + export interface FilePath { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file path. Always `file_path`. + */ + type: 'file_path'; + } +} + +/** + * Emitted when there is a partial refusal text. + */ +export interface ResponseRefusalDeltaEvent { + /** + * The index of the content part that the refusal text is added to. + */ + content_index: number; + + /** + * The refusal text that is added. + */ + delta: string; + + /** + * The ID of the output item that the refusal text is added to. + */ + item_id: string; + + /** + * The index of the output item that the refusal text is added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.refusal.delta`. + */ + type: 'response.refusal.delta'; +} + +/** + * Emitted when refusal text is finalized. + */ +export interface ResponseRefusalDoneEvent { + /** + * The index of the content part that the refusal text is finalized. + */ + content_index: number; + + /** + * The ID of the output item that the refusal text is finalized. + */ + item_id: string; + + /** + * The index of the output item that the refusal text is finalized. + */ + output_index: number; + + /** + * The refusal text that is finalized. + */ + refusal: string; + + /** + * The type of the event. Always `response.refusal.done`. + */ + type: 'response.refusal.done'; +} + +/** + * The status of the response generation. One of `completed`, `failed`, + * `in_progress`, or `incomplete`. + */ +export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete'; + +/** + * Emitted when there is a partial audio response. + */ +export type ResponseStreamEvent = + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseCodeInterpreterCallCodeDeltaEvent + | ResponseCodeInterpreterCallCodeDoneEvent + | ResponseCodeInterpreterCallCompletedEvent + | ResponseCodeInterpreterCallInProgressEvent + | ResponseCodeInterpreterCallInterpretingEvent + | ResponseCompletedEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent + | ResponseCreatedEvent + | ResponseErrorEvent + | ResponseFileSearchCallCompletedEvent + | ResponseFileSearchCallInProgressEvent + | ResponseFileSearchCallSearchingEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent + | ResponseInProgressEvent + | ResponseFailedEvent + | ResponseIncompleteEvent + | ResponseOutputItemAddedEvent + | ResponseOutputItemDoneEvent + | ResponseRefusalDeltaEvent + | ResponseRefusalDoneEvent + | ResponseTextAnnotationDeltaEvent + | ResponseTextDeltaEvent + | ResponseTextDoneEvent + | ResponseWebSearchCallCompletedEvent + | ResponseWebSearchCallInProgressEvent + | ResponseWebSearchCallSearchingEvent; + +/** + * Emitted when a text annotation is added. + */ +export interface ResponseTextAnnotationDeltaEvent { + /** + * A citation to a file. + */ + annotation: + | ResponseTextAnnotationDeltaEvent.FileCitation + | ResponseTextAnnotationDeltaEvent.URLCitation + | ResponseTextAnnotationDeltaEvent.FilePath; + + /** + * The index of the annotation that was added. + */ + annotation_index: number; + + /** + * The index of the content part that the text annotation was added to. + */ + content_index: number; + + /** + * The ID of the output item that the text annotation was added to. + */ + item_id: string; + + /** + * The index of the output item that the text annotation was added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_text.annotation.added`. + */ + type: 'response.output_text.annotation.added'; +} + +export namespace ResponseTextAnnotationDeltaEvent { + /** + * A citation to a file. + */ + export interface FileCitation { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file citation. Always `file_citation`. + */ + type: 'file_citation'; + } + + /** + * A citation for a web resource used to generate a model response. + */ + export interface URLCitation { + /** + * The index of the last character of the URL citation in the message. + */ + end_index: number; + + /** + * The index of the first character of the URL citation in the message. + */ + start_index: number; + + /** + * The title of the web resource. + */ + title: string; + + /** + * The type of the URL citation. Always `url_citation`. + */ + type: 'url_citation'; + + /** + * The URL of the web resource. + */ + url: string; + } + + /** + * A path to a file. + */ + export interface FilePath { + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the file in the list of files. + */ + index: number; + + /** + * The type of the file path. Always `file_path`. + */ + type: 'file_path'; + } +} + +/** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ +export interface ResponseTextConfig { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponseFormatTextConfig; +} + +/** + * Emitted when there is an additional text delta. + */ +export interface ResponseTextDeltaEvent { + /** + * The index of the content part that the text delta was added to. + */ + content_index: number; + + /** + * The text delta that was added. + */ + delta: string; + + /** + * The ID of the output item that the text delta was added to. + */ + item_id: string; + + /** + * The index of the output item that the text delta was added to. + */ + output_index: number; + + /** + * The type of the event. Always `response.output_text.delta`. + */ + type: 'response.output_text.delta'; +} + +/** + * Emitted when text content is finalized. + */ +export interface ResponseTextDoneEvent { + /** + * The index of the content part that the text content is finalized. + */ + content_index: number; + + /** + * The ID of the output item that the text content is finalized. + */ + item_id: string; + + /** + * The index of the output item that the text content is finalized. + */ + output_index: number; + + /** + * The text content that is finalized. + */ + text: string; + + /** + * The type of the event. Always `response.output_text.done`. + */ + type: 'response.output_text.done'; +} + +/** + * Represents token usage details including input tokens, output tokens, a + * breakdown of output tokens, and the total tokens used. + */ +export interface ResponseUsage { + /** + * The number of input tokens. + */ + input_tokens: number; + + /** + * The number of output tokens. + */ + output_tokens: number; + + /** + * A detailed breakdown of the output tokens. + */ + output_tokens_details: ResponseUsage.OutputTokensDetails; + + /** + * The total number of tokens used. + */ + total_tokens: number; +} + +export namespace ResponseUsage { + /** + * A detailed breakdown of the output tokens. + */ + export interface OutputTokensDetails { + /** + * The number of reasoning tokens. + */ + reasoning_tokens: number; + } +} + +/** + * Emitted when a web search call is completed. + */ +export interface ResponseWebSearchCallCompletedEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.completed`. + */ + type: 'response.web_search_call.completed'; +} + +/** + * Emitted when a web search call is initiated. + */ +export interface ResponseWebSearchCallInProgressEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.in_progress`. + */ + type: 'response.web_search_call.in_progress'; +} + +/** + * Emitted when a web search call is executing. + */ +export interface ResponseWebSearchCallSearchingEvent { + /** + * Unique ID for the output item associated with the web search call. + */ + item_id: string; + + /** + * The index of the output item that the web search call is associated with. + */ + output_index: number; + + /** + * The type of the event. Always `response.web_search_call.searching`. + */ + type: 'response.web_search_call.searching'; +} + +/** + * A tool that searches for relevant content from uploaded files. Learn more about + * the + * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + */ +export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool; + +/** + * Use this option to force the model to call a specific function. + */ +export interface ToolChoiceFunction { + /** + * The name of the function to call. + */ + name: string; + + /** + * For function calling, the type is always `function`. + */ + type: 'function'; +} + +/** + * Controls which (if any) tool is called by the model. + * + * `none` means the model will not call any tool and instead generates a message. + * + * `auto` means the model can pick between generating a message or calling one or + * more tools. + * + * `required` means the model must call one or more tools. + */ +export type ToolChoiceOptions = 'none' | 'auto' | 'required'; + +/** + * Indicates that the model should use a built-in tool to generate a response. + * [Learn more about built-in tools](https://platform.openai.com/docs/guides/tools). + */ +export interface ToolChoiceTypes { + /** + * The type of hosted tool the model should to use. Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * + * Allowed values are: + * + * - `file_search` + * - `web_search_preview` + * - `computer_use_preview` + */ + type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11'; +} + +/** + * This tool searches the web for relevant results to use in a response. Learn more + * about the + * [web search tool](https://platform.openai.com/docs/guides/tools-web-search). + */ +export interface WebSearchTool { + /** + * The type of the web search tool. One of: + * + * - `web_search_preview` + * - `web_search_preview_2025_03_11` + */ + type: 'web_search_preview' | 'web_search_preview_2025_03_11'; + + /** + * 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. + */ + search_context_size?: 'low' | 'medium' | 'high'; + + user_location?: WebSearchTool.UserLocation | null; +} + +export namespace WebSearchTool { + export interface UserLocation { + /** + * The type of location approximation. Always `approximate`. + */ + type: 'approximate'; + + /** + * Free text input for the city of the user, e.g. `San Francisco`. + */ + city?: string; + + /** + * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of + * the user, e.g. `US`. + */ + country?: string; + + /** + * Free text input for the region of the user, e.g. `California`. + */ + region?: string; + + /** + * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the + * user, e.g. `America/Los_Angeles`. + */ + timezone?: string; + } +} + +export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming; + +export interface ResponseCreateParamsBase { + /** + * Text, image, or file inputs to the model, used to generate a response. + * + * Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Image inputs](https://platform.openai.com/docs/guides/images) + * - [File inputs](https://platform.openai.com/docs/guides/pdf-files) + * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) + * - [Function calling](https://platform.openai.com/docs/guides/function-calling) + */ + input: string | ResponseInput; + + /** + * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. + */ + model: (string & {}) | Shared.ChatModel; + + /** + * Specify additional output data to include in the model response. Currently + * supported values are: + * + * - `file_search_call.results`: Include the search results of the file search tool + * call. + * - `message.input_image.image_url`: Include image urls from the input message. + * - `computer_call_output.output.image_url`: Include image urls from the computer + * call output. + */ + include?: Array | null; + + /** + * Inserts a system (or developer) message as the first item in the model's + * context. + * + * When using along with `previous_response_id`, the instructions from a previous + * response will be not be carried over to the next response. This makes it simple + * to swap out system (or developer) messages in new responses. + */ + instructions?: string | null; + + /** + * An upper bound for the number of tokens that can be generated for a response, + * including visible output tokens and + * [reasoning tokens](https://platform.openai.com/docs/guides/reasoning). + */ + max_output_tokens?: number | null; + + /** + * 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; + + /** + * Whether to allow the model to run tool calls in parallel. + */ + parallel_tool_calls?: boolean | null; + + /** + * The unique ID of the previous response to the model. Use this to create + * multi-turn conversations. Learn more about + * [conversation state](https://platform.openai.com/docs/guides/conversation-state). + */ + previous_response_id?: string | null; + + /** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ + reasoning?: Shared.Reasoning | null; + + /** + * Whether to store the generated model response for later retrieval via API. + */ + store?: boolean | null; + + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: boolean | null; + + /** + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will + * make the output more random, while lower values like 0.2 will make it more + * focused and deterministic. We generally recommend altering this or `top_p` but + * not both. + */ + temperature?: number | null; + + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: ResponseTextConfig; + + /** + * How the model should select which tool (or tools) to use when generating a + * response. See the `tools` parameter to see how to specify which tools the model + * can call. + */ + tool_choice?: ToolChoiceOptions | ToolChoiceTypes | ToolChoiceFunction; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + + /** + * An alternative to sampling with temperature, called nucleus sampling, where the + * model considers the results of the tokens with top_p probability mass. So 0.1 + * means only the tokens comprising the top 10% probability mass are considered. + * + * We generally recommend altering this or `temperature` but not both. + */ + top_p?: number | null; + + /** + * The truncation strategy to use for the model response. + * + * - `auto`: If the context of this response and previous ones exceeds the model's + * context window size, the model will truncate the response to fit the context + * window by dropping input items in the middle of the conversation. + * - `disabled` (default): If a model response will exceed the context window size + * for a model, the request will fail with a 400 error. + */ + truncation?: 'auto' | 'disabled' | null; + + /** + * A unique identifier representing your end-user, which can help OpenAI to monitor + * and detect abuse. + * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). + */ + user?: string; +} + +export namespace ResponseCreateParams { + export type ResponseCreateParamsNonStreaming = ResponsesAPI.ResponseCreateParamsNonStreaming; + export type ResponseCreateParamsStreaming = ResponsesAPI.ResponseCreateParamsStreaming; +} + +export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: false | null; +} + +export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream: true; +} + +export interface ResponseRetrieveParams { + /** + * Additional fields to include in the response. See the `include` parameter for + * Response creation above for more information. + */ + include?: Array; +} + +Responses.InputItems = InputItems; + +export declare namespace Responses { + export { + InputItems as InputItems, + type ResponseItemList as ResponseItemList, + type ResponseItemListDataPage as ResponseItemListDataPage, + type InputItemListParams as InputItemListParams, + }; +} diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 18e2ecddc..86b2d2dee 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -9,6 +9,9 @@ export type ChatModel = | 'o1-preview-2024-09-12' | 'o1-mini' | 'o1-mini-2024-09-12' + | 'computer-use-preview' + | 'computer-use-preview-2025-02-04' + | 'computer-use-preview-2025-03-11' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-4o' @@ -43,6 +46,51 @@ export type ChatModel = | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo-16k-0613'; +/** + * A filter used to compare a specified attribute key to a given value using a + * defined comparison operation. + */ +export interface ComparisonFilter { + /** + * The key to compare against the value. + */ + key: string; + + /** + * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`. + * + * - `eq`: equals + * - `ne`: not equal + * - `gt`: greater than + * - `gte`: greater than or equal + * - `lt`: less than + * - `lte`: less than or equal + */ + type: 'eq' | 'ne' | 'gt' | 'gte' | 'lt' | 'lte'; + + /** + * The value to compare against the attribute key; supports string, number, or + * boolean types. + */ + value: string | number | boolean; +} + +/** + * Combine multiple filters using `and` or `or`. + */ +export interface CompoundFilter { + /** + * Array of filters to combine. Items can be `ComparisonFilter` or + * `CompoundFilter`. + */ + filters: Array; + + /** + * Type of operation: `and` or `or`. + */ + type: 'and' | 'or'; +} + export interface ErrorObject { code: string | null; @@ -108,23 +156,76 @@ export type FunctionParameters = Record; */ export type Metadata = Record; +/** + * **o-series models only** + * + * Configuration options for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). + */ +export interface Reasoning { + /** + * **o-series models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ + effort: ReasoningEffort | null; + + /** + * **o-series models only** + * + * A summary of the reasoning performed by the model. This can be useful for + * debugging and understanding the model's reasoning process. One of `concise` or + * `detailed`. + */ + generate_summary?: 'concise' | 'detailed' | null; +} + +/** + * **o-series models only** + * + * Constrains effort on reasoning for + * [reasoning models](https://platform.openai.com/docs/guides/reasoning). Currently + * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can + * result in faster responses and fewer tokens used on reasoning in a response. + */ +export type ReasoningEffort = 'low' | 'medium' | 'high' | null; + +/** + * JSON object response format. An older method of generating JSON responses. Using + * `json_schema` is recommended for models that support it. Note that the model + * will not generate JSON without a system or user message instructing it to do so. + */ export interface ResponseFormatJSONObject { /** - * The type of response format being defined: `json_object` + * The type of response format being defined. Always `json_object`. */ type: 'json_object'; } +/** + * JSON Schema response format. Used to generate structured JSON responses. Learn + * more about + * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). + */ export interface ResponseFormatJSONSchema { + /** + * Structured Outputs configuration options, including a JSON Schema. + */ json_schema: ResponseFormatJSONSchema.JSONSchema; /** - * The type of response format being defined: `json_schema` + * The type of response format being defined. Always `json_schema`. */ type: 'json_schema'; } export namespace ResponseFormatJSONSchema { + /** + * Structured Outputs configuration options, including a JSON Schema. + */ export interface JSONSchema { /** * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores @@ -139,7 +240,8 @@ export namespace ResponseFormatJSONSchema { description?: string; /** - * The schema for the response format, described as a JSON Schema object. + * The schema for the response format, described as a JSON Schema object. Learn how + * to build JSON schemas [here](https://json-schema.org/). */ schema?: Record; @@ -154,9 +256,12 @@ export namespace ResponseFormatJSONSchema { } } +/** + * Default response format. Used to generate text responses. + */ export interface ResponseFormatText { /** - * The type of response format being defined: `text` + * The type of response format being defined. Always `text`. */ type: 'text'; } diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index a2f1b5250..96ed91f6a 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -24,10 +24,9 @@ export class Uploads extends APIResource { * contains all the parts you uploaded. This File is usable in the rest of our * platform as a regular File object. * - * For certain `purpose`s, the correct `mime_type` must be specified. Please refer - * to documentation for the supported MIME types for your use case: - * - * - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search#supported-files) + * For certain `purpose` values, the correct `mime_type` must be specified. Please + * refer to documentation for the + * [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files). * * For guidance on the proper filename extensions for each purpose, please follow * the documentation on diff --git a/src/resources/beta/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts similarity index 91% rename from src/resources/beta/vector-stores/file-batches.ts rename to src/resources/vector-stores/file-batches.ts index 4cb62feb8..fb155a3bb 100644 --- a/src/resources/beta/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../resource'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; -import { buildHeaders } from '../../../internal/headers'; -import { RequestOptions } from '../../../internal/request-options'; -import { sleep } from '../../../internal/utils/sleep'; -import { type Uploadable } from '../../../uploads'; -import { allSettledWithThrow } from '../../../lib/Util'; -import { path } from '../../../internal/utils/path'; +import { APIPromise } from '../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { sleep } from '../../internal/utils/sleep'; +import { type Uploadable } from '../../uploads'; +import { allSettledWithThrow } from '../../lib/Util'; +import { path } from '../../internal/utils/path'; export class FileBatches extends APIResource { /** @@ -262,6 +262,15 @@ export interface FileBatchCreateParams { */ file_ids: Array; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. diff --git a/src/resources/beta/vector-stores/files.ts b/src/resources/vector-stores/files.ts similarity index 71% rename from src/resources/beta/vector-stores/files.ts rename to src/resources/vector-stores/files.ts index 2c499930e..3d3928ac6 100644 --- a/src/resources/beta/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../resource'; import * as VectorStoresAPI from './vector-stores'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; -import { buildHeaders } from '../../../internal/headers'; -import { RequestOptions } from '../../../internal/request-options'; -import { sleep } from '../../../internal/utils'; -import { Uploadable } from '../../../uploads'; -import { path } from '../../../internal/utils/path'; +import { APIPromise } from '../../api-promise'; +import { CursorPage, type CursorPageParams, PagePromise, Page } from '../../pagination'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { sleep } from '../../internal/utils'; +import { Uploadable } from '../../uploads'; +import { path } from '../../internal/utils/path'; export class Files extends APIResource { /** @@ -43,6 +43,18 @@ export class Files extends APIResource { }); } + /** + * Update attributes on a vector store file. + */ + update(fileID: string, params: FileUpdateParams, options?: RequestOptions): APIPromise { + const { vector_store_id, ...body } = params; + return this._client.post(path`/vector_stores/${vector_store_id}/files/${fileID}`, { + body, + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), + }); + } + /** * Returns a list of vector store files. */ @@ -87,7 +99,6 @@ export class Files extends APIResource { const file = await this.create(vectorStoreId, body, options); return await this.poll(vectorStoreId, file.id, options); } - /** * Wait for the vector store file to finish processing. * @@ -141,7 +152,6 @@ export class Files extends APIResource { } } } - /** * Upload a file to the `files` API and then attach it to the given vector store. * @@ -152,7 +162,6 @@ export class Files extends APIResource { const fileInfo = await this._client.files.create({ file: file, purpose: 'assistants' }, options); return this.create(vectorStoreId, { file_id: fileInfo.id }, options); } - /** * Add a file to a vector store and poll until processing is complete. */ @@ -164,10 +173,28 @@ export class Files extends APIResource { const fileInfo = await this.upload(vectorStoreId, file, options); return await this.poll(vectorStoreId, fileInfo.id, options); } + /** + * Retrieve the parsed contents of a vector store file. + */ + content( + fileID: string, + params: FileContentParams, + options?: RequestOptions, + ): PagePromise { + const { vector_store_id } = params; + return this._client.getAPIList( + path`/vector_stores/${vector_store_id}/files/${fileID}/content`, + Page, + { ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]) }, + ); + } } export type VectorStoreFilesPage = CursorPage; +// Note: no pagination actually occurs yet, this is for forwards-compatibility. +export type FileContentResponsesPage = Page; + /** * A list of files attached to a vector store. */ @@ -214,6 +241,15 @@ export interface VectorStoreFile { */ vector_store_id: string; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The strategy used to chunk the file. */ @@ -246,6 +282,18 @@ export interface VectorStoreFileDeleted { object: 'vector_store.file.deleted'; } +export interface FileContentResponse { + /** + * The text content + */ + text?: string; + + /** + * The content type (currently only `"text"`) + */ + type?: string; +} + export interface FileCreateParams { /** * A [File](https://platform.openai.com/docs/api-reference/files) ID that the @@ -254,6 +302,15 @@ export interface FileCreateParams { */ file_id: string; + /** + * 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, booleans, or numbers. + */ + attributes?: Record | null; + /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` * strategy. Only applicable if `file_ids` is non-empty. @@ -268,6 +325,22 @@ export interface FileRetrieveParams { vector_store_id: string; } +export interface FileUpdateParams { + /** + * Path param: The ID of the vector store the file belongs to. + */ + vector_store_id: string; + + /** + * 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, 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, booleans, or numbers. + */ + attributes: Record | null; +} + export interface FileListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -296,14 +369,25 @@ export interface FileDeleteParams { vector_store_id: string; } +export interface FileContentParams { + /** + * The ID of the vector store. + */ + vector_store_id: string; +} + export declare namespace Files { export { type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, + type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, + type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, + type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, + type FileContentParams as FileContentParams, }; } diff --git a/src/resources/beta/vector-stores/index.ts b/src/resources/vector-stores/index.ts similarity index 82% rename from src/resources/beta/vector-stores/index.ts rename to src/resources/vector-stores/index.ts index d3353db63..cbcb36221 100644 --- a/src/resources/beta/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -12,11 +12,15 @@ export { Files, type VectorStoreFile, type VectorStoreFileDeleted, + type FileContentResponse, type FileCreateParams, type FileRetrieveParams, + type FileUpdateParams, type FileListParams, type FileDeleteParams, + type FileContentParams, type VectorStoreFilesPage, + type FileContentResponsesPage, } from './files'; export { VectorStores, @@ -29,8 +33,11 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, type VectorStoreListParams, + type VectorStoreSearchParams, type VectorStoresPage, + type VectorStoreSearchResponsesPage, } from './vector-stores'; diff --git a/src/resources/beta/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts similarity index 76% rename from src/resources/beta/vector-stores/vector-stores.ts rename to src/resources/vector-stores/vector-stores.ts index 94f32905e..ef942cded 100644 --- a/src/resources/beta/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Shared from '../../shared'; +import { APIResource } from '../../resource'; +import * as Shared from '../shared'; import * as FileBatchesAPI from './file-batches'; import { FileBatchCancelParams, @@ -13,20 +13,24 @@ import { } from './file-batches'; import * as FilesAPI from './files'; import { + FileContentParams, + FileContentResponse, + FileContentResponsesPage, FileCreateParams, FileDeleteParams, FileListParams, FileRetrieveParams, + FileUpdateParams, Files, VectorStoreFile, VectorStoreFileDeleted, VectorStoreFilesPage, } from './files'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; -import { buildHeaders } from '../../../internal/headers'; -import { RequestOptions } from '../../../internal/request-options'; -import { path } from '../../../internal/utils/path'; +import { APIPromise } from '../../api-promise'; +import { CursorPage, type CursorPageParams, Page, PagePromise } from '../../pagination'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; export class VectorStores extends APIResource { files: FilesAPI.Files = new FilesAPI.Files(this._client); @@ -91,10 +95,34 @@ export class VectorStores extends APIResource { headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), }); } + + /** + * Search a vector store for relevant chunks based on a query and file attributes + * filter. + */ + search( + vectorStoreID: string, + body: VectorStoreSearchParams, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + path`/vector_stores/${vectorStoreID}/search`, + Page, + { + body, + method: 'post', + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), + }, + ); + } } export type VectorStoresPage = CursorPage; +// Note: no pagination actually occurs yet, this is for forwards-compatibility. +export type VectorStoreSearchResponsesPage = Page; + /** * The default strategy. This strategy currently uses a `max_chunk_size_tokens` of * `800` and `chunk_overlap_tokens` of `400`. @@ -153,6 +181,9 @@ export interface StaticFileChunkingStrategyObject { type: 'static'; } +/** + * Customize your own chunking strategy by setting chunk size and chunk overlap. + */ export interface StaticFileChunkingStrategyObjectParam { static: StaticFileChunkingStrategy; @@ -280,6 +311,51 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } +export interface VectorStoreSearchResponse { + /** + * 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, booleans, or numbers. + */ + attributes: Record | null; + + /** + * Content chunks from the file. + */ + content: Array; + + /** + * The ID of the vector store file. + */ + file_id: string; + + /** + * The name of the vector store file. + */ + filename: string; + + /** + * The similarity score for the result. + */ + score: number; +} + +export namespace VectorStoreSearchResponse { + export interface Content { + /** + * The text content returned from search. + */ + text: string; + + /** + * The type of content. + */ + type: 'text'; + } +} + export interface VectorStoreCreateParams { /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` @@ -389,6 +465,45 @@ export interface VectorStoreListParams extends CursorPageParams { order?: 'asc' | 'desc'; } +export interface VectorStoreSearchParams { + /** + * A query string for a search + */ + query: string | Array; + + /** + * A filter to apply based on file attributes. + */ + filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + + /** + * The maximum number of results to return. This number should be between 1 and 50 + * inclusive. + */ + max_num_results?: number; + + /** + * Ranking options for search. + */ + ranking_options?: VectorStoreSearchParams.RankingOptions; + + /** + * Whether to rewrite the natural language query for vector search. + */ + rewrite_query?: boolean; +} + +export namespace VectorStoreSearchParams { + /** + * Ranking options for search. + */ + export interface RankingOptions { + ranker?: 'auto' | 'default-2024-11-15'; + + score_threshold?: number; + } +} + VectorStores.Files = Files; VectorStores.FileBatches = FileBatches; @@ -403,21 +518,28 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, + type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreUpdateParams as VectorStoreUpdateParams, type VectorStoreListParams as VectorStoreListParams, + type VectorStoreSearchParams as VectorStoreSearchParams, }; export { Files as Files, type VectorStoreFile as VectorStoreFile, type VectorStoreFileDeleted as VectorStoreFileDeleted, + type FileContentResponse as FileContentResponse, type VectorStoreFilesPage as VectorStoreFilesPage, + type FileContentResponsesPage as FileContentResponsesPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, + type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, + type FileContentParams as FileContentParams, }; export { diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts index 5de69484a..f95953719 100644 --- a/tests/api-resources/chat/completions/completions.test.ts +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -42,9 +42,9 @@ describe('resource completions', () => { presence_penalty: -2, reasoning_effort: 'low', response_format: { type: 'text' }, - seed: 0, + seed: -9007199254740991, service_tier: 'auto', - stop: 'string', + stop: '\n', store: true, stream: false, stream_options: { include_usage: true }, @@ -59,6 +59,13 @@ describe('resource completions', () => { top_logprobs: 0, top_p: 1, user: 'user-1234', + web_search_options: { + search_context_size: 'low', + user_location: { + approximate: { city: 'city', country: 'country', region: 'region', timezone: 'timezone' }, + type: 'approximate', + }, + }, }); }); diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts new file mode 100644 index 000000000..abc8185f6 --- /dev/null +++ b/tests/api-resources/responses/input-items.test.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource inputItems', () => { + test('list', async () => { + const responsePromise = client.responses.inputItems.list('response_id'); + 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.responses.inputItems.list( + 'response_id', + { after: 'after', before: 'before', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts new file mode 100644 index 000000000..e025facc4 --- /dev/null +++ b/tests/api-resources/responses/responses.test.ts @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource responses', () => { + test('create: only required params', async () => { + const responsePromise = client.responses.create({ input: 'string', model: 'gpt-4o' }); + 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('create: required and optional params', async () => { + const response = await client.responses.create({ + input: 'string', + model: 'gpt-4o', + include: ['file_search_call.results'], + instructions: 'instructions', + max_output_tokens: 0, + metadata: { foo: 'string' }, + parallel_tool_calls: true, + previous_response_id: 'previous_response_id', + reasoning: { effort: 'low', generate_summary: 'concise' }, + store: true, + stream: false, + temperature: 1, + text: { format: { type: 'text' } }, + tool_choice: 'none', + tools: [ + { + type: 'file_search', + vector_store_ids: ['string'], + filters: { key: 'key', type: 'eq', value: 'string' }, + max_num_results: 0, + ranking_options: { ranker: 'auto', score_threshold: 0 }, + }, + ], + top_p: 1, + truncation: 'auto', + user: 'user-1234', + }); + }); + + test('retrieve', async () => { + const responsePromise = client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d'); + 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('retrieve: 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.responses.retrieve( + 'resp_677efb5139a88190b512bc3fef8e535d', + { include: ['file_search_call.results'] }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete', async () => { + const responsePromise = client.responses.delete('resp_677efb5139a88190b512bc3fef8e535d'); + 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); + }); +}); diff --git a/tests/api-resources/beta/vector-stores/file-batches.test.ts b/tests/api-resources/vector-stores/file-batches.test.ts similarity index 79% rename from tests/api-resources/beta/vector-stores/file-batches.test.ts rename to tests/api-resources/vector-stores/file-batches.test.ts index 783801214..e765a2ace 100644 --- a/tests/api-resources/beta/vector-stores/file-batches.test.ts +++ b/tests/api-resources/vector-stores/file-batches.test.ts @@ -9,9 +9,7 @@ const client = new OpenAI({ describe('resource fileBatches', () => { test('create: only required params', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.create('vs_abc123', { - file_ids: ['string'], - }); + const responsePromise = client.vectorStores.fileBatches.create('vs_abc123', { file_ids: ['string'] }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,14 +20,15 @@ describe('resource fileBatches', () => { }); test('create: required and optional params', async () => { - const response = await client.beta.vectorStores.fileBatches.create('vs_abc123', { + const response = await client.vectorStores.fileBatches.create('vs_abc123', { file_ids: ['string'], + attributes: { foo: 'string' }, chunking_strategy: { type: 'auto' }, }); }); test('retrieve: only required params', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.retrieve('vsfb_abc123', { + const responsePromise = client.vectorStores.fileBatches.retrieve('vsfb_abc123', { vector_store_id: 'vs_abc123', }); const rawResponse = await responsePromise.asResponse(); @@ -42,13 +41,13 @@ describe('resource fileBatches', () => { }); test('retrieve: required and optional params', async () => { - const response = await client.beta.vectorStores.fileBatches.retrieve('vsfb_abc123', { + const response = await client.vectorStores.fileBatches.retrieve('vsfb_abc123', { vector_store_id: 'vs_abc123', }); }); test('cancel: only required params', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.cancel('batch_id', { + const responsePromise = client.vectorStores.fileBatches.cancel('batch_id', { vector_store_id: 'vector_store_id', }); const rawResponse = await responsePromise.asResponse(); @@ -61,13 +60,13 @@ describe('resource fileBatches', () => { }); test('cancel: required and optional params', async () => { - const response = await client.beta.vectorStores.fileBatches.cancel('batch_id', { + const response = await client.vectorStores.fileBatches.cancel('batch_id', { vector_store_id: 'vector_store_id', }); }); test('listFiles: only required params', async () => { - const responsePromise = client.beta.vectorStores.fileBatches.listFiles('batch_id', { + const responsePromise = client.vectorStores.fileBatches.listFiles('batch_id', { vector_store_id: 'vector_store_id', }); const rawResponse = await responsePromise.asResponse(); @@ -80,7 +79,7 @@ describe('resource fileBatches', () => { }); test('listFiles: required and optional params', async () => { - const response = await client.beta.vectorStores.fileBatches.listFiles('batch_id', { + const response = await client.vectorStores.fileBatches.listFiles('batch_id', { vector_store_id: 'vector_store_id', after: 'after', before: 'before', diff --git a/tests/api-resources/beta/vector-stores/files.test.ts b/tests/api-resources/vector-stores/files.test.ts similarity index 57% rename from tests/api-resources/beta/vector-stores/files.test.ts rename to tests/api-resources/vector-stores/files.test.ts index c32cb6408..9e9afc95d 100644 --- a/tests/api-resources/beta/vector-stores/files.test.ts +++ b/tests/api-resources/vector-stores/files.test.ts @@ -9,7 +9,7 @@ const client = new OpenAI({ describe('resource files', () => { test('create: only required params', async () => { - const responsePromise = client.beta.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); + const responsePromise = client.vectorStores.files.create('vs_abc123', { file_id: 'file_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,14 +20,15 @@ describe('resource files', () => { }); test('create: required and optional params', async () => { - const response = await client.beta.vectorStores.files.create('vs_abc123', { + const response = await client.vectorStores.files.create('vs_abc123', { file_id: 'file_id', + attributes: { foo: 'string' }, chunking_strategy: { type: 'auto' }, }); }); test('retrieve: only required params', async () => { - const responsePromise = client.beta.vectorStores.files.retrieve('file-abc123', { + const responsePromise = client.vectorStores.files.retrieve('file-abc123', { vector_store_id: 'vs_abc123', }); const rawResponse = await responsePromise.asResponse(); @@ -40,13 +41,34 @@ describe('resource files', () => { }); test('retrieve: required and optional params', async () => { - const response = await client.beta.vectorStores.files.retrieve('file-abc123', { + const response = await client.vectorStores.files.retrieve('file-abc123', { vector_store_id: 'vs_abc123', }); }); + test('update: only required params', async () => { + const responsePromise = client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + 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('update: required and optional params', async () => { + const response = await client.vectorStores.files.update('file-abc123', { + vector_store_id: 'vs_abc123', + attributes: { foo: 'string' }, + }); + }); + test('list', async () => { - const responsePromise = client.beta.vectorStores.files.list('vector_store_id'); + const responsePromise = client.vectorStores.files.list('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -59,7 +81,7 @@ describe('resource files', () => { 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.beta.vectorStores.files.list( + client.vectorStores.files.list( 'vector_store_id', { after: 'after', before: 'before', filter: 'in_progress', limit: 0, order: 'asc' }, { path: '/_stainless_unknown_path' }, @@ -68,7 +90,7 @@ describe('resource files', () => { }); test('delete: only required params', async () => { - const responsePromise = client.beta.vectorStores.files.delete('file_id', { + const responsePromise = client.vectorStores.files.delete('file_id', { vector_store_id: 'vector_store_id', }); const rawResponse = await responsePromise.asResponse(); @@ -81,8 +103,25 @@ describe('resource files', () => { }); test('delete: required and optional params', async () => { - const response = await client.beta.vectorStores.files.delete('file_id', { + const response = await client.vectorStores.files.delete('file_id', { vector_store_id: 'vector_store_id', }); }); + + test('content: only required params', async () => { + const responsePromise = client.vectorStores.files.content('file-abc123', { + vector_store_id: 'vs_abc123', + }); + 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('content: required and optional params', async () => { + const response = await client.vectorStores.files.content('file-abc123', { vector_store_id: 'vs_abc123' }); + }); }); diff --git a/tests/api-resources/beta/vector-stores/vector-stores.test.ts b/tests/api-resources/vector-stores/vector-stores.test.ts similarity index 68% rename from tests/api-resources/beta/vector-stores/vector-stores.test.ts rename to tests/api-resources/vector-stores/vector-stores.test.ts index ecb8d33a1..830397279 100644 --- a/tests/api-resources/beta/vector-stores/vector-stores.test.ts +++ b/tests/api-resources/vector-stores/vector-stores.test.ts @@ -9,7 +9,7 @@ const client = new OpenAI({ describe('resource vectorStores', () => { test('create', async () => { - const responsePromise = client.beta.vectorStores.create({}); + const responsePromise = client.vectorStores.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,7 +20,7 @@ describe('resource vectorStores', () => { }); test('retrieve', async () => { - const responsePromise = client.beta.vectorStores.retrieve('vector_store_id'); + const responsePromise = client.vectorStores.retrieve('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -31,7 +31,7 @@ describe('resource vectorStores', () => { }); test('update', async () => { - const responsePromise = client.beta.vectorStores.update('vector_store_id', {}); + const responsePromise = client.vectorStores.update('vector_store_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -42,7 +42,7 @@ describe('resource vectorStores', () => { }); test('list', async () => { - const responsePromise = client.beta.vectorStores.list(); + const responsePromise = client.vectorStores.list(); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -55,7 +55,7 @@ describe('resource vectorStores', () => { 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.beta.vectorStores.list( + client.vectorStores.list( { after: 'after', before: 'before', limit: 0, order: 'asc' }, { path: '/_stainless_unknown_path' }, ), @@ -63,7 +63,7 @@ describe('resource vectorStores', () => { }); test('delete', async () => { - const responsePromise = client.beta.vectorStores.delete('vector_store_id'); + const responsePromise = client.vectorStores.delete('vector_store_id'); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -72,4 +72,25 @@ describe('resource vectorStores', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('search: only required params', async () => { + const responsePromise = client.vectorStores.search('vs_abc123', { query: 'string' }); + 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('search: required and optional params', async () => { + const response = await client.vectorStores.search('vs_abc123', { + query: 'string', + filters: { key: 'key', type: 'eq', value: 'string' }, + max_num_results: 1, + ranking_options: { ranker: 'auto', score_threshold: 0 }, + rewrite_query: true, + }); + }); }); From 66fb8157217de604d7f535e917b085fa8b6754d4 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 11 Mar 2025 19:52:39 +0000 Subject: [PATCH 240/509] fix(responses): correct computer use enum value --- .stats.yml | 2 +- src/resources/responses/responses.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 455874212..9c4a2e536 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-be834d63e326a82494e819085137f5eb15866f3fc787db1f3afe7168d419e18a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-9ce5257763fb30c6e0e1ee2bef7e13baf661511e09572207e528d643da8e16b3.yml diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 1186cab6b..ac0af3afb 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -90,7 +90,7 @@ export interface ComputerTool { /** * The type of the computer use tool. Always `computer_use_preview`. */ - type: 'computer-preview'; + type: 'computer_use_preview'; } /** From 1698b95af215ed5a3f0fcf512779efe89a95d4d2 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 11 Mar 2025 21:44:06 +0000 Subject: [PATCH 241/509] fix(responses): correct reasoning output type --- .stats.yml | 2 +- api.md | 1 + src/resources/responses/responses.ts | 129 +++++++++------------------ 3 files changed, 45 insertions(+), 87 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9c4a2e536..edc2aaf89 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-9ce5257763fb30c6e0e1ee2bef7e13baf661511e09572207e528d643da8e16b3.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml diff --git a/api.md b/api.md index 1cf080c91..4657d4337 100644 --- a/api.md +++ b/api.md @@ -582,6 +582,7 @@ Types: - ResponseOutputMessage - ResponseOutputRefusal - ResponseOutputText +- ResponseReasoningItem - ResponseRefusalDeltaEvent - ResponseRefusalDoneEvent - ResponseStatus diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index ac0af3afb..d89f7580d 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -1490,7 +1490,7 @@ export type ResponseInputItem = | ResponseFunctionWebSearch | ResponseFunctionToolCall | ResponseInputItem.FunctionCallOutput - | ResponseInputItem.Reasoning + | ResponseReasoningItem | ResponseInputItem.ItemReference; export namespace ResponseInputItem { @@ -1635,47 +1635,6 @@ export namespace ResponseInputItem { status?: 'in_progress' | 'completed' | 'incomplete'; } - /** - * A description of the chain of thought used by a reasoning model while generating - * a response. - */ - export interface Reasoning { - /** - * The unique identifier of the reasoning content. - */ - id: string; - - /** - * Reasoning text contents. - */ - content: Array; - - /** - * The type of the object. Always `reasoning`. - */ - type: 'reasoning'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace Reasoning { - export interface Content { - /** - * A short summary of the reasoning used by the model when generating the response. - */ - text: string; - - /** - * The type of the object. Always `text`. - */ - type: 'reasoning_summary'; - } - } - /** * An internal identifier for an item to reference. */ @@ -1742,50 +1701,7 @@ export type ResponseOutputItem = | ResponseFunctionToolCall | ResponseFunctionWebSearch | ResponseComputerToolCall - | ResponseOutputItem.Reasoning; - -export namespace ResponseOutputItem { - /** - * A description of the chain of thought used by a reasoning model while generating - * a response. - */ - export interface Reasoning { - /** - * The unique identifier of the reasoning content. - */ - id: string; - - /** - * Reasoning text contents. - */ - content: Array; - - /** - * The type of the object. Always `reasoning`. - */ - type: 'reasoning'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace Reasoning { - export interface Content { - /** - * A short summary of the reasoning used by the model when generating the response. - */ - text: string; - - /** - * The type of the object. Always `text`. - */ - type: 'reasoning_summary'; - } - } -} + | ResponseReasoningItem; /** * Emitted when a new output item is added. @@ -1967,6 +1883,47 @@ export namespace ResponseOutputText { } } +/** + * A description of the chain of thought used by a reasoning model while generating + * a response. + */ +export interface ResponseReasoningItem { + /** + * The unique identifier of the reasoning content. + */ + id: string; + + /** + * Reasoning text contents. + */ + summary: Array; + + /** + * The type of the object. Always `reasoning`. + */ + type: 'reasoning'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +export namespace ResponseReasoningItem { + export interface Summary { + /** + * A short summary of the reasoning used by the model when generating the response. + */ + text: string; + + /** + * The type of the object. Always `summary_text`. + */ + type: 'summary_text'; + } +} + /** * Emitted when there is a partial refusal text. */ From ef43345f0828a5313b595ed1715094d110f2f44e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 15:34:52 -0400 Subject: [PATCH 242/509] chore(internal): remove CI condition --- .github/workflows/ci.yml | 3 --- .stats.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50caff538..41cd0bd37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ jobs: lint: name: lint runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' steps: - uses: actions/checkout@v4 @@ -32,7 +31,6 @@ jobs: build: name: build runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' steps: - uses: actions/checkout@v4 @@ -50,7 +48,6 @@ jobs: test: name: test runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' steps: - uses: actions/checkout@v4 diff --git a/.stats.yml b/.stats.yml index edc2aaf89..53c73037d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml From a06deb8aec21ecf8bfbc369112da10a790039178 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 19:39:35 +0000 Subject: [PATCH 243/509] fix(internal): add mts file + crypto shim types --- scripts/build | 11 +++-------- src/internal/shims/crypto.node.d.mts | 1 + src/internal/shims/file.node.d.mts | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 src/internal/shims/crypto.node.d.mts create mode 100644 src/internal/shims/file.node.d.mts diff --git a/scripts/build b/scripts/build index dd2c9dd57..e9ebac741 100755 --- a/scripts/build +++ b/scripts/build @@ -28,20 +28,15 @@ node scripts/utils/make-dist-package-json.cjs > dist/package.json # build to .js/.mjs/.d.ts files npm exec tsc-multi -# we need to add exports = module.exports = OpenAI to index.js; -# No way to get that from index.ts because it would cause compile errors +# we need to patch index.js so that `new module.exports()` works for cjs backwards +# compat. No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/utils/fix-index-exports.cjs -# with "moduleResolution": "nodenext", if ESM resolves to index.d.ts, -# it'll have TS errors on the default import. But if it resolves to -# index.d.mts the default import will work (even though both files have -# the same export default statement) -cp dist/index.d.ts dist/index.d.mts cp tsconfig.dist-src.json dist/src/tsconfig.json cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts mkdir -p dist/internal/shims -cp src/internal/shims/*.{mjs,js,d.ts} dist/internal/shims +cp src/internal/shims/*.{mjs,js,d.ts,d.mts} dist/internal/shims node scripts/utils/postprocess-files.cjs diff --git a/src/internal/shims/crypto.node.d.mts b/src/internal/shims/crypto.node.d.mts new file mode 100644 index 000000000..5cc196301 --- /dev/null +++ b/src/internal/shims/crypto.node.d.mts @@ -0,0 +1 @@ +export { crypto } from './crypto.node.js'; diff --git a/src/internal/shims/file.node.d.mts b/src/internal/shims/file.node.d.mts new file mode 100644 index 000000000..38cc9ff7a --- /dev/null +++ b/src/internal/shims/file.node.d.mts @@ -0,0 +1 @@ +export { File } from './file.node.js'; From e905c95a27213ee65210b061ead4c982de01648b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 19:24:51 +0000 Subject: [PATCH 244/509] chore(internal): remove CI condition (#1381) --- .github/workflows/ci.yml | 5 ++- .github/workflows/create-releases.yml | 50 --------------------------- .github/workflows/publish-jsr.yml | 8 +++-- .github/workflows/publish-npm.yml | 8 +++-- .github/workflows/release-doctor.yml | 1 - .stats.yml | 2 +- bin/check-release-environment | 4 --- examples/yarn.lock | 0 8 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/create-releases.yml delete mode 100644 examples/yarn.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe24c0dcb..3efb3f17a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: name: lint runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' + steps: - uses: actions/checkout@v4 @@ -31,7 +31,7 @@ jobs: build: name: build runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' + steps: - uses: actions/checkout@v4 @@ -49,7 +49,6 @@ jobs: test: name: test runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml deleted file mode 100644 index 19b7dd831..000000000 --- a/.github/workflows/create-releases.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Create releases -on: - schedule: - - cron: '0 5 * * *' # every day at 5am UTC - push: - branches: - - master - -jobs: - release: - name: release - if: github.ref == 'refs/heads/master' && github.repository == 'openai/openai-node' - runs-on: ubuntu-latest - environment: publish - permissions: - contents: read - id-token: write - - steps: - - uses: actions/checkout@v4 - - - uses: stainless-api/trigger-release-please@v1 - id: release - with: - repo: ${{ github.event.repository.full_name }} - stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} - - - name: Set up Node - if: ${{ steps.release.outputs.releases_created }} - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install dependencies - if: ${{ steps.release.outputs.releases_created }} - run: | - yarn install - - - name: Publish to NPM - if: ${{ steps.release.outputs.releases_created }} - run: | - bash ./bin/publish-npm - env: - NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} - - - name: Publish to JSR - if: ${{ steps.release.outputs.releases_created }} - run: | - bash ./bin/publish-jsr - diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index 1e46d6bfb..dc5fe0a2a 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -1,9 +1,13 @@ -# workflow for re-running publishing to JSR in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to JSR in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml name: Publish JSR on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 5a3711b53..d3b184555 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,9 +1,13 @@ -# workflow for re-running publishing to NPM in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to NPM in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml name: Publish NPM on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 37bc09e80..754a44931 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -19,6 +19,5 @@ jobs: run: | bash ./bin/check-release-environment env: - STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/.stats.yml b/.stats.yml index 455874212..53c73037d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-be834d63e326a82494e819085137f5eb15866f3fc787db1f3afe7168d419e18a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml diff --git a/bin/check-release-environment b/bin/check-release-environment index dbfd546bf..e51564b7d 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${STAINLESS_API_KEY}" ]; then - errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") -fi - if [ -z "${NPM_TOKEN}" ]; then errors+=("The OPENAI_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi diff --git a/examples/yarn.lock b/examples/yarn.lock deleted file mode 100644 index e69de29bb..000000000 From 2cbf49a0b9a8cfbee29cec558c5ccdcebd72396f Mon Sep 17 00:00:00 2001 From: meorphis Date: Fri, 14 Mar 2025 16:53:35 -0400 Subject: [PATCH 245/509] chore(internal): update release workflows --- .github/workflows/publish-jsr.yml | 8 ++------ .github/workflows/publish-npm.yml | 8 ++------ .github/workflows/release-doctor.yml | 1 + 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index dc5fe0a2a..1e46d6bfb 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -1,13 +1,9 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to JSR in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml +# workflow for re-running publishing to JSR in case it fails for some reason +# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml name: Publish JSR on: workflow_dispatch: - release: - types: [published] - jobs: publish: name: publish diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index d3b184555..5a3711b53 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,13 +1,9 @@ -# This workflow is triggered when a GitHub release is created. -# It can also be run manually to re-publish to NPM in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml +# workflow for re-running publishing to NPM in case it fails for some reason +# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml name: Publish NPM on: workflow_dispatch: - release: - types: [published] - jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 754a44931..37bc09e80 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -19,5 +19,6 @@ jobs: run: | bash ./bin/check-release-environment env: + STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} From f4647cc7546d06145bf34113be22aabbd1b7e7ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:56:15 +0000 Subject: [PATCH 246/509] chore: add missing type alias exports (#1390) --- src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.ts b/src/index.ts index c3abed2db..34cc3e84d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -118,6 +118,7 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, + ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStoreMessage, ChatCompletionStreamOptions, @@ -129,6 +130,7 @@ import { ChatCompletionUpdateParams, ChatCompletionUserMessageParam, ChatCompletionsPage, + CreateChatCompletionRequestMessage, } from './resources/chat/completions/completions'; export interface ClientOptions { @@ -404,6 +406,8 @@ export declare namespace OpenAI { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type CreateChatCompletionRequestMessage as CreateChatCompletionRequestMessage, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, From 9c45ef37249e7db3ba8aa2e81886ffe306b95da4 Mon Sep 17 00:00:00 2001 From: meorphis <108296353+meorphis@users.noreply.github.com> Date: Tue, 18 Mar 2025 11:33:27 -0400 Subject: [PATCH 247/509] chore(internal): run CI on update-specs branch --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3efb3f17a..627f5954f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - update-specs pull_request: branches: - master @@ -87,7 +88,6 @@ jobs: ecosystem_tests: name: ecosystem tests (v${{ matrix.node-version }}) runs-on: ubuntu-latest - if: github.repository == 'openai/openai-node' timeout-minutes: 20 strategy: fail-fast: false From e983d0c61d33b106f149d87eed90378bd0bbc349 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 17:54:03 +0000 Subject: [PATCH 248/509] fix(api): correct some Responses types (#1391) --- .stats.yml | 2 +- src/resources/batches.ts | 8 +++--- src/resources/chat/completions/completions.ts | 18 ++++++++----- src/resources/responses/responses.ts | 26 +++++++++++++++---- src/resources/shared.ts | 4 +-- tests/api-resources/batches.test.ts | 4 +-- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 53c73037d..1e04d7c26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f763c1a35c8b9b02f1e31b9b2e09e21f98bfe8413e5079c86cbb07da2dd7779b.yml diff --git a/src/resources/batches.ts b/src/resources/batches.ts index aadda83a6..2cf2ac566 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -220,11 +220,11 @@ export interface BatchCreateParams { /** * The endpoint to be used for all requests in the batch. Currently - * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. - * Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 - * embedding inputs across all requests in the batch. + * `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` + * are supported. Note that `/v1/embeddings` batches are also restricted to a + * maximum of 50,000 embedding inputs across all requests in the batch. */ - endpoint: '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions'; + endpoint: '/v1/responses' | '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions'; /** * The ID of an uploaded file that contains requests for the new batch. diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 7b1c353e2..f54c01597 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -377,10 +377,13 @@ export interface ChatCompletionChunk { /** * An optional field that will only be present when you set * `stream_options: {"include_usage": true}` in your request. When present, it - * contains a null value except for the last chunk which contains the token usage - * statistics for the entire request. + * contains a null value **except for the last chunk** which contains the token + * usage statistics for the entire request. + * + * **NOTE:** If the stream is interrupted or cancelled, you may not receive the + * final usage chunk which contains the total token usage for the request. */ - usage?: CompletionsAPI.CompletionUsage | null; + usage?: CompletionsAPI.CompletionUsage; } export namespace ChatCompletionChunk { @@ -551,7 +554,7 @@ export namespace ChatCompletionContentPart { /** * The name of the file, used when passing the file to the model as a string. */ - file_name?: string; + filename?: string; } } } @@ -930,8 +933,11 @@ export interface ChatCompletionStreamOptions { /** * If set, an additional chunk will be streamed before the `data: [DONE]` message. * The `usage` field on this chunk shows the token usage statistics for the entire - * request, and the `choices` field will always be an empty array. All other chunks - * will also include a `usage` field, but with a null value. + * request, and the `choices` field will always be an empty array. + * + * All other chunks will also include a `usage` field, but with a null value. + * **NOTE:** If the stream is interrupted, you may not receive the final usage + * chunk which contains the total token usage for the request. */ include_usage?: boolean; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 72adf0696..20d67b8ac 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -1362,11 +1362,6 @@ export interface ResponseFunctionCallArgumentsDoneEvent { * for more information. */ export interface ResponseFunctionToolCall { - /** - * The unique ID of the function tool call. - */ - id: string; - /** * A JSON string of the arguments to pass to the function. */ @@ -1387,6 +1382,11 @@ export interface ResponseFunctionToolCall { */ type: 'function_call'; + /** + * The unique ID of the function tool call. + */ + id?: string; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -2305,6 +2305,11 @@ export interface ResponseUsage { */ input_tokens: number; + /** + * A detailed breakdown of the input tokens. + */ + input_tokens_details: ResponseUsage.InputTokensDetails; + /** * The number of output tokens. */ @@ -2322,6 +2327,17 @@ export interface ResponseUsage { } export namespace ResponseUsage { + /** + * A detailed breakdown of the input tokens. + */ + export interface InputTokensDetails { + /** + * The number of tokens that were retrieved from the cache. + * [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching). + */ + cached_tokens: number; + } + /** * A detailed breakdown of the output tokens. */ diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 86b2d2dee..5fbdbba6a 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -171,10 +171,10 @@ export interface Reasoning { * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - effort: ReasoningEffort | null; + effort?: ReasoningEffort | null; /** - * **o-series models only** + * **computer_use_preview only** * * A summary of the reasoning performed by the model. This can be useful for * debugging and understanding the model's reasoning process. One of `concise` or diff --git a/tests/api-resources/batches.test.ts b/tests/api-resources/batches.test.ts index 96e200fb9..7c7397d06 100644 --- a/tests/api-resources/batches.test.ts +++ b/tests/api-resources/batches.test.ts @@ -12,7 +12,7 @@ describe('resource batches', () => { test('create: only required params', async () => { const responsePromise = client.batches.create({ completion_window: '24h', - endpoint: '/v1/chat/completions', + endpoint: '/v1/responses', input_file_id: 'input_file_id', }); const rawResponse = await responsePromise.asResponse(); @@ -27,7 +27,7 @@ describe('resource batches', () => { test('create: required and optional params', async () => { const response = await client.batches.create({ completion_window: '24h', - endpoint: '/v1/chat/completions', + endpoint: '/v1/responses', input_file_id: 'input_file_id', metadata: { foo: 'string' }, }); From ca6266eea5229056a3bc2b5e4225b9ea9eaa459e Mon Sep 17 00:00:00 2001 From: meorphis Date: Tue, 18 Mar 2025 14:08:33 -0400 Subject: [PATCH 249/509] chore(internal): add back release workflow --- .github/workflows/create-releases.yml | 50 +++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/create-releases.yml diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml new file mode 100644 index 000000000..19b7dd831 --- /dev/null +++ b/.github/workflows/create-releases.yml @@ -0,0 +1,50 @@ +name: Create releases +on: + schedule: + - cron: '0 5 * * *' # every day at 5am UTC + push: + branches: + - master + +jobs: + release: + name: release + if: github.ref == 'refs/heads/master' && github.repository == 'openai/openai-node' + runs-on: ubuntu-latest + environment: publish + permissions: + contents: read + id-token: write + + steps: + - uses: actions/checkout@v4 + + - uses: stainless-api/trigger-release-please@v1 + id: release + with: + repo: ${{ github.event.repository.full_name }} + stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} + + - name: Set up Node + if: ${{ steps.release.outputs.releases_created }} + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install dependencies + if: ${{ steps.release.outputs.releases_created }} + run: | + yarn install + + - name: Publish to NPM + if: ${{ steps.release.outputs.releases_created }} + run: | + bash ./bin/publish-npm + env: + NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} + + - name: Publish to JSR + if: ${{ steps.release.outputs.releases_created }} + run: | + bash ./bin/publish-jsr + From d2be74a28dec48cd7d88db88af95e8bc608cdede Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 18 Mar 2025 18:52:33 +0000 Subject: [PATCH 250/509] fix(types): ignore missing `id` in responses pagination --- src/resources/responses/input-items.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 9704be89a..d622b8e58 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -65,6 +65,7 @@ export class InputItems extends APIResource { } export class ResponseItemListDataPage extends CursorPage< + // @ts-ignore some items don't necessarily have the `id` property | ResponseItemList.Message | ResponsesAPI.ResponseOutputMessage | ResponsesAPI.ResponseFileSearchToolCall From 454832606ebe9d5cf8ffd436eac09375f682c495 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 20:48:11 +0000 Subject: [PATCH 251/509] fix(types): improve responses type names (#1392) --- .stats.yml | 2 +- api.md | 8 +- src/resources/responses/index.ts | 7 +- src/resources/responses/input-items.ts | 210 +------------------- src/resources/responses/input-items.ts.orig | 114 +++++++++++ src/resources/responses/responses.ts | 191 +++++++++++++++--- 6 files changed, 298 insertions(+), 234 deletions(-) create mode 100644 src/resources/responses/input-items.ts.orig diff --git a/.stats.yml b/.stats.yml index 1e04d7c26..b03256223 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f763c1a35c8b9b02f1e31b9b2e09e21f98bfe8413e5079c86cbb07da2dd7779b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f3bce04386c4fcfd5037e0477fbaa39010003fd1558eb5185fe4a71dd6a05fdd.yml diff --git a/api.md b/api.md index 2fac07f38..fd8482bf2 100644 --- a/api.md +++ b/api.md @@ -548,6 +548,8 @@ Types: - ResponseCodeInterpreterToolCall - ResponseCompletedEvent - ResponseComputerToolCall +- ResponseComputerToolCallOutputItem +- ResponseComputerToolCallOutputScreenshot - ResponseContent - ResponseContentPartAddedEvent - ResponseContentPartDoneEvent @@ -564,6 +566,8 @@ Types: - ResponseFunctionCallArgumentsDeltaEvent - ResponseFunctionCallArgumentsDoneEvent - ResponseFunctionToolCall +- ResponseFunctionToolCallItem +- ResponseFunctionToolCallOutputItem - ResponseFunctionWebSearch - ResponseInProgressEvent - ResponseIncludable @@ -575,7 +579,9 @@ Types: - ResponseInputImage - ResponseInputItem - ResponseInputMessageContentList +- ResponseInputMessageItem - ResponseInputText +- ResponseItem - ResponseOutputAudio - ResponseOutputItem - ResponseOutputItemAddedEvent @@ -616,4 +622,4 @@ Types: Methods: -- client.responses.inputItems.list(responseId, { ...params }) -> ResponseItemListDataPage +- client.responses.inputItems.list(responseId, { ...params }) -> ResponseItemsPage diff --git a/src/resources/responses/index.ts b/src/resources/responses/index.ts index 84f761a93..ad3f9a386 100644 --- a/src/resources/responses/index.ts +++ b/src/resources/responses/index.ts @@ -1,9 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - ResponseItemListDataPage, - InputItems, - type ResponseItemList, - type InputItemListParams, -} from './input-items'; +export { InputItems, type ResponseItemList, type InputItemListParams } from './input-items'; export { Responses } from './responses'; diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index d622b8e58..f2292e5c6 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -4,7 +4,8 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as ResponsesAPI from './responses'; -import { CursorPage, type CursorPageParams } from '../../pagination'; +import { ResponseItemsPage } from './responses'; +import { type CursorPageParams } from '../../pagination'; export class InputItems extends APIResource { /** @@ -14,68 +15,26 @@ export class InputItems extends APIResource { responseId: string, query?: InputItemListParams, options?: Core.RequestOptions, - ): Core.PagePromise< - ResponseItemListDataPage, - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - >; + ): Core.PagePromise; list( responseId: string, options?: Core.RequestOptions, - ): Core.PagePromise< - ResponseItemListDataPage, - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - >; + ): Core.PagePromise; list( responseId: string, query: InputItemListParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.PagePromise< - ResponseItemListDataPage, - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - > { + ): Core.PagePromise { if (isRequestOptions(query)) { return this.list(responseId, {}, query); } - return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemListDataPage, { + return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemsPage, { query, ...options, }); } } -export class ResponseItemListDataPage extends CursorPage< - // @ts-ignore some items don't necessarily have the `id` property - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput -> {} - /** * A list of Response items. */ @@ -83,16 +42,7 @@ export interface ResponseItemList { /** * A list of items used to generate this response. */ - data: Array< - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - >; + data: Array; /** * The ID of the first item in the list. @@ -115,142 +65,6 @@ export interface ResponseItemList { object: 'list'; } -export namespace ResponseItemList { - export interface Message { - /** - * The unique ID of the message input. - */ - id: string; - - /** - * A list of one or many input items to the model, containing different content - * types. - */ - content: ResponsesAPI.ResponseInputMessageContentList; - - /** - * The role of the message input. One of `user`, `system`, or `developer`. - */ - role: 'user' | 'system' | 'developer'; - - /** - * The status of item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - - /** - * The type of the message input. Always set to `message`. - */ - type?: 'message'; - } - - export interface ComputerCallOutput { - /** - * The unique ID of the computer call tool output. - */ - id: string; - - /** - * The ID of the computer tool call that produced the output. - */ - call_id: string; - - /** - * A computer screenshot image used with the computer use tool. - */ - output: ComputerCallOutput.Output; - - /** - * The type of the computer tool call output. Always `computer_call_output`. - */ - type: 'computer_call_output'; - - /** - * The safety checks reported by the API that have been acknowledged by the - * developer. - */ - acknowledged_safety_checks?: Array; - - /** - * The status of the message input. One of `in_progress`, `completed`, or - * `incomplete`. Populated when input items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace ComputerCallOutput { - /** - * A computer screenshot image used with the computer use tool. - */ - export interface Output { - /** - * Specifies the event type. For a computer screenshot, this property is always set - * to `computer_screenshot`. - */ - type: 'computer_screenshot'; - - /** - * The identifier of an uploaded file that contains the screenshot. - */ - file_id?: string; - - /** - * The URL of the screenshot image. - */ - image_url?: string; - } - - /** - * A pending safety check for the computer call. - */ - export interface AcknowledgedSafetyCheck { - /** - * The ID of the pending safety check. - */ - id: string; - - /** - * The type of the pending safety check. - */ - code: string; - - /** - * Details about the pending safety check. - */ - message: string; - } - } - - export interface FunctionCallOutput { - /** - * The unique ID of the function call tool output. - */ - id: string; - - /** - * The unique ID of the function tool call generated by the model. - */ - call_id: string; - - /** - * A JSON string of the output of the function tool call. - */ - output: string; - - /** - * The type of the function tool call output. Always `function_call_output`. - */ - type: 'function_call_output'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } -} - export interface InputItemListParams extends CursorPageParams { /** * An item ID to list items before, used in pagination. @@ -266,12 +80,8 @@ export interface InputItemListParams extends CursorPageParams { order?: 'asc' | 'desc'; } -InputItems.ResponseItemListDataPage = ResponseItemListDataPage; - export declare namespace InputItems { - export { - type ResponseItemList as ResponseItemList, - ResponseItemListDataPage as ResponseItemListDataPage, - type InputItemListParams as InputItemListParams, - }; + export { type ResponseItemList as ResponseItemList, type InputItemListParams as InputItemListParams }; } + +export { ResponseItemsPage }; diff --git a/src/resources/responses/input-items.ts.orig b/src/resources/responses/input-items.ts.orig new file mode 100644 index 000000000..470740b61 --- /dev/null +++ b/src/resources/responses/input-items.ts.orig @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; +import * as ResponsesAPI from './responses'; +import { ResponseItemsPage } from './responses'; +import { type CursorPageParams } from '../../pagination'; + +export class InputItems extends APIResource { + /** + * Returns a list of input items for a given response. + */ + list( + responseId: string, + query?: InputItemListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + responseId: string, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + responseId: string, + query: InputItemListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list(responseId, {}, query); + } + return this._client.getAPIList(`/responses/${responseId}/input_items`, ResponseItemsPage, { + query, + ...options, + }); + } +} + +<<<<<<< HEAD +export class ResponseItemListDataPage extends CursorPage< + // @ts-ignore some items don't necessarily have the `id` property + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput +> {} + +||||||| parent of e5ea4a71 (fix(types): improve responses type names (#1392)) +export class ResponseItemListDataPage extends CursorPage< + | ResponseItemList.Message + | ResponsesAPI.ResponseOutputMessage + | ResponsesAPI.ResponseFileSearchToolCall + | ResponsesAPI.ResponseComputerToolCall + | ResponseItemList.ComputerCallOutput + | ResponsesAPI.ResponseFunctionWebSearch + | ResponsesAPI.ResponseFunctionToolCall + | ResponseItemList.FunctionCallOutput +> {} + +======= +>>>>>>> e5ea4a71 (fix(types): improve responses type names (#1392)) +/** + * A list of Response items. + */ +export interface ResponseItemList { + /** + * A list of items used to generate this response. + */ + data: Array; + + /** + * The ID of the first item in the list. + */ + first_id: string; + + /** + * Whether there are more items available. + */ + has_more: boolean; + + /** + * The ID of the last item in the list. + */ + last_id: string; + + /** + * The type of object returned, must be `list`. + */ + object: 'list'; +} + +export interface InputItemListParams extends CursorPageParams { + /** + * An item ID to list items before, used in pagination. + */ + before?: string; + + /** + * The order to return the input items in. Default is `asc`. + * + * - `asc`: Return the input items in ascending order. + * - `desc`: Return the input items in descending order. + */ + order?: 'asc' | 'desc'; +} + +export declare namespace InputItems { + export { type ResponseItemList as ResponseItemList, type InputItemListParams as InputItemListParams }; +} + +export { ResponseItemsPage }; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 20d67b8ac..b2cd6b56c 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -9,12 +9,13 @@ import { import * as Core from '../../core'; import { APIPromise, isRequestOptions } from '../../core'; import { APIResource } from '../../resource'; -import { Stream } from '../../streaming'; import * as Shared from '../shared'; import * as InputItemsAPI from './input-items'; -import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items'; +import { InputItemListParams, InputItems, ResponseItemList } from './input-items'; import * as ResponsesAPI from './responses'; import { ResponseStream, ResponseStreamParams } from '../../lib/responses/ResponseStream'; +import { CursorPage } from '../../pagination'; +import { Stream } from '../../streaming'; export interface ParsedResponseOutputText extends ResponseOutputText { parsed: ParsedT | null; @@ -137,6 +138,8 @@ export class Responses extends APIResource { } } +export class ResponseItemsPage extends CursorPage {} + /** * A tool that controls a virtual computer. Learn more about the * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). @@ -966,6 +969,83 @@ export namespace ResponseComputerToolCall { } } +export interface ResponseComputerToolCallOutputItem { + /** + * The unique ID of the computer call tool output. + */ + id: string; + + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ResponseComputerToolCallOutputScreenshot; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +export namespace ResponseComputerToolCallOutputItem { + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } +} + +/** + * A computer screenshot image used with the computer use tool. + */ +export interface ResponseComputerToolCallOutputScreenshot { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; +} + /** * Multi-modal input and output contents. */ @@ -1394,6 +1474,46 @@ export interface ResponseFunctionToolCall { status?: 'in_progress' | 'completed' | 'incomplete'; } +/** + * A tool call to run a function. See the + * [function calling guide](https://platform.openai.com/docs/guides/function-calling) + * for more information. + */ +export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { + /** + * The unique ID of the function call tool output. + */ + id: string; +} + +export interface ResponseFunctionToolCallOutputItem { + /** + * The unique ID of the function call tool output. + */ + id: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + /** * The results of a web search tool call. See the * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for @@ -1607,7 +1727,7 @@ export namespace ResponseInputItem { /** * A computer screenshot image used with the computer use tool. */ - output: ComputerCallOutput.Output; + output: ResponsesAPI.ResponseComputerToolCallOutputScreenshot; /** * The type of the computer tool call output. Always `computer_call_output`. @@ -1633,27 +1753,6 @@ export namespace ResponseInputItem { } export namespace ComputerCallOutput { - /** - * A computer screenshot image used with the computer use tool. - */ - export interface Output { - /** - * Specifies the event type. For a computer screenshot, this property is always set - * to `computer_screenshot`. - */ - type: 'computer_screenshot'; - - /** - * The identifier of an uploaded file that contains the screenshot. - */ - file_id?: string; - - /** - * The URL of the screenshot image. - */ - image_url?: string; - } - /** * A pending safety check for the computer call. */ @@ -1729,6 +1828,35 @@ export namespace ResponseInputItem { */ export type ResponseInputMessageContentList = Array; +export interface ResponseInputMessageItem { + /** + * The unique ID of the message input. + */ + id: string; + + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; +} + /** * A text input to the model. */ @@ -1744,6 +1872,19 @@ export interface ResponseInputText { type: 'input_text'; } +/** + * Content item used to generate a response. + */ +export type ResponseItem = + | ResponseInputMessageItem + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseComputerToolCall + | ResponseComputerToolCallOutputItem + | ResponseFunctionWebSearch + | ResponseFunctionToolCallItem + | ResponseFunctionToolCallOutputItem; + /** * An audio output from the model. */ @@ -2722,13 +2863,11 @@ export interface ResponseRetrieveParams { } Responses.InputItems = InputItems; -Responses.ResponseItemListDataPage = ResponseItemListDataPage; export declare namespace Responses { export { InputItems as InputItems, type ResponseItemList as ResponseItemList, - ResponseItemListDataPage as ResponseItemListDataPage, type InputItemListParams as InputItemListParams, }; } From d9277683745a854e52ac165a67840a09049e5077 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 20:48:40 +0000 Subject: [PATCH 252/509] release: 4.87.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0c7a85094..a3649b199 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.87.3" + ".": "4.87.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a595495..d820d8fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.87.4 (2025-03-18) + +Full Changelog: [v4.87.3...v4.87.4](https://github.com/openai/openai-node/compare/v4.87.3...v4.87.4) + +### Bug Fixes + +* **api:** correct some Responses types ([#1391](https://github.com/openai/openai-node/issues/1391)) ([af45876](https://github.com/openai/openai-node/commit/af458766ac721fb6cf18e7d78c458506c8bfc4e1)) +* **types:** ignore missing `id` in responses pagination ([1b9d20e](https://github.com/openai/openai-node/commit/1b9d20e71f5afbd4999f1999fe4810175476c5d2)) +* **types:** improve responses type names ([#1392](https://github.com/openai/openai-node/issues/1392)) ([164f476](https://github.com/openai/openai-node/commit/164f47606b41fd3e2850f8209eb1c6e2996a81ff)) + + +### Chores + +* add missing type alias exports ([#1390](https://github.com/openai/openai-node/issues/1390)) ([16c5e22](https://github.com/openai/openai-node/commit/16c5e2261c8c1a0ba96c2d5f475e8b1bc67387d7)) +* **internal:** add back release workflow ([dddf29b](https://github.com/openai/openai-node/commit/dddf29bd914a02d4586b239ec06217389a4409f9)) +* **internal:** remove CI condition ([#1381](https://github.com/openai/openai-node/issues/1381)) ([ef17981](https://github.com/openai/openai-node/commit/ef17981a0bd6b3e971986ece829c5d260d7392d4)) +* **internal:** run CI on update-specs branch ([9fc2130](https://github.com/openai/openai-node/commit/9fc2130b74a5919a3bbd41926903bdb310de4446)) +* **internal:** update release workflows ([90b77d0](https://github.com/openai/openai-node/commit/90b77d09c04d21487aa38fe775c79ae632136813)) + ## 4.87.3 (2025-03-11) Full Changelog: [v4.87.2...v4.87.3](https://github.com/openai/openai-node/compare/v4.87.2...v4.87.3) diff --git a/jsr.json b/jsr.json index 1051fade0..3e7c40d5f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.87.3", + "version": "4.87.4", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 9967a814d..baddade77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.87.3", + "version": "4.87.4", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index e84192528..172c899ea 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.87.3'; // x-release-please-version +export const VERSION = '4.87.4'; // x-release-please-version From 2e495267329b6853edff76c415e4c5ddc5e143e8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:50:59 +0000 Subject: [PATCH 253/509] chore(internal): version bump (#1393) --- jsr.json.orig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 jsr.json.orig diff --git a/jsr.json.orig b/jsr.json.orig new file mode 100644 index 000000000..c7b99a6f6 --- /dev/null +++ b/jsr.json.orig @@ -0,0 +1,25 @@ +{ + "name": "@openai/openai", +<<<<<<< HEAD + "version": "4.87.4", + "exports": { + ".": "./index.ts", + "./helpers/zod": "./helpers/zod.ts", + "./beta/realtime/websocket": "./beta/realtime/websocket.ts" + }, + "imports": { + "zod": "npm:zod@3" + }, +||||||| parent of 0603bcac (chore(internal): version bump (#1393)) + "version": "4.87.3", + "exports": "./index.ts", +======= + "version": "4.87.4", + "exports": "./index.ts", +>>>>>>> 0603bcac (chore(internal): version bump (#1393)) + "publish": { + "exclude": [ + "!." + ] + } +} From 023d106185abf62f892bff66faf617eb45777004 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:18:34 +0000 Subject: [PATCH 254/509] chore(exports): cleaner resource index imports (#1396) --- src/resources.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/resources.ts diff --git a/src/resources.ts b/src/resources.ts new file mode 100644 index 000000000..b283d5781 --- /dev/null +++ b/src/resources.ts @@ -0,0 +1 @@ +export * from './resources/index'; From 7c3d212b47ee3090f5bbb82dd21026ba532da6e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:28:57 +0000 Subject: [PATCH 255/509] chore(exports): stop using path fallbacks (#1397) --- package.json | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index baddade77..ac540cf0e 100644 --- a/package.json +++ b/package.json @@ -112,38 +112,17 @@ "default": "./dist/index.mjs" }, "./*.mjs": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "default": [ - "./dist/*.mjs", - "./dist/*/index.mjs" - ] + "types": "./dist/*.d.ts", + "default": "./dist/*.mjs" }, "./*.js": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "default": [ - "./dist/*.js", - "./dist/*/index.js" - ] + "types": "./dist/*.d.ts", + "default": "./dist/*.js" }, "./*": { - "types": [ - "./dist/*.d.ts", - "./dist/*/index.d.ts" - ], - "require": [ - "./dist/*.js", - "./dist/*/index.js" - ], - "default": [ - "./dist/*.mjs", - "./dist/*/index.mjs" - ] + "types": "./dist/*.d.ts", + "require": "./dist/*.js", + "default": "./dist/*.mjs" } }, "bin": "./bin/cli", From aefd2675154ff848032a7fec856f0db6ed2ad629 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:35:03 +0000 Subject: [PATCH 256/509] feat(api): o1-pro now available through the API (#1398) --- .stats.yml | 2 +- api.md | 2 ++ src/index.ts | 2 ++ src/resources/responses/responses.ts | 6 +++--- src/resources/shared.ts | 27 ++++++++++++++++++++++----- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.stats.yml b/.stats.yml index b03256223..e0b06dc22 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f3bce04386c4fcfd5037e0477fbaa39010003fd1558eb5185fe4a71dd6a05fdd.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b26121d5df6eb5d3032a45a267473798b15fcfec76dd44a3256cf1238be05fa4.yml diff --git a/api.md b/api.md index fd8482bf2..9b3aec141 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ Types: +- AllModels - ChatModel - ComparisonFilter - CompoundFilter @@ -14,6 +15,7 @@ Types: - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText +- ResponsesModel # Completions diff --git a/src/index.ts b/src/index.ts index 34cc3e84d..931894f2f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -508,6 +508,7 @@ export declare namespace OpenAI { export { Responses as Responses }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; @@ -520,6 +521,7 @@ export declare namespace OpenAI { export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; export type ResponseFormatText = API.ResponseFormatText; + export type ResponsesModel = API.ResponsesModel; } // ---------------------- Azure ---------------------- diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index b2cd6b56c..b90d415bd 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -327,7 +327,7 @@ export interface Response { * [model guide](https://platform.openai.com/docs/models) to browse and compare * available models. */ - model: (string & {}) | Shared.ChatModel; + model: Shared.ResponsesModel; /** * The object type of this resource - always set to `response`. @@ -1481,7 +1481,7 @@ export interface ResponseFunctionToolCall { */ export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { /** - * The unique ID of the function call tool output. + * The unique ID of the function tool call. */ id: string; } @@ -2679,7 +2679,7 @@ export interface ResponseCreateParamsBase { * [model guide](https://platform.openai.com/docs/models) to browse and compare * available models. */ - model: (string & {}) | Shared.ChatModel; + model: Shared.ResponsesModel; /** * Specify additional output data to include in the model response. Currently diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 5fbdbba6a..2c0fb1c32 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export type AllModels = + | string + | ChatModel + | string + | ChatModel + | 'o1-pro' + | 'o1-pro-2025-03-19' + | 'computer-use-preview' + | 'computer-use-preview-2025-03-11'; + export type ChatModel = | 'o3-mini' | 'o3-mini-2025-01-31' @@ -9,11 +19,6 @@ export type ChatModel = | 'o1-preview-2024-09-12' | 'o1-mini' | 'o1-mini-2024-09-12' - | 'computer-use-preview' - | 'computer-use-preview-2025-02-04' - | 'computer-use-preview-2025-03-11' - | 'gpt-4.5-preview' - | 'gpt-4.5-preview-2025-02-27' | 'gpt-4o' | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' @@ -23,6 +28,10 @@ export type ChatModel = | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' + | 'gpt-4o-search-preview' + | 'gpt-4o-mini-search-preview' + | 'gpt-4o-search-preview-2025-03-11' + | 'gpt-4o-mini-search-preview-2025-03-11' | 'chatgpt-4o-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' @@ -265,3 +274,11 @@ export interface ResponseFormatText { */ type: 'text'; } + +export type ResponsesModel = + | (string & {}) + | ChatModel + | 'o1-pro' + | 'o1-pro-2025-03-19' + | 'computer-use-preview' + | 'computer-use-preview-2025-03-11'; From 20e97a4373711f0380f488477c3888e90d7134ac Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:04:38 +0000 Subject: [PATCH 257/509] release: 4.88.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a3649b199..424ace296 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.87.4" + ".": "4.88.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d820d8fcd..e2a73af85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.88.0 (2025-03-19) + +Full Changelog: [v4.87.4...v4.88.0](https://github.com/openai/openai-node/compare/v4.87.4...v4.88.0) + +### Features + +* **api:** o1-pro now available through the API ([#1398](https://github.com/openai/openai-node/issues/1398)) ([616a7e9](https://github.com/openai/openai-node/commit/616a7e90e764882cd749a65af8cc6ae8734fc80d)) + + +### Chores + +* **exports:** cleaner resource index imports ([#1396](https://github.com/openai/openai-node/issues/1396)) ([26b0856](https://github.com/openai/openai-node/commit/26b0856cd63846c34b75895a1ea42ceec7908c1a)) +* **exports:** stop using path fallbacks ([#1397](https://github.com/openai/openai-node/issues/1397)) ([d1479c2](https://github.com/openai/openai-node/commit/d1479c23aff68dd46c73fd31896dd2298a6bf140)) +* **internal:** version bump ([#1393](https://github.com/openai/openai-node/issues/1393)) ([7f16c3a](https://github.com/openai/openai-node/commit/7f16c3aa7b1ab36541219c5a0f93fc518733d0e3)) + ## 4.87.4 (2025-03-18) Full Changelog: [v4.87.3...v4.87.4](https://github.com/openai/openai-node/compare/v4.87.3...v4.87.4) diff --git a/jsr.json b/jsr.json index 3e7c40d5f..ed87ee6d0 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.87.4", + "version": "4.88.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index ac540cf0e..471fafc31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.87.4", + "version": "4.88.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 172c899ea..c56dab45e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.87.4'; // x-release-please-version +export const VERSION = '4.88.0'; // x-release-please-version From d11b13cdf5412f03e551365297a27e610a36edda Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:13:23 +0000 Subject: [PATCH 258/509] feat(api): new models for TTS, STT, + new audio features for Realtime (#1407) --- .stats.yml | 4 +- api.md | 18 + src/resources/audio/audio.ts | 17 +- src/resources/audio/index.ts | 6 + src/resources/audio/speech.ts | 10 +- src/resources/audio/transcriptions.ts | 224 +++++++- src/resources/audio/translations.ts | 2 +- src/resources/beta/realtime/index.ts | 5 + src/resources/beta/realtime/realtime.ts | 522 ++++++++++++++++-- src/resources/beta/realtime/sessions.ts | 236 ++++++-- .../beta/realtime/transcription-sessions.ts | 308 +++++++++++ src/resources/chat/completions/completions.ts | 2 +- tests/api-resources/audio/speech.test.ts | 1 + .../audio/transcriptions.test.ts | 6 +- .../realtime/transcription-sessions.test.ts | 22 + 15 files changed, 1247 insertions(+), 136 deletions(-) create mode 100644 src/resources/beta/realtime/transcription-sessions.ts create mode 100644 tests/api-resources/beta/realtime/transcription-sessions.test.ts diff --git a/.stats.yml b/.stats.yml index e0b06dc22..abb937131 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b26121d5df6eb5d3032a45a267473798b15fcfec76dd44a3256cf1238be05fa4.yml +configured_endpoints: 82 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c22f59c66aec7914b6ee653d3098d1c1c8c16c180d2a158e819c8ddbf476f74b.yml diff --git a/api.md b/api.md index 9b3aec141..cf464cf63 100644 --- a/api.md +++ b/api.md @@ -142,7 +142,11 @@ Types: Types: - Transcription +- TranscriptionInclude - TranscriptionSegment +- TranscriptionStreamEvent +- TranscriptionTextDeltaEvent +- TranscriptionTextDoneEvent - TranscriptionVerbose - TranscriptionWord - TranscriptionCreateResponse @@ -306,7 +310,9 @@ Types: - ConversationItemDeleteEvent - ConversationItemDeletedEvent - ConversationItemInputAudioTranscriptionCompletedEvent +- ConversationItemInputAudioTranscriptionDeltaEvent - ConversationItemInputAudioTranscriptionFailedEvent +- ConversationItemRetrieveEvent - ConversationItemTruncateEvent - ConversationItemTruncatedEvent - ConversationItemWithReference @@ -343,6 +349,8 @@ Types: - SessionCreatedEvent - SessionUpdateEvent - SessionUpdatedEvent +- TranscriptionSessionUpdate +- TranscriptionSessionUpdatedEvent ### Sessions @@ -355,6 +363,16 @@ Methods: - client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse +### TranscriptionSessions + +Types: + +- TranscriptionSession + +Methods: + +- client.beta.realtime.transcriptionSessions.create({ ...params }) -> TranscriptionSession + ## Assistants Types: diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index b9a7ad4f8..071fe5929 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -7,8 +7,14 @@ import * as TranscriptionsAPI from './transcriptions'; import { Transcription, TranscriptionCreateParams, + TranscriptionCreateParamsNonStreaming, + TranscriptionCreateParamsStreaming, TranscriptionCreateResponse, + TranscriptionInclude, TranscriptionSegment, + TranscriptionStreamEvent, + TranscriptionTextDeltaEvent, + TranscriptionTextDoneEvent, TranscriptionVerbose, TranscriptionWord, Transcriptions, @@ -28,11 +34,12 @@ export class Audio extends APIResource { speech: SpeechAPI.Speech = new SpeechAPI.Speech(this._client); } -export type AudioModel = 'whisper-1'; +export type AudioModel = 'whisper-1' | 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe'; /** * The format of the output, in one of these options: `json`, `text`, `srt`, - * `verbose_json`, or `vtt`. + * `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, + * the only supported format is `json`. */ export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; @@ -46,11 +53,17 @@ export declare namespace Audio { export { Transcriptions as Transcriptions, type Transcription as Transcription, + type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, + type TranscriptionStreamEvent as TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, }; export { diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index 2bbe9e3ab..deed39ede 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -5,11 +5,17 @@ export { Speech, type SpeechModel, type SpeechCreateParams } from './speech'; export { Transcriptions, type Transcription, + type TranscriptionInclude, type TranscriptionSegment, + type TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent, type TranscriptionVerbose, type TranscriptionWord, type TranscriptionCreateResponse, type TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming, } from './transcriptions'; export { Translations, diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 35e82c4c1..4324028d5 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -18,7 +18,7 @@ export class Speech extends APIResource { } } -export type SpeechModel = 'tts-1' | 'tts-1-hd'; +export type SpeechModel = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts'; export interface SpeechCreateParams { /** @@ -28,7 +28,7 @@ export interface SpeechCreateParams { /** * One of the available [TTS models](https://platform.openai.com/docs/models#tts): - * `tts-1` or `tts-1-hd` + * `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`. */ model: (string & {}) | SpeechModel; @@ -40,6 +40,12 @@ export interface SpeechCreateParams { */ voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; + /** + * Control the voice of your generated audio with additional instructions. Does not + * work with `tts-1` or `tts-1-hd`. + */ + instructions?: string; + /** * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, * `wav`, and `pcm`. diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 6fbe96b58..7f797c709 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -2,29 +2,42 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import * as TranscriptionsAPI from './transcriptions'; import * as AudioAPI from './audio'; +import { Stream } from '../../streaming'; export class Transcriptions extends APIResource { /** * Transcribes audio into the input language. */ create( - body: TranscriptionCreateParams<'json' | undefined>, + body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, options?: Core.RequestOptions, ): Core.APIPromise; create( - body: TranscriptionCreateParams<'verbose_json'>, + body: TranscriptionCreateParamsNonStreaming<'verbose_json'>, options?: Core.RequestOptions, ): Core.APIPromise; create( - body: TranscriptionCreateParams<'srt' | 'vtt' | 'text'>, + body: TranscriptionCreateParamsNonStreaming<'srt' | 'vtt' | 'text'>, options?: Core.RequestOptions, ): Core.APIPromise; - create(body: TranscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise; + create( + body: TranscriptionCreateParamsNonStreaming, + options?: Core.RequestOptions, + ): Core.APIPromise; + create( + body: TranscriptionCreateParamsStreaming, + options?: Core.RequestOptions, + ): Core.APIPromise>; + create( + body: TranscriptionCreateParamsStreaming, + options?: Core.RequestOptions, + ): Core.APIPromise>; create( body: TranscriptionCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise> { return this._client.post( '/audio/transcriptions', Core.multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }), @@ -41,8 +54,36 @@ export interface Transcription { * The transcribed text. */ text: string; + + /** + * The log probabilities of the tokens in the transcription. Only returned with the + * models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added + * to the `include` array. + */ + logprobs?: Array; } +export namespace Transcription { + export interface Logprob { + /** + * The token in the transcription. + */ + token?: string; + + /** + * The bytes of the token. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } +} + +export type TranscriptionInclude = 'logprobs'; + export interface TranscriptionSegment { /** * Unique identifier of the segment. @@ -98,6 +139,103 @@ export interface TranscriptionSegment { tokens: Array; } +/** + * Emitted when there is an additional text delta. This is also the first event + * emitted when the transcription starts. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export type TranscriptionStreamEvent = TranscriptionTextDeltaEvent | TranscriptionTextDoneEvent; + +/** + * Emitted when there is an additional text delta. This is also the first event + * emitted when the transcription starts. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export interface TranscriptionTextDeltaEvent { + /** + * The text delta that was additionally transcribed. + */ + delta: string; + + /** + * The type of the event. Always `transcript.text.delta`. + */ + type: 'transcript.text.delta'; + + /** + * The log probabilities of the delta. Only included if you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `include[]` parameter set to `logprobs`. + */ + logprobs?: Array; +} + +export namespace TranscriptionTextDeltaEvent { + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token?: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } +} + +/** + * Emitted when the transcription is complete. Contains the complete transcription + * text. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export interface TranscriptionTextDoneEvent { + /** + * The text that was transcribed. + */ + text: string; + + /** + * The type of the event. Always `transcript.text.done`. + */ + type: 'transcript.text.done'; + + /** + * The log probabilities of the individual tokens in the transcription. Only + * included if you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `include[]` parameter set to `logprobs`. + */ + logprobs?: Array; +} + +export namespace TranscriptionTextDoneEvent { + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token?: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } +} + /** * Represents a verbose json transcription response returned by model, based on the * provided input. @@ -152,7 +290,11 @@ export interface TranscriptionWord { */ export type TranscriptionCreateResponse = Transcription | TranscriptionVerbose; -export interface TranscriptionCreateParams< +export type TranscriptionCreateParams< + ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, +> = TranscriptionCreateParamsNonStreaming | TranscriptionCreateParamsStreaming; + +export interface TranscriptionCreateParamsBase< ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, > { /** @@ -162,11 +304,21 @@ export interface TranscriptionCreateParams< file: Core.Uploadable; /** - * ID of the model to use. Only `whisper-1` (which is powered by our open source - * Whisper V2 model) is currently available. + * ID of the model to use. The options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source + * Whisper V2 model). */ model: (string & {}) | AudioAPI.AudioModel; + /** + * Additional information to include in the transcription response. `logprobs` will + * return the log probabilities of the tokens in the response to understand the + * model's confidence in the transcription. `logprobs` only works with + * response_format set to `json` and only with the models `gpt-4o-transcribe` and + * `gpt-4o-mini-transcribe`. + */ + include?: Array; + /** * 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`) @@ -184,10 +336,23 @@ export interface TranscriptionCreateParams< /** * The format of the output, in one of these options: `json`, `text`, `srt`, - * `verbose_json`, or `vtt`. + * `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, + * the only supported format is `json`. */ response_format?: ResponseFormat; + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream?: boolean | null; + /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the * output more random, while lower values like 0.2 will make it more focused and @@ -207,13 +372,54 @@ export interface TranscriptionCreateParams< timestamp_granularities?: Array<'word' | 'segment'>; } +export namespace TranscriptionCreateParams { + export type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming; + export type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming; +} + +export interface TranscriptionCreateParamsNonStreaming< + ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, +> extends TranscriptionCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream?: false | null; +} + +export interface TranscriptionCreateParamsStreaming extends TranscriptionCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream: true; +} + export declare namespace Transcriptions { export { type Transcription as Transcription, + type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, + type TranscriptionStreamEvent as TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, }; } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index dac519ede..df312f876 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -88,7 +88,7 @@ export interface TranslationCreateParams< * The format of the output, in one of these options: `json`, `text`, `srt`, * `verbose_json`, or `vtt`. */ - response_format?: ResponseFormat; + response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the diff --git a/src/resources/beta/realtime/index.ts b/src/resources/beta/realtime/index.ts index 66c3ecaae..ba51d8a66 100644 --- a/src/resources/beta/realtime/index.ts +++ b/src/resources/beta/realtime/index.ts @@ -2,3 +2,8 @@ export { Realtime } from './realtime'; export { Sessions, type Session, type SessionCreateResponse, type SessionCreateParams } from './sessions'; +export { + TranscriptionSessions, + type TranscriptionSession, + type TranscriptionSessionCreateParams, +} from './transcription-sessions'; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5e2b1c833..d0a74840b 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -10,9 +10,17 @@ import { SessionCreateResponse, Sessions, } from './sessions'; +import * as TranscriptionSessionsAPI from './transcription-sessions'; +import { + TranscriptionSession, + TranscriptionSessionCreateParams, + TranscriptionSessions, +} from './transcription-sessions'; export class Realtime extends APIResource { sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client); + transcriptionSessions: TranscriptionSessionsAPI.TranscriptionSessions = + new TranscriptionSessionsAPI.TranscriptionSessions(this._client); } /** @@ -300,6 +308,91 @@ export interface ConversationItemInputAudioTranscriptionCompletedEvent { * The event type, must be `conversation.item.input_audio_transcription.completed`. */ type: 'conversation.item.input_audio_transcription.completed'; + + /** + * The log probabilities of the transcription. + */ + logprobs?: Array | null; +} + +export namespace ConversationItemInputAudioTranscriptionCompletedEvent { + /** + * A log probability object. + */ + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes: Array; + + /** + * The log probability of the token. + */ + logprob: number; + } +} + +/** + * Returned when the text value of an input audio transcription content part is + * updated. + */ +export interface ConversationItemInputAudioTranscriptionDeltaEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.delta`. + */ + type: 'conversation.item.input_audio_transcription.delta'; + + /** + * The index of the content part in the item's content array. + */ + content_index?: number; + + /** + * The text delta. + */ + delta?: string; + + /** + * The log probabilities of the transcription. + */ + logprobs?: Array | null; +} + +export namespace ConversationItemInputAudioTranscriptionDeltaEvent { + /** + * A log probability object. + */ + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes: Array; + + /** + * The log probability of the token. + */ + logprob: number; + } } /** @@ -361,6 +454,30 @@ export namespace ConversationItemInputAudioTranscriptionFailedEvent { } } +/** + * Send this event when you want to retrieve the server's representation of a + * specific item in the conversation history. This is useful, for example, to + * inspect user audio after noise cancellation and VAD. The server will respond + * with a `conversation.item.retrieved` event, unless the item does not exist in + * the conversation history, in which case the server will respond with an error. + */ +export interface ConversationItemRetrieveEvent { + /** + * The ID of the item to retrieve. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.retrieve`. + */ + type: 'conversation.item.retrieve'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + /** * Send this event to truncate a previous assistant message’s audio. The server * will produce audio faster than realtime, so this event is useful when the user @@ -789,18 +906,20 @@ export namespace RateLimitsUpdatedEvent { } /** - * All events that the client can send to the Realtime API + * A realtime client event. */ export type RealtimeClientEvent = - | SessionUpdateEvent - | InputAudioBufferAppendEvent - | InputAudioBufferCommitEvent - | InputAudioBufferClearEvent | ConversationItemCreateEvent - | ConversationItemTruncateEvent | ConversationItemDeleteEvent + | ConversationItemRetrieveEvent + | ConversationItemTruncateEvent + | InputAudioBufferAppendEvent + | InputAudioBufferClearEvent + | InputAudioBufferCommitEvent + | ResponseCancelEvent | ResponseCreateEvent - | ResponseCancelEvent; + | SessionUpdateEvent + | TranscriptionSessionUpdate; /** * The response resource. @@ -1009,37 +1128,63 @@ export namespace RealtimeResponseUsage { } /** - * All events that the Realtime API can send back + * A realtime server event. */ export type RealtimeServerEvent = - | ErrorEvent - | SessionCreatedEvent - | SessionUpdatedEvent | ConversationCreatedEvent - | InputAudioBufferCommittedEvent - | InputAudioBufferClearedEvent - | InputAudioBufferSpeechStartedEvent - | InputAudioBufferSpeechStoppedEvent | ConversationItemCreatedEvent + | ConversationItemDeletedEvent | ConversationItemInputAudioTranscriptionCompletedEvent + | ConversationItemInputAudioTranscriptionDeltaEvent | ConversationItemInputAudioTranscriptionFailedEvent + | RealtimeServerEvent.ConversationItemRetrieved | ConversationItemTruncatedEvent - | ConversationItemDeletedEvent + | ErrorEvent + | InputAudioBufferClearedEvent + | InputAudioBufferCommittedEvent + | InputAudioBufferSpeechStartedEvent + | InputAudioBufferSpeechStoppedEvent + | RateLimitsUpdatedEvent + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent | ResponseCreatedEvent | ResponseDoneEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent - | ResponseContentPartAddedEvent - | ResponseContentPartDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent - | ResponseAudioTranscriptDeltaEvent - | ResponseAudioTranscriptDoneEvent - | ResponseAudioDeltaEvent - | ResponseAudioDoneEvent - | ResponseFunctionCallArgumentsDeltaEvent - | ResponseFunctionCallArgumentsDoneEvent - | RateLimitsUpdatedEvent; + | SessionCreatedEvent + | SessionUpdatedEvent + | TranscriptionSessionUpdatedEvent; + +export namespace RealtimeServerEvent { + /** + * Returned when a conversation item is retrieved with + * `conversation.item.retrieve`. + */ + export interface ConversationItemRetrieved { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: RealtimeAPI.ConversationItem; + + /** + * The event type, must be `conversation.item.retrieved`. + */ + type: 'conversation.item.retrieved'; + } +} /** * Returned when the model-generated audio is updated. @@ -1834,15 +1979,24 @@ export namespace SessionUpdateEvent { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: Session.InputAudioTranscription; @@ -1891,7 +2045,8 @@ export namespace SessionUpdateEvent { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -1907,9 +2062,16 @@ export namespace SessionUpdateEvent { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ turn_detection?: Session.TurnDetection; @@ -1922,15 +2084,31 @@ export namespace SessionUpdateEvent { } export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** @@ -1941,16 +2119,17 @@ export namespace SessionUpdateEvent { language?: string; /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * The model to use for transcription, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ 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. + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". */ prompt?: string; } @@ -1979,48 +2158,62 @@ export namespace SessionUpdateEvent { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: string; + type?: 'server_vad' | 'semantic_vad'; } } } @@ -2046,7 +2239,216 @@ export interface SessionUpdatedEvent { type: 'session.updated'; } +/** + * Send this event to update a transcription session. + */ +export interface TranscriptionSessionUpdate { + /** + * Realtime transcription session object configuration. + */ + session: TranscriptionSessionUpdate.Session; + + /** + * The event type, must be `transcription_session.update`. + */ + type: 'transcription_session.update'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +export namespace TranscriptionSessionUpdate { + /** + * Realtime transcription session object configuration. + */ + export interface Session { + /** + * The set of items to include in the transcription. Current available items are: + * + * - `item.input_audio_transcription.logprobs` + */ + include?: Array; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + turn_detection?: Session.TurnDetection; + } + + export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; + } + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. + */ + create_response?: boolean; + + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. + */ + interrupt_response?: boolean; + + /** + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection. + */ + type?: 'server_vad' | 'semantic_vad'; + } + } +} + +/** + * Returned when a transcription session is updated with a + * `transcription_session.update` event, unless there is an error. + */ +export interface TranscriptionSessionUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * A new Realtime transcription session configuration. + * + * When a session is created on the server via REST API, the session object also + * contains an ephemeral key. Default TTL for keys is one minute. This property is + * not present when a session is updated via the WebSocket API. + */ + session: TranscriptionSessionsAPI.TranscriptionSession; + + /** + * The event type, must be `transcription_session.updated`. + */ + type: 'transcription_session.updated'; +} + Realtime.Sessions = Sessions; +Realtime.TranscriptionSessions = TranscriptionSessions; export declare namespace Realtime { export { @@ -2055,4 +2457,10 @@ export declare namespace Realtime { type SessionCreateResponse as SessionCreateResponse, type SessionCreateParams as SessionCreateParams, }; + + export { + TranscriptionSessions as TranscriptionSessions, + type TranscriptionSession as TranscriptionSession, + type TranscriptionSessionCreateParams as TranscriptionSessionCreateParams, + }; } diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index a99c9e045..bae50124e 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -27,7 +27,7 @@ export class Sessions extends APIResource { */ export interface Session { /** - * Unique identifier for the session object. + * Unique identifier for the session that looks like `sess_1234567890abcdef`. */ id?: string; @@ -38,12 +38,24 @@ export interface Session { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + /** * 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 + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: Session.InputAudioTranscription; @@ -79,7 +91,6 @@ export interface Session { * The Realtime model used for this session. */ model?: - | (string & {}) | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' @@ -93,7 +104,8 @@ export interface Session { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -109,11 +121,18 @@ export interface Session { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ - turn_detection?: Session.TurnDetection | null; + turn_detection?: Session.TurnDetection; /** * The voice the model uses to respond. Voice cannot be changed during the session @@ -124,19 +143,54 @@ export interface Session { } export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ model?: string; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; } export interface Tool { @@ -163,48 +217,62 @@ export namespace Session { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: 'server_vad'; + type?: 'server_vad' | 'semantic_vad'; } } @@ -394,15 +462,24 @@ export interface SessionCreateParams { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: SessionCreateParams.InputAudioNoiseReduction; + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: SessionCreateParams.InputAudioTranscription; @@ -451,7 +528,8 @@ export interface SessionCreateParams { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -467,9 +545,16 @@ export interface SessionCreateParams { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ turn_detection?: SessionCreateParams.TurnDetection; @@ -482,15 +567,31 @@ export interface SessionCreateParams { } export namespace SessionCreateParams { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** @@ -501,16 +602,17 @@ export namespace SessionCreateParams { language?: string; /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * The model to use for transcription, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ 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. + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". */ prompt?: string; } @@ -539,48 +641,62 @@ export namespace SessionCreateParams { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: string; + type?: 'server_vad' | 'semantic_vad'; } } diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts new file mode 100644 index 000000000..d749f8502 --- /dev/null +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -0,0 +1,308 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class TranscriptionSessions extends APIResource { + /** + * Create an ephemeral API token for use in client-side applications with the + * Realtime API specifically for realtime transcriptions. Can be configured with + * the same session parameters as the `transcription_session.update` client event. + * + * It responds with a session object, plus a `client_secret` key which contains a + * usable ephemeral API token that can be used to authenticate browser clients for + * the Realtime API. + */ + create( + body: TranscriptionSessionCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/realtime/transcription_sessions', { + body, + ...options, + headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers }, + }); + } +} + +/** + * A new Realtime transcription session configuration. + * + * When a session is created on the server via REST API, the session object also + * contains an ephemeral key. Default TTL for keys is one minute. This property is + * not present when a session is updated via the WebSocket API. + */ +export interface TranscriptionSession { + /** + * Ephemeral key returned by the API. Only present when the session is created on + * the server via REST API. + */ + client_secret: TranscriptionSession.ClientSecret; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: string; + + /** + * Configuration of the transcription model. + */ + input_audio_transcription?: TranscriptionSession.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: TranscriptionSession.TurnDetection; +} + +export namespace TranscriptionSession { + /** + * Ephemeral key returned by the API. Only present when the session is created on + * the server via REST API. + */ + export interface ClientSecret { + /** + * Timestamp for when the token expires. Currently, all tokens expire after one + * minute. + */ + 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; + } + + /** + * Configuration of the transcription model. + */ + 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. Can be `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, or `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * 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; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export interface TranscriptionSessionCreateParams { + /** + * The set of items to include in the transcription. Current available items are: + * + * - `item.input_audio_transcription.logprobs` + */ + include?: Array; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: TranscriptionSessionCreateParams.InputAudioNoiseReduction; + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + input_audio_transcription?: TranscriptionSessionCreateParams.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + turn_detection?: TranscriptionSessionCreateParams.TurnDetection; +} + +export namespace TranscriptionSessionCreateParams { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; + } + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. + */ + create_response?: boolean; + + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. + */ + interrupt_response?: boolean; + + /** + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection. + */ + type?: 'server_vad' | 'semantic_vad'; + } +} + +export declare namespace TranscriptionSessions { + export { + type TranscriptionSession as TranscriptionSession, + type TranscriptionSessionCreateParams as TranscriptionSessionCreateParams, + }; +} diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index f54c01597..08bf7f8db 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -383,7 +383,7 @@ export interface ChatCompletionChunk { * **NOTE:** If the stream is interrupted or cancelled, you may not receive the * final usage chunk which contains the total token usage for the request. */ - usage?: CompletionsAPI.CompletionUsage; + usage?: CompletionsAPI.CompletionUsage | null; } export namespace ChatCompletionChunk { diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index 904d75e5d..cbec6cfac 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -14,6 +14,7 @@ describe('resource speech', () => { input: 'input', model: 'string', voice: 'alloy', + instructions: 'instructions', response_format: 'mp3', speed: 0.25, }); diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 86ef5e576..2297677b4 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -12,7 +12,7 @@ describe('resource transcriptions', () => { test('create: only required params', async () => { const responsePromise = client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'whisper-1', + model: 'gpt-4o-transcribe', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -26,10 +26,12 @@ describe('resource transcriptions', () => { test('create: required and optional params', async () => { const response = await client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'whisper-1', + model: 'gpt-4o-transcribe', + include: ['logprobs'], language: 'language', prompt: 'prompt', response_format: 'json', + stream: false, temperature: 0, timestamp_granularities: ['word'], }); diff --git a/tests/api-resources/beta/realtime/transcription-sessions.test.ts b/tests/api-resources/beta/realtime/transcription-sessions.test.ts new file mode 100644 index 000000000..d52ce2403 --- /dev/null +++ b/tests/api-resources/beta/realtime/transcription-sessions.test.ts @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource transcriptionSessions', () => { + test('create', async () => { + const responsePromise = client.beta.realtime.transcriptionSessions.create({}); + 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); + }); +}); From ec5067deba1fe4202d90db42e45c3bd774936af1 Mon Sep 17 00:00:00 2001 From: Kevin Whinnery Date: Thu, 20 Mar 2025 11:34:48 -0500 Subject: [PATCH 259/509] feat: add audio helpers --- examples/speech-to-text.ts | 19 +++++ examples/text-to-speech.ts | 23 ++++++ src/helpers/audio.ts | 145 +++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 examples/speech-to-text.ts create mode 100644 examples/text-to-speech.ts create mode 100644 src/helpers/audio.ts diff --git a/examples/speech-to-text.ts b/examples/speech-to-text.ts new file mode 100644 index 000000000..f2eb60b4d --- /dev/null +++ b/examples/speech-to-text.ts @@ -0,0 +1,19 @@ +import OpenAI from 'openai'; +import { recordAudio } from 'openai/helpers/audio'; + +const openai = new OpenAI(); + +async function main(): Promise { + console.log('Recording for 5 seconds...'); + const response = await recordAudio({ timeout: 5000, device: 4 }); + + console.log('Transcribing...'); + const transcription = await openai.audio.transcriptions.create({ + file: response, + model: 'whisper-1', + }); + + console.log(transcription.text); +} + +main().catch(console.error); diff --git a/examples/text-to-speech.ts b/examples/text-to-speech.ts new file mode 100644 index 000000000..5a87adf91 --- /dev/null +++ b/examples/text-to-speech.ts @@ -0,0 +1,23 @@ +import OpenAI from 'openai'; +import { playAudio } from 'openai/helpers/audio'; + +const openai = new OpenAI(); + +const exampleText = ` +I see skies of blue and clouds of white +The bright blessed days, the dark sacred nights +And I think to myself +What a wonderful world +`.trim(); + +async function main(): Promise { + const response = await openai.audio.speech.create({ + model: 'tts-1', + voice: 'nova', + input: exampleText, + }); + + await playAudio(response); +} + +main().catch(console.error); diff --git a/src/helpers/audio.ts b/src/helpers/audio.ts new file mode 100644 index 000000000..f1a6ea371 --- /dev/null +++ b/src/helpers/audio.ts @@ -0,0 +1,145 @@ +import { File } from 'formdata-node'; +import { spawn } from 'node:child_process'; +import { Readable } from 'node:stream'; +import { platform, versions } from 'node:process'; +import { Response } from 'openai/_shims'; + +const DEFAULT_SAMPLE_RATE = 24000; +const DEFAULT_CHANNELS = 1; + +const isNode = Boolean(versions?.node); + +const recordingProviders: Record = { + win32: 'dshow', + darwin: 'avfoundation', + linux: 'alsa', + aix: 'alsa', + android: 'alsa', + freebsd: 'alsa', + haiku: 'alsa', + sunos: 'alsa', + netbsd: 'alsa', + openbsd: 'alsa', + cygwin: 'dshow', +}; + +function isResponse(stream: NodeJS.ReadableStream | Response | File): stream is Response { + return typeof (stream as any).body !== 'undefined'; +} + +function isFile(stream: NodeJS.ReadableStream | Response | File): stream is File { + return stream instanceof File; +} + +async function nodejsPlayAudio(stream: NodeJS.ReadableStream | Response | File): Promise { + return new Promise((resolve, reject) => { + try { + const ffplay = spawn('ffplay', ['-autoexit', '-nodisp', '-i', 'pipe:0']); + + if (isResponse(stream)) { + stream.body.pipe(ffplay.stdin); + } else if (isFile(stream)) { + Readable.from(stream.stream()).pipe(ffplay.stdin); + } else { + stream.pipe(ffplay.stdin); + } + + ffplay.on('close', (code: number) => { + if (code !== 0) { + reject(new Error(`ffplay process exited with code ${code}`)); + } + resolve(); + }); + } catch (error) { + reject(error); + } + }); +} + +export async function playAudio(input: NodeJS.ReadableStream | Response | File): Promise { + if (isNode) { + return nodejsPlayAudio(input); + } + + throw new Error( + 'Play audio is not supported in the browser yet. Check out https://npm.im/wavtools as an alternative.', + ); +} + +type RecordAudioOptions = { + signal?: AbortSignal; + device?: number; + timeout?: number; +}; + +function nodejsRecordAudio({ signal, device, timeout }: RecordAudioOptions = {}): Promise { + return new Promise((resolve, reject) => { + const data: any[] = []; + const provider = recordingProviders[platform]; + try { + const ffmpeg = spawn( + 'ffmpeg', + [ + '-f', + provider, + '-i', + `:${device ?? 0}`, // default audio input device; adjust as needed + '-ar', + DEFAULT_SAMPLE_RATE.toString(), + '-ac', + DEFAULT_CHANNELS.toString(), + '-f', + 'wav', + 'pipe:1', + ], + { + stdio: ['ignore', 'pipe', 'pipe'], + }, + ); + + ffmpeg.stdout.on('data', (chunk) => { + data.push(chunk); + }); + + ffmpeg.on('error', (error) => { + console.error(error); + reject(error); + }); + + ffmpeg.on('close', (code) => { + returnData(); + }); + + function returnData() { + const audioBuffer = Buffer.concat(data); + const audioFile = new File([audioBuffer], 'audio.wav', { type: 'audio/wav' }); + resolve(audioFile); + } + + if (typeof timeout === 'number' && timeout > 0) { + const internalSignal = AbortSignal.timeout(timeout); + internalSignal.addEventListener('abort', () => { + ffmpeg.kill('SIGTERM'); + }); + } + + if (signal) { + signal.addEventListener('abort', () => { + ffmpeg.kill('SIGTERM'); + }); + } + } catch (error) { + reject(error); + } + }); +} + +export async function recordAudio(options: RecordAudioOptions = {}) { + if (isNode) { + return nodejsRecordAudio(options); + } + + throw new Error( + 'Record audio is not supported in the browser. Check out https://npm.im/wavtools as an alternative.', + ); +} From 4b0d0392cc030e33d3889dfd42382c66df5910da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:35:21 +0000 Subject: [PATCH 260/509] release: 4.89.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 424ace296..c77dd18b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.88.0" + ".": "4.89.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e2a73af85..4597d6e56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.89.0 (2025-03-20) + +Full Changelog: [v4.88.0...v4.89.0](https://github.com/openai/openai-node/compare/v4.88.0...v4.89.0) + +### Features + +* add audio helpers ([ea1b6b4](https://github.com/openai/openai-node/commit/ea1b6b4ef38813af568b3662037519da9404b80e)) +* **api:** new models for TTS, STT, + new audio features for Realtime ([#1407](https://github.com/openai/openai-node/issues/1407)) ([142933a](https://github.com/openai/openai-node/commit/142933ae70d06045dbf4661cd72c7fa35ae7903d)) + + +### Chores + +* **internal:** version bump ([#1400](https://github.com/openai/openai-node/issues/1400)) ([6838ab4](https://github.com/openai/openai-node/commit/6838ab4268c7c0e083e7be21ef1a51bdea0f0b57)) + ## 4.88.0 (2025-03-19) Full Changelog: [v4.87.4...v4.88.0](https://github.com/openai/openai-node/compare/v4.87.4...v4.88.0) diff --git a/jsr.json b/jsr.json index ed87ee6d0..3e7fdb744 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.88.0", + "version": "4.89.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 471fafc31..a77975fda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.88.0", + "version": "4.89.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c56dab45e..dab92ced6 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.88.0'; // x-release-please-version +export const VERSION = '4.89.0'; // x-release-please-version From 1ed4288c7b9ca8fcb00e524bc6f39c255c6661c5 Mon Sep 17 00:00:00 2001 From: Khai Tran Date: Mon, 24 Mar 2025 16:13:16 -0700 Subject: [PATCH 261/509] chore: update next to 14.2.25 for CVE-2025-29927 --- ecosystem-tests/vercel-edge/package-lock.json | 119 +- ecosystem-tests/vercel-edge/package.json | 2 +- examples/package-lock.json | 2007 +++++++++++++++++ examples/package.json | 2 +- 4 files changed, 2080 insertions(+), 50 deletions(-) create mode 100644 examples/package-lock.json diff --git a/ecosystem-tests/vercel-edge/package-lock.json b/ecosystem-tests/vercel-edge/package-lock.json index bc820a010..541213a8d 100644 --- a/ecosystem-tests/vercel-edge/package-lock.json +++ b/ecosystem-tests/vercel-edge/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "ai": "2.1.34", - "next": "14.1.1", + "next": "^14.2.25", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -1180,17 +1180,19 @@ } }, "node_modules/@next/env": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.1.1.tgz", - "integrity": "sha512-7CnQyD5G8shHxQIIg3c7/pSeYFeMhsNbpU/bmvH7ZnDql7mNRgg8O2JZrhrc/soFnfBnKP4/xXNiiSIPn2w8gA==" + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.25.tgz", + "integrity": "sha512-JnzQ2cExDeG7FxJwqAksZ3aqVJrHjFwZQAEJ9gQZSoEhIow7SNoKZzju/AwQ+PLIR4NY8V0rhcVozx/2izDO0w==", + "license": "MIT" }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.1.tgz", - "integrity": "sha512-yDjSFKQKTIjyT7cFv+DqQfW5jsD+tVxXTckSe1KIouKk75t1qZmj/mV3wzdmFb0XHVGtyRjDMulfVG8uCKemOQ==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.25.tgz", + "integrity": "sha512-09clWInF1YRd6le00vt750s3m7SEYNehz9C4PUcSu3bAdCTpjIV4aTYQZ25Ehrr83VR1rZeqtKUPWSI7GfuKZQ==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1200,12 +1202,13 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.1.tgz", - "integrity": "sha512-KCQmBL0CmFmN8D64FHIZVD9I4ugQsDBBEJKiblXGgwn7wBCSe8N4Dx47sdzl4JAg39IkSN5NNrr8AniXLMb3aw==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.25.tgz", + "integrity": "sha512-V+iYM/QR+aYeJl3/FWWU/7Ix4b07ovsQ5IbkwgUK29pTHmq+5UxeDr7/dphvtXEq5pLB/PucfcBNh9KZ8vWbug==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1215,12 +1218,13 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.1.tgz", - "integrity": "sha512-YDQfbWyW0JMKhJf/T4eyFr4b3tceTorQ5w2n7I0mNVTFOvu6CGEzfwT3RSAQGTi/FFMTFcuspPec/7dFHuP7Eg==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.25.tgz", + "integrity": "sha512-LFnV2899PJZAIEHQ4IMmZIgL0FBieh5keMnriMY1cK7ompR+JUd24xeTtKkcaw8QmxmEdhoE5Mu9dPSuDBgtTg==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1230,12 +1234,13 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.1.tgz", - "integrity": "sha512-fiuN/OG6sNGRN/bRFxRvV5LyzLB8gaL8cbDH5o3mEiVwfcMzyE5T//ilMmaTrnA8HLMS6hoz4cHOu6Qcp9vxgQ==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.25.tgz", + "integrity": "sha512-QC5y5PPTmtqFExcKWKYgUNkHeHE/z3lUsu83di488nyP0ZzQ3Yse2G6TCxz6nNsQwgAx1BehAJTZez+UQxzLfw==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1245,12 +1250,13 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.1.tgz", - "integrity": "sha512-rv6AAdEXoezjbdfp3ouMuVqeLjE1Bin0AuE6qxE6V9g3Giz5/R3xpocHoAi7CufRR+lnkuUjRBn05SYJ83oKNQ==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.25.tgz", + "integrity": "sha512-y6/ML4b9eQ2D/56wqatTJN5/JR8/xdObU2Fb1RBidnrr450HLCKr6IJZbPqbv7NXmje61UyxjF5kvSajvjye5w==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1260,12 +1266,13 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.1.tgz", - "integrity": "sha512-YAZLGsaNeChSrpz/G7MxO3TIBLaMN8QWMr3X8bt6rCvKovwU7GqQlDu99WdvF33kI8ZahvcdbFsy4jAFzFX7og==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.25.tgz", + "integrity": "sha512-sPX0TSXHGUOZFvv96GoBXpB3w4emMqKeMgemrSxI7A6l55VBJp/RKYLwZIB9JxSqYPApqiREaIIap+wWq0RU8w==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1275,12 +1282,13 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.1.tgz", - "integrity": "sha512-1L4mUYPBMvVDMZg1inUYyPvFSduot0g73hgfD9CODgbr4xiTYe0VOMTZzaRqYJYBA9mana0x4eaAaypmWo1r5A==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.25.tgz", + "integrity": "sha512-ReO9S5hkA1DU2cFCsGoOEp7WJkhFzNbU/3VUF6XxNGUCQChyug6hZdYL/istQgfT/GWE6PNIg9cm784OI4ddxQ==", "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -1290,12 +1298,13 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.1.tgz", - "integrity": "sha512-jvIE9tsuj9vpbbXlR5YxrghRfMuG0Qm/nZ/1KDHc+y6FpnZ/apsgh+G6t15vefU0zp3WSpTMIdXRUsNl/7RSuw==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.25.tgz", + "integrity": "sha512-DZ/gc0o9neuCDyD5IumyTGHVun2dCox5TfPQI/BJTYwpSNYM3CZDI4i6TOdjeq1JMo+Ug4kPSMuZdwsycwFbAw==", "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -1305,12 +1314,13 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.1.tgz", - "integrity": "sha512-S6K6EHDU5+1KrBDLko7/c1MNy/Ya73pIAmvKeFwsF4RmBFJSO7/7YeD4FnZ4iBdzE69PpQ4sOMU9ORKeNuxe8A==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.25.tgz", + "integrity": "sha512-KSznmS6eFjQ9RJ1nEc66kJvtGIL1iZMYmGEXsZPh2YtnLtqrgdVvKXJY2ScjjoFnG6nGLyPFR0UiEvDwVah4Tw==", "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -1418,11 +1428,19 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "license": "Apache-2.0" + }, "node_modules/@swc/helpers": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz", - "integrity": "sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", + "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", + "license": "Apache-2.0", "dependencies": { + "@swc/counter": "^0.1.3", "tslib": "^2.4.0" } }, @@ -5061,12 +5079,13 @@ "dev": true }, "node_modules/next": { - "version": "14.1.1", - "resolved": "https://registry.npmjs.org/next/-/next-14.1.1.tgz", - "integrity": "sha512-McrGJqlGSHeaz2yTRPkEucxQKe5Zq7uPwyeHNmJaZNY4wx9E9QdxmTp310agFRoMuIYgQrCrT3petg13fSVOww==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.25.tgz", + "integrity": "sha512-N5M7xMc4wSb4IkPvEV5X2BRRXUmhVHNyaXwEM86+voXthSZz8ZiRyQW4p9mwAoAPIm6OzuVZtn7idgEJeAJN3Q==", + "license": "MIT", "dependencies": { - "@next/env": "14.1.1", - "@swc/helpers": "0.5.2", + "@next/env": "14.2.25", + "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", "graceful-fs": "^4.2.11", @@ -5080,18 +5099,19 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.1.1", - "@next/swc-darwin-x64": "14.1.1", - "@next/swc-linux-arm64-gnu": "14.1.1", - "@next/swc-linux-arm64-musl": "14.1.1", - "@next/swc-linux-x64-gnu": "14.1.1", - "@next/swc-linux-x64-musl": "14.1.1", - "@next/swc-win32-arm64-msvc": "14.1.1", - "@next/swc-win32-ia32-msvc": "14.1.1", - "@next/swc-win32-x64-msvc": "14.1.1" + "@next/swc-darwin-arm64": "14.2.25", + "@next/swc-darwin-x64": "14.2.25", + "@next/swc-linux-arm64-gnu": "14.2.25", + "@next/swc-linux-arm64-musl": "14.2.25", + "@next/swc-linux-x64-gnu": "14.2.25", + "@next/swc-linux-x64-musl": "14.2.25", + "@next/swc-win32-arm64-msvc": "14.2.25", + "@next/swc-win32-ia32-msvc": "14.2.25", + "@next/swc-win32-x64-msvc": "14.2.25" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.3.0" @@ -5100,6 +5120,9 @@ "@opentelemetry/api": { "optional": true }, + "@playwright/test": { + "optional": true + }, "sass": { "optional": true } diff --git a/ecosystem-tests/vercel-edge/package.json b/ecosystem-tests/vercel-edge/package.json index 4c75dd4fd..5a8fea816 100644 --- a/ecosystem-tests/vercel-edge/package.json +++ b/ecosystem-tests/vercel-edge/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "ai": "2.1.34", - "next": "14.1.1", + "next": "^14.2.25", "react": "18.2.0", "react-dom": "18.2.0" }, diff --git a/examples/package-lock.json b/examples/package-lock.json new file mode 100644 index 000000000..6feb8c5f4 --- /dev/null +++ b/examples/package-lock.json @@ -0,0 +1,2007 @@ +{ + "name": "openai-examples", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "openai-examples", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@azure/identity": "^4.2.0", + "dotenv": "^16.4.7", + "express": "^4.18.2", + "next": "^14.2.25", + "openai": "file:..", + "zod-to-json-schema": "^3.21.4" + }, + "devDependencies": { + "@types/body-parser": "^1.19.3", + "@types/express": "^4.17.19", + "@types/web": "^0.0.194" + } + }, + "..": { + "name": "openai", + "version": "4.89.0", + "license": "Apache-2.0", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + }, + "bin": { + "openai": "bin/cli" + }, + "devDependencies": { + "@swc/core": "^1.3.102", + "@swc/jest": "^0.2.29", + "@types/jest": "^29.4.0", + "@types/ws": "^8.5.13", + "@typescript-eslint/eslint-plugin": "^6.7.0", + "@typescript-eslint/parser": "^6.7.0", + "eslint": "^8.49.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-unused-imports": "^3.0.0", + "fast-check": "^3.22.0", + "iconv-lite": "^0.6.3", + "jest": "^29.4.0", + "prettier": "^3.0.0", + "prettier-2": "npm:prettier@^2", + "ts-jest": "^29.1.0", + "ts-node": "^10.5.0", + "tsc-multi": "^1.1.0", + "tsconfig-paths": "^4.0.0", + "typescript": "^4.8.2", + "ws": "^8.18.0", + "zod": "^3.23.8" + }, + "peerDependencies": { + "ws": "^8.18.0", + "zod": "^3.23.8" + }, + "peerDependenciesMeta": { + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/@azure/abort-controller": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", + "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-auth": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz", + "integrity": "sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-util": "^1.11.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-client": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.3.tgz", + "integrity": "sha512-/wGw8fJ4mdpJ1Cum7s1S+VQyXt1ihwKLzfabS1O/RDADnmzVc01dHn44qD0BvGH6KlZNzOMW95tEpKqhkCChPA==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.4.0", + "@azure/core-rest-pipeline": "^1.9.1", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.6.1", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-rest-pipeline": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.19.1.tgz", + "integrity": "sha512-zHeoI3NCs53lLBbWNzQycjnYKsA1CVKlnzSNuSFcUDwBp8HHVObePxrM7HaX+Ha5Ks639H7chNC9HOaIhNS03w==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.8.0", + "@azure/core-tracing": "^1.0.1", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.0.0", + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-tracing": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", + "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/core-util": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.11.0.tgz", + "integrity": "sha512-DxOSLua+NdpWoSqULhjDyAZTXFdP/LKkqtYuxxz1SCN289zk3OG8UOpnCQAz/tygyACBtWp/BoO72ptK7msY8g==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/identity": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.8.0.tgz", + "integrity": "sha512-l9ALUGHtFB/JfsqmA+9iYAp2a+cCwdNO/cyIr2y7nJLJsz1aae6qVP8XxT7Kbudg0IQRSIMXj0+iivFdbD1xPA==", + "license": "MIT", + "dependencies": { + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.9.0", + "@azure/core-client": "^1.9.2", + "@azure/core-rest-pipeline": "^1.17.0", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.0.0", + "@azure/msal-browser": "^4.2.0", + "@azure/msal-node": "^3.2.3", + "events": "^3.0.0", + "jws": "^4.0.0", + "open": "^10.1.0", + "stoppable": "^1.1.0", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/logger": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.1.4.tgz", + "integrity": "sha512-4IXXzcCdLdlXuCG+8UKEwLA1T1NHqUfanhXYHiQTn+6sfWCZXduqbtXDGceg3Ce5QxTGo7EqmbV6Bi+aqKuClQ==", + "license": "MIT", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@azure/msal-browser": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.8.0.tgz", + "integrity": "sha512-z7kJlMW3IAETyq82LDKJqr++IeOvU728q9lkuTFjEIPUWxnB1OlmuPCF32fYurxOnOnJeFEZxjbEzq8xyP0aag==", + "license": "MIT", + "dependencies": { + "@azure/msal-common": "15.3.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-common": { + "version": "15.3.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.3.0.tgz", + "integrity": "sha512-lh+eZfibGwtQxFnx+mj6cYWn0pwA8tDnn8CBs9P21nC7Uw5YWRwfXaXdVQSMENZ5ojRqR+NzRaucEo4qUvs3pA==", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.4.0.tgz", + "integrity": "sha512-b4wBaPV68i+g61wFOfl5zh1lQ9UylgCQpI2638pJHV0SINneO78hOFdnX8WCoGw5OOc4Eewth9pYOg7gaiyUYw==", + "license": "MIT", + "dependencies": { + "@azure/msal-common": "15.3.0", + "jsonwebtoken": "^9.0.0", + "uuid": "^8.3.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@next/env": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.25.tgz", + "integrity": "sha512-JnzQ2cExDeG7FxJwqAksZ3aqVJrHjFwZQAEJ9gQZSoEhIow7SNoKZzju/AwQ+PLIR4NY8V0rhcVozx/2izDO0w==", + "license": "MIT" + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.25.tgz", + "integrity": "sha512-09clWInF1YRd6le00vt750s3m7SEYNehz9C4PUcSu3bAdCTpjIV4aTYQZ25Ehrr83VR1rZeqtKUPWSI7GfuKZQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.25.tgz", + "integrity": "sha512-V+iYM/QR+aYeJl3/FWWU/7Ix4b07ovsQ5IbkwgUK29pTHmq+5UxeDr7/dphvtXEq5pLB/PucfcBNh9KZ8vWbug==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.25.tgz", + "integrity": "sha512-LFnV2899PJZAIEHQ4IMmZIgL0FBieh5keMnriMY1cK7ompR+JUd24xeTtKkcaw8QmxmEdhoE5Mu9dPSuDBgtTg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.25.tgz", + "integrity": "sha512-QC5y5PPTmtqFExcKWKYgUNkHeHE/z3lUsu83di488nyP0ZzQ3Yse2G6TCxz6nNsQwgAx1BehAJTZez+UQxzLfw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.25.tgz", + "integrity": "sha512-y6/ML4b9eQ2D/56wqatTJN5/JR8/xdObU2Fb1RBidnrr450HLCKr6IJZbPqbv7NXmje61UyxjF5kvSajvjye5w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.25.tgz", + "integrity": "sha512-sPX0TSXHGUOZFvv96GoBXpB3w4emMqKeMgemrSxI7A6l55VBJp/RKYLwZIB9JxSqYPApqiREaIIap+wWq0RU8w==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.25.tgz", + "integrity": "sha512-ReO9S5hkA1DU2cFCsGoOEp7WJkhFzNbU/3VUF6XxNGUCQChyug6hZdYL/istQgfT/GWE6PNIg9cm784OI4ddxQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.25.tgz", + "integrity": "sha512-DZ/gc0o9neuCDyD5IumyTGHVun2dCox5TfPQI/BJTYwpSNYM3CZDI4i6TOdjeq1JMo+Ug4kPSMuZdwsycwFbAw==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.25.tgz", + "integrity": "sha512-KSznmS6eFjQ9RJ1nEc66kJvtGIL1iZMYmGEXsZPh2YtnLtqrgdVvKXJY2ScjjoFnG6nGLyPFR0UiEvDwVah4Tw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "license": "Apache-2.0" + }, + "node_modules/@swc/helpers": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", + "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", + "license": "Apache-2.0", + "dependencies": { + "@swc/counter": "^0.1.3", + "tslib": "^2.4.0" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.5", + "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", + "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/connect": { + "version": "3.4.38", + "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", + "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", + "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.19.6", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", + "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" + } + }, + "node_modules/@types/http-errors": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", + "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mime": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", + "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.13.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz", + "integrity": "sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@types/qs": { + "version": "6.9.18", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz", + "integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/send": { + "version": "0.17.4", + "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", + "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.15.7", + "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", + "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "*" + } + }, + "node_modules/@types/web": { + "version": "0.0.194", + "resolved": "https://registry.npmjs.org/@types/web/-/web-0.0.194.tgz", + "integrity": "sha512-VKseTFF3Y8SNbpZqdVFNWQ677ujwNyrI9LcySEUwZX5iebbcdE235Lq/vqrfCzj1oFsXyVUUBqq4x8enXSakMA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/agent-base": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", + "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001707", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001707.tgz", + "integrity": "sha512-3qtRjw/HQSMlDWf+X79N206fepf4SOOU6SQLMaq/0KkZLmSjPxAkBOQQ+FxbHKfHmYLZFfdWsO3KA90ceHPSnw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "license": "MIT" + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "license": "MIT", + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/dotenv": { + "version": "16.4.7", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz", + "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com/" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/express": { + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/http-proxy-agent/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/http-proxy-agent/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT", + "peer": true + }, + "node_modules/jsonwebtoken": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", + "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "license": "MIT", + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jsonwebtoken/node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "license": "MIT", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jsonwebtoken/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/jwa": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.0.tgz", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.0.tgz", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.0", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/next": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.25.tgz", + "integrity": "sha512-N5M7xMc4wSb4IkPvEV5X2BRRXUmhVHNyaXwEM86+voXthSZz8ZiRyQW4p9mwAoAPIm6OzuVZtn7idgEJeAJN3Q==", + "license": "MIT", + "dependencies": { + "@next/env": "14.2.25", + "@swc/helpers": "0.5.5", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", + "postcss": "8.4.31", + "styled-jsx": "5.1.1" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=18.17.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "14.2.25", + "@next/swc-darwin-x64": "14.2.25", + "@next/swc-linux-arm64-gnu": "14.2.25", + "@next/swc-linux-arm64-musl": "14.2.25", + "@next/swc-linux-x64-gnu": "14.2.25", + "@next/swc-linux-x64-musl": "14.2.25", + "@next/swc-win32-arm64-msvc": "14.2.25", + "@next/swc-win32-ia32-msvc": "14.2.25", + "@next/swc-win32-x64-msvc": "14.2.25" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openai": { + "resolved": "..", + "link": true + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/stoppable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", + "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", + "license": "MIT", + "engines": { + "node": ">=4", + "npm": ">=6" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/zod": { + "version": "3.24.2", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.2.tgz", + "integrity": "sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.24.5", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.24.5.tgz", + "integrity": "sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.24.1" + } + } + } +} diff --git a/examples/package.json b/examples/package.json index 70ec2c523..db01a2c10 100644 --- a/examples/package.json +++ b/examples/package.json @@ -9,7 +9,7 @@ "@azure/identity": "^4.2.0", "dotenv": "^16.4.7", "express": "^4.18.2", - "next": "^14.1.1", + "next": "^14.2.25", "openai": "file:..", "zod-to-json-schema": "^3.21.4" }, From 22a4d95f8be418827b4b13280c2d7f976bd1ad42 Mon Sep 17 00:00:00 2001 From: Khai Tran Date: Mon, 24 Mar 2025 16:18:28 -0700 Subject: [PATCH 262/509] Update next to patch CVE-2025-29927 --- ecosystem-tests/vercel-edge/package-lock.json | 624 +++++++++++++++--- ecosystem-tests/vercel-edge/package.json | 2 +- 2 files changed, 542 insertions(+), 84 deletions(-) diff --git a/ecosystem-tests/vercel-edge/package-lock.json b/ecosystem-tests/vercel-edge/package-lock.json index 541213a8d..770dc460a 100644 --- a/ecosystem-tests/vercel-edge/package-lock.json +++ b/ecosystem-tests/vercel-edge/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "ai": "2.1.34", - "next": "^14.2.25", + "next": "^15.2.3", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -777,6 +777,16 @@ "node": ">=16" } }, + "node_modules/@emnapi/runtime": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", + "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -792,6 +802,367 @@ "@hapi/hoek": "^9.0.0" } }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1180,15 +1551,15 @@ } }, "node_modules/@next/env": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.25.tgz", - "integrity": "sha512-JnzQ2cExDeG7FxJwqAksZ3aqVJrHjFwZQAEJ9gQZSoEhIow7SNoKZzju/AwQ+PLIR4NY8V0rhcVozx/2izDO0w==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.2.3.tgz", + "integrity": "sha512-a26KnbW9DFEUsSxAxKBORR/uD9THoYoKbkpFywMN/AFvboTt94b8+g/07T8J6ACsdLag8/PDU60ov4rPxRAixw==", "license": "MIT" }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.25.tgz", - "integrity": "sha512-09clWInF1YRd6le00vt750s3m7SEYNehz9C4PUcSu3bAdCTpjIV4aTYQZ25Ehrr83VR1rZeqtKUPWSI7GfuKZQ==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.2.3.tgz", + "integrity": "sha512-uaBhA8aLbXLqwjnsHSkxs353WrRgQgiFjduDpc7YXEU0B54IKx3vU+cxQlYwPCyC8uYEEX7THhtQQsfHnvv8dw==", "cpu": [ "arm64" ], @@ -1202,9 +1573,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.25.tgz", - "integrity": "sha512-V+iYM/QR+aYeJl3/FWWU/7Ix4b07ovsQ5IbkwgUK29pTHmq+5UxeDr7/dphvtXEq5pLB/PucfcBNh9KZ8vWbug==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.2.3.tgz", + "integrity": "sha512-pVwKvJ4Zk7h+4hwhqOUuMx7Ib02u3gDX3HXPKIShBi9JlYllI0nU6TWLbPT94dt7FSi6mSBhfc2JrHViwqbOdw==", "cpu": [ "x64" ], @@ -1218,9 +1589,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.25.tgz", - "integrity": "sha512-LFnV2899PJZAIEHQ4IMmZIgL0FBieh5keMnriMY1cK7ompR+JUd24xeTtKkcaw8QmxmEdhoE5Mu9dPSuDBgtTg==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.2.3.tgz", + "integrity": "sha512-50ibWdn2RuFFkOEUmo9NCcQbbV9ViQOrUfG48zHBCONciHjaUKtHcYFiCwBVuzD08fzvzkWuuZkd4AqbvKO7UQ==", "cpu": [ "arm64" ], @@ -1234,9 +1605,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.25.tgz", - "integrity": "sha512-QC5y5PPTmtqFExcKWKYgUNkHeHE/z3lUsu83di488nyP0ZzQ3Yse2G6TCxz6nNsQwgAx1BehAJTZez+UQxzLfw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.2.3.tgz", + "integrity": "sha512-2gAPA7P652D3HzR4cLyAuVYwYqjG0mt/3pHSWTCyKZq/N/dJcUAEoNQMyUmwTZWCJRKofB+JPuDVP2aD8w2J6Q==", "cpu": [ "arm64" ], @@ -1250,9 +1621,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.25.tgz", - "integrity": "sha512-y6/ML4b9eQ2D/56wqatTJN5/JR8/xdObU2Fb1RBidnrr450HLCKr6IJZbPqbv7NXmje61UyxjF5kvSajvjye5w==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.2.3.tgz", + "integrity": "sha512-ODSKvrdMgAJOVU4qElflYy1KSZRM3M45JVbeZu42TINCMG3anp7YCBn80RkISV6bhzKwcUqLBAmOiWkaGtBA9w==", "cpu": [ "x64" ], @@ -1266,9 +1637,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.25.tgz", - "integrity": "sha512-sPX0TSXHGUOZFvv96GoBXpB3w4emMqKeMgemrSxI7A6l55VBJp/RKYLwZIB9JxSqYPApqiREaIIap+wWq0RU8w==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.2.3.tgz", + "integrity": "sha512-ZR9kLwCWrlYxwEoytqPi1jhPd1TlsSJWAc+H/CJHmHkf2nD92MQpSRIURR1iNgA/kuFSdxB8xIPt4p/T78kwsg==", "cpu": [ "x64" ], @@ -1282,9 +1653,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.25.tgz", - "integrity": "sha512-ReO9S5hkA1DU2cFCsGoOEp7WJkhFzNbU/3VUF6XxNGUCQChyug6hZdYL/istQgfT/GWE6PNIg9cm784OI4ddxQ==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.2.3.tgz", + "integrity": "sha512-+G2FrDcfm2YDbhDiObDU/qPriWeiz/9cRR0yMWJeTLGGX6/x8oryO3tt7HhodA1vZ8r2ddJPCjtLcpaVl7TE2Q==", "cpu": [ "arm64" ], @@ -1297,26 +1668,10 @@ "node": ">= 10" } }, - "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.25.tgz", - "integrity": "sha512-DZ/gc0o9neuCDyD5IumyTGHVun2dCox5TfPQI/BJTYwpSNYM3CZDI4i6TOdjeq1JMo+Ug4kPSMuZdwsycwFbAw==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.25.tgz", - "integrity": "sha512-KSznmS6eFjQ9RJ1nEc66kJvtGIL1iZMYmGEXsZPh2YtnLtqrgdVvKXJY2ScjjoFnG6nGLyPFR0UiEvDwVah4Tw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.2.3.tgz", + "integrity": "sha512-gHYS9tc+G2W0ZC8rBL+H6RdtXIyk40uLiaos0yj5US85FNhbFEndMA2nW3z47nzOWiSvXTZ5kBClc3rD0zJg0w==", "cpu": [ "x64" ], @@ -1435,13 +1790,12 @@ "license": "Apache-2.0" }, "node_modules/@swc/helpers": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", - "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", "license": "Apache-2.0", "dependencies": { - "@swc/counter": "^0.1.3", - "tslib": "^2.4.0" + "tslib": "^2.8.0" } }, "node_modules/@ts-morph/common": { @@ -2669,7 +3023,8 @@ "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" }, "node_modules/cliui": { "version": "8.0.1", @@ -2720,11 +3075,25 @@ "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, + "devOptional": true, "dependencies": { "color-name": "~1.1.4" }, @@ -2736,7 +3105,18 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "devOptional": true + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } }, "node_modules/color-support": { "version": "1.1.3", @@ -2918,10 +3298,11 @@ } }, "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", - "dev": true, + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", + "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", + "devOptional": true, + "license": "Apache-2.0", "engines": { "node": ">=8" } @@ -3810,7 +4191,8 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true }, "node_modules/has-flag": { "version": "4.0.0", @@ -5079,41 +5461,42 @@ "dev": true }, "node_modules/next": { - "version": "14.2.25", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.25.tgz", - "integrity": "sha512-N5M7xMc4wSb4IkPvEV5X2BRRXUmhVHNyaXwEM86+voXthSZz8ZiRyQW4p9mwAoAPIm6OzuVZtn7idgEJeAJN3Q==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/next/-/next-15.2.3.tgz", + "integrity": "sha512-x6eDkZxk2rPpu46E1ZVUWIBhYCLszmUY6fvHBFcbzJ9dD+qRX6vcHusaqqDlnY+VngKzKbAiG2iRCkPbmi8f7w==", "license": "MIT", "dependencies": { - "@next/env": "14.2.25", - "@swc/helpers": "0.5.5", + "@next/env": "15.2.3", + "@swc/counter": "0.1.3", + "@swc/helpers": "0.5.15", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", - "graceful-fs": "^4.2.11", "postcss": "8.4.31", - "styled-jsx": "5.1.1" + "styled-jsx": "5.1.6" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": ">=18.17.0" + "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.2.25", - "@next/swc-darwin-x64": "14.2.25", - "@next/swc-linux-arm64-gnu": "14.2.25", - "@next/swc-linux-arm64-musl": "14.2.25", - "@next/swc-linux-x64-gnu": "14.2.25", - "@next/swc-linux-x64-musl": "14.2.25", - "@next/swc-win32-arm64-msvc": "14.2.25", - "@next/swc-win32-ia32-msvc": "14.2.25", - "@next/swc-win32-x64-msvc": "14.2.25" + "@next/swc-darwin-arm64": "15.2.3", + "@next/swc-darwin-x64": "15.2.3", + "@next/swc-linux-arm64-gnu": "15.2.3", + "@next/swc-linux-arm64-musl": "15.2.3", + "@next/swc-linux-x64-gnu": "15.2.3", + "@next/swc-linux-x64-musl": "15.2.3", + "@next/swc-win32-arm64-msvc": "15.2.3", + "@next/swc-win32-x64-msvc": "15.2.3", + "sharp": "^0.33.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", - "react": "^18.2.0", - "react-dom": "^18.2.0", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "peerDependenciesMeta": { @@ -5123,6 +5506,9 @@ "@playwright/test": { "optional": true }, + "babel-plugin-react-compiler": { + "optional": true + }, "sass": { "optional": true } @@ -5815,6 +6201,59 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, + "node_modules/sharp": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", + "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.6.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.33.5", + "@img/sharp-darwin-x64": "0.33.5", + "@img/sharp-libvips-darwin-arm64": "1.0.4", + "@img/sharp-libvips-darwin-x64": "1.0.4", + "@img/sharp-libvips-linux-arm": "1.0.5", + "@img/sharp-libvips-linux-arm64": "1.0.4", + "@img/sharp-libvips-linux-s390x": "1.0.4", + "@img/sharp-libvips-linux-x64": "1.0.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", + "@img/sharp-libvips-linuxmusl-x64": "1.0.4", + "@img/sharp-linux-arm": "0.33.5", + "@img/sharp-linux-arm64": "0.33.5", + "@img/sharp-linux-s390x": "0.33.5", + "@img/sharp-linux-x64": "0.33.5", + "@img/sharp-linuxmusl-arm64": "0.33.5", + "@img/sharp-linuxmusl-x64": "0.33.5", + "@img/sharp-wasm32": "0.33.5", + "@img/sharp-win32-ia32": "0.33.5", + "@img/sharp-win32-x64": "0.33.5" + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -5848,6 +6287,23 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "license": "MIT", + "optional": true, + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "license": "MIT", + "optional": true + }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -6079,9 +6535,10 @@ } }, "node_modules/styled-jsx": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", - "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "license": "MIT", "dependencies": { "client-only": "0.0.1" }, @@ -6089,7 +6546,7 @@ "node": ">= 12.0.0" }, "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" }, "peerDependenciesMeta": { "@babel/core": { @@ -6386,9 +6843,10 @@ "dev": true }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/type-detect": { "version": "4.0.8", diff --git a/ecosystem-tests/vercel-edge/package.json b/ecosystem-tests/vercel-edge/package.json index 5a8fea816..420bca941 100644 --- a/ecosystem-tests/vercel-edge/package.json +++ b/ecosystem-tests/vercel-edge/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "ai": "2.1.34", - "next": "^14.2.25", + "next": "^15.2.3", "react": "18.2.0", "react-dom": "18.2.0" }, From 23fd3ffef3b19656b27576b4d0c613d19ea1ae2f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:58:50 +0000 Subject: [PATCH 263/509] fix(client): remove duplicate types (#1410) --- src/resources/shared.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 2c0fb1c32..3e8ded763 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export type AllModels = - | string - | ChatModel - | string + | (string & {}) | ChatModel | 'o1-pro' | 'o1-pro-2025-03-19' From 16e21df0a4d8903ae119a5f7445eafc5031c82a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:49:50 -0400 Subject: [PATCH 264/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index abb937131..2df281d34 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c22f59c66aec7914b6ee653d3098d1c1c8c16c180d2a158e819c8ddbf476f74b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml From f395e9584ac63780442bb54c2d292914eaecf3c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 12:11:17 +0000 Subject: [PATCH 265/509] fix: avoid type error in certain environments (#1413) --- src/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index a41eaa3fa..1e1cb0a4a 100644 --- a/src/core.ts +++ b/src/core.ts @@ -430,7 +430,7 @@ export abstract class APIClient { !headers ? {} : Symbol.iterator in headers ? Object.fromEntries(Array.from(headers as Iterable).map((header) => [...header])) - : { ...headers } + : { ...(headers as any as Record) } ); } From 06c03d7125d8331679dd206d0e34705d65669046 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 19:08:04 +0000 Subject: [PATCH 266/509] fix(exports): add missing type exports (#1417) --- src/resources/beta/beta.ts | 106 +++++++++++++++++++++++- src/resources/beta/realtime/realtime.ts | 52 ++++++++++++ src/resources/responses/responses.ts | 83 +++++++++++++++++++ 3 files changed, 239 insertions(+), 2 deletions(-) diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 0b909de18..6282d4593 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -22,7 +22,58 @@ import { ThreadStreamEvent, } from './assistants'; import * as RealtimeAPI from './realtime/realtime'; -import { Realtime } from './realtime/realtime'; +import { + ConversationCreatedEvent, + ConversationItem, + ConversationItemContent, + ConversationItemCreateEvent, + ConversationItemCreatedEvent, + ConversationItemDeleteEvent, + ConversationItemDeletedEvent, + ConversationItemInputAudioTranscriptionCompletedEvent, + ConversationItemInputAudioTranscriptionDeltaEvent, + ConversationItemInputAudioTranscriptionFailedEvent, + ConversationItemRetrieveEvent, + ConversationItemTruncateEvent, + ConversationItemTruncatedEvent, + ConversationItemWithReference, + ErrorEvent, + InputAudioBufferAppendEvent, + InputAudioBufferClearEvent, + InputAudioBufferClearedEvent, + InputAudioBufferCommitEvent, + InputAudioBufferCommittedEvent, + InputAudioBufferSpeechStartedEvent, + InputAudioBufferSpeechStoppedEvent, + RateLimitsUpdatedEvent, + Realtime, + RealtimeClientEvent, + RealtimeResponse, + RealtimeResponseStatus, + RealtimeResponseUsage, + RealtimeServerEvent, + ResponseAudioDeltaEvent, + ResponseAudioDoneEvent, + ResponseAudioTranscriptDeltaEvent, + ResponseAudioTranscriptDoneEvent, + ResponseCancelEvent, + ResponseContentPartAddedEvent, + ResponseContentPartDoneEvent, + ResponseCreateEvent, + ResponseCreatedEvent, + ResponseDoneEvent, + ResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseOutputItemAddedEvent, + ResponseOutputItemDoneEvent, + ResponseTextDeltaEvent, + ResponseTextDoneEvent, + SessionCreatedEvent, + SessionUpdateEvent, + SessionUpdatedEvent, + TranscriptionSessionUpdate, + TranscriptionSessionUpdatedEvent, +} from './realtime/realtime'; import * as ThreadsAPI from './threads/threads'; import { AssistantResponseFormatOption, @@ -55,7 +106,58 @@ Beta.AssistantsPage = AssistantsPage; Beta.Threads = Threads; export declare namespace Beta { - export { Realtime as Realtime }; + export { + Realtime as Realtime, + type ConversationCreatedEvent as ConversationCreatedEvent, + type ConversationItem as ConversationItem, + type ConversationItemContent as ConversationItemContent, + type ConversationItemCreateEvent as ConversationItemCreateEvent, + type ConversationItemCreatedEvent as ConversationItemCreatedEvent, + type ConversationItemDeleteEvent as ConversationItemDeleteEvent, + type ConversationItemDeletedEvent as ConversationItemDeletedEvent, + type ConversationItemInputAudioTranscriptionCompletedEvent as ConversationItemInputAudioTranscriptionCompletedEvent, + type ConversationItemInputAudioTranscriptionDeltaEvent as ConversationItemInputAudioTranscriptionDeltaEvent, + type ConversationItemInputAudioTranscriptionFailedEvent as ConversationItemInputAudioTranscriptionFailedEvent, + type ConversationItemRetrieveEvent as ConversationItemRetrieveEvent, + type ConversationItemTruncateEvent as ConversationItemTruncateEvent, + type ConversationItemTruncatedEvent as ConversationItemTruncatedEvent, + type ConversationItemWithReference as ConversationItemWithReference, + type ErrorEvent as ErrorEvent, + type InputAudioBufferAppendEvent as InputAudioBufferAppendEvent, + type InputAudioBufferClearEvent as InputAudioBufferClearEvent, + type InputAudioBufferClearedEvent as InputAudioBufferClearedEvent, + type InputAudioBufferCommitEvent as InputAudioBufferCommitEvent, + type InputAudioBufferCommittedEvent as InputAudioBufferCommittedEvent, + type InputAudioBufferSpeechStartedEvent as InputAudioBufferSpeechStartedEvent, + type InputAudioBufferSpeechStoppedEvent as InputAudioBufferSpeechStoppedEvent, + type RateLimitsUpdatedEvent as RateLimitsUpdatedEvent, + type RealtimeClientEvent as RealtimeClientEvent, + type RealtimeResponse as RealtimeResponse, + type RealtimeResponseStatus as RealtimeResponseStatus, + type RealtimeResponseUsage as RealtimeResponseUsage, + type RealtimeServerEvent as RealtimeServerEvent, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCancelEvent as ResponseCancelEvent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreateEvent as ResponseCreateEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseDoneEvent as ResponseDoneEvent, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type SessionCreatedEvent as SessionCreatedEvent, + type SessionUpdateEvent as SessionUpdateEvent, + type SessionUpdatedEvent as SessionUpdatedEvent, + type TranscriptionSessionUpdate as TranscriptionSessionUpdate, + type TranscriptionSessionUpdatedEvent as TranscriptionSessionUpdatedEvent, + }; export { Chat }; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index d0a74840b..224d94f37 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2451,6 +2451,58 @@ Realtime.Sessions = Sessions; Realtime.TranscriptionSessions = TranscriptionSessions; export declare namespace Realtime { + export { + type ConversationCreatedEvent as ConversationCreatedEvent, + type ConversationItem as ConversationItem, + type ConversationItemContent as ConversationItemContent, + type ConversationItemCreateEvent as ConversationItemCreateEvent, + type ConversationItemCreatedEvent as ConversationItemCreatedEvent, + type ConversationItemDeleteEvent as ConversationItemDeleteEvent, + type ConversationItemDeletedEvent as ConversationItemDeletedEvent, + type ConversationItemInputAudioTranscriptionCompletedEvent as ConversationItemInputAudioTranscriptionCompletedEvent, + type ConversationItemInputAudioTranscriptionDeltaEvent as ConversationItemInputAudioTranscriptionDeltaEvent, + type ConversationItemInputAudioTranscriptionFailedEvent as ConversationItemInputAudioTranscriptionFailedEvent, + type ConversationItemRetrieveEvent as ConversationItemRetrieveEvent, + type ConversationItemTruncateEvent as ConversationItemTruncateEvent, + type ConversationItemTruncatedEvent as ConversationItemTruncatedEvent, + type ConversationItemWithReference as ConversationItemWithReference, + type ErrorEvent as ErrorEvent, + type InputAudioBufferAppendEvent as InputAudioBufferAppendEvent, + type InputAudioBufferClearEvent as InputAudioBufferClearEvent, + type InputAudioBufferClearedEvent as InputAudioBufferClearedEvent, + type InputAudioBufferCommitEvent as InputAudioBufferCommitEvent, + type InputAudioBufferCommittedEvent as InputAudioBufferCommittedEvent, + type InputAudioBufferSpeechStartedEvent as InputAudioBufferSpeechStartedEvent, + type InputAudioBufferSpeechStoppedEvent as InputAudioBufferSpeechStoppedEvent, + type RateLimitsUpdatedEvent as RateLimitsUpdatedEvent, + type RealtimeClientEvent as RealtimeClientEvent, + type RealtimeResponse as RealtimeResponse, + type RealtimeResponseStatus as RealtimeResponseStatus, + type RealtimeResponseUsage as RealtimeResponseUsage, + type RealtimeServerEvent as RealtimeServerEvent, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCancelEvent as ResponseCancelEvent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreateEvent as ResponseCreateEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseDoneEvent as ResponseDoneEvent, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type SessionCreatedEvent as SessionCreatedEvent, + type SessionUpdateEvent as SessionUpdateEvent, + type SessionUpdatedEvent as SessionUpdatedEvent, + type TranscriptionSessionUpdate as TranscriptionSessionUpdate, + type TranscriptionSessionUpdatedEvent as TranscriptionSessionUpdatedEvent, + }; + export { Sessions as Sessions, type SessionsAPISession as Session, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index b90d415bd..706d66730 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -2865,6 +2865,89 @@ export interface ResponseRetrieveParams { Responses.InputItems = InputItems; export declare namespace Responses { + export { + type ComputerTool as ComputerTool, + type EasyInputMessage as EasyInputMessage, + type FileSearchTool as FileSearchTool, + type FunctionTool as FunctionTool, + type Response as Response, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCodeInterpreterCallCodeDeltaEvent as ResponseCodeInterpreterCallCodeDeltaEvent, + type ResponseCodeInterpreterCallCodeDoneEvent as ResponseCodeInterpreterCallCodeDoneEvent, + type ResponseCodeInterpreterCallCompletedEvent as ResponseCodeInterpreterCallCompletedEvent, + type ResponseCodeInterpreterCallInProgressEvent as ResponseCodeInterpreterCallInProgressEvent, + type ResponseCodeInterpreterCallInterpretingEvent as ResponseCodeInterpreterCallInterpretingEvent, + type ResponseCodeInterpreterToolCall as ResponseCodeInterpreterToolCall, + type ResponseCompletedEvent as ResponseCompletedEvent, + type ResponseComputerToolCall as ResponseComputerToolCall, + type ResponseComputerToolCallOutputItem as ResponseComputerToolCallOutputItem, + type ResponseComputerToolCallOutputScreenshot as ResponseComputerToolCallOutputScreenshot, + type ResponseContent as ResponseContent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseError as ResponseError, + type ResponseErrorEvent as ResponseErrorEvent, + type ResponseFailedEvent as ResponseFailedEvent, + type ResponseFileSearchCallCompletedEvent as ResponseFileSearchCallCompletedEvent, + type ResponseFileSearchCallInProgressEvent as ResponseFileSearchCallInProgressEvent, + type ResponseFileSearchCallSearchingEvent as ResponseFileSearchCallSearchingEvent, + type ResponseFileSearchToolCall as ResponseFileSearchToolCall, + type ResponseFormatTextConfig as ResponseFormatTextConfig, + type ResponseFormatTextJSONSchemaConfig as ResponseFormatTextJSONSchemaConfig, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseFunctionToolCall as ResponseFunctionToolCall, + type ResponseFunctionToolCallItem as ResponseFunctionToolCallItem, + type ResponseFunctionToolCallOutputItem as ResponseFunctionToolCallOutputItem, + type ResponseFunctionWebSearch as ResponseFunctionWebSearch, + type ResponseInProgressEvent as ResponseInProgressEvent, + type ResponseIncludable as ResponseIncludable, + type ResponseIncompleteEvent as ResponseIncompleteEvent, + type ResponseInput as ResponseInput, + type ResponseInputAudio as ResponseInputAudio, + type ResponseInputContent as ResponseInputContent, + type ResponseInputFile as ResponseInputFile, + type ResponseInputImage as ResponseInputImage, + type ResponseInputItem as ResponseInputItem, + type ResponseInputMessageContentList as ResponseInputMessageContentList, + type ResponseInputMessageItem as ResponseInputMessageItem, + type ResponseInputText as ResponseInputText, + type ResponseItem as ResponseItem, + type ResponseOutputAudio as ResponseOutputAudio, + type ResponseOutputItem as ResponseOutputItem, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseOutputMessage as ResponseOutputMessage, + type ResponseOutputRefusal as ResponseOutputRefusal, + type ResponseOutputText as ResponseOutputText, + type ResponseReasoningItem as ResponseReasoningItem, + type ResponseRefusalDeltaEvent as ResponseRefusalDeltaEvent, + type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, + type ResponseStatus as ResponseStatus, + type ResponseStreamEvent as ResponseStreamEvent, + type ResponseTextAnnotationDeltaEvent as ResponseTextAnnotationDeltaEvent, + type ResponseTextConfig as ResponseTextConfig, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type ResponseUsage as ResponseUsage, + type ResponseWebSearchCallCompletedEvent as ResponseWebSearchCallCompletedEvent, + type ResponseWebSearchCallInProgressEvent as ResponseWebSearchCallInProgressEvent, + type ResponseWebSearchCallSearchingEvent as ResponseWebSearchCallSearchingEvent, + type Tool as Tool, + type ToolChoiceFunction as ToolChoiceFunction, + type ToolChoiceOptions as ToolChoiceOptions, + type ToolChoiceTypes as ToolChoiceTypes, + type WebSearchTool as WebSearchTool, + type ResponseCreateParams as ResponseCreateParams, + type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, + type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, + type ResponseRetrieveParams as ResponseRetrieveParams, + }; + export { InputItems as InputItems, type ResponseItemList as ResponseItemList, From 7239db018432c10c4c42962b8b3525011d0d375e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 05:07:24 +0000 Subject: [PATCH 267/509] release: 4.89.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c77dd18b0..05b012220 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.89.0" + ".": "4.89.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 4597d6e56..2bd7f344f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.89.1 (2025-03-26) + +Full Changelog: [v4.89.0...v4.89.1](https://github.com/openai/openai-node/compare/v4.89.0...v4.89.1) + +### Bug Fixes + +* avoid type error in certain environments ([#1413](https://github.com/openai/openai-node/issues/1413)) ([d3f6f8f](https://github.com/openai/openai-node/commit/d3f6f8f9c7511a98cc5795756fee49a30e44d485)) +* **client:** remove duplicate types ([#1410](https://github.com/openai/openai-node/issues/1410)) ([338878b](https://github.com/openai/openai-node/commit/338878bf484dac5a4fadf50592b1f8d1045cd4b6)) +* **exports:** add missing type exports ([#1417](https://github.com/openai/openai-node/issues/1417)) ([2d15ada](https://github.com/openai/openai-node/commit/2d15ada0e0d81a4e0d097dddbe99be2222c4c0ef)) + + +### Chores + +* **internal:** version bump ([#1408](https://github.com/openai/openai-node/issues/1408)) ([9c0949a](https://github.com/openai/openai-node/commit/9c0949a93c3e181d327f820dbc2a4b0ad77258e9)) + ## 4.89.0 (2025-03-20) Full Changelog: [v4.88.0...v4.89.0](https://github.com/openai/openai-node/compare/v4.88.0...v4.89.0) diff --git a/jsr.json b/jsr.json index 3e7fdb744..393ef104b 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.89.0", + "version": "4.89.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index a77975fda..29c52a1a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.89.0", + "version": "4.89.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index dab92ced6..c8c72aa23 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.89.0'; // x-release-please-version +export const VERSION = '4.89.1'; // x-release-please-version From 48921aaabc3456408907e4bcf1cc074a9228c459 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:33:07 +0000 Subject: [PATCH 268/509] chore: add hash of OpenAPI spec/config inputs to .stats.yml --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index 2df281d34..fe9320429 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml +openapi_spec_hash: 0c255269b89767eae26f4d4dc22d3cbd +config_hash: d36e491b0afc4f79e3afad4b3c9bec70 From 6c93a23b79f335a21c65b52d1192890a5325ed6d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 19:33:55 +0000 Subject: [PATCH 269/509] chore(client): expose headers on some streaming errors (#1423) --- src/streaming.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/streaming.ts b/src/streaming.ts index 25b960314..c9cf2fab8 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -3,6 +3,7 @@ import { OpenAIError } from './error'; import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line'; import { ReadableStreamToAsyncIterable } from './internal/stream-utils'; +import { createResponseHeaders } from './core'; import { APIError } from './error'; type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined; @@ -53,7 +54,7 @@ export class Stream implements AsyncIterable { } if (data && data.error) { - throw new APIError(undefined, data.error, undefined, undefined); + throw new APIError(undefined, data.error, undefined, createResponseHeaders(response.headers)); } yield data; From fb0e96a7fa8c020ac6109951bb36f9a4ada24d03 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 20:32:39 +0000 Subject: [PATCH 270/509] chore(api): updates to supported Voice IDs (#1424) --- .stats.yml | 4 +- src/resources/audio/speech.ts | 18 +++++- src/resources/beta/realtime/realtime.ts | 61 +++++++++++++++---- src/resources/beta/realtime/sessions.ts | 47 ++++++++++++-- .../beta/realtime/transcription-sessions.ts | 4 +- src/resources/chat/completions/completions.ts | 14 ++++- src/resources/responses/input-items.ts | 6 ++ src/resources/responses/responses.ts | 20 +++--- tests/api-resources/audio/speech.test.ts | 2 +- .../chat/completions/completions.test.ts | 2 +- .../responses/input-items.test.ts | 2 +- 11 files changed, 143 insertions(+), 37 deletions(-) diff --git a/.stats.yml b/.stats.yml index fe9320429..4d1276a5e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml -openapi_spec_hash: 0c255269b89767eae26f4d4dc22d3cbd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml +openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e config_hash: d36e491b0afc4f79e3afad4b3c9bec70 diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 4324028d5..4b99ee5f4 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -34,11 +34,23 @@ export interface SpeechCreateParams { /** * The voice to use when generating the audio. Supported voices are `alloy`, `ash`, - * `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the - * voices are available in the + * `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and + * `verse`. Previews of the voices are available in the * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). */ - voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; + voice: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; /** * Control the voice of your generated audio with additional instructions. Does not diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 224d94f37..1c02fdd1a 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -1005,9 +1005,22 @@ export interface RealtimeResponse { /** * 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'; + * `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and + * `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } /** @@ -1620,9 +1633,22 @@ export namespace ResponseCreateEvent { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Response { @@ -2078,9 +2104,22 @@ export namespace SessionUpdateEvent { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Session { @@ -2376,7 +2415,7 @@ export namespace TranscriptionSessionUpdate { export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. + * occurs. Not available for transcription sessions. */ create_response?: boolean; @@ -2390,7 +2429,7 @@ export namespace TranscriptionSessionUpdate { /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. + * occurs. Not available for transcription sessions. */ interrupt_response?: boolean; diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index bae50124e..28a44431e 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -139,7 +139,19 @@ export interface Session { * once the model has responded with audio at least once. Current voice options are * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Session { @@ -361,7 +373,19 @@ export interface SessionCreateResponse { * once the model has responded with audio at least once. Current voice options are * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace SessionCreateResponse { @@ -561,9 +585,22 @@ export interface SessionCreateParams { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace SessionCreateParams { diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index d749f8502..a54ec1125 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -255,7 +255,7 @@ export namespace TranscriptionSessionCreateParams { export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. + * occurs. Not available for transcription sessions. */ create_response?: boolean; @@ -269,7 +269,7 @@ export namespace TranscriptionSessionCreateParams { /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. + * occurs. Not available for transcription sessions. */ interrupt_response?: boolean; diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 08bf7f8db..f0ef1d0cc 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -325,7 +325,19 @@ export interface ChatCompletionAudioParam { * The voice the model uses to respond. Supported voices are `alloy`, `ash`, * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. */ - voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } /** diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index f2292e5c6..c88bb441d 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -71,6 +71,12 @@ export interface InputItemListParams extends CursorPageParams { */ before?: string; + /** + * Additional fields to include in the response. See the `include` parameter for + * Response creation above for more information. + */ + include?: Array; + /** * The order to return the input items in. Default is `asc`. * diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 706d66730..6c9f58b43 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -305,8 +305,8 @@ export interface Response { * context. * * When using along with `previous_response_id`, the instructions from a previous - * response will be not be carried over to the next response. This makes it simple - * to swap out system (or developer) messages in new responses. + * response will not be carried over to the next response. This makes it simple to + * swap out system (or developer) messages in new responses. */ instructions: string | null; @@ -1356,6 +1356,12 @@ export type ResponseFormatTextConfig = * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). */ export interface ResponseFormatTextJSONSchemaConfig { + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores + * and dashes, with a maximum length of 64. + */ + name: string; + /** * The schema for the response format, described as a JSON Schema object. Learn how * to build JSON schemas [here](https://json-schema.org/). @@ -1373,12 +1379,6 @@ export interface ResponseFormatTextJSONSchemaConfig { */ description?: string; - /** - * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores - * and dashes, with a maximum length of 64. - */ - name?: string; - /** * Whether to enable strict schema adherence when generating the output. If set to * true, the model will always follow the exact schema defined in the `schema` @@ -2698,8 +2698,8 @@ export interface ResponseCreateParamsBase { * context. * * When using along with `previous_response_id`, the instructions from a previous - * response will be not be carried over to the next response. This makes it simple - * to swap out system (or developer) messages in new responses. + * response will not be carried over to the next response. This makes it simple to + * swap out system (or developer) messages in new responses. */ instructions?: string | null; diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index cbec6cfac..191c6a313 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -13,7 +13,7 @@ describe('resource speech', () => { const response = await client.audio.speech.create({ input: 'input', model: 'string', - voice: 'alloy', + voice: 'ash', instructions: 'instructions', response_format: 'mp3', speed: 0.25, diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts index eddf252b1..60c23591a 100644 --- a/tests/api-resources/chat/completions/completions.test.ts +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -27,7 +27,7 @@ describe('resource completions', () => { const response = await client.chat.completions.create({ messages: [{ content: 'string', role: 'developer', name: 'name' }], model: 'gpt-4o', - audio: { format: 'wav', voice: 'alloy' }, + audio: { format: 'wav', voice: 'ash' }, frequency_penalty: -2, function_call: 'none', functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts index 51b86f1b3..25ab166c0 100644 --- a/tests/api-resources/responses/input-items.test.ts +++ b/tests/api-resources/responses/input-items.test.ts @@ -32,7 +32,7 @@ describe('resource inputItems', () => { await expect( client.responses.inputItems.list( 'response_id', - { after: 'after', before: 'before', limit: 0, order: 'asc' }, + { after: 'after', before: 'before', include: ['file_search_call.results'], limit: 0, order: 'asc' }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); From 16c67be29bbb976660ac01d76f54e8735e71c1e0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:07:24 +0000 Subject: [PATCH 271/509] feat(api): add `get /chat/completions` endpoint --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4d1276a5e..1e1104a06 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: d36e491b0afc4f79e3afad4b3c9bec70 +config_hash: 9351ea829c2b41da3b48a38c934c92ee From 9c7d352181c690156e26c9538c00edff6db5b384 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 27 Mar 2025 16:56:35 +0000 Subject: [PATCH 272/509] fix(audio): correctly handle transcription streaming --- src/resources/audio/transcriptions.ts | 7 ++++++- src/streaming.ts | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 7f797c709..ba4fec6c5 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -40,7 +40,12 @@ export class Transcriptions extends APIResource { ): Core.APIPromise> { return this._client.post( '/audio/transcriptions', - Core.multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }), + Core.multipartFormRequestOptions({ + body, + ...options, + stream: body.stream ?? false, + __metadata: { model: body.model }, + }), ); } } diff --git a/src/streaming.ts b/src/streaming.ts index c9cf2fab8..ee25daca6 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -42,7 +42,11 @@ export class Stream implements AsyncIterable { continue; } - if (sse.event === null || sse.event.startsWith('response.')) { + if ( + sse.event === null || + sse.event.startsWith('response.') || + sse.event.startsWith('transcript.') + ) { let data; try { From 84edc62d05eddaefee0973f9687fcfdd43b0afa9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 17:19:39 +0000 Subject: [PATCH 273/509] fix(internal): work around https://github.com/vercel/next.js/issues/76881 (#1427) --- src/_shims/index-deno.ts | 2 ++ src/_shims/index.d.ts | 2 ++ src/_shims/index.js | 6 +++++- src/_shims/index.mjs | 6 +++++- src/core.ts | 5 +++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/_shims/index-deno.ts b/src/_shims/index-deno.ts index d9eabb5a9..e83c7a6d3 100644 --- a/src/_shims/index-deno.ts +++ b/src/_shims/index-deno.ts @@ -108,3 +108,5 @@ export declare class FsReadStream extends Readable { const _ReadableStream = ReadableStream; type _ReadableStream = ReadableStream; export { _ReadableStream as ReadableStream }; + +export const init = () => {}; diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts index d867b293b..107cf7fd6 100644 --- a/src/_shims/index.d.ts +++ b/src/_shims/index.d.ts @@ -79,3 +79,5 @@ export function fileFromPath(path: string, options?: FileFromPathOptions): Promi export function fileFromPath(path: string, filename?: string, options?: FileFromPathOptions): Promise; export function isFsReadStream(value: any): value is FsReadStream; + +export const init: () => void; diff --git a/src/_shims/index.js b/src/_shims/index.js index b5fc8229e..959f2b9ce 100644 --- a/src/_shims/index.js +++ b/src/_shims/index.js @@ -3,7 +3,9 @@ */ const shims = require('./registry'); const auto = require('openai/_shims/auto/runtime'); -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +exports.init = () => { + if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +}; for (const property of Object.keys(shims)) { Object.defineProperty(exports, property, { get() { @@ -11,3 +13,5 @@ for (const property of Object.keys(shims)) { }, }); } + +exports.init(); diff --git a/src/_shims/index.mjs b/src/_shims/index.mjs index 81665e610..26d7a716c 100644 --- a/src/_shims/index.mjs +++ b/src/_shims/index.mjs @@ -3,5 +3,9 @@ */ import * as shims from './registry.mjs'; import * as auto from 'openai/_shims/auto/runtime'; -if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +export const init = () => { + if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); +}; export * from './registry.mjs'; + +init(); diff --git a/src/core.ts b/src/core.ts index 1e1cb0a4a..0dedc53eb 100644 --- a/src/core.ts +++ b/src/core.ts @@ -17,7 +17,12 @@ import { type RequestInit, type Response, type HeadersInit, + init, } from './_shims/index'; + +// try running side effects outside of _shims/index to workaround https://github.com/vercel/next.js/issues/76881 +init(); + export { type Response }; import { BlobLike, isBlobLike, isMultipartBody } from './uploads'; export { From 8ab47e2b569216d5c67a95e5512a3b09cbc7d261 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 17:20:08 +0000 Subject: [PATCH 274/509] release: 4.90.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 05b012220..7b04494d6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.89.1" + ".": "4.90.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd7f344f..89523001a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 4.90.0 (2025-03-27) + +Full Changelog: [v4.89.1...v4.90.0](https://github.com/openai/openai-node/compare/v4.89.1...v4.90.0) + +### Features + +* **api:** add `get /chat/completions` endpoint ([2d6710a](https://github.com/openai/openai-node/commit/2d6710a1f9dd4f768d9c73e9c9f5f93c737cdc66)) + + +### Bug Fixes + +* **audio:** correctly handle transcription streaming ([2a9b603](https://github.com/openai/openai-node/commit/2a9b60336cd40a4d4fb9b898ece49170ad648fd0)) +* **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#1427](https://github.com/openai/openai-node/issues/1427)) ([b467e94](https://github.com/openai/openai-node/commit/b467e949476621e8e92587a83c9de6fab35b2b9d)) + + +### Chores + +* add hash of OpenAPI spec/config inputs to .stats.yml ([45db35e](https://github.com/openai/openai-node/commit/45db35e34be560c75bf36224cc153c6d0e6e2a88)) +* **api:** updates to supported Voice IDs ([#1424](https://github.com/openai/openai-node/issues/1424)) ([404f4db](https://github.com/openai/openai-node/commit/404f4db41a2ee651f5bfdaa7b8881e1bf015f058)) +* **client:** expose headers on some streaming errors ([#1423](https://github.com/openai/openai-node/issues/1423)) ([b0783cc](https://github.com/openai/openai-node/commit/b0783cc6221b68f1738e759b393756a7d0e540a3)) + ## 4.89.1 (2025-03-26) Full Changelog: [v4.89.0...v4.89.1](https://github.com/openai/openai-node/compare/v4.89.0...v4.89.1) diff --git a/jsr.json b/jsr.json index 393ef104b..98c8e6959 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.89.1", + "version": "4.90.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 29c52a1a5..408e50a73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.89.1", + "version": "4.90.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c8c72aa23..03d899bdd 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.89.1'; // x-release-please-version +export const VERSION = '4.90.0'; // x-release-please-version From 85175d9644348e61d9779ce0cb15cfef4aa87a1d Mon Sep 17 00:00:00 2001 From: Khai Tran Date: Fri, 28 Mar 2025 09:44:45 -0700 Subject: [PATCH 275/509] update --- ecosystem-tests/vercel-edge/package-lock.json | 625 +++--------------- ecosystem-tests/vercel-edge/package.json | 2 +- 2 files changed, 79 insertions(+), 548 deletions(-) diff --git a/ecosystem-tests/vercel-edge/package-lock.json b/ecosystem-tests/vercel-edge/package-lock.json index 770dc460a..aaca4370c 100644 --- a/ecosystem-tests/vercel-edge/package-lock.json +++ b/ecosystem-tests/vercel-edge/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "ai": "2.1.34", - "next": "^15.2.3", + "next": "^14.2.25", "react": "18.2.0", "react-dom": "18.2.0" }, @@ -777,16 +777,6 @@ "node": ">=16" } }, - "node_modules/@emnapi/runtime": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", - "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", - "license": "MIT", - "optional": true, - "dependencies": { - "tslib": "^2.4.0" - } - }, "node_modules/@hapi/hoek": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", @@ -802,367 +792,6 @@ "@hapi/hoek": "^9.0.0" } }, - "node_modules/@img/sharp-darwin-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", - "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.0.4" - } - }, - "node_modules/@img/sharp-darwin-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", - "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-darwin-x64": "1.0.4" - } - }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", - "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-darwin-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", - "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "darwin" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", - "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", - "cpu": [ - "arm" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", - "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-s390x": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", - "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", - "cpu": [ - "s390x" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linux-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", - "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", - "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", - "cpu": [ - "arm64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-libvips-linuxmusl-x64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", - "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", - "cpu": [ - "x64" - ], - "license": "LGPL-3.0-or-later", - "optional": true, - "os": [ - "linux" - ], - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-linux-arm": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", - "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", - "cpu": [ - "arm" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm": "1.0.5" - } - }, - "node_modules/@img/sharp-linux-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", - "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-arm64": "1.0.4" - } - }, - "node_modules/@img/sharp-linux-s390x": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", - "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", - "cpu": [ - "s390x" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-s390x": "1.0.4" - } - }, - "node_modules/@img/sharp-linux-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", - "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linux-x64": "1.0.4" - } - }, - "node_modules/@img/sharp-linuxmusl-arm64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", - "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", - "cpu": [ - "arm64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" - } - }, - "node_modules/@img/sharp-linuxmusl-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", - "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-libvips-linuxmusl-x64": "1.0.4" - } - }, - "node_modules/@img/sharp-wasm32": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", - "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", - "cpu": [ - "wasm32" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", - "optional": true, - "dependencies": { - "@emnapi/runtime": "^1.2.0" - }, - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-ia32": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", - "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", - "cpu": [ - "ia32" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/@img/sharp-win32-x64": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", - "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", - "cpu": [ - "x64" - ], - "license": "Apache-2.0 AND LGPL-3.0-or-later", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1551,19 +1180,17 @@ } }, "node_modules/@next/env": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.2.3.tgz", - "integrity": "sha512-a26KnbW9DFEUsSxAxKBORR/uD9THoYoKbkpFywMN/AFvboTt94b8+g/07T8J6ACsdLag8/PDU60ov4rPxRAixw==", - "license": "MIT" + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.25.tgz", + "integrity": "sha512-JnzQ2cExDeG7FxJwqAksZ3aqVJrHjFwZQAEJ9gQZSoEhIow7SNoKZzju/AwQ+PLIR4NY8V0rhcVozx/2izDO0w==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.2.3.tgz", - "integrity": "sha512-uaBhA8aLbXLqwjnsHSkxs353WrRgQgiFjduDpc7YXEU0B54IKx3vU+cxQlYwPCyC8uYEEX7THhtQQsfHnvv8dw==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.25.tgz", + "integrity": "sha512-09clWInF1YRd6le00vt750s3m7SEYNehz9C4PUcSu3bAdCTpjIV4aTYQZ25Ehrr83VR1rZeqtKUPWSI7GfuKZQ==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -1573,13 +1200,12 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.2.3.tgz", - "integrity": "sha512-pVwKvJ4Zk7h+4hwhqOUuMx7Ib02u3gDX3HXPKIShBi9JlYllI0nU6TWLbPT94dt7FSi6mSBhfc2JrHViwqbOdw==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.25.tgz", + "integrity": "sha512-V+iYM/QR+aYeJl3/FWWU/7Ix4b07ovsQ5IbkwgUK29pTHmq+5UxeDr7/dphvtXEq5pLB/PucfcBNh9KZ8vWbug==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "darwin" @@ -1589,13 +1215,12 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.2.3.tgz", - "integrity": "sha512-50ibWdn2RuFFkOEUmo9NCcQbbV9ViQOrUfG48zHBCONciHjaUKtHcYFiCwBVuzD08fzvzkWuuZkd4AqbvKO7UQ==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.25.tgz", + "integrity": "sha512-LFnV2899PJZAIEHQ4IMmZIgL0FBieh5keMnriMY1cK7ompR+JUd24xeTtKkcaw8QmxmEdhoE5Mu9dPSuDBgtTg==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1605,13 +1230,12 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.2.3.tgz", - "integrity": "sha512-2gAPA7P652D3HzR4cLyAuVYwYqjG0mt/3pHSWTCyKZq/N/dJcUAEoNQMyUmwTZWCJRKofB+JPuDVP2aD8w2J6Q==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.25.tgz", + "integrity": "sha512-QC5y5PPTmtqFExcKWKYgUNkHeHE/z3lUsu83di488nyP0ZzQ3Yse2G6TCxz6nNsQwgAx1BehAJTZez+UQxzLfw==", "cpu": [ "arm64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1621,13 +1245,12 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.2.3.tgz", - "integrity": "sha512-ODSKvrdMgAJOVU4qElflYy1KSZRM3M45JVbeZu42TINCMG3anp7YCBn80RkISV6bhzKwcUqLBAmOiWkaGtBA9w==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.25.tgz", + "integrity": "sha512-y6/ML4b9eQ2D/56wqatTJN5/JR8/xdObU2Fb1RBidnrr450HLCKr6IJZbPqbv7NXmje61UyxjF5kvSajvjye5w==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1637,13 +1260,12 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.2.3.tgz", - "integrity": "sha512-ZR9kLwCWrlYxwEoytqPi1jhPd1TlsSJWAc+H/CJHmHkf2nD92MQpSRIURR1iNgA/kuFSdxB8xIPt4p/T78kwsg==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.25.tgz", + "integrity": "sha512-sPX0TSXHGUOZFvv96GoBXpB3w4emMqKeMgemrSxI7A6l55VBJp/RKYLwZIB9JxSqYPApqiREaIIap+wWq0RU8w==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -1653,13 +1275,27 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.2.3.tgz", - "integrity": "sha512-+G2FrDcfm2YDbhDiObDU/qPriWeiz/9cRR0yMWJeTLGGX6/x8oryO3tt7HhodA1vZ8r2ddJPCjtLcpaVl7TE2Q==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.25.tgz", + "integrity": "sha512-ReO9S5hkA1DU2cFCsGoOEp7WJkhFzNbU/3VUF6XxNGUCQChyug6hZdYL/istQgfT/GWE6PNIg9cm784OI4ddxQ==", "cpu": [ "arm64" ], - "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.25.tgz", + "integrity": "sha512-DZ/gc0o9neuCDyD5IumyTGHVun2dCox5TfPQI/BJTYwpSNYM3CZDI4i6TOdjeq1JMo+Ug4kPSMuZdwsycwFbAw==", + "cpu": [ + "ia32" + ], "optional": true, "os": [ "win32" @@ -1669,13 +1305,12 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.2.3.tgz", - "integrity": "sha512-gHYS9tc+G2W0ZC8rBL+H6RdtXIyk40uLiaos0yj5US85FNhbFEndMA2nW3z47nzOWiSvXTZ5kBClc3rD0zJg0w==", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.25.tgz", + "integrity": "sha512-KSznmS6eFjQ9RJ1nEc66kJvtGIL1iZMYmGEXsZPh2YtnLtqrgdVvKXJY2ScjjoFnG6nGLyPFR0UiEvDwVah4Tw==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "win32" @@ -1786,16 +1421,15 @@ "node_modules/@swc/counter": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", - "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", - "license": "Apache-2.0" + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==" }, "node_modules/@swc/helpers": { - "version": "0.5.15", - "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", - "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", - "license": "Apache-2.0", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.5.tgz", + "integrity": "sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==", "dependencies": { - "tslib": "^2.8.0" + "@swc/counter": "^0.1.3", + "tslib": "^2.4.0" } }, "node_modules/@ts-morph/common": { @@ -3023,8 +2657,7 @@ "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", - "license": "MIT" + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" }, "node_modules/cliui": { "version": "8.0.1", @@ -3075,25 +2708,11 @@ "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", "dev": true }, - "node_modules/color": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", - "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", - "license": "MIT", - "optional": true, - "dependencies": { - "color-convert": "^2.0.1", - "color-string": "^1.9.0" - }, - "engines": { - "node": ">=12.5.0" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "devOptional": true, + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -3105,18 +2724,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "devOptional": true - }, - "node_modules/color-string": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", - "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", - "license": "MIT", - "optional": true, - "dependencies": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } + "dev": true }, "node_modules/color-support": { "version": "1.1.3", @@ -3301,7 +2909,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz", "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", - "devOptional": true, + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=8" @@ -4191,8 +3799,7 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/has-flag": { "version": "4.0.0", @@ -5461,42 +5068,40 @@ "dev": true }, "node_modules/next": { - "version": "15.2.3", - "resolved": "https://registry.npmjs.org/next/-/next-15.2.3.tgz", - "integrity": "sha512-x6eDkZxk2rPpu46E1ZVUWIBhYCLszmUY6fvHBFcbzJ9dD+qRX6vcHusaqqDlnY+VngKzKbAiG2iRCkPbmi8f7w==", - "license": "MIT", - "dependencies": { - "@next/env": "15.2.3", - "@swc/counter": "0.1.3", - "@swc/helpers": "0.5.15", + "version": "14.2.25", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.25.tgz", + "integrity": "sha512-N5M7xMc4wSb4IkPvEV5X2BRRXUmhVHNyaXwEM86+voXthSZz8ZiRyQW4p9mwAoAPIm6OzuVZtn7idgEJeAJN3Q==", + "dependencies": { + "@next/env": "14.2.25", + "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", "postcss": "8.4.31", - "styled-jsx": "5.1.6" + "styled-jsx": "5.1.1" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" + "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.2.3", - "@next/swc-darwin-x64": "15.2.3", - "@next/swc-linux-arm64-gnu": "15.2.3", - "@next/swc-linux-arm64-musl": "15.2.3", - "@next/swc-linux-x64-gnu": "15.2.3", - "@next/swc-linux-x64-musl": "15.2.3", - "@next/swc-win32-arm64-msvc": "15.2.3", - "@next/swc-win32-x64-msvc": "15.2.3", - "sharp": "^0.33.5" + "@next/swc-darwin-arm64": "14.2.25", + "@next/swc-darwin-x64": "14.2.25", + "@next/swc-linux-arm64-gnu": "14.2.25", + "@next/swc-linux-arm64-musl": "14.2.25", + "@next/swc-linux-x64-gnu": "14.2.25", + "@next/swc-linux-x64-musl": "14.2.25", + "@next/swc-win32-arm64-msvc": "14.2.25", + "@next/swc-win32-ia32-msvc": "14.2.25", + "@next/swc-win32-x64-msvc": "14.2.25" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.41.2", - "babel-plugin-react-compiler": "*", - "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", - "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", "sass": "^1.3.0" }, "peerDependenciesMeta": { @@ -5506,9 +5111,6 @@ "@playwright/test": { "optional": true }, - "babel-plugin-react-compiler": { - "optional": true - }, "sass": { "optional": true } @@ -6201,59 +5803,6 @@ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, - "node_modules/sharp": { - "version": "0.33.5", - "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz", - "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==", - "hasInstallScript": true, - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "color": "^4.2.3", - "detect-libc": "^2.0.3", - "semver": "^7.6.3" - }, - "engines": { - "node": "^18.17.0 || ^20.3.0 || >=21.0.0" - }, - "funding": { - "url": "https://opencollective.com/libvips" - }, - "optionalDependencies": { - "@img/sharp-darwin-arm64": "0.33.5", - "@img/sharp-darwin-x64": "0.33.5", - "@img/sharp-libvips-darwin-arm64": "1.0.4", - "@img/sharp-libvips-darwin-x64": "1.0.4", - "@img/sharp-libvips-linux-arm": "1.0.5", - "@img/sharp-libvips-linux-arm64": "1.0.4", - "@img/sharp-libvips-linux-s390x": "1.0.4", - "@img/sharp-libvips-linux-x64": "1.0.4", - "@img/sharp-libvips-linuxmusl-arm64": "1.0.4", - "@img/sharp-libvips-linuxmusl-x64": "1.0.4", - "@img/sharp-linux-arm": "0.33.5", - "@img/sharp-linux-arm64": "0.33.5", - "@img/sharp-linux-s390x": "0.33.5", - "@img/sharp-linux-x64": "0.33.5", - "@img/sharp-linuxmusl-arm64": "0.33.5", - "@img/sharp-linuxmusl-x64": "0.33.5", - "@img/sharp-wasm32": "0.33.5", - "@img/sharp-win32-ia32": "0.33.5", - "@img/sharp-win32-x64": "0.33.5" - } - }, - "node_modules/sharp/node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", - "license": "ISC", - "optional": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6287,23 +5836,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", - "license": "MIT", - "optional": true, - "dependencies": { - "is-arrayish": "^0.3.1" - } - }, - "node_modules/simple-swizzle/node_modules/is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", - "license": "MIT", - "optional": true - }, "node_modules/sisteransi": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", @@ -6535,10 +6067,9 @@ } }, "node_modules/styled-jsx": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", - "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", - "license": "MIT", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.1.tgz", + "integrity": "sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==", "dependencies": { "client-only": "0.0.1" }, @@ -6546,7 +6077,7 @@ "node": ">= 12.0.0" }, "peerDependencies": { - "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0" }, "peerDependenciesMeta": { "@babel/core": { diff --git a/ecosystem-tests/vercel-edge/package.json b/ecosystem-tests/vercel-edge/package.json index 420bca941..5a8fea816 100644 --- a/ecosystem-tests/vercel-edge/package.json +++ b/ecosystem-tests/vercel-edge/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "ai": "2.1.34", - "next": "^15.2.3", + "next": "^14.2.25", "react": "18.2.0", "react-dom": "18.2.0" }, From 3676d34127cd88a67dde6e6d24f2b6a7b65d3073 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 19:41:56 +0000 Subject: [PATCH 276/509] feat(api): add `get /responses/{response_id}/input_items` endpoint --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 1e1104a06..f6a90d243 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 9351ea829c2b41da3b48a38c934c92ee +config_hash: e25e31d8446b6bc0e3ef7103b6993cce From be00d29fadb2b78920bcae1e6e72750bc6f973a4 Mon Sep 17 00:00:00 2001 From: Wassim Chegham Date: Fri, 28 Mar 2025 21:46:46 +0100 Subject: [PATCH 277/509] perf(embedding): default embedding creation to base64 (#1312) * perf(embedding): always request embedding creation as base64 Requesting base64 encoded embeddings returns smaller body sizes, on average ~60% smaller than float32 encoded. In other words, the size of the response body containing embeddings in float32 is ~2.3x bigger than base64 encoded embedding. We always request embedding creating encoded as base64, and then decoded them to float32 based on the user's provided encoding_format parameter. Closes #1310 Co-authored-by: Robert Craigie --- src/core.ts | 21 +++++++++++++ src/resources/embeddings.ts | 42 ++++++++++++++++++++++++-- tests/api-resources/embeddings.test.ts | 31 +++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/src/core.ts b/src/core.ts index 0dedc53eb..a3f664906 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1287,6 +1287,27 @@ export const toBase64 = (str: string | null | undefined): string => { throw new OpenAIError('Cannot generate b64 string; Expected `Buffer` or `btoa` to be defined'); }; +/** + * Converts a Base64 encoded string to a Float32Array. + * @param base64Str - The Base64 encoded string. + * @returns An Array of numbers interpreted as Float32 values. + */ +export const toFloat32Array = (base64Str: string): Array => { + if (typeof Buffer !== 'undefined') { + // for Node.js environment + return Array.from(new Float32Array(Buffer.from(base64Str, 'base64').buffer)); + } else { + // for legacy web platform APIs + const binaryStr = atob(base64Str); + const len = binaryStr.length; + const bytes = new Uint8Array(len); + for (let i = 0; i < len; i++) { + bytes[i] = binaryStr.charCodeAt(i); + } + return Array.from(new Float32Array(bytes.buffer)); + } +}; + export function isObj(obj: unknown): obj is Record { return obj != null && typeof obj === 'object' && !Array.isArray(obj); } diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index d01ffc807..a4be9ca3c 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -9,9 +9,47 @@ export class Embeddings extends APIResource { */ create( body: EmbeddingCreateParams, - options?: Core.RequestOptions, + options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.post('/embeddings', { body, ...options }); + const hasUserProvidedEncodingFormat = !!body.encoding_format; + // No encoding_format specified, defaulting to base64 for performance reasons + // See https://github.com/openai/openai-node/pull/1312 + let encoding_format: EmbeddingCreateParams['encoding_format'] = + hasUserProvidedEncodingFormat ? body.encoding_format : 'base64'; + + if (hasUserProvidedEncodingFormat) { + Core.debug('Request', 'User defined encoding_format:', body.encoding_format); + } + + const response: Core.APIPromise = this._client.post('/embeddings', { + body: { + ...body, + encoding_format: encoding_format as EmbeddingCreateParams['encoding_format'], + }, + ...options, + }); + + // if the user specified an encoding_format, return the response as-is + if (hasUserProvidedEncodingFormat) { + return response; + } + + // in this stage, we are sure the user did not specify an encoding_format + // and we defaulted to base64 for performance reasons + // we are sure then that the response is base64 encoded, let's decode it + // the returned result will be a float32 array since this is OpenAI API's default encoding + Core.debug('response', 'Decoding base64 embeddings to float32 array'); + + return (response as Core.APIPromise)._thenUnwrap((response) => { + if (response && response.data) { + response.data.forEach((embeddingBase64Obj) => { + const embeddingBase64Str = embeddingBase64Obj.embedding as unknown as string; + embeddingBase64Obj.embedding = Core.toFloat32Array(embeddingBase64Str); + }); + } + + return response; + }); } } diff --git a/tests/api-resources/embeddings.test.ts b/tests/api-resources/embeddings.test.ts index 46dd1b2a3..e226ade9e 100644 --- a/tests/api-resources/embeddings.test.ts +++ b/tests/api-resources/embeddings.test.ts @@ -32,4 +32,35 @@ describe('resource embeddings', () => { user: 'user-1234', }); }); + + test('create: encoding_format=float should create float32 embeddings', async () => { + const response = await client.embeddings.create({ + input: 'The quick brown fox jumped over the lazy dog', + model: 'text-embedding-3-small', + }); + + expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); + expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + }); + + test('create: encoding_format=base64 should create float32 embeddings', async () => { + const response = await client.embeddings.create({ + input: 'The quick brown fox jumped over the lazy dog', + model: 'text-embedding-3-small', + encoding_format: 'base64', + }); + + expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); + expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + }); + + test('create: encoding_format=default should create float32 embeddings', async () => { + const response = await client.embeddings.create({ + input: 'The quick brown fox jumped over the lazy dog', + model: 'text-embedding-3-small', + }); + + expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); + expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + }); }); From ca69782d2eb83e01d56ea81637133caadddef786 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:58:34 +0000 Subject: [PATCH 278/509] release: 4.91.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7b04494d6..f6df5bd5c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.90.0" + ".": "4.91.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 89523001a..8cf3201bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.91.0 (2025-03-31) + +Full Changelog: [v4.90.0...v4.91.0](https://github.com/openai/openai-node/compare/v4.90.0...v4.91.0) + +### Features + +* **api:** add `get /responses/{response_id}/input_items` endpoint ([ef0e0ac](https://github.com/openai/openai-node/commit/ef0e0acd469379ae6f2745c83e6c6813ff7b4edc)) + + +### Performance Improvements + +* **embedding:** default embedding creation to base64 ([#1312](https://github.com/openai/openai-node/issues/1312)) ([e54530e](https://github.com/openai/openai-node/commit/e54530e4f6f00d7d74fc8636bbdb6f6280548750)), closes [#1310](https://github.com/openai/openai-node/issues/1310) + ## 4.90.0 (2025-03-27) Full Changelog: [v4.89.1...v4.90.0](https://github.com/openai/openai-node/compare/v4.89.1...v4.90.0) diff --git a/jsr.json b/jsr.json index 98c8e6959..4595ab4b7 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.90.0", + "version": "4.91.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 408e50a73..089656265 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.90.0", + "version": "4.91.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 03d899bdd..0095d88c8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.90.0'; // x-release-please-version +export const VERSION = '4.91.0'; // x-release-please-version From 71950f6e891ba0813c25b2992db93a61ef6c9664 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 00:26:27 +0000 Subject: [PATCH 279/509] chore: Remove deprecated/unused remote spec feature --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f6a90d243..2ccfd3411 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: e25e31d8446b6bc0e3ef7103b6993cce +config_hash: 2daae06cc598821ccf87201de0861e40 From 1847673de09586c809e1057a6b08c604471e13ff Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 1 Apr 2025 14:36:41 -0400 Subject: [PATCH 280/509] fix(docs): correct docstring on responses.stream --- src/resources/responses/responses.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 6c9f58b43..a46c4182c 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -128,7 +128,7 @@ export class Responses extends APIResource { } /** - * Creates a chat completion stream + * Creates a model response stream */ stream>( body: Params, From e080e12cd3ab75ddc843746e7baa8fbf38f8a031 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 18:37:12 +0000 Subject: [PATCH 281/509] release: 4.91.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f6df5bd5c..0fdb6f309 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.91.0" + ".": "4.91.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cf3201bb..0de0d9630 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.91.1 (2025-04-01) + +Full Changelog: [v4.91.0...v4.91.1](https://github.com/openai/openai-node/compare/v4.91.0...v4.91.1) + +### Bug Fixes + +* **docs:** correct docstring on responses.stream ([1c8cd6a](https://github.com/openai/openai-node/commit/1c8cd6a638128b0ff5fac89d6c7db256f0b63a85)) + + +### Chores + +* Remove deprecated/unused remote spec feature ([ce3dfa8](https://github.com/openai/openai-node/commit/ce3dfa88bd4d395debccc0e6e1aac6d218b07cb8)) + ## 4.91.0 (2025-03-31) Full Changelog: [v4.90.0...v4.91.0](https://github.com/openai/openai-node/compare/v4.90.0...v4.91.0) diff --git a/jsr.json b/jsr.json index 4595ab4b7..9bd85f8c9 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.91.0", + "version": "4.91.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 089656265..cfa3e6201 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.91.0", + "version": "4.91.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 0095d88c8..85314d847 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.91.0'; // x-release-please-version +export const VERSION = '4.91.1'; // x-release-please-version From 32afb0022939b19069c37fcd9cabfe666ea86b77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:12:23 +0000 Subject: [PATCH 282/509] feat(api): manual updates --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2ccfd3411..71ac95541 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 2daae06cc598821ccf87201de0861e40 +config_hash: 31a12443afeef2933b34e2de23c40954 From efce6d3d719ad463b035b22e9a1cf461ab62b5af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:18:37 +0000 Subject: [PATCH 283/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 71ac95541..baad2afc1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 31a12443afeef2933b34e2de23c40954 +config_hash: 178ba1bfb1237bf6b94abb3408072aa7 From 5e5e4607a103fcb6257c071bb4bf57902ee6415f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 13:34:13 +0000 Subject: [PATCH 284/509] fix(client): send `X-Stainless-Timeout` in seconds (#1442) --- src/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index a3f664906..1858a31e8 100644 --- a/src/core.ts +++ b/src/core.ts @@ -406,7 +406,7 @@ export abstract class APIClient { getHeader(headers, 'x-stainless-timeout') === undefined && options.timeout ) { - reqHeaders['x-stainless-timeout'] = String(options.timeout); + reqHeaders['x-stainless-timeout'] = String(Math.trunc(options.timeout / 1000)); } this.validateHeaders(reqHeaders, headers); From c1c281983e23dcfdca964720265d3cba28b17795 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:49:58 +0000 Subject: [PATCH 285/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index baad2afc1..675edb075 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 178ba1bfb1237bf6b94abb3408072aa7 +config_hash: 578c5bff4208d560c0c280f13324409f From 1cb66b6ccbcecaa6e48b90d37d8cac4840bb69a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 20:55:24 +0000 Subject: [PATCH 286/509] chore(internal): add aliases for Record and Array (#1443) --- src/core.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/core.ts b/src/core.ts index 1858a31e8..ee445daf1 100644 --- a/src/core.ts +++ b/src/core.ts @@ -34,6 +34,20 @@ export { export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise; +/** + * An alias to the builtin `Array` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Array = Array; + +/** + * An alias to the builtin `Record` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Record = Record; + +export type { _Array as Array, _Record as Record }; + type PromiseOrValue = T | Promise; type APIResponseProps = { From 4af79ddd5b19925fa09d9ae877470aa8304535c2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:22:30 +0000 Subject: [PATCH 287/509] fix(api): improve type resolution when importing as a package (#1444) --- packages/mcp-server/src/tools.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/mcp-server/src/tools.ts diff --git a/packages/mcp-server/src/tools.ts b/packages/mcp-server/src/tools.ts new file mode 100644 index 000000000..7e516de7c --- /dev/null +++ b/packages/mcp-server/src/tools.ts @@ -0,0 +1 @@ +export * from './tools/index'; From b893d81420359c712dab6997c2dbc9f309549712 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:37:52 +0000 Subject: [PATCH 288/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 675edb075..aebb90c8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 578c5bff4208d560c0c280f13324409f +config_hash: bcd2cacdcb9fae9938f273cd167f613c From 4ba994773b41a3ed05a3ad908b235fc5f3810dfc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:09:16 +0000 Subject: [PATCH 289/509] fix(mcp): remove unused tools.ts (#1445) --- packages/mcp-server/src/tools.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/mcp-server/src/tools.ts diff --git a/packages/mcp-server/src/tools.ts b/packages/mcp-server/src/tools.ts deleted file mode 100644 index 7e516de7c..000000000 --- a/packages/mcp-server/src/tools.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './tools/index'; From d6b99c8fcbd35ef6b45d66f487aea759c01febbc Mon Sep 17 00:00:00 2001 From: Richard Dzenis Date: Mon, 7 Apr 2025 14:00:53 +0300 Subject: [PATCH 290/509] fix(embeddings): correctly decode base64 data (#1448) * Fix Core.toFloat32Array, Buffer version According to NodeJS docs Buffer.buffer is not guaranteed to correspond exactly to the original Buffer. [1] The previous implementation could use buffer garbage while converting bytes to floats. [1] https://nodejs.org/api/buffer.html#bufbuffer * add tests for embeddings data * fix formatting --------- Co-authored-by: Robert Craigie --- src/core.ts | 5 +- .../embeddings-base64-response.json | 1 + .../embeddings-float-response.json | 1 + tests/api-resources/embeddings.test.ts | 57 ++++++++++++++++--- 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 tests/api-resources/embeddings-base64-response.json create mode 100644 tests/api-resources/embeddings-float-response.json diff --git a/src/core.ts b/src/core.ts index ee445daf1..ccc677e0e 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1309,7 +1309,10 @@ export const toBase64 = (str: string | null | undefined): string => { export const toFloat32Array = (base64Str: string): Array => { if (typeof Buffer !== 'undefined') { // for Node.js environment - return Array.from(new Float32Array(Buffer.from(base64Str, 'base64').buffer)); + const buf = Buffer.from(base64Str, 'base64'); + return Array.from( + new Float32Array(buf.buffer, buf.byteOffset, buf.length / Float32Array.BYTES_PER_ELEMENT), + ); } else { // for legacy web platform APIs const binaryStr = atob(base64Str); diff --git a/tests/api-resources/embeddings-base64-response.json b/tests/api-resources/embeddings-base64-response.json new file mode 100644 index 000000000..9b0f7629c --- /dev/null +++ b/tests/api-resources/embeddings-base64-response.json @@ -0,0 +1 @@ +{"object":"list","data":[{"object":"embedding","index":0,"embedding":"A1fLvaC4Bb0QB7w8yEvrPOm9Xj2r0yA8EW4sPRq75j3Fbiq81/chPumAGb0afqG8R6AFvpzsQT35SPO7Hi39PEMAir1lf0A92McfvRoVlLxQv9o9tHqIvQYlrL0fwlK8sufPPYz2gjzH5Ho93GebvN+eCTxjRjW8PJRKvXMtFD4+n3C9ByMPO39Gkjs1Jm49A1fLPdNXpjv8RLm92McfveKpLz01VNO9SUIevhAHvD0flG09+9srvW5j7Txp8dY8LW4Ju08bJb1GdL29g+aNPWlLBD1p8dY8LkCkvfPLtjxcBj4+1/ehPebv/bz/Ifo8SqkOvREFHzyAr588HbUPPbFS+r00gri825WAPQlcGj1qHZ+8o8EOPo880Tn5dli9zRUSPc2APD0b5RG9mhxEvTyUSj3FQMU95u/9vE20tD3wwBC94NmxvXSUhL3Ofh8904WLPRbeJb2Paja8BClmvhwgOj2e6Ic9em0LPdj1BD3lSau7dJQEPJi107yB6kc97sTKO6lAaD2YDwE9YDuPPSFVC735dtg9SK1IOysJNrwtQkE8BmJxPb2ZXT0hVYs9g+YNvLfuuz2nyhe9z7nHN5UVWDxea5E77F1avTIbyL256oG9ft+hPVWJAbwNoug82TCtvUrm072wgN86JPWGO3TRyTwOY4a8xJwPvkx5DL1f1B68RwkTvja7Q72BrQI9Pfs6PTdfeb3RxG09jJxVvfl22D3eCbQ9FbR6vTPtYrn0mzS+kqGkPDxXhbwyG8i98M9wveayuL1EpL88lNqvve3yL70RQmQ7VcZGPaPBjr1wyEA9fKaWOskMibwNomi8J9Rku9EeGz016Si8O1mivQ38lb0EgxO88P1VvcilmLuNA0a9lj8DvHCceD3lSSs9uFWsve6HBT6XEZ68ShS5PFJSE70dTIK86OvDvSNgsbzS8DU8bPz8PAuVpTxKQIE9/NmOPBhFFj7LsL67PJRKvIxu8LwSqVS8D8yTPSOOlj1g0gG8A+69vYz2AjxPhLK80fLSPbrL/LztWz09LAcZvqfKF73B/JO8lnzIvCk5OLxwMU69dmQCvQtp3bs6hwe9WZKKume4S7x3CLg9zK4hPLsjDT16P6a7MbTXPRp+IT0dtQ89GayGvcngwD2F8bO70R4bu8tFlDxcBr67xAWdvdnWfzzQTIC9zn6fPYSKwz3alx28h8GxPW74wj3eNxk+xUBFvIpjyj0WdRi9AkoIPXhvqLugx+U8F0ezvUlCHjx3NAC9uvlhPEOmXD36oAM9D56uvddgrz2giiC9GhWUvHrWGLv0yRk8fOPbvMc+KLs7//S8v5UjPJUV2D0KLjW6YKa5PDciNDuJznQ9USZLPQ=="}],"model":"text-embedding-3-large","usage":{"prompt_tokens":1,"total_tokens":1}} \ No newline at end of file diff --git a/tests/api-resources/embeddings-float-response.json b/tests/api-resources/embeddings-float-response.json new file mode 100644 index 000000000..9b5b788e2 --- /dev/null +++ b/tests/api-resources/embeddings-float-response.json @@ -0,0 +1 @@ +{"object":"list","data":[{"object":"embedding","index":0,"embedding":[-0.099287055,-0.032646775,0.022952586,0.028722659,0.05438033,0.009816091,0.042097155,0.112661555,-0.010402386,0.158172,-0.037476454,-0.01971345,-0.13049422,0.04734479,-0.0074244705,0.030905303,-0.06738331,0.046996493,-0.039008945,-0.018076468,0.10681021,-0.06664029,-0.08405499,-0.012863665,0.10151614,0.015986703,0.061253335,-0.018970422,0.008399694,-0.011064145,-0.049457774,0.14470463,-0.058745615,0.0021840946,0.00446397,0.058141906,0.099287055,0.0050763874,-0.09046361,-0.039008945,0.042886622,-0.103187956,-0.15454973,0.091810346,0.058002587,-0.041957837,0.028978076,0.02623816,-0.002097021,-0.040309247,-0.09250693,0.06928732,0.03229848,0.02623816,-0.08020054,0.022314047,0.18557113,0.079086,-0.030998182,0.030533789,-0.034829415,0.009705798,0.019492865,0.035084832,-0.122228034,-0.022523023,0.06278583,0.037685428,-0.019423205,0.13941054,0.00039908706,-0.052847836,0.035665322,0.04602127,-0.035618883,-0.04787884,0.049457774,0.096314944,-0.030998182,0.08823452,-0.03534025,-0.086841345,-0.06473628,0.03893929,0.06812634,-0.040495,-0.011133804,-0.22476584,0.045440778,0.06636165,0.03403995,0.032461017,-0.005227315,0.008092035,-0.025843427,0.048807625,0.0061880266,0.05670229,0.031509012,0.06993747,-0.034016732,0.10569567,0.0030620862,-0.011110584,0.011795563,0.058931373,0.054101694,0.068033464,-0.008660915,0.091763906,-0.0370585,0.000023809172,0.013188739,0.004437848,-0.053312227,-0.09770812,-0.06343598,0.07903956,-0.007906278,0.028397584,-0.084565826,-0.103466585,0.0017051902,0.0041185785,0.024636008,-0.016404655,-0.14024645,-0.034295365,-0.009694188,-0.14359008,-0.04778596,0.031903747,0.045649756,-0.06088182,0.058049027,-0.052151248,0.10569567,0.087909445,-0.061206896,-0.00021641403,-0.17637616,0.020096574,-0.016276948,-0.09770812,-0.058792055,-0.09018497,0.023393758,-0.08586612,-0.04295628,0.0034829418,0.048528988,-0.06970527,0.047066152,0.0011493708,-0.01672973,-0.014198792,-0.0034916492,0.037871186,-0.010309507,-0.079271756,-0.073234655,-0.0090034045,-0.052244127,-0.0046584345,-0.04834323,-0.008010766,0.060696065,0.04181852,-0.08414787,0.13040134,-0.019295497,0.022592682,-0.03596718,-0.015905434,-0.0956648,-0.021652287,0.011104779,0.030882083,0.02021267,0.0631109,0.017437927,0.14674795,-0.005819415,-0.012364443,-0.029349588,-0.012979763,0.072166555,0.07351329,-0.007923692,-0.09273913,0.007993352,-0.021791605,0.1030022,-0.030858863,0.046230245,-0.14944142,-0.0370585,-0.018064858,-0.02447347,-0.011244097,-0.050340116,-0.03183409,-0.006756907,-0.033087946,-0.001057218,-0.012434102,0.089859895,0.009868335,0.034457903,-0.005073485,0.10532416,0.0394269,0.035084832,-0.06575794,0.09417874,-0.005491438,-0.002366949,0.018099686,-0.005799098,-0.07667115,0.0156151885,-0.06264651,0.07787858,0.09547904,-0.009618724,0.086794905,0.095200405,0.14962718,-0.012039368,0.09882267,-0.037221037,0.033273704,-0.0051402412,0.02804929,-0.08753794,0.009659358,-0.031300034,0.01379245,0.053869497,0.03213594,-0.08526241,0.085633926,-0.039194703,-0.018076468,-0.0023321197,0.009386528,-0.026841871,-0.0025672184,-0.02990686,0.009984433,0.105509914,-0.00069114624,0.022662342,0.0027486214,0.05976728,0.04959709]}],"model":"text-embedding-3-large","usage":{"prompt_tokens":1,"total_tokens":1}} \ No newline at end of file diff --git a/tests/api-resources/embeddings.test.ts b/tests/api-resources/embeddings.test.ts index e226ade9e..629265643 100644 --- a/tests/api-resources/embeddings.test.ts +++ b/tests/api-resources/embeddings.test.ts @@ -2,6 +2,9 @@ import OpenAI from 'openai'; import { Response } from 'node-fetch'; +import { mockFetch } from '../utils/mock-fetch'; +import fs from 'fs/promises'; +import Path from 'path'; const client = new OpenAI({ apiKey: 'My API Key', @@ -33,34 +36,72 @@ describe('resource embeddings', () => { }); }); - test('create: encoding_format=float should create float32 embeddings', async () => { + test('create: encoding_format=default should create float32 embeddings', async () => { + const client = makeClient(); const response = await client.embeddings.create({ input: 'The quick brown fox jumped over the lazy dog', model: 'text-embedding-3-small', }); expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); - expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + expect(response.data?.at(0)?.embedding.at(0)).toBe(-0.09928705543279648); }); - test('create: encoding_format=base64 should create float32 embeddings', async () => { + test('create: encoding_format=float should create float32 embeddings', async () => { + const client = makeClient(); const response = await client.embeddings.create({ input: 'The quick brown fox jumped over the lazy dog', model: 'text-embedding-3-small', - encoding_format: 'base64', + encoding_format: 'float', }); expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); - expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + expect(response.data?.at(0)?.embedding.at(0)).toBe(-0.099287055); }); - test('create: encoding_format=default should create float32 embeddings', async () => { + test('create: encoding_format=base64 should return base64 embeddings', async () => { + const client = makeClient(); const response = await client.embeddings.create({ input: 'The quick brown fox jumped over the lazy dog', model: 'text-embedding-3-small', + encoding_format: 'base64', }); - expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); - expect(Number.isFinite(response.data?.at(0)?.embedding.at(0))).toBe(true); + expect(typeof response.data?.at(0)?.embedding).toBe('string'); }); }); + +function makeClient(): OpenAI { + const { fetch, handleRequest } = mockFetch(); + + handleRequest(async (_, init) => { + const format = (JSON.parse(init!.body as string) as OpenAI.EmbeddingCreateParams).encoding_format; + return new Response( + await fs.readFile( + Path.join( + __dirname, + + // these responses were taken from the live API with: + // + // model: 'text-embedding-3-large', + // input: 'h', + // dimensions: 256, + + format === 'base64' ? 'embeddings-base64-response.json' : 'embeddings-float-response.json', + ), + ), + { + status: 200, + headers: { + 'Content-Type': 'application/json', + }, + }, + ); + }); + + return new OpenAI({ + fetch, + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', + }); +} From 0d31f406d3c47fb2f3a2a406a53ca28279af5641 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 11:01:19 +0000 Subject: [PATCH 291/509] release: 4.92.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 24 ++++++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0fdb6f309..e2b30744d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.91.1" + ".": "4.92.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0de0d9630..56fe95617 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog +## 4.92.0 (2025-04-07) + +Full Changelog: [v4.91.1...v4.92.0](https://github.com/openai/openai-node/compare/v4.91.1...v4.92.0) + +### Features + +* **api:** manual updates ([891754d](https://github.com/openai/openai-node/commit/891754d7fa42d71ce4f93288dd043ef0b97fee23)) +* **api:** manual updates ([01e5546](https://github.com/openai/openai-node/commit/01e5546f3f48a1f4d645e09e7581f16b30f25bdd)) +* **api:** manual updates ([f38dbf3](https://github.com/openai/openai-node/commit/f38dbf3b39b0800b3bbef5c603a4fa2b616f25d8)) +* **api:** manual updates ([1f12253](https://github.com/openai/openai-node/commit/1f12253054a5a7e35dc03b17901b4c1f33bf5b3d)) + + +### Bug Fixes + +* **api:** improve type resolution when importing as a package ([#1444](https://github.com/openai/openai-node/issues/1444)) ([4aa46d6](https://github.com/openai/openai-node/commit/4aa46d6c0da681bcdde31fcbb09e8ba6fdaf764b)) +* **client:** send `X-Stainless-Timeout` in seconds ([#1442](https://github.com/openai/openai-node/issues/1442)) ([aa4206c](https://github.com/openai/openai-node/commit/aa4206c7d93b4e3114a697f5467ffbbf5a64d1a8)) +* **embeddings:** correctly decode base64 data ([#1448](https://github.com/openai/openai-node/issues/1448)) ([58128f7](https://github.com/openai/openai-node/commit/58128f7efde73726da740c42adde7b02cdf60a6a)) +* **mcp:** remove unused tools.ts ([#1445](https://github.com/openai/openai-node/issues/1445)) ([520a8fa](https://github.com/openai/openai-node/commit/520a8fa77a69ce5855dde3481f9bd39339cb7b83)) + + +### Chores + +* **internal:** add aliases for Record and Array ([#1443](https://github.com/openai/openai-node/issues/1443)) ([b65391b](https://github.com/openai/openai-node/commit/b65391ba10d5063035c3e5c0bcc5a48ffc80f41d)) + ## 4.91.1 (2025-04-01) Full Changelog: [v4.91.0...v4.91.1](https://github.com/openai/openai-node/compare/v4.91.0...v4.91.1) diff --git a/jsr.json b/jsr.json index 9bd85f8c9..e5bac64a6 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.91.1", + "version": "4.92.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index cfa3e6201..2f79e9653 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.91.1", + "version": "4.92.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 85314d847..e2dac6b4c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.91.1'; // x-release-please-version +export const VERSION = '4.92.0'; // x-release-please-version From 93569f39799512604db439af20f0ef0ad3dae295 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:51:53 +0000 Subject: [PATCH 292/509] chore(internal): only run examples workflow in main repo (#1450) --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 627f5954f..6e59bb3fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,6 +68,7 @@ jobs: examples: name: examples runs-on: ubuntu-latest + if: github.repository == 'openai/openai-node' steps: - uses: actions/checkout@v4 From 324b091e8d70c6a13e486ca87727d4bd59d9b71f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:52:33 +0000 Subject: [PATCH 293/509] release: 4.92.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e2b30744d..837894bfb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.92.0" + ".": "4.92.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 56fe95617..105627c5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.92.1 (2025-04-07) + +Full Changelog: [v4.92.0...v4.92.1](https://github.com/openai/openai-node/compare/v4.92.0...v4.92.1) + +### Chores + +* **internal:** only run examples workflow in main repo ([#1450](https://github.com/openai/openai-node/issues/1450)) ([5e49a7a](https://github.com/openai/openai-node/commit/5e49a7a447bb788fa05898c15ae57c6ea9c8fd49)) + ## 4.92.0 (2025-04-07) Full Changelog: [v4.91.1...v4.92.0](https://github.com/openai/openai-node/compare/v4.91.1...v4.92.0) diff --git a/jsr.json b/jsr.json index e5bac64a6..b986198a1 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.92.0", + "version": "4.92.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 2f79e9653..58c231fda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.92.0", + "version": "4.92.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index e2dac6b4c..bfae301de 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.92.0'; // x-release-please-version +export const VERSION = '4.92.1'; // x-release-please-version From 15a86c958bf300486907f2498e1028fc9bc50b00 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:25:49 +0000 Subject: [PATCH 294/509] chore(tests): improve enum examples (#1454) --- tests/api-resources/images.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 88eb97a93..43e67b030 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -28,7 +28,7 @@ describe('resource images', () => { model: 'dall-e-2', n: 1, response_format: 'url', - size: '256x256', + size: '1024x1024', user: 'user-1234', }); }); @@ -55,7 +55,7 @@ describe('resource images', () => { model: 'dall-e-2', n: 1, response_format: 'url', - size: '256x256', + size: '1024x1024', user: 'user-1234', }); }); @@ -78,7 +78,7 @@ describe('resource images', () => { n: 1, quality: 'standard', response_format: 'url', - size: '256x256', + size: '1024x1024', style: 'vivid', user: 'user-1234', }); From 33b66f517e756e63c676efee97f7122b3cf165d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 18:49:53 +0000 Subject: [PATCH 295/509] feat(api): Add evalapi to sdk (#1456) Adding the evalsapi to the sdk. --- .stats.yml | 8 +- api.md | 72 ++ src/index.ts | 38 + src/resources/evals.ts | 3 + src/resources/evals/evals.ts | 783 ++++++++++++ src/resources/evals/index.ts | 33 + src/resources/evals/runs.ts | 3 + src/resources/evals/runs/index.ts | 23 + src/resources/evals/runs/output-items.ts | 410 +++++++ src/resources/evals/runs/runs.ts | 1058 +++++++++++++++++ src/resources/fine-tuning/checkpoints.ts | 3 + .../fine-tuning/checkpoints/checkpoints.ts | 32 + .../fine-tuning/checkpoints/index.ts | 12 + .../fine-tuning/checkpoints/permissions.ts | 198 +++ src/resources/fine-tuning/fine-tuning.ts | 6 + src/resources/fine-tuning/index.ts | 1 + src/resources/index.ts | 17 + tests/api-resources/evals/evals.test.ts | 417 +++++++ .../evals/runs/output-items.test.ts | 61 + tests/api-resources/evals/runs/runs.test.ts | 118 ++ .../checkpoints/permissions.test.ts | 85 ++ 21 files changed, 3377 insertions(+), 4 deletions(-) create mode 100644 src/resources/evals.ts create mode 100644 src/resources/evals/evals.ts create mode 100644 src/resources/evals/index.ts create mode 100644 src/resources/evals/runs.ts create mode 100644 src/resources/evals/runs/index.ts create mode 100644 src/resources/evals/runs/output-items.ts create mode 100644 src/resources/evals/runs/runs.ts create mode 100644 src/resources/fine-tuning/checkpoints.ts create mode 100644 src/resources/fine-tuning/checkpoints/checkpoints.ts create mode 100644 src/resources/fine-tuning/checkpoints/index.ts create mode 100644 src/resources/fine-tuning/checkpoints/permissions.ts create mode 100644 tests/api-resources/evals/evals.test.ts create mode 100644 tests/api-resources/evals/runs/output-items.test.ts create mode 100644 tests/api-resources/evals/runs/runs.test.ts create mode 100644 tests/api-resources/fine-tuning/checkpoints/permissions.test.ts diff --git a/.stats.yml b/.stats.yml index aebb90c8c..ebe07c137 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml -openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: bcd2cacdcb9fae9938f273cd167f613c +configured_endpoints: 97 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-472fe3036ea745365257fe870c0330917fb3153705c2826f49873cd631319b0a.yml +openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 +config_hash: ef19d36c307306f14f2e1cd5c834a151 diff --git a/api.md b/api.md index cf464cf63..2eb54b34a 100644 --- a/api.md +++ b/api.md @@ -235,6 +235,22 @@ Methods: - client.fineTuning.jobs.checkpoints.list(fineTuningJobId, { ...params }) -> FineTuningJobCheckpointsPage +## Checkpoints + +### Permissions + +Types: + +- PermissionCreateResponse +- PermissionRetrieveResponse +- PermissionDeleteResponse + +Methods: + +- client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage +- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse +- client.fineTuning.checkpoints.permissions.del(fineTunedModelCheckpoint) -> PermissionDeleteResponse + # VectorStores Types: @@ -643,3 +659,59 @@ Types: Methods: - client.responses.inputItems.list(responseId, { ...params }) -> ResponseItemsPage + +# Evals + +Types: + +- EvalCustomDataSourceConfig +- EvalLabelModelGrader +- EvalStoredCompletionsDataSourceConfig +- EvalStringCheckGrader +- EvalTextSimilarityGrader +- EvalCreateResponse +- EvalRetrieveResponse +- EvalUpdateResponse +- EvalListResponse +- EvalDeleteResponse + +Methods: + +- client.evals.create({ ...params }) -> EvalCreateResponse +- client.evals.retrieve(evalId) -> EvalRetrieveResponse +- client.evals.update(evalId, { ...params }) -> EvalUpdateResponse +- client.evals.list({ ...params }) -> EvalListResponsesPage +- client.evals.del(evalId) -> EvalDeleteResponse + +## Runs + +Types: + +- CreateEvalCompletionsRunDataSource +- CreateEvalJSONLRunDataSource +- EvalAPIError +- RunCreateResponse +- RunRetrieveResponse +- RunListResponse +- RunDeleteResponse +- RunCancelResponse + +Methods: + +- client.evals.runs.create(evalId, { ...params }) -> RunCreateResponse +- client.evals.runs.retrieve(evalId, runId) -> RunRetrieveResponse +- client.evals.runs.list(evalId, { ...params }) -> RunListResponsesPage +- client.evals.runs.del(evalId, runId) -> RunDeleteResponse +- client.evals.runs.cancel(evalId, runId) -> RunCancelResponse + +### OutputItems + +Types: + +- OutputItemRetrieveResponse +- OutputItemListResponse + +Methods: + +- client.evals.runs.outputItems.retrieve(evalId, runId, outputItemId) -> OutputItemRetrieveResponse +- client.evals.runs.outputItems.list(evalId, runId, { ...params }) -> OutputItemListResponsesPage diff --git a/src/index.ts b/src/index.ts index 931894f2f..9e8d7ce37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,6 +66,23 @@ import { import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; +import { + EvalCreateParams, + EvalCreateResponse, + EvalCustomDataSourceConfig, + EvalDeleteResponse, + EvalLabelModelGrader, + EvalListParams, + EvalListResponse, + EvalListResponsesPage, + EvalRetrieveResponse, + EvalStoredCompletionsDataSourceConfig, + EvalStringCheckGrader, + EvalTextSimilarityGrader, + EvalUpdateParams, + EvalUpdateResponse, + Evals, +} from './resources/evals/evals'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; import { Responses } from './resources/responses/responses'; import { @@ -293,6 +310,7 @@ export class OpenAI extends Core.APIClient { batches: API.Batches = new API.Batches(this); uploads: API.Uploads = new API.Uploads(this); responses: API.Responses = new API.Responses(this); + evals: API.Evals = new API.Evals(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -356,6 +374,8 @@ OpenAI.Batches = Batches; OpenAI.BatchesPage = BatchesPage; OpenAI.Uploads = UploadsAPIUploads; OpenAI.Responses = Responses; +OpenAI.Evals = Evals; +OpenAI.EvalListResponsesPage = EvalListResponsesPage; export declare namespace OpenAI { export type RequestOptions = Core.RequestOptions; @@ -508,6 +528,24 @@ export declare namespace OpenAI { export { Responses as Responses }; + export { + Evals as Evals, + type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLabelModelGrader as EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader as EvalStringCheckGrader, + type EvalTextSimilarityGrader as EvalTextSimilarityGrader, + type EvalCreateResponse as EvalCreateResponse, + type EvalRetrieveResponse as EvalRetrieveResponse, + type EvalUpdateResponse as EvalUpdateResponse, + type EvalListResponse as EvalListResponse, + type EvalDeleteResponse as EvalDeleteResponse, + EvalListResponsesPage as EvalListResponsesPage, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, + type EvalListParams as EvalListParams, + }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; diff --git a/src/resources/evals.ts b/src/resources/evals.ts new file mode 100644 index 000000000..b611710e1 --- /dev/null +++ b/src/resources/evals.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './evals/index'; diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts new file mode 100644 index 000000000..84ff6d1bb --- /dev/null +++ b/src/resources/evals/evals.ts @@ -0,0 +1,783 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; +import * as Shared from '../shared'; +import * as RunsAPI from './runs/runs'; +import { + CreateEvalCompletionsRunDataSource, + CreateEvalJSONLRunDataSource, + EvalAPIError, + RunCancelResponse, + RunCreateParams, + RunCreateResponse, + RunDeleteResponse, + RunListParams, + RunListResponse, + RunListResponsesPage, + RunRetrieveResponse, + Runs, +} from './runs/runs'; +import { CursorPage, type CursorPageParams } from '../../pagination'; + +export class Evals extends APIResource { + runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); + + /** + * Create the structure of an evaluation that can be used to test a model's + * performance. An evaluation is a set of testing criteria and a datasource. After + * creating an evaluation, you can run it on different models and model parameters. + * We support several types of graders and datasources. For more information, see + * the [Evals guide](https://platform.openai.com/docs/guides/evals). + */ + create(body: EvalCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/evals', { body, ...options }); + } + + /** + * Get an evaluation by ID. + */ + retrieve(evalId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/evals/${evalId}`, options); + } + + /** + * Update certain properties of an evaluation. + */ + update( + evalId: string, + body: EvalUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/evals/${evalId}`, { body, ...options }); + } + + /** + * List evaluations for a project. + */ + list( + query?: EvalListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: EvalListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/evals', EvalListResponsesPage, { query, ...options }); + } + + /** + * Delete an evaluation. + */ + del(evalId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/evals/${evalId}`, options); + } +} + +export class EvalListResponsesPage extends CursorPage {} + +/** + * A CustomDataSourceConfig which specifies the schema of your `item` and + * optionally `sample` namespaces. The response schema defines the shape of the + * data that will be: + * + * - Used to define your testing criteria and + * - What data is required when creating a run + */ +export interface EvalCustomDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `custom`. + */ + type: 'custom'; +} + +/** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ +export interface EvalLabelModelGrader { + input: Array; + + /** + * The labels to assign to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; +} + +export namespace EvalLabelModelGrader { + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface Assistant { + content: Assistant.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace Assistant { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A StoredCompletionsDataSourceConfig which specifies the metadata property of + * your stored completions query. This is usually metadata like `usecase=chatbot` + * or `prompt-version=v2`, etc. The schema returned by this data source config is + * used to defined what variables are available in your evals. `item` and `sample` + * are both defined when using this data source config. + */ +export interface EvalStoredCompletionsDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `stored_completions`. + */ + type: 'stored_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?: Shared.Metadata | null; +} + +/** + * A StringCheckGrader object that performs a string comparison between input and + * reference using a specified operation. + */ +export interface EvalStringCheckGrader { + /** + * The input text. This may include template strings. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. + */ + operation: 'eq' | 'ne' | 'like' | 'ilike'; + + /** + * The reference text. This may include template strings. + */ + reference: string; + + /** + * The object type, which is always `string_check`. + */ + type: 'string_check'; +} + +/** + * A TextSimilarityGrader object which grades text based on similarity metrics. + */ +export interface EvalTextSimilarityGrader { + /** + * The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, + * `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + */ + evaluation_metric: + | 'fuzzy_match' + | 'bleu' + | 'gleu' + | 'meteor' + | 'rouge_1' + | 'rouge_2' + | 'rouge_3' + | 'rouge_4' + | 'rouge_5' + | 'rouge_l' + | 'cosine'; + + /** + * The text being graded. + */ + input: string; + + /** + * A float score where a value greater than or equal indicates a passing grade. + */ + pass_threshold: number; + + /** + * The text being graded against. + */ + reference: string; + + /** + * The type of grader. + */ + type: 'text_similarity'; + + /** + * The name of the grader. + */ + name?: string; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalCreateResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalRetrieveResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalUpdateResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalListResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +export interface EvalDeleteResponse { + deleted: boolean; + + eval_id: string; + + object: string; +} + +export interface EvalCreateParams { + /** + * The configuration for the data source used for the evaluation runs. + */ + data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + + /** + * A list of graders for all eval runs in this group. + */ + testing_criteria: Array; + + /** + * 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 name of the evaluation. + */ + name?: string; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai?: boolean; +} + +export namespace EvalCreateParams { + /** + * A CustomDataSourceConfig object that defines the schema for the data source used + * for the evaluation runs. This schema is used to define the shape of the data + * that will be: + * + * - Used to define your testing criteria and + * - What data is required when creating a run + */ + export interface Custom { + /** + * The json schema for the run data source items. + */ + item_schema: Record; + + /** + * The type of data source. Always `custom`. + */ + type: 'custom'; + + /** + * Whether to include the sample schema in the data source. + */ + include_sample_schema?: boolean; + } + + /** + * A data source config which specifies the metadata property of your stored + * completions query. This is usually metadata like `usecase=chatbot` or + * `prompt-version=v2`, etc. + */ + export interface StoredCompletions { + /** + * The type of data source. Always `stored_completions`. + */ + type: 'stored_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?: Shared.Metadata | null; + } + + /** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ + export interface LabelModel { + input: Array; + + /** + * The labels to classify to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; + } + + export namespace LabelModel { + export interface SimpleInputMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface OutputMessage { + content: OutputMessage.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace OutputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } + } +} + +export interface EvalUpdateParams { + /** + * 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; + + /** + * Rename the evaluation. + */ + name?: string; +} + +export interface EvalListParams extends CursorPageParams { + /** + * Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for + * descending order. + */ + order?: 'asc' | 'desc'; + + /** + * Evals can be ordered by creation time or last updated time. Use `created_at` for + * creation time or `updated_at` for last updated time. + */ + order_by?: 'created_at' | 'updated_at'; +} + +Evals.EvalListResponsesPage = EvalListResponsesPage; +Evals.Runs = Runs; +Evals.RunListResponsesPage = RunListResponsesPage; + +export declare namespace Evals { + export { + type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLabelModelGrader as EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader as EvalStringCheckGrader, + type EvalTextSimilarityGrader as EvalTextSimilarityGrader, + type EvalCreateResponse as EvalCreateResponse, + type EvalRetrieveResponse as EvalRetrieveResponse, + type EvalUpdateResponse as EvalUpdateResponse, + type EvalListResponse as EvalListResponse, + type EvalDeleteResponse as EvalDeleteResponse, + EvalListResponsesPage as EvalListResponsesPage, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, + type EvalListParams as EvalListParams, + }; + + export { + Runs as Runs, + type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type EvalAPIError as EvalAPIError, + type RunCreateResponse as RunCreateResponse, + type RunRetrieveResponse as RunRetrieveResponse, + type RunListResponse as RunListResponse, + type RunDeleteResponse as RunDeleteResponse, + type RunCancelResponse as RunCancelResponse, + RunListResponsesPage as RunListResponsesPage, + type RunCreateParams as RunCreateParams, + type RunListParams as RunListParams, + }; +} diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts new file mode 100644 index 000000000..a246fe4e7 --- /dev/null +++ b/src/resources/evals/index.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + EvalListResponsesPage, + Evals, + type EvalCustomDataSourceConfig, + type EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader, + type EvalTextSimilarityGrader, + type EvalCreateResponse, + type EvalRetrieveResponse, + type EvalUpdateResponse, + type EvalListResponse, + type EvalDeleteResponse, + type EvalCreateParams, + type EvalUpdateParams, + type EvalListParams, +} from './evals'; +export { + RunListResponsesPage, + Runs, + type CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource, + type EvalAPIError, + type RunCreateResponse, + type RunRetrieveResponse, + type RunListResponse, + type RunDeleteResponse, + type RunCancelResponse, + type RunCreateParams, + type RunListParams, +} from './runs/index'; diff --git a/src/resources/evals/runs.ts b/src/resources/evals/runs.ts new file mode 100644 index 000000000..a3cc2bc7f --- /dev/null +++ b/src/resources/evals/runs.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './runs/index'; diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts new file mode 100644 index 000000000..d0e18bff4 --- /dev/null +++ b/src/resources/evals/runs/index.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + OutputItemListResponsesPage, + OutputItems, + type OutputItemRetrieveResponse, + type OutputItemListResponse, + type OutputItemListParams, +} from './output-items'; +export { + RunListResponsesPage, + Runs, + type CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource, + type EvalAPIError, + type RunCreateResponse, + type RunRetrieveResponse, + type RunListResponse, + type RunDeleteResponse, + type RunCancelResponse, + type RunCreateParams, + type RunListParams, +} from './runs'; diff --git a/src/resources/evals/runs/output-items.ts b/src/resources/evals/runs/output-items.ts new file mode 100644 index 000000000..ee947c60f --- /dev/null +++ b/src/resources/evals/runs/output-items.ts @@ -0,0 +1,410 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import * as RunsAPI from './runs'; +import { CursorPage, type CursorPageParams } from '../../../pagination'; + +export class OutputItems extends APIResource { + /** + * Get an evaluation run output item by ID. + */ + retrieve( + evalId: string, + runId: string, + outputItemId: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.get(`/evals/${evalId}/runs/${runId}/output_items/${outputItemId}`, options); + } + + /** + * Get a list of output items for an evaluation run. + */ + list( + evalId: string, + runId: string, + query?: OutputItemListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + evalId: string, + runId: string, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + evalId: string, + runId: string, + query: OutputItemListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list(evalId, runId, {}, query); + } + return this._client.getAPIList( + `/evals/${evalId}/runs/${runId}/output_items`, + OutputItemListResponsesPage, + { query, ...options }, + ); + } +} + +export class OutputItemListResponsesPage extends CursorPage {} + +/** + * A schema representing an evaluation run output item. + */ +export interface OutputItemRetrieveResponse { + /** + * Unique identifier for the evaluation run output item. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Details of the input data source item. + */ + datasource_item: Record; + + /** + * The identifier for the data source item. + */ + datasource_item_id: number; + + /** + * The identifier of the evaluation group. + */ + eval_id: string; + + /** + * The type of the object. Always "eval.run.output_item". + */ + object: 'eval.run.output_item'; + + /** + * A list of results from the evaluation run. + */ + results: Array>; + + /** + * The identifier of the evaluation run associated with this output item. + */ + run_id: string; + + /** + * A sample containing the input and output of the evaluation run. + */ + sample: OutputItemRetrieveResponse.Sample; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace OutputItemRetrieveResponse { + /** + * A sample containing the input and output of the evaluation run. + */ + export interface Sample { + /** + * An object representing an error response from the Eval API. + */ + error: RunsAPI.EvalAPIError; + + /** + * The reason why the sample generation was finished. + */ + finish_reason: string; + + /** + * An array of input messages. + */ + input: Array; + + /** + * The maximum number of tokens allowed for completion. + */ + max_completion_tokens: number; + + /** + * The model used for generating the sample. + */ + model: string; + + /** + * An array of output messages. + */ + output: Array; + + /** + * The seed used for generating the sample. + */ + seed: number; + + /** + * The sampling temperature used. + */ + temperature: number; + + /** + * The top_p value used for sampling. + */ + top_p: number; + + /** + * Token usage details for the sample. + */ + usage: Sample.Usage; + } + + export namespace Sample { + /** + * An input message. + */ + export interface Input { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message sender (e.g., system, user, developer). + */ + role: string; + } + + export interface Output { + /** + * The content of the message. + */ + content?: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role?: string; + } + + /** + * Token usage details for the sample. + */ + export interface Usage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + } +} + +/** + * A schema representing an evaluation run output item. + */ +export interface OutputItemListResponse { + /** + * Unique identifier for the evaluation run output item. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Details of the input data source item. + */ + datasource_item: Record; + + /** + * The identifier for the data source item. + */ + datasource_item_id: number; + + /** + * The identifier of the evaluation group. + */ + eval_id: string; + + /** + * The type of the object. Always "eval.run.output_item". + */ + object: 'eval.run.output_item'; + + /** + * A list of results from the evaluation run. + */ + results: Array>; + + /** + * The identifier of the evaluation run associated with this output item. + */ + run_id: string; + + /** + * A sample containing the input and output of the evaluation run. + */ + sample: OutputItemListResponse.Sample; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace OutputItemListResponse { + /** + * A sample containing the input and output of the evaluation run. + */ + export interface Sample { + /** + * An object representing an error response from the Eval API. + */ + error: RunsAPI.EvalAPIError; + + /** + * The reason why the sample generation was finished. + */ + finish_reason: string; + + /** + * An array of input messages. + */ + input: Array; + + /** + * The maximum number of tokens allowed for completion. + */ + max_completion_tokens: number; + + /** + * The model used for generating the sample. + */ + model: string; + + /** + * An array of output messages. + */ + output: Array; + + /** + * The seed used for generating the sample. + */ + seed: number; + + /** + * The sampling temperature used. + */ + temperature: number; + + /** + * The top_p value used for sampling. + */ + top_p: number; + + /** + * Token usage details for the sample. + */ + usage: Sample.Usage; + } + + export namespace Sample { + /** + * An input message. + */ + export interface Input { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message sender (e.g., system, user, developer). + */ + role: string; + } + + export interface Output { + /** + * The content of the message. + */ + content?: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role?: string; + } + + /** + * Token usage details for the sample. + */ + export interface Usage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + } +} + +export interface OutputItemListParams extends CursorPageParams { + /** + * Sort order for output items by timestamp. Use `asc` for ascending order or + * `desc` for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; + + /** + * Filter output items by status. Use `failed` to filter by failed output items or + * `pass` to filter by passed output items. + */ + status?: 'fail' | 'pass'; +} + +OutputItems.OutputItemListResponsesPage = OutputItemListResponsesPage; + +export declare namespace OutputItems { + export { + type OutputItemRetrieveResponse as OutputItemRetrieveResponse, + type OutputItemListResponse as OutputItemListResponse, + OutputItemListResponsesPage as OutputItemListResponsesPage, + type OutputItemListParams as OutputItemListParams, + }; +} diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts new file mode 100644 index 000000000..ca2b7f424 --- /dev/null +++ b/src/resources/evals/runs/runs.ts @@ -0,0 +1,1058 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import * as Shared from '../../shared'; +import * as OutputItemsAPI from './output-items'; +import { + OutputItemListParams, + OutputItemListResponse, + OutputItemListResponsesPage, + OutputItemRetrieveResponse, + OutputItems, +} from './output-items'; +import { CursorPage, type CursorPageParams } from '../../../pagination'; + +export class Runs extends APIResource { + outputItems: OutputItemsAPI.OutputItems = new OutputItemsAPI.OutputItems(this._client); + + /** + * Create a new evaluation run. This is the endpoint that will kick off grading. + */ + create( + evalId: string, + body: RunCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/evals/${evalId}/runs`, { body, ...options }); + } + + /** + * Get an evaluation run by ID. + */ + retrieve( + evalId: string, + runId: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.get(`/evals/${evalId}/runs/${runId}`, options); + } + + /** + * Get a list of runs for an evaluation. + */ + list( + evalId: string, + query?: RunListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + evalId: string, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + evalId: string, + query: RunListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list(evalId, {}, query); + } + return this._client.getAPIList(`/evals/${evalId}/runs`, RunListResponsesPage, { query, ...options }); + } + + /** + * Delete an eval run. + */ + del(evalId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/evals/${evalId}/runs/${runId}`, options); + } + + /** + * Cancel an ongoing evaluation run. + */ + cancel(evalId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/evals/${evalId}/runs/${runId}`, options); + } +} + +export class RunListResponsesPage extends CursorPage {} + +/** + * A CompletionsRunDataSource object describing a model sampling configuration. + */ +export interface CreateEvalCompletionsRunDataSource { + input_messages: + | CreateEvalCompletionsRunDataSource.Template + | CreateEvalCompletionsRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model: string; + + /** + * A StoredCompletionsRunDataSource configuration describing a set of filters + */ + source: + | CreateEvalCompletionsRunDataSource.FileContent + | CreateEvalCompletionsRunDataSource.FileID + | CreateEvalCompletionsRunDataSource.StoredCompletions; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + sampling_params?: CreateEvalCompletionsRunDataSource.SamplingParams; +} + +export namespace CreateEvalCompletionsRunDataSource { + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface OutputMessage { + content: OutputMessage.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace OutputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A StoredCompletionsRunDataSource configuration describing a set of filters + */ + export interface StoredCompletions { + /** + * An optional Unix timestamp to filter items created after this time. + */ + created_after: number | null; + + /** + * An optional Unix timestamp to filter items created before this time. + */ + created_before: number | null; + + /** + * An optional maximum number of items to return. + */ + limit: number | null; + + /** + * 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; + + /** + * An optional model to filter by (e.g., 'gpt-4o'). + */ + model: string | null; + + /** + * The type of source. Always `stored_completions`. + */ + type: 'stored_completions'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } +} + +/** + * A JsonlRunDataSource object with that specifies a JSONL file that matches the + * eval + */ +export interface CreateEvalJSONLRunDataSource { + source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; + + /** + * The type of data source. Always `jsonl`. + */ + type: 'jsonl'; +} + +export namespace CreateEvalJSONLRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } +} + +/** + * An object representing an error response from the Eval API. + */ +export interface EvalAPIError { + /** + * The error code. + */ + code: string; + + /** + * The error message. + */ + message: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCreateResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCreateResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCreateResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +/** + * A schema representing an evaluation run. + */ +export interface RunRetrieveResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunRetrieveResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunRetrieveResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +/** + * A schema representing an evaluation run. + */ +export interface RunListResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunListResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunDeleteResponse { + deleted?: boolean; + + object?: string; + + run_id?: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCancelResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCancelResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCancelResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunCreateParams { + /** + * Details about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * 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 name of the run. + */ + name?: string; +} + +export interface RunListParams extends CursorPageParams { + /** + * Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for + * descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; + + /** + * Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" | + * "canceled". + */ + status?: 'queued' | 'in_progress' | 'completed' | 'canceled' | 'failed'; +} + +Runs.RunListResponsesPage = RunListResponsesPage; +Runs.OutputItems = OutputItems; +Runs.OutputItemListResponsesPage = OutputItemListResponsesPage; + +export declare namespace Runs { + export { + type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type EvalAPIError as EvalAPIError, + type RunCreateResponse as RunCreateResponse, + type RunRetrieveResponse as RunRetrieveResponse, + type RunListResponse as RunListResponse, + type RunDeleteResponse as RunDeleteResponse, + type RunCancelResponse as RunCancelResponse, + RunListResponsesPage as RunListResponsesPage, + type RunCreateParams as RunCreateParams, + type RunListParams as RunListParams, + }; + + export { + OutputItems as OutputItems, + type OutputItemRetrieveResponse as OutputItemRetrieveResponse, + type OutputItemListResponse as OutputItemListResponse, + OutputItemListResponsesPage as OutputItemListResponsesPage, + type OutputItemListParams as OutputItemListParams, + }; +} diff --git a/src/resources/fine-tuning/checkpoints.ts b/src/resources/fine-tuning/checkpoints.ts new file mode 100644 index 000000000..eb09063f6 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './checkpoints/index'; diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts new file mode 100644 index 000000000..08422aa64 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -0,0 +1,32 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as PermissionsAPI from './permissions'; +import { + PermissionCreateParams, + PermissionCreateResponse, + PermissionCreateResponsesPage, + PermissionDeleteResponse, + PermissionRetrieveParams, + PermissionRetrieveResponse, + Permissions, +} from './permissions'; + +export class Checkpoints extends APIResource { + permissions: PermissionsAPI.Permissions = new PermissionsAPI.Permissions(this._client); +} + +Checkpoints.Permissions = Permissions; +Checkpoints.PermissionCreateResponsesPage = PermissionCreateResponsesPage; + +export declare namespace Checkpoints { + export { + Permissions as Permissions, + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionCreateParams as PermissionCreateParams, + type PermissionRetrieveParams as PermissionRetrieveParams, + }; +} diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts new file mode 100644 index 000000000..51d1af9cf --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Checkpoints } from './checkpoints'; +export { + PermissionCreateResponsesPage, + Permissions, + type PermissionCreateResponse, + type PermissionRetrieveResponse, + type PermissionDeleteResponse, + type PermissionCreateParams, + type PermissionRetrieveParams, +} from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts new file mode 100644 index 000000000..500c3de81 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -0,0 +1,198 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import { Page } from '../../../pagination'; + +export class Permissions extends APIResource { + /** + * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). + * + * This enables organization owners to share fine-tuned models with other projects + * in their organization. + */ + create( + fineTunedModelCheckpoint: string, + body: PermissionCreateParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + return this._client.getAPIList( + `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + PermissionCreateResponsesPage, + { body, method: 'post', ...options }, + ); + } + + /** + * **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. + */ + retrieve( + fineTunedModelCheckpoint: string, + query?: PermissionRetrieveParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieve( + fineTunedModelCheckpoint: string, + options?: Core.RequestOptions, + ): Core.APIPromise; + retrieve( + fineTunedModelCheckpoint: string, + query: PermissionRetrieveParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.retrieve(fineTunedModelCheckpoint, {}, query); + } + return this._client.get(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, { + query, + ...options, + }); + } + + /** + * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + * + * Organization owners can use this endpoint to delete a permission for a + * fine-tuned model checkpoint. + */ + del( + fineTunedModelCheckpoint: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.delete(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, options); + } +} + +/** + * Note: no pagination actually occurs yet, this is for forwards-compatibility. + */ +export class PermissionCreateResponsesPage extends Page {} + +/** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ +export interface PermissionCreateResponse { + /** + * 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 PermissionRetrieveResponse { + data: Array; + + has_more: boolean; + + object: 'list'; + + first_id?: string | null; + + last_id?: string | null; +} + +export namespace PermissionRetrieveResponse { + /** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ + export interface Data { + /** + * 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. + */ + id: string; + + /** + * Whether the fine-tuned model checkpoint permission was successfully deleted. + */ + deleted: boolean; + + /** + * The object type, which is always "checkpoint.permission". + */ + object: 'checkpoint.permission'; +} + +export interface PermissionCreateParams { + /** + * The project identifiers to grant access to. + */ + project_ids: Array; +} + +export interface PermissionRetrieveParams { + /** + * Identifier for the last permission ID from the previous pagination request. + */ + after?: string; + + /** + * Number of permissions to retrieve. + */ + limit?: number; + + /** + * The order in which to retrieve permissions. + */ + order?: 'ascending' | 'descending'; + + /** + * The ID of the project to get permissions for. + */ + project_id?: string; +} + +Permissions.PermissionCreateResponsesPage = PermissionCreateResponsesPage; + +export declare namespace Permissions { + export { + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionCreateParams as PermissionCreateParams, + type PermissionRetrieveParams as PermissionRetrieveParams, + }; +} diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index df013c8ec..9b0a01992 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -1,6 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as CheckpointsAPI from './checkpoints/checkpoints'; +import { Checkpoints } from './checkpoints/checkpoints'; import * as JobsAPI from './jobs/jobs'; import { FineTuningJob, @@ -18,11 +20,13 @@ import { export class FineTuning extends APIResource { jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); + checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); } FineTuning.Jobs = Jobs; FineTuning.FineTuningJobsPage = FineTuningJobsPage; FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage; +FineTuning.Checkpoints = Checkpoints; export declare namespace FineTuning { export { @@ -38,4 +42,6 @@ export declare namespace FineTuning { type JobListParams as JobListParams, type JobListEventsParams as JobListEventsParams, }; + + export { Checkpoints as Checkpoints }; } diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 4954406b8..d23161c62 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Checkpoints } from './checkpoints/index'; export { FineTuning } from './fine-tuning'; export { FineTuningJobsPage, diff --git a/src/resources/index.ts b/src/resources/index.ts index 04c2c887b..0d8ec9220 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -29,6 +29,23 @@ export { type EmbeddingModel, type EmbeddingCreateParams, } from './embeddings'; +export { + EvalListResponsesPage, + Evals, + type EvalCustomDataSourceConfig, + type EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader, + type EvalTextSimilarityGrader, + type EvalCreateResponse, + type EvalRetrieveResponse, + type EvalUpdateResponse, + type EvalListResponse, + type EvalDeleteResponse, + type EvalCreateParams, + type EvalUpdateParams, + type EvalListParams, +} from './evals/evals'; export { FileObjectsPage, Files, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts new file mode 100644 index 000000000..3aeb3e15c --- /dev/null +++ b/tests/api-resources/evals/evals.test.ts @@ -0,0 +1,417 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource evals', () => { + test('create: only required params', async () => { + const responsePromise = client.evals.create({ + data_source_config: { + item_schema: { + '0': 'bar', + '1': 'bar', + '2': 'bar', + '3': 'bar', + '4': 'bar', + '5': 'bar', + '6': 'bar', + '7': 'bar', + '8': 'bar', + '9': 'bar', + '10': 'bar', + '11': 'bar', + '12': 'bar', + '13': 'bar', + '14': 'bar', + '15': 'bar', + '16': 'bar', + '17': 'bar', + '18': 'bar', + '19': 'bar', + '20': 'bar', + '21': 'bar', + '22': 'bar', + '23': 'bar', + '24': 'bar', + '25': 'bar', + '26': 'bar', + '27': 'bar', + '28': 'bar', + '29': 'bar', + '30': 'bar', + '31': 'bar', + '32': 'bar', + '33': 'bar', + '34': 'bar', + '35': 'bar', + '36': 'bar', + '37': 'bar', + '38': 'bar', + '39': 'bar', + '40': 'bar', + '41': 'bar', + '42': 'bar', + '43': 'bar', + '44': 'bar', + '45': 'bar', + '46': 'bar', + '47': 'bar', + '48': 'bar', + '49': 'bar', + '50': 'bar', + '51': 'bar', + '52': 'bar', + '53': 'bar', + '54': 'bar', + '55': 'bar', + '56': 'bar', + '57': 'bar', + '58': 'bar', + '59': 'bar', + '60': 'bar', + '61': 'bar', + '62': 'bar', + '63': 'bar', + '64': 'bar', + '65': 'bar', + '66': 'bar', + '67': 'bar', + '68': 'bar', + '69': 'bar', + '70': 'bar', + '71': 'bar', + '72': 'bar', + '73': 'bar', + '74': 'bar', + '75': 'bar', + '76': 'bar', + '77': 'bar', + '78': 'bar', + '79': 'bar', + '80': 'bar', + '81': 'bar', + '82': 'bar', + '83': 'bar', + '84': 'bar', + '85': 'bar', + '86': 'bar', + '87': 'bar', + '88': 'bar', + '89': 'bar', + '90': 'bar', + '91': 'bar', + '92': 'bar', + '93': 'bar', + '94': 'bar', + '95': 'bar', + '96': 'bar', + '97': 'bar', + '98': 'bar', + '99': 'bar', + '100': 'bar', + '101': 'bar', + '102': 'bar', + '103': 'bar', + '104': 'bar', + '105': 'bar', + '106': 'bar', + '107': 'bar', + '108': 'bar', + '109': 'bar', + '110': 'bar', + '111': 'bar', + '112': 'bar', + '113': 'bar', + '114': 'bar', + '115': 'bar', + '116': 'bar', + '117': 'bar', + '118': 'bar', + '119': 'bar', + '120': 'bar', + '121': 'bar', + '122': 'bar', + '123': 'bar', + '124': 'bar', + '125': 'bar', + '126': 'bar', + '127': 'bar', + '128': 'bar', + '129': 'bar', + '130': 'bar', + '131': 'bar', + '132': 'bar', + '133': 'bar', + '134': 'bar', + '135': 'bar', + '136': 'bar', + '137': 'bar', + '138': 'bar', + '139': 'bar', + }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + 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('create: required and optional params', async () => { + const response = await client.evals.create({ + data_source_config: { + item_schema: { + '0': 'bar', + '1': 'bar', + '2': 'bar', + '3': 'bar', + '4': 'bar', + '5': 'bar', + '6': 'bar', + '7': 'bar', + '8': 'bar', + '9': 'bar', + '10': 'bar', + '11': 'bar', + '12': 'bar', + '13': 'bar', + '14': 'bar', + '15': 'bar', + '16': 'bar', + '17': 'bar', + '18': 'bar', + '19': 'bar', + '20': 'bar', + '21': 'bar', + '22': 'bar', + '23': 'bar', + '24': 'bar', + '25': 'bar', + '26': 'bar', + '27': 'bar', + '28': 'bar', + '29': 'bar', + '30': 'bar', + '31': 'bar', + '32': 'bar', + '33': 'bar', + '34': 'bar', + '35': 'bar', + '36': 'bar', + '37': 'bar', + '38': 'bar', + '39': 'bar', + '40': 'bar', + '41': 'bar', + '42': 'bar', + '43': 'bar', + '44': 'bar', + '45': 'bar', + '46': 'bar', + '47': 'bar', + '48': 'bar', + '49': 'bar', + '50': 'bar', + '51': 'bar', + '52': 'bar', + '53': 'bar', + '54': 'bar', + '55': 'bar', + '56': 'bar', + '57': 'bar', + '58': 'bar', + '59': 'bar', + '60': 'bar', + '61': 'bar', + '62': 'bar', + '63': 'bar', + '64': 'bar', + '65': 'bar', + '66': 'bar', + '67': 'bar', + '68': 'bar', + '69': 'bar', + '70': 'bar', + '71': 'bar', + '72': 'bar', + '73': 'bar', + '74': 'bar', + '75': 'bar', + '76': 'bar', + '77': 'bar', + '78': 'bar', + '79': 'bar', + '80': 'bar', + '81': 'bar', + '82': 'bar', + '83': 'bar', + '84': 'bar', + '85': 'bar', + '86': 'bar', + '87': 'bar', + '88': 'bar', + '89': 'bar', + '90': 'bar', + '91': 'bar', + '92': 'bar', + '93': 'bar', + '94': 'bar', + '95': 'bar', + '96': 'bar', + '97': 'bar', + '98': 'bar', + '99': 'bar', + '100': 'bar', + '101': 'bar', + '102': 'bar', + '103': 'bar', + '104': 'bar', + '105': 'bar', + '106': 'bar', + '107': 'bar', + '108': 'bar', + '109': 'bar', + '110': 'bar', + '111': 'bar', + '112': 'bar', + '113': 'bar', + '114': 'bar', + '115': 'bar', + '116': 'bar', + '117': 'bar', + '118': 'bar', + '119': 'bar', + '120': 'bar', + '121': 'bar', + '122': 'bar', + '123': 'bar', + '124': 'bar', + '125': 'bar', + '126': 'bar', + '127': 'bar', + '128': 'bar', + '129': 'bar', + '130': 'bar', + '131': 'bar', + '132': 'bar', + '133': 'bar', + '134': 'bar', + '135': 'bar', + '136': 'bar', + '137': 'bar', + '138': 'bar', + '139': 'bar', + }, + type: 'custom', + include_sample_schema: true, + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + metadata: { foo: 'string' }, + name: 'name', + share_with_openai: true, + }); + }); + + test('retrieve', async () => { + const responsePromise = client.evals.retrieve('eval_id'); + 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('retrieve: request options instead of 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.evals.retrieve('eval_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); + + test('update', async () => { + const responsePromise = client.evals.update('eval_id', {}); + 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', async () => { + const responsePromise = client.evals.list(); + 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 instead of 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.evals.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); + + 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.evals.list( + { after: 'after', limit: 0, order: 'asc', order_by: 'created_at' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.evals.del('eval_id'); + 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('del: request options instead of 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.evals.del('eval_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); +}); diff --git a/tests/api-resources/evals/runs/output-items.test.ts b/tests/api-resources/evals/runs/output-items.test.ts new file mode 100644 index 000000000..ff075b404 --- /dev/null +++ b/tests/api-resources/evals/runs/output-items.test.ts @@ -0,0 +1,61 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource outputItems', () => { + test('retrieve', async () => { + const responsePromise = client.evals.runs.outputItems.retrieve('eval_id', 'run_id', 'output_item_id'); + 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('retrieve: request options instead of 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.evals.runs.outputItems.retrieve('eval_id', 'run_id', 'output_item_id', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('list', async () => { + const responsePromise = client.evals.runs.outputItems.list('eval_id', 'run_id'); + 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 instead of 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.evals.runs.outputItems.list('eval_id', 'run_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + 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.evals.runs.outputItems.list( + 'eval_id', + 'run_id', + { after: 'after', limit: 0, order: 'asc', status: 'fail' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/evals/runs/runs.test.ts b/tests/api-resources/evals/runs/runs.test.ts new file mode 100644 index 000000000..786df0ba1 --- /dev/null +++ b/tests/api-resources/evals/runs/runs.test.ts @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource runs', () => { + test('create: only required params', async () => { + const responsePromise = client.evals.runs.create('eval_id', { + data_source: { source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, type: 'jsonl' }, + }); + 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('create: required and optional params', async () => { + const response = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' }, sample: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + metadata: { foo: 'string' }, + name: 'name', + }); + }); + + test('retrieve', async () => { + const responsePromise = client.evals.runs.retrieve('eval_id', 'run_id'); + 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('retrieve: request options instead of 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.evals.runs.retrieve('eval_id', 'run_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('list', async () => { + const responsePromise = client.evals.runs.list('eval_id'); + 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 instead of 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.evals.runs.list('eval_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); + + 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.evals.runs.list( + 'eval_id', + { after: 'after', limit: 0, order: 'asc', status: 'queued' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.evals.runs.del('eval_id', 'run_id'); + 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('del: request options instead of 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.evals.runs.del('eval_id', 'run_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('cancel', async () => { + const responsePromise = client.evals.runs.cancel('eval_id', 'run_id'); + 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('cancel: request options instead of 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.evals.runs.cancel('eval_id', 'run_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts new file mode 100644 index 000000000..cb8c7a9a1 --- /dev/null +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -0,0 +1,85 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource permissions', () => { + test('create: only required params', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + ); + 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('create: required and optional params', async () => { + const response = await client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + ); + }); + + test('retrieve', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.retrieve('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('retrieve: request options instead of 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.retrieve('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('retrieve: 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.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + { after: 'after', limit: 0, order: 'ascending', project_id: 'project_id' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.del( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + ); + 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('del: request options instead of 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.del('ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); From a100f0a0e1d336f8a78c8bbd9e3703cda3f0c5d8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:44:39 +0000 Subject: [PATCH 296/509] chore(internal): fix examples (#1457) --- .stats.yml | 4 +- .../beta/threads/runs/runs.test.ts | 2 +- .../beta/threads/threads.test.ts | 2 +- tests/api-resources/evals/evals.test.ts | 293 +----------------- tests/api-resources/images.test.ts | 6 +- tests/api-resources/moderations.test.ts | 5 +- 6 files changed, 10 insertions(+), 302 deletions(-) diff --git a/.stats.yml b/.stats.yml index ebe07c137..4a82ee242 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-472fe3036ea745365257fe870c0330917fb3153705c2826f49873cd631319b0a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: ef19d36c307306f14f2e1cd5c834a151 +config_hash: d6c61213488683418adb860a9ee1501b diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 13ae89a00..4b2b8030b 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -37,7 +37,7 @@ describe('resource runs', () => { max_completion_tokens: 256, max_prompt_tokens: 256, metadata: { foo: 'string' }, - model: 'gpt-4o', + model: 'string', parallel_tool_calls: true, reasoning_effort: 'low', response_format: 'auto', diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index f26d6ec44..bc92a0c8a 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -121,7 +121,7 @@ describe('resource threads', () => { max_completion_tokens: 256, max_prompt_tokens: 256, metadata: { foo: 'string' }, - model: 'gpt-4o', + model: 'string', parallel_tool_calls: true, response_format: 'auto', stream: false, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts index 3aeb3e15c..fabc2602a 100644 --- a/tests/api-resources/evals/evals.test.ts +++ b/tests/api-resources/evals/evals.test.ts @@ -11,151 +11,7 @@ const client = new OpenAI({ describe('resource evals', () => { test('create: only required params', async () => { const responsePromise = client.evals.create({ - data_source_config: { - item_schema: { - '0': 'bar', - '1': 'bar', - '2': 'bar', - '3': 'bar', - '4': 'bar', - '5': 'bar', - '6': 'bar', - '7': 'bar', - '8': 'bar', - '9': 'bar', - '10': 'bar', - '11': 'bar', - '12': 'bar', - '13': 'bar', - '14': 'bar', - '15': 'bar', - '16': 'bar', - '17': 'bar', - '18': 'bar', - '19': 'bar', - '20': 'bar', - '21': 'bar', - '22': 'bar', - '23': 'bar', - '24': 'bar', - '25': 'bar', - '26': 'bar', - '27': 'bar', - '28': 'bar', - '29': 'bar', - '30': 'bar', - '31': 'bar', - '32': 'bar', - '33': 'bar', - '34': 'bar', - '35': 'bar', - '36': 'bar', - '37': 'bar', - '38': 'bar', - '39': 'bar', - '40': 'bar', - '41': 'bar', - '42': 'bar', - '43': 'bar', - '44': 'bar', - '45': 'bar', - '46': 'bar', - '47': 'bar', - '48': 'bar', - '49': 'bar', - '50': 'bar', - '51': 'bar', - '52': 'bar', - '53': 'bar', - '54': 'bar', - '55': 'bar', - '56': 'bar', - '57': 'bar', - '58': 'bar', - '59': 'bar', - '60': 'bar', - '61': 'bar', - '62': 'bar', - '63': 'bar', - '64': 'bar', - '65': 'bar', - '66': 'bar', - '67': 'bar', - '68': 'bar', - '69': 'bar', - '70': 'bar', - '71': 'bar', - '72': 'bar', - '73': 'bar', - '74': 'bar', - '75': 'bar', - '76': 'bar', - '77': 'bar', - '78': 'bar', - '79': 'bar', - '80': 'bar', - '81': 'bar', - '82': 'bar', - '83': 'bar', - '84': 'bar', - '85': 'bar', - '86': 'bar', - '87': 'bar', - '88': 'bar', - '89': 'bar', - '90': 'bar', - '91': 'bar', - '92': 'bar', - '93': 'bar', - '94': 'bar', - '95': 'bar', - '96': 'bar', - '97': 'bar', - '98': 'bar', - '99': 'bar', - '100': 'bar', - '101': 'bar', - '102': 'bar', - '103': 'bar', - '104': 'bar', - '105': 'bar', - '106': 'bar', - '107': 'bar', - '108': 'bar', - '109': 'bar', - '110': 'bar', - '111': 'bar', - '112': 'bar', - '113': 'bar', - '114': 'bar', - '115': 'bar', - '116': 'bar', - '117': 'bar', - '118': 'bar', - '119': 'bar', - '120': 'bar', - '121': 'bar', - '122': 'bar', - '123': 'bar', - '124': 'bar', - '125': 'bar', - '126': 'bar', - '127': 'bar', - '128': 'bar', - '129': 'bar', - '130': 'bar', - '131': 'bar', - '132': 'bar', - '133': 'bar', - '134': 'bar', - '135': 'bar', - '136': 'bar', - '137': 'bar', - '138': 'bar', - '139': 'bar', - }, - type: 'custom', - }, + data_source_config: { item_schema: { foo: 'bar' }, type: 'custom' }, testing_criteria: [ { input: [{ content: 'content', role: 'role' }], @@ -178,152 +34,7 @@ describe('resource evals', () => { test('create: required and optional params', async () => { const response = await client.evals.create({ - data_source_config: { - item_schema: { - '0': 'bar', - '1': 'bar', - '2': 'bar', - '3': 'bar', - '4': 'bar', - '5': 'bar', - '6': 'bar', - '7': 'bar', - '8': 'bar', - '9': 'bar', - '10': 'bar', - '11': 'bar', - '12': 'bar', - '13': 'bar', - '14': 'bar', - '15': 'bar', - '16': 'bar', - '17': 'bar', - '18': 'bar', - '19': 'bar', - '20': 'bar', - '21': 'bar', - '22': 'bar', - '23': 'bar', - '24': 'bar', - '25': 'bar', - '26': 'bar', - '27': 'bar', - '28': 'bar', - '29': 'bar', - '30': 'bar', - '31': 'bar', - '32': 'bar', - '33': 'bar', - '34': 'bar', - '35': 'bar', - '36': 'bar', - '37': 'bar', - '38': 'bar', - '39': 'bar', - '40': 'bar', - '41': 'bar', - '42': 'bar', - '43': 'bar', - '44': 'bar', - '45': 'bar', - '46': 'bar', - '47': 'bar', - '48': 'bar', - '49': 'bar', - '50': 'bar', - '51': 'bar', - '52': 'bar', - '53': 'bar', - '54': 'bar', - '55': 'bar', - '56': 'bar', - '57': 'bar', - '58': 'bar', - '59': 'bar', - '60': 'bar', - '61': 'bar', - '62': 'bar', - '63': 'bar', - '64': 'bar', - '65': 'bar', - '66': 'bar', - '67': 'bar', - '68': 'bar', - '69': 'bar', - '70': 'bar', - '71': 'bar', - '72': 'bar', - '73': 'bar', - '74': 'bar', - '75': 'bar', - '76': 'bar', - '77': 'bar', - '78': 'bar', - '79': 'bar', - '80': 'bar', - '81': 'bar', - '82': 'bar', - '83': 'bar', - '84': 'bar', - '85': 'bar', - '86': 'bar', - '87': 'bar', - '88': 'bar', - '89': 'bar', - '90': 'bar', - '91': 'bar', - '92': 'bar', - '93': 'bar', - '94': 'bar', - '95': 'bar', - '96': 'bar', - '97': 'bar', - '98': 'bar', - '99': 'bar', - '100': 'bar', - '101': 'bar', - '102': 'bar', - '103': 'bar', - '104': 'bar', - '105': 'bar', - '106': 'bar', - '107': 'bar', - '108': 'bar', - '109': 'bar', - '110': 'bar', - '111': 'bar', - '112': 'bar', - '113': 'bar', - '114': 'bar', - '115': 'bar', - '116': 'bar', - '117': 'bar', - '118': 'bar', - '119': 'bar', - '120': 'bar', - '121': 'bar', - '122': 'bar', - '123': 'bar', - '124': 'bar', - '125': 'bar', - '126': 'bar', - '127': 'bar', - '128': 'bar', - '129': 'bar', - '130': 'bar', - '131': 'bar', - '132': 'bar', - '133': 'bar', - '134': 'bar', - '135': 'bar', - '136': 'bar', - '137': 'bar', - '138': 'bar', - '139': 'bar', - }, - type: 'custom', - include_sample_schema: true, - }, + data_source_config: { item_schema: { foo: 'bar' }, type: 'custom', include_sample_schema: true }, testing_criteria: [ { input: [{ content: 'content', role: 'role' }], diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 43e67b030..4f15e20ac 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -25,7 +25,7 @@ describe('resource images', () => { test('createVariation: required and optional params', async () => { const response = await client.images.createVariation({ image: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'dall-e-2', + model: 'string', n: 1, response_format: 'url', size: '1024x1024', @@ -52,7 +52,7 @@ describe('resource images', () => { image: await toFile(Buffer.from('# my file contents'), 'README.md'), prompt: 'A cute baby sea otter wearing a beret', mask: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'dall-e-2', + model: 'string', n: 1, response_format: 'url', size: '1024x1024', @@ -74,7 +74,7 @@ describe('resource images', () => { test('generate: required and optional params', async () => { const response = await client.images.generate({ prompt: 'A cute baby sea otter', - model: 'dall-e-3', + model: 'string', n: 1, quality: 'standard', response_format: 'url', diff --git a/tests/api-resources/moderations.test.ts b/tests/api-resources/moderations.test.ts index 64f9acf3c..107ce9974 100644 --- a/tests/api-resources/moderations.test.ts +++ b/tests/api-resources/moderations.test.ts @@ -21,9 +21,6 @@ describe('resource moderations', () => { }); test('create: required and optional params', async () => { - const response = await client.moderations.create({ - input: 'I want to kill them.', - model: 'omni-moderation-2024-09-26', - }); + const response = await client.moderations.create({ input: 'I want to kill them.', model: 'string' }); }); }); From 58f4559d952f6e56a8f27a6bcaba0acf295623df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:46:32 +0000 Subject: [PATCH 297/509] chore(internal): skip broken test (#1458) --- .stats.yml | 2 +- .../fine-tuning/checkpoints/permissions.test.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4a82ee242..c39ce1186 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: d6c61213488683418adb860a9ee1501b +config_hash: 43dc8df20ffec9d1503f91866cb2b7d9 diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts index cb8c7a9a1..e7aceae3e 100644 --- a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -61,7 +61,8 @@ describe('resource permissions', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('del', async () => { + // OpenAPI spec is slightly incorrect + test.skip('del', async () => { const responsePromise = client.fineTuning.checkpoints.permissions.del( 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', ); @@ -74,7 +75,8 @@ describe('resource permissions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('del: request options instead of params are passed correctly', async () => { + // OpenAPI spec is slightly incorrect + test.skip('del: request options instead of 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.del('ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', { From e9ca1a07691976f41492e3652e1cccea33a9b70b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:47:04 +0000 Subject: [PATCH 298/509] release: 4.93.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 837894bfb..bc3f36214 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.92.1" + ".": "4.93.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 105627c5b..e6a402af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 4.93.0 (2025-04-08) + +Full Changelog: [v4.92.1...v4.93.0](https://github.com/openai/openai-node/compare/v4.92.1...v4.93.0) + +### Features + +* **api:** Add evalapi to sdk ([#1456](https://github.com/openai/openai-node/issues/1456)) ([ee917e3](https://github.com/openai/openai-node/commit/ee917e3335fcf44e87a28e54ce8ddfdcdfab1652)) + + +### Chores + +* **internal:** fix examples ([#1457](https://github.com/openai/openai-node/issues/1457)) ([a3dd0dd](https://github.com/openai/openai-node/commit/a3dd0dde3e8ad9cc7a02cf203d4550f91d31a2ae)) +* **internal:** skip broken test ([#1458](https://github.com/openai/openai-node/issues/1458)) ([4d2f815](https://github.com/openai/openai-node/commit/4d2f815ba5f6c426f9c21f4c3db443166389bbf8)) +* **tests:** improve enum examples ([#1454](https://github.com/openai/openai-node/issues/1454)) ([ecabce2](https://github.com/openai/openai-node/commit/ecabce282a9fb60122310942f3b647dfefae5403)) + ## 4.92.1 (2025-04-07) Full Changelog: [v4.92.0...v4.92.1](https://github.com/openai/openai-node/compare/v4.92.0...v4.92.1) diff --git a/jsr.json b/jsr.json index b986198a1..b5e49671a 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.92.1", + "version": "4.93.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 58c231fda..b9316cbe3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.92.1", + "version": "4.93.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index bfae301de..c385afc4c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.92.1'; // x-release-please-version +export const VERSION = '4.93.0'; // x-release-please-version From 554c3b142024bec8010474cd7e42b99a209d4daa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:05:16 +0000 Subject: [PATCH 299/509] feat(api): manual updates --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c39ce1186..d4a4370a7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: 43dc8df20ffec9d1503f91866cb2b7d9 +config_hash: 69e3afd56ccb0f0f822a7a9dc130fc99 From d6b396b94d9ccf64ddfe945069012b6162225fa9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:26:35 +0000 Subject: [PATCH 300/509] chore: workaround build errors --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d4a4370a7..9d8d07c6a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: 69e3afd56ccb0f0f822a7a9dc130fc99 +config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea From 2d452879000c07f3ef4e775e19a527f5f6fa7b4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:43:34 +0000 Subject: [PATCH 301/509] chore(internal): upload builds and expand CI branch coverage (#1460) --- .github/workflows/ci.yml | 37 +++++++++++++++++++++----------- scripts/utils/upload-artifact.sh | 25 +++++++++++++++++++++ 2 files changed, 50 insertions(+), 12 deletions(-) create mode 100755 scripts/utils/upload-artifact.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e59bb3fa..bd57cd3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,20 +1,18 @@ name: CI on: push: - branches: - - master - - update-specs - pull_request: - branches: - - master - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - - steps: - uses: actions/checkout@v4 @@ -32,8 +30,9 @@ jobs: build: name: build runs-on: ubuntu-latest - - + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 @@ -47,10 +46,24 @@ jobs: - name: Check build run: ./scripts/build + + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/openai-node' + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + if: github.repository == 'stainless-sdks/openai-node' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh test: name: test runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 000000000..0e8490199 --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/openai-node/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi From 77fc77f7d05d03eafe6c8f002044c60c4bab3c64 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:08:51 +0000 Subject: [PATCH 302/509] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd57cd3e6..2ed1eead8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - master + pull_request: + branches: + - master + - next jobs: lint: From 6558b7ca8aef2f98f47a07bc206eb4a789097510 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 14:30:54 +0000 Subject: [PATCH 303/509] chore(client): minor internal fixes --- src/core.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core.ts b/src/core.ts index ccc677e0e..cfd4eeaa6 100644 --- a/src/core.ts +++ b/src/core.ts @@ -331,10 +331,10 @@ export abstract class APIClient { } buildRequest( - options: FinalRequestOptions, + inputOptions: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, ): { req: RequestInit; url: string; timeout: number } { - options = { ...options }; + const options = { ...inputOptions }; const { method, path, query, headers: headers = {} } = options; const body = @@ -362,8 +362,8 @@ export abstract class APIClient { } if (this.idempotencyHeader && method !== 'get') { - if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); - headers[this.idempotencyHeader] = options.idempotencyKey; + if (!inputOptions.idempotencyKey) inputOptions.idempotencyKey = this.defaultIdempotencyKey(); + headers[this.idempotencyHeader] = inputOptions.idempotencyKey; } const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount }); From 840e7de7870835488d4c823d97afdf5d53a739be Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:40:57 +0000 Subject: [PATCH 304/509] feat(api): adding gpt-4.1 family of model IDs --- .stats.yml | 4 ++-- src/resources/beta/assistants.ts | 6 ++++++ src/resources/shared.ts | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9d8d07c6a..b40485bd0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml -openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a555f81249cb084f463dcefa4aba069f9341fdaf3dd6ac27d7f237fc90e8f488.yml +openapi_spec_hash: 8e590296cd1a54b9508510b0c7a2c45a config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 0668dcf54..bf957db95 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1337,6 +1337,12 @@ export interface AssistantUpdateParams { */ model?: | (string & {}) + | 'gpt-4.1' + | 'gpt-4.1-mini' + | 'gpt-4.1-nano' + | 'gpt-4.1-2025-04-14' + | 'gpt-4.1-mini-2025-04-14' + | 'gpt-4.1-nano-2025-04-14' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 3e8ded763..94ef50585 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -9,6 +9,12 @@ export type AllModels = | 'computer-use-preview-2025-03-11'; export type ChatModel = + | 'gpt-4.1' + | 'gpt-4.1-mini' + | 'gpt-4.1-nano' + | 'gpt-4.1-2025-04-14' + | 'gpt-4.1-mini-2025-04-14' + | 'gpt-4.1-nano-2025-04-14' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' From bd501650af112dd69a2b220beadbb30f42cd9f77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:41:30 +0000 Subject: [PATCH 305/509] release: 4.94.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bc3f36214..12b27aa8e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.93.0" + ".": "4.94.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index e6a402af8..d4e7613fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 4.94.0 (2025-04-14) + +Full Changelog: [v4.93.0...v4.94.0](https://github.com/openai/openai-node/compare/v4.93.0...v4.94.0) + +### Features + +* **api:** adding gpt-4.1 family of model IDs ([bddcbcf](https://github.com/openai/openai-node/commit/bddcbcffdc409ffc8a078a65bbd302cd50b35ff0)) +* **api:** manual updates ([7532f48](https://github.com/openai/openai-node/commit/7532f48ad25c5125064a59985587c20c47a2cbfb)) + + +### Chores + +* **client:** minor internal fixes ([d342f17](https://github.com/openai/openai-node/commit/d342f17e2642da5ee83d080b410dc3c4fe153814)) +* **internal:** reduce CI branch coverage ([a49b94a](https://github.com/openai/openai-node/commit/a49b94a9aebd3e30e1802fff633e1b46cfb81942)) +* **internal:** upload builds and expand CI branch coverage ([#1460](https://github.com/openai/openai-node/issues/1460)) ([7e23bb4](https://github.com/openai/openai-node/commit/7e23bb4f4a09303195b612cc5b393cc41c1d855b)) +* workaround build errors ([913eba8](https://github.com/openai/openai-node/commit/913eba828d116f49fa78b219c62274c1e95c6f17)) + ## 4.93.0 (2025-04-08) Full Changelog: [v4.92.1...v4.93.0](https://github.com/openai/openai-node/compare/v4.92.1...v4.93.0) diff --git a/jsr.json b/jsr.json index b5e49671a..891e18dcb 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.93.0", + "version": "4.94.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index b9316cbe3..a399b6cf6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.93.0", + "version": "4.94.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c385afc4c..4a35de04b 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.93.0'; // x-release-please-version +export const VERSION = '4.94.0'; // x-release-please-version From a0d000094f69db82974de4ba792cd07d4ab59c21 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:42:31 +0000 Subject: [PATCH 306/509] feat(api): add o3 and o4-mini model IDs --- .stats.yml | 6 +- src/resources/chat/completions/completions.ts | 55 ++++++++++++++++--- src/resources/completions.ts | 2 + src/resources/responses/responses.ts | 46 +++++++++++++++- src/resources/shared.ts | 19 +++++-- .../api-resources/responses/responses.test.ts | 3 +- 6 files changed, 112 insertions(+), 19 deletions(-) diff --git a/.stats.yml b/.stats.yml index b40485bd0..848c5b5ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a555f81249cb084f463dcefa4aba069f9341fdaf3dd6ac27d7f237fc90e8f488.yml -openapi_spec_hash: 8e590296cd1a54b9508510b0c7a2c45a -config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5633633cc38734869cf7d993f7b549bb8e4d10e0ec45381ec2cd91507cd8eb8f.yml +openapi_spec_hash: c855121b2b2324b99499c9244c21d24d +config_hash: d20837393b73efdb19cd08e04c1cc9a1 diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index f0ef1d0cc..17edac02c 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -140,9 +140,25 @@ export interface ChatCompletion { object: 'chat.completion'; /** - * The service tier used for processing the request. + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ - service_tier?: 'scale' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -319,11 +335,11 @@ export interface ChatCompletionAudioParam { * Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, * or `pcm16`. */ - format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; + format: 'wav' | 'aac' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** * The voice the model uses to respond. Supported voices are `alloy`, `ash`, - * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. + * `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, and `shimmer`. */ voice: | (string & {}) @@ -375,9 +391,25 @@ export interface ChatCompletionChunk { object: 'chat.completion.chunk'; /** - * The service tier used for processing the request. + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ - service_tier?: 'scale' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -1114,7 +1146,7 @@ export interface ChatCompletionCreateParamsBase { messages: Array; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -1194,7 +1226,7 @@ export interface ChatCompletionCreateParamsBase { * * This value is now deprecated in favor of `max_completion_tokens`, and is not * compatible with - * [o1 series models](https://platform.openai.com/docs/guides/reasoning). + * [o-series models](https://platform.openai.com/docs/guides/reasoning). */ max_tokens?: number | null; @@ -1296,14 +1328,19 @@ export interface ChatCompletionCreateParamsBase { * latency guarentee. * - If set to 'default', the request will be processed using the default service * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). * - When not set, the default behavior is 'auto'. * * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** + * Not supported with latest reasoning models `o3` and `o4-mini`. + * * Up to 4 sequences where the API will stop generating further tokens. The * returned text will not contain the stop sequence. */ diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 664e39d9d..5cbec5e3c 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -293,6 +293,8 @@ export interface CompletionCreateParamsBase { seed?: number | null; /** + * Not supported with latest reasoning models `o3` and `o4-mini`. + * * Up to 4 sequences where the API will stop generating further tokens. The * returned text will not contain the stop sequence. */ diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index a46c4182c..52dd079fc 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -321,7 +321,7 @@ export interface Response { metadata: Shared.Metadata | null; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -414,6 +414,27 @@ export interface Response { */ reasoning?: Shared.Reasoning | null; + /** + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. + */ + service_tier?: 'auto' | 'default' | 'flex' | null; + /** * The status of the response generation. One of `completed`, `failed`, * `in_progress`, or `incomplete`. @@ -2673,7 +2694,7 @@ export interface ResponseCreateParamsBase { input: string | ResponseInput; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -2740,6 +2761,27 @@ export interface ResponseCreateParamsBase { */ reasoning?: Shared.Reasoning | null; + /** + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. + */ + service_tier?: 'auto' | 'default' | 'flex' | null; + /** * Whether to store the generated model response for later retrieval via API. */ diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 94ef50585..1c0006b18 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -15,6 +15,10 @@ export type ChatModel = | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano-2025-04-14' + | 'o4-mini' + | 'o4-mini-2025-04-16' + | 'o3' + | 'o3-2025-04-16' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' @@ -187,13 +191,20 @@ export interface Reasoning { effort?: ReasoningEffort | null; /** - * **computer_use_preview only** + * @deprecated **Deprecated:** use `summary` instead. * * A summary of the reasoning performed by the model. This can be useful for - * debugging and understanding the model's reasoning process. One of `concise` or - * `detailed`. + * debugging and understanding the model's reasoning process. One of `auto`, + * `concise`, or `detailed`. */ - generate_summary?: 'concise' | 'detailed' | null; + generate_summary?: 'auto' | 'concise' | 'detailed' | null; + + /** + * A summary of the reasoning performed by the model. This can be useful for + * debugging and understanding the model's reasoning process. One of `auto`, + * `concise`, or `detailed`. + */ + summary?: 'auto' | 'concise' | 'detailed' | null; } /** diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index e10722738..cf7e9cf3c 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -30,7 +30,8 @@ describe('resource responses', () => { metadata: { foo: 'string' }, parallel_tool_calls: true, previous_response_id: 'previous_response_id', - reasoning: { effort: 'low', generate_summary: 'concise' }, + reasoning: { effort: 'low', generate_summary: 'auto', summary: 'auto' }, + service_tier: 'auto', store: true, stream: false, temperature: 1, From b5a5ee43837778adae925f6abcbc395b30ed826b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:43:04 +0000 Subject: [PATCH 307/509] release: 4.95.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 12b27aa8e..077a9fd7a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.94.0" + ".": "4.95.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d4e7613fd..3f5f1ef26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.95.0 (2025-04-16) + +Full Changelog: [v4.94.0...v4.95.0](https://github.com/openai/openai-node/compare/v4.94.0...v4.95.0) + +### Features + +* **api:** add o3 and o4-mini model IDs ([4845cd9](https://github.com/openai/openai-node/commit/4845cd9ac17450022f1632ae01397e41a97f1662)) + ## 4.94.0 (2025-04-14) Full Changelog: [v4.93.0...v4.94.0](https://github.com/openai/openai-node/compare/v4.93.0...v4.94.0) diff --git a/jsr.json b/jsr.json index 891e18dcb..d6cacf5f9 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.94.0", + "version": "4.95.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index a399b6cf6..512e2ee55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.94.0", + "version": "4.95.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 4a35de04b..5f581d42d 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.94.0'; // x-release-please-version +export const VERSION = '4.95.0'; // x-release-please-version From aea2d123d200e6a7eae11e66583127270a8db8bf Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 18 Apr 2025 16:49:09 +0100 Subject: [PATCH 308/509] fix(zod): warn on optional field usage (#1469) --- .../zod-to-json-schema/parsers/object.ts | 12 ++++- tests/helpers/zod.test.ts | 52 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/_vendor/zod-to-json-schema/parsers/object.ts b/src/_vendor/zod-to-json-schema/parsers/object.ts index f2120c8fe..25e5db116 100644 --- a/src/_vendor/zod-to-json-schema/parsers/object.ts +++ b/src/_vendor/zod-to-json-schema/parsers/object.ts @@ -39,12 +39,20 @@ export function parseObjectDef(def: ZodObjectDef, refs: Refs) { [propName, propDef], ) => { if (propDef === undefined || propDef._def === undefined) return acc; + const propertyPath = [...refs.currentPath, 'properties', propName]; const parsedDef = parseDef(propDef._def, { ...refs, - currentPath: [...refs.currentPath, 'properties', propName], - propertyPath: [...refs.currentPath, 'properties', propName], + currentPath: propertyPath, + propertyPath, }); if (parsedDef === undefined) return acc; + if (refs.openaiStrictMode && propDef.isOptional() && !propDef.isNullable()) { + console.warn( + `Zod field at \`${propertyPath.join( + '/', + )}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required\nThis will become an error in a future version of the SDK.`, + ); + } return { properties: { ...acc.properties, diff --git a/tests/helpers/zod.test.ts b/tests/helpers/zod.test.ts index 493b4c0c8..02d8a7a8f 100644 --- a/tests/helpers/zod.test.ts +++ b/tests/helpers/zod.test.ts @@ -278,4 +278,56 @@ describe('zodResponseFormat', () => { } `); }); + + it('warns on optional fields', () => { + const consoleSpy = jest.spyOn(console, 'warn'); + consoleSpy.mockClear(); + + zodResponseFormat( + z.object({ + required: z.string(), + optional: z.string().optional(), + optional_and_nullable: z.string().optional().nullable(), + }), + 'schema', + ); + + expect(consoleSpy).toHaveBeenCalledWith( + 'Zod field at `#/definitions/schema/properties/optional` uses `.optional()` without `.nullable()` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required\nThis will become an error in a future version of the SDK.', + ); + expect(consoleSpy).toHaveBeenCalledTimes(1); + }); + + it('warns on nested optional fields', () => { + const consoleSpy = jest.spyOn(console, 'warn'); + consoleSpy.mockClear(); + + zodResponseFormat( + z.object({ + foo: z.object({ bar: z.array(z.object({ can_be_missing: z.boolean().optional() })) }), + }), + 'schema', + ); + + expect(consoleSpy).toHaveBeenCalledWith( + expect.stringContaining( + 'Zod field at `#/definitions/schema/properties/foo/properties/bar/items/properties/can_be_missing` uses `.optional()`', + ), + ); + expect(consoleSpy).toHaveBeenCalledTimes(1); + }); + + it('does not warn on union nullable fields', () => { + const consoleSpy = jest.spyOn(console, 'warn'); + consoleSpy.mockClear(); + + zodResponseFormat( + z.object({ + union: z.union([z.string(), z.null()]).optional(), + }), + 'schema', + ); + + expect(consoleSpy).toHaveBeenCalledTimes(0); + }); }); From 2785c1186b528e4ab3a2a7c9282e041aaa4c13f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 18 Apr 2025 15:50:02 +0000 Subject: [PATCH 309/509] release: 4.95.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 077a9fd7a..2f61d58b0 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.95.0" + ".": "4.95.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5f1ef26..1f864e203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.95.1 (2025-04-18) + +Full Changelog: [v4.95.0...v4.95.1](https://github.com/openai/openai-node/compare/v4.95.0...v4.95.1) + +### Bug Fixes + +* **zod:** warn on optional field usage ([#1469](https://github.com/openai/openai-node/issues/1469)) ([aea2d12](https://github.com/openai/openai-node/commit/aea2d123d200e6a7eae11e66583127270a8db8bf)) + ## 4.95.0 (2025-04-16) Full Changelog: [v4.94.0...v4.95.0](https://github.com/openai/openai-node/compare/v4.94.0...v4.95.0) diff --git a/jsr.json b/jsr.json index d6cacf5f9..8271c8522 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.95.0", + "version": "4.95.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 512e2ee55..76fe7d4d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.95.0", + "version": "4.95.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 5f581d42d..cd1995322 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.95.0'; // x-release-please-version +export const VERSION = '4.95.1'; // x-release-please-version From bc492ba124cddd545eec7a1199712452c573a7a4 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 18 Apr 2025 17:56:50 +0100 Subject: [PATCH 310/509] fix(types): export AssistantStream (#1472) --- src/resources/beta/assistants.ts | 3 +++ src/resources/beta/threads/threads.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index bf957db95..00a6ff2cf 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -9,6 +9,7 @@ import * as ThreadsAPI from './threads/threads'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; import { CursorPage, type CursorPageParams } from '../../pagination'; +import { AssistantStream } from '../../lib/AssistantStream'; export class Assistants extends APIResource { /** @@ -1517,4 +1518,6 @@ export declare namespace Assistants { type AssistantUpdateParams as AssistantUpdateParams, type AssistantListParams as AssistantListParams, }; + + export { AssistantStream }; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 8075ba0ac..1e0077a3f 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -1718,4 +1718,6 @@ export declare namespace Threads { type MessageUpdateParams as MessageUpdateParams, type MessageListParams as MessageListParams, }; + + export { AssistantStream }; } From 939f6365c304c037e0473207d85bbc2f2731b105 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:12:57 +0000 Subject: [PATCH 311/509] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ed1eead8..b0aac41b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: @@ -27,6 +28,7 @@ jobs: run: ./scripts/lint build: + timeout-minutes: 5 name: build runs-on: ubuntu-latest permissions: @@ -61,6 +63,7 @@ jobs: SHA: ${{ github.sha }} run: ./scripts/utils/upload-artifact.sh test: + timeout-minutes: 10 name: test runs-on: ubuntu-latest steps: @@ -78,6 +81,7 @@ jobs: run: ./scripts/test examples: + timeout-minutes: 10 name: examples runs-on: ubuntu-latest if: github.repository == 'openai/openai-node' From c353531a238863e7f386a66dcee9f02b8115dd47 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:30:01 +0000 Subject: [PATCH 312/509] feat(api): adding new image model support --- .stats.yml | 6 +- api.md | 6 +- src/resources/beta/realtime/realtime.ts | 98 +- src/resources/beta/threads/threads.ts | 4 +- src/resources/evals/evals.ts | 749 +++++++- src/resources/evals/runs/runs.ts | 1699 ++++++++++++++--- .../fine-tuning/checkpoints/permissions.ts | 6 +- src/resources/images.ts | 202 +- src/resources/responses/responses.ts | 162 ++ tests/api-resources/evals/evals.test.ts | 1 - .../checkpoints/permissions.test.ts | 15 +- tests/api-resources/images.test.ts | 7 +- 12 files changed, 2534 insertions(+), 421 deletions(-) diff --git a/.stats.yml b/.stats.yml index 848c5b5ad..d92408173 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5633633cc38734869cf7d993f7b549bb8e4d10e0ec45381ec2cd91507cd8eb8f.yml -openapi_spec_hash: c855121b2b2324b99499c9244c21d24d -config_hash: d20837393b73efdb19cd08e04c1cc9a1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml +openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03 +config_hash: b597cd9a31e9e5ec709e2eefb4c54122 diff --git a/api.md b/api.md index 2eb54b34a..49e6548a8 100644 --- a/api.md +++ b/api.md @@ -249,7 +249,7 @@ Methods: - client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage - client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse -- client.fineTuning.checkpoints.permissions.del(fineTunedModelCheckpoint) -> PermissionDeleteResponse +- client.fineTuning.checkpoints.permissions.del(fineTunedModelCheckpoint, permissionId) -> PermissionDeleteResponse # VectorStores @@ -626,6 +626,10 @@ Types: - ResponseOutputRefusal - ResponseOutputText - ResponseReasoningItem +- ResponseReasoningSummaryPartAddedEvent +- ResponseReasoningSummaryPartDoneEvent +- ResponseReasoningSummaryTextDeltaEvent +- ResponseReasoningSummaryTextDoneEvent - ResponseRefusalDeltaEvent - ResponseRefusalDoneEvent - ResponseStatus diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 1c02fdd1a..5012b1edd 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -915,12 +915,34 @@ export type RealtimeClientEvent = | ConversationItemTruncateEvent | InputAudioBufferAppendEvent | InputAudioBufferClearEvent + | RealtimeClientEvent.OutputAudioBufferClear | InputAudioBufferCommitEvent | ResponseCancelEvent | ResponseCreateEvent | SessionUpdateEvent | TranscriptionSessionUpdate; +export namespace RealtimeClientEvent { + /** + * **WebRTC Only:** Emit to cut off the current audio response. This will trigger + * the server to stop generating audio and emit a `output_audio_buffer.cleared` + * event. This event should be preceded by a `response.cancel` client event to stop + * the generation of the current response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferClear { + /** + * The event type, must be `output_audio_buffer.clear`. + */ + type: 'output_audio_buffer.clear'; + + /** + * The unique ID of the client event used for error handling. + */ + event_id?: string; + } +} + /** * The response resource. */ @@ -1174,7 +1196,10 @@ export type RealtimeServerEvent = | ResponseTextDoneEvent | SessionCreatedEvent | SessionUpdatedEvent - | TranscriptionSessionUpdatedEvent; + | TranscriptionSessionUpdatedEvent + | RealtimeServerEvent.OutputAudioBufferStarted + | RealtimeServerEvent.OutputAudioBufferStopped + | RealtimeServerEvent.OutputAudioBufferCleared; export namespace RealtimeServerEvent { /** @@ -1197,6 +1222,77 @@ export namespace RealtimeServerEvent { */ type: 'conversation.item.retrieved'; } + + /** + * **WebRTC Only:** Emitted when the server begins streaming audio to the client. + * This event is emitted after an audio content part has been added + * (`response.content_part.added`) to the response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferStarted { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.started`. + */ + type: 'output_audio_buffer.started'; + } + + /** + * **WebRTC Only:** Emitted when the output audio buffer has been completely + * drained on the server, and no more audio is forthcoming. This event is emitted + * after the full response data has been sent to the client (`response.done`). + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferStopped { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.stopped`. + */ + type: 'output_audio_buffer.stopped'; + } + + /** + * **WebRTC Only:** Emitted when the output audio buffer is cleared. This happens + * either in VAD mode when the user has interrupted + * (`input_audio_buffer.speech_started`), or when the client has emitted the + * `output_audio_buffer.clear` event to manually cut off the current audio + * response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferCleared { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.cleared`. + */ + type: 'output_audio_buffer.cleared'; + } } /** diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 1e0077a3f..2e5ab1cc8 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -686,9 +686,7 @@ export interface ThreadCreateAndRunParamsBase { * Override the tools the assistant can use for this run. This is useful for * modifying the behavior on a per-run basis. */ - tools?: Array< - AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool - > | null; + tools?: Array | null; /** * An alternative to sampling with temperature, called nucleus sampling, where the diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 84ff6d1bb..caef7acc0 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; +import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, @@ -107,7 +108,7 @@ export interface EvalCustomDataSourceConfig { * the evaluation. */ export interface EvalLabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -136,57 +137,43 @@ export interface EvalLabelModelGrader { } export namespace EvalLabelModelGrader { - export interface InputMessage { - content: InputMessage.Content; - + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { /** - * The role of the message. One of `user`, `system`, or `developer`. + * Text inputs to the model - can contain template strings. */ - role: 'user' | 'system' | 'developer'; + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; /** - * The type of item, which is always `message`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - type: 'message'; - } - - export namespace InputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `input_text`. - */ - type: 'input_text'; - } - } - - export interface Assistant { - content: Assistant.Content; + role: 'user' | 'assistant' | 'system' | 'developer'; /** - * The role of the message. Must be `assistant` for output. + * The type of the message input. Always `message`. */ - role: 'assistant'; + type?: 'message'; + } + export namespace Input { /** - * The type of item, which is always `message`. + * A text output from the model. */ - type: 'message'; - } - - export namespace Assistant { - export interface Content { + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `output_text`. + * The type of the output text. Always `output_text`. */ type: 'output_text'; } @@ -259,8 +246,8 @@ export interface EvalStringCheckGrader { */ export interface EvalTextSimilarityGrader { /** - * The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, - * `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, + * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. */ evaluation_metric: | 'fuzzy_match' @@ -272,8 +259,7 @@ export interface EvalTextSimilarityGrader { | 'rouge_3' | 'rouge_4' | 'rouge_5' - | 'rouge_l' - | 'cosine'; + | 'rouge_l'; /** * The text being graded. @@ -346,14 +332,131 @@ export interface EvalCreateResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalCreateResponse.Python + | EvalCreateResponse.ScoreModel + >; +} +export namespace EvalCreateResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. */ - testing_criteria: Array; + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -401,14 +504,131 @@ export interface EvalRetrieveResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalRetrieveResponse.Python + | EvalRetrieveResponse.ScoreModel + >; +} +export namespace EvalRetrieveResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -456,14 +676,131 @@ export interface EvalUpdateResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. + */ + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalUpdateResponse.Python + | EvalUpdateResponse.ScoreModel + >; +} + +export namespace EvalUpdateResponse { + /** + * A PythonGrader object that runs a python script on the input. */ - share_with_openai: boolean; + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } /** - * A list of testing criteria. + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -511,14 +848,131 @@ export interface EvalListResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalListResponse.Python + | EvalListResponse.ScoreModel + >; +} +export namespace EvalListResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } export interface EvalDeleteResponse { @@ -533,12 +987,18 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs; /** * A list of graders for all eval runs in this group. */ - testing_criteria: Array; + testing_criteria: Array< + | EvalCreateParams.LabelModel + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalCreateParams.Python + | EvalCreateParams.ScoreModel + >; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -554,11 +1014,6 @@ export interface EvalCreateParams { * The name of the evaluation. */ name?: string; - - /** - * Indicates whether the evaluation is shared with OpenAI. - */ - share_with_openai?: boolean; } export namespace EvalCreateParams { @@ -572,7 +1027,7 @@ export namespace EvalCreateParams { */ export interface Custom { /** - * The json schema for the run data source items. + * The json schema for each row in the data source. */ item_schema: Record; @@ -582,7 +1037,8 @@ export namespace EvalCreateParams { type: 'custom'; /** - * Whether to include the sample schema in the data source. + * Whether the eval should expect you to populate the sample namespace (ie, by + * generating responses off of your data source) */ include_sample_schema?: boolean; } @@ -592,21 +1048,16 @@ export namespace EvalCreateParams { * completions query. This is usually metadata like `usecase=chatbot` or * `prompt-version=v2`, etc. */ - export interface StoredCompletions { + export interface Logs { /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `logs`. */ - type: 'stored_completions'; + type: 'logs'; /** - * 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 filters for the logs data source. */ - metadata?: Shared.Metadata | null; + metadata?: Record; } /** @@ -614,7 +1065,11 @@ export namespace EvalCreateParams { * the evaluation. */ export interface LabelModel { - input: Array; + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + input: Array; /** * The labels to classify to each item in the evaluation. @@ -655,57 +1110,157 @@ export namespace EvalCreateParams { role: string; } - export interface InputMessage { - content: InputMessage.Content; + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; /** - * The role of the message. One of `user`, `system`, or `developer`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - role: 'user' | 'system' | 'developer'; + role: 'user' | 'assistant' | 'system' | 'developer'; /** - * The type of item, which is always `message`. + * The type of the message input. Always `message`. */ - type: 'message'; + type?: 'message'; } - export namespace InputMessage { - export interface Content { + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `input_text`. + * The type of the output text. Always `output_text`. */ - type: 'input_text'; + type: 'output_text'; } } + } + + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; - export interface OutputMessage { - content: OutputMessage.Content; + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { /** - * The role of the message. Must be `assistant` for output. + * Text inputs to the model - can contain template strings. */ - role: 'assistant'; + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; /** - * The type of item, which is always `message`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - type: 'message'; + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; } - export namespace OutputMessage { - export interface Content { + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `output_text`. + * The type of the output text. Always `output_text`. */ type: 'output_text'; } diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index ca2b7f424..50c07a514 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as Shared from '../../shared'; +import * as ResponsesAPI from '../../responses/responses'; import * as OutputItemsAPI from './output-items'; import { OutputItemListParams, @@ -83,15 +84,6 @@ export class RunListResponsesPage extends CursorPage {} * A CompletionsRunDataSource object describing a model sampling configuration. */ export interface CreateEvalCompletionsRunDataSource { - input_messages: - | CreateEvalCompletionsRunDataSource.Template - | CreateEvalCompletionsRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model: string; - /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -105,105 +97,19 @@ export interface CreateEvalCompletionsRunDataSource { */ type: 'completions'; + input_messages?: + | CreateEvalCompletionsRunDataSource.Template + | CreateEvalCompletionsRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + sampling_params?: CreateEvalCompletionsRunDataSource.SamplingParams; } export namespace CreateEvalCompletionsRunDataSource { - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - export interface InputMessage { - content: InputMessage.Content; - - /** - * The role of the message. One of `user`, `system`, or `developer`. - */ - role: 'user' | 'system' | 'developer'; - - /** - * The type of item, which is always `message`. - */ - type: 'message'; - } - - export namespace InputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `input_text`. - */ - type: 'input_text'; - } - } - - export interface OutputMessage { - content: OutputMessage.Content; - - /** - * The role of the message. Must be `assistant` for output. - */ - role: 'assistant'; - - /** - * The type of item, which is always `message`. - */ - type: 'message'; - } - - export namespace OutputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - export interface FileContent { /** * The content of the jsonl file. @@ -240,20 +146,25 @@ export namespace CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ export interface StoredCompletions { + /** + * The type of source. Always `stored_completions`. + */ + type: 'stored_completions'; + /** * An optional Unix timestamp to filter items created after this time. */ - created_after: number | null; + created_after?: number | null; /** * An optional Unix timestamp to filter items created before this time. */ - created_before: number | null; + created_before?: number | null; /** * An optional maximum number of items to return. */ - limit: number | null; + limit?: number | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -263,17 +174,81 @@ export namespace CreateEvalCompletionsRunDataSource { * Keys are strings with a maximum length of 64 characters. Values are strings with * a maximum length of 512 characters. */ - metadata: Shared.Metadata | null; + metadata?: Shared.Metadata | null; /** * An optional model to filter by (e.g., 'gpt-4o'). */ - model: string | null; + model?: string | null; + } + export interface Template { /** - * The type of source. Always `stored_completions`. + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. */ - type: 'stored_completions'; + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Message { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Message.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Message { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; } export interface SamplingParams { @@ -378,7 +353,10 @@ export interface RunCreateResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCreateResponse.Completions; /** * An object representing an error response from the Eval API. @@ -442,162 +420,240 @@ export interface RunCreateResponse { } export namespace RunCreateResponse { - export interface PerModelUsage { - /** - * The number of tokens retrieved from cache. - */ - cached_tokens: number; - + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { /** - * The number of completion tokens generated. + * A EvalResponsesSource object describing a run data source configuration. */ - completion_tokens: number; + source: Completions.FileContent | Completions.FileID | Completions.Responses; /** - * The number of invocations. + * The type of run data source. Always `completions`. */ - invocation_count: number; + type: 'completions'; - /** - * The name of the model. - */ - model_name: string; + input_messages?: Completions.Template | Completions.ItemReference; /** - * The number of prompt tokens used. + * The name of the model to use for generating completions (e.g. "o3-mini"). */ - prompt_tokens: number; + model?: string; - /** - * The total number of tokens used. - */ - total_tokens: number; + sampling_params?: Completions.SamplingParams; } - export interface PerTestingCriteriaResult { - /** - * Number of tests failed for this criteria. - */ - failed: number; + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; - /** - * Number of tests passed for this criteria. - */ - passed: number; + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } - /** - * A description of the testing criteria. - */ - testing_criteria: string; - } + export namespace FileContent { + export interface Content { + item: Record; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - export interface ResultCounts { - /** - * Number of output items that resulted in an error. - */ - errored: number; + sample?: Record; + } + } - /** - * Number of output items that failed to pass the evaluation. - */ - failed: number; + export interface FileID { + /** + * The identifier of the file. + */ + id: string; - /** - * Number of output items that passed the evaluation. - */ - passed: number; + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } /** - * Total number of executed output items. + * A EvalResponsesSource object describing a run data source configuration. */ - total: number; - } -} + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; -/** - * A schema representing an evaluation run. - */ -export interface RunRetrieveResponse { - /** - * Unique identifier for the evaluation run. - */ - id: string; + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; - /** - * Unix timestamp (in seconds) when the evaluation run was created. - */ - created_at: number; + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; - /** - * Information about the run's data source. - */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; - /** - * An object representing an error response from the Eval API. - */ - error: EvalAPIError; + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; - /** - * The identifier of the associated evaluation. - */ - eval_id: string; + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; - /** - * 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; + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; - /** - * The model that is evaluated, if applicable. - */ - model: string; + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; - /** - * The name of the evaluation run. - */ - name: string; + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; - /** - * The type of the object. Always "eval.run". - */ - object: 'eval.run'; + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; - /** - * Usage statistics for each model during the evaluation run. - */ - per_model_usage: Array; + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; - /** - * Results per testing criteria applied during the evaluation run. - */ - per_testing_criteria_results: Array; + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } - /** - * The URL to the rendered evaluation run report on the UI dashboard. - */ - report_url: string; + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunRetrieveResponse.ResultCounts; + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } - /** - * The status of the evaluation run. - */ - status: string; -} + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } -export namespace RunRetrieveResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -676,7 +732,7 @@ export namespace RunRetrieveResponse { /** * A schema representing an evaluation run. */ -export interface RunListResponse { +export interface RunRetrieveResponse { /** * Unique identifier for the evaluation run. */ @@ -690,7 +746,10 @@ export interface RunListResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunRetrieveResponse.Completions; /** * An object representing an error response from the Eval API. @@ -730,12 +789,12 @@ export interface RunListResponse { /** * Usage statistics for each model during the evaluation run. */ - per_model_usage: Array; + per_model_usage: Array; /** * Results per testing criteria applied during the evaluation run. */ - per_testing_criteria_results: Array; + per_testing_criteria_results: Array; /** * The URL to the rendered evaluation run report on the UI dashboard. @@ -745,7 +804,7 @@ export interface RunListResponse { /** * Counters summarizing the outcomes of the evaluation run. */ - result_counts: RunListResponse.ResultCounts; + result_counts: RunRetrieveResponse.ResultCounts; /** * The status of the evaluation run. @@ -753,7 +812,241 @@ export interface RunListResponse { status: string; } -export namespace RunListResponse { +export namespace RunRetrieveResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Completions.FileContent | Completions.FileID | Completions.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: Completions.Template | Completions.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -829,18 +1122,10 @@ export namespace RunListResponse { } } -export interface RunDeleteResponse { - deleted?: boolean; - - object?: string; - - run_id?: string; -} - /** * A schema representing an evaluation run. */ -export interface RunCancelResponse { +export interface RunListResponse { /** * Unique identifier for the evaluation run. */ @@ -854,7 +1139,10 @@ export interface RunCancelResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunListResponse.Completions; /** * An object representing an error response from the Eval API. @@ -894,12 +1182,12 @@ export interface RunCancelResponse { /** * Usage statistics for each model during the evaluation run. */ - per_model_usage: Array; + per_model_usage: Array; /** * Results per testing criteria applied during the evaluation run. */ - per_testing_criteria_results: Array; + per_testing_criteria_results: Array; /** * The URL to the rendered evaluation run report on the UI dashboard. @@ -909,7 +1197,7 @@ export interface RunCancelResponse { /** * Counters summarizing the outcomes of the evaluation run. */ - result_counts: RunCancelResponse.ResultCounts; + result_counts: RunListResponse.ResultCounts; /** * The status of the evaluation run. @@ -917,25 +1205,660 @@ export interface RunCancelResponse { status: string; } -export namespace RunCancelResponse { - export interface PerModelUsage { +export namespace RunListResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { /** - * The number of tokens retrieved from cache. + * A EvalResponsesSource object describing a run data source configuration. */ - cached_tokens: number; + source: Completions.FileContent | Completions.FileID | Completions.Responses; /** - * The number of completion tokens generated. + * The type of run data source. Always `completions`. */ - completion_tokens: number; + type: 'completions'; - /** - * The number of invocations. - */ - invocation_count: number; + input_messages?: Completions.Template | Completions.ItemReference; /** - * The name of the model. + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunDeleteResponse { + deleted?: boolean; + + object?: string; + + run_id?: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCancelResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCancelResponse.Completions; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCancelResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCancelResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Completions.FileContent | Completions.FileID | Completions.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: Completions.Template | Completions.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. */ model_name: string; @@ -997,7 +1920,10 @@ export interface RunCreateParams { /** * Details about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCreateParams.CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1015,6 +1941,247 @@ export interface RunCreateParams { name?: string; } +export namespace RunCreateParams { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: + | CreateEvalResponsesRunDataSource.Template + | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; + } + + export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } +} + export interface RunListParams extends CursorPageParams { /** * Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for @@ -1023,8 +2190,8 @@ export interface RunListParams extends CursorPageParams { order?: 'asc' | 'desc'; /** - * Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" | - * "canceled". + * Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` + * | `canceled`. */ status?: 'queued' | 'in_progress' | 'completed' | 'canceled' | 'failed'; } diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index 500c3de81..e808b2001 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -61,9 +61,13 @@ export class Permissions extends APIResource { */ del( fineTunedModelCheckpoint: string, + permissionId: string, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.delete(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, options); + return this._client.delete( + `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions/${permissionId}`, + options, + ); } } diff --git a/src/resources/images.ts b/src/resources/images.ts index 8e1c6d92e..de1882d30 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -5,7 +5,7 @@ import * as Core from '../core'; export class Images extends APIResource { /** - * Creates a variation of a given image. + * Creates a variation of a given image. This endpoint only supports `dall-e-2`. */ createVariation( body: ImageCreateVariationParams, @@ -15,7 +15,8 @@ export class Images extends APIResource { } /** - * Creates an edited or extended image given an original image and a prompt. + * Creates an edited or extended image given one or more source images and a + * prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`. */ edit(body: ImageEditParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/images/edits', Core.multipartFormRequestOptions({ body, ...options })); @@ -23,6 +24,7 @@ export class Images extends APIResource { /** * Creates an image given a prompt. + * [Learn more](https://platform.openai.com/docs/guides/images). */ generate(body: ImageGenerateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/images/generations', { body, ...options }); @@ -30,33 +32,93 @@ export class Images extends APIResource { } /** - * Represents the url or the content of an image generated by the OpenAI API. + * Represents the content or the URL of an image generated by the OpenAI API. */ export interface Image { /** - * The base64-encoded JSON of the generated image, if `response_format` is - * `b64_json`. + * The base64-encoded JSON of the generated image. Default value for `gpt-image-1`, + * and only present if `response_format` is set to `b64_json` for `dall-e-2` and + * `dall-e-3`. */ b64_json?: string; /** - * The prompt that was used to generate the image, if there was any revision to the - * prompt. + * For `dall-e-3` only, the revised prompt that was used to generate the image. */ revised_prompt?: string; /** - * The URL of the generated image, if `response_format` is `url` (default). + * When using `dall-e-2` or `dall-e-3`, the URL of the generated image if + * `response_format` is set to `url` (default value). Unsupported for + * `gpt-image-1`. */ url?: string; } -export type ImageModel = 'dall-e-2' | 'dall-e-3'; +export type ImageModel = 'dall-e-2' | 'dall-e-3' | 'gpt-image-1'; +/** + * The response from the image generation endpoint. + */ export interface ImagesResponse { + /** + * The Unix timestamp (in seconds) of when the image was created. + */ created: number; - data: Array; + /** + * The list of generated images. + */ + data?: Array; + + /** + * For `gpt-image-1` only, the token usage information for the image generation. + */ + usage?: ImagesResponse.Usage; +} + +export namespace ImagesResponse { + /** + * For `gpt-image-1` only, the token usage information for the image generation. + */ + export interface Usage { + /** + * The number of tokens (images and text) in the input prompt. + */ + input_tokens: number; + + /** + * The input tokens detailed information for the image generation. + */ + input_tokens_details: Usage.InputTokensDetails; + + /** + * The number of image tokens in the output image. + */ + output_tokens: number; + + /** + * The total number of tokens (images and text) used for the image generation. + */ + total_tokens: number; + } + + export namespace Usage { + /** + * The input tokens detailed information for the image generation. + */ + export interface InputTokensDetails { + /** + * The number of image tokens in the input prompt. + */ + image_tokens: number; + + /** + * The number of text tokens in the input prompt. + */ + text_tokens: number; + } + } } export interface ImageCreateVariationParams { @@ -73,8 +135,7 @@ export interface ImageCreateVariationParams { model?: (string & {}) | ImageModel | null; /** - * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - * `n=1` is supported. + * The number of images to generate. Must be between 1 and 10. */ n?: number | null; @@ -101,27 +162,31 @@ export interface ImageCreateVariationParams { export interface ImageEditParams { /** - * The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask - * is not provided, image must have transparency, which will be used as the mask. + * The image(s) to edit. Must be a supported image file or an array of images. For + * `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than + * 25MB. For `dall-e-2`, you can only provide one image, and it should be a square + * `png` file less than 4MB. */ - image: Core.Uploadable; + image: Core.Uploadable | Array; /** * A text description of the desired image(s). The maximum length is 1000 - * characters. + * characters for `dall-e-2`, and 32000 characters for `gpt-image-1`. */ prompt: string; /** * An additional image whose fully transparent areas (e.g. where alpha is zero) - * indicate where `image` should be edited. Must be a valid PNG file, less than + * indicate where `image` should be edited. If there are multiple images provided, + * the mask will be applied on the first image. Must be a valid PNG file, less than * 4MB, and have the same dimensions as `image`. */ mask?: Core.Uploadable; /** - * The model to use for image generation. Only `dall-e-2` is supported at this - * time. + * The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are + * supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` + * is used. */ model?: (string & {}) | ImageModel | null; @@ -130,16 +195,25 @@ export interface ImageEditParams { */ n?: number | null; + /** + * The quality of the image that will be generated. `high`, `medium` and `low` are + * only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. + * Defaults to `auto`. + */ + quality?: 'standard' | 'low' | 'medium' | 'high' | 'auto' | null; + /** * The format in which the generated images are returned. Must be one of `url` or * `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. + * generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1` + * will always return base64-encoded images. */ response_format?: 'url' | 'b64_json' | null; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024`. + * The size of the generated images. Must be one of `1024x1024`, `1536x1024` + * (landscape), `1024x1536` (portrait), or `auto` (default value) for + * `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. */ size?: '256x256' | '512x512' | '1024x1024' | null; @@ -153,16 +227,36 @@ export interface ImageEditParams { export interface ImageGenerateParams { /** - * A text description of the desired image(s). The maximum length is 1000 - * characters for `dall-e-2` and 4000 characters for `dall-e-3`. + * A text description of the desired image(s). The maximum length is 32000 + * characters for `gpt-image-1`, 1000 characters for `dall-e-2` and 4000 characters + * for `dall-e-3`. */ prompt: string; /** - * The model to use for image generation. + * Allows to set transparency for the background of the generated image(s). This + * parameter is only supported for `gpt-image-1`. Must be one of `transparent`, + * `opaque` or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * If `transparent`, the output format needs to support transparency, so it should + * be set to either `png` (default value) or `webp`. + */ + background?: 'transparent' | 'opaque' | 'auto' | null; + + /** + * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or + * `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to + * `gpt-image-1` is used. */ model?: (string & {}) | ImageModel | null; + /** + * Control the content-moderation level for images generated by `gpt-image-1`. Must + * be either `low` for less restrictive filtering or `auto` (default value). + */ + moderation?: 'low' | 'auto' | null; + /** * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only * `n=1` is supported. @@ -170,31 +264,59 @@ export interface ImageGenerateParams { n?: number | null; /** - * The quality of the image that will be generated. `hd` creates images with finer - * details and greater consistency across the image. This param is only supported - * for `dall-e-3`. + * The compression level (0-100%) for the generated images. This parameter is only + * supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and + * defaults to 100. */ - quality?: 'standard' | 'hd'; + output_compression?: number | null; /** - * The format in which the generated images are returned. Must be one of `url` or - * `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. + * The format in which the generated images are returned. This parameter is only + * supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. + */ + output_format?: 'png' | 'jpeg' | 'webp' | null; + + /** + * The quality of the image that will be generated. + * + * - `auto` (default value) will automatically select the best quality for the + * given model. + * - `high`, `medium` and `low` are supported for `gpt-image-1`. + * - `hd` and `standard` are supported for `dall-e-3`. + * - `standard` is the only option for `dall-e-2`. + */ + quality?: 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto' | null; + + /** + * The format in which generated images with `dall-e-2` and `dall-e-3` are + * returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes + * after the image has been generated. This parameter isn't supported for + * `gpt-image-1` which will always return base64-encoded images. */ response_format?: 'url' | 'b64_json' | null; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or - * `1024x1792` for `dall-e-3` models. + * The size of the generated images. Must be one of `1024x1024`, `1536x1024` + * (landscape), `1024x1536` (portrait), or `auto` (default value) for + * `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and + * one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. */ - size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792' | null; + size?: + | 'auto' + | '1024x1024' + | '1536x1024' + | '1024x1536' + | '256x256' + | '512x512' + | '1792x1024' + | '1024x1792' + | null; /** - * The style of the generated images. Must be one of `vivid` or `natural`. Vivid - * causes the model to lean towards generating hyper-real and dramatic images. - * Natural causes the model to produce more natural, less hyper-real looking - * images. This param is only supported for `dall-e-3`. + * The style of the generated images. This parameter is only supported for + * `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean + * towards generating hyper-real and dramatic images. Natural causes the model to + * produce more natural, less hyper-real looking images. */ style?: 'vivid' | 'natural' | null; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 52dd079fc..771b8daf2 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -2158,6 +2158,160 @@ export namespace ResponseReasoningItem { } } +/** + * Emitted when a new reasoning summary part is added. + */ +export interface ResponseReasoningSummaryPartAddedEvent { + /** + * The ID of the item this summary part is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary part is associated with. + */ + output_index: number; + + /** + * The summary part that was added. + */ + part: ResponseReasoningSummaryPartAddedEvent.Part; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_part.added`. + */ + type: 'response.reasoning_summary_part.added'; +} + +export namespace ResponseReasoningSummaryPartAddedEvent { + /** + * The summary part that was added. + */ + export interface Part { + /** + * The text of the summary part. + */ + text: string; + + /** + * The type of the summary part. Always `summary_text`. + */ + type: 'summary_text'; + } +} + +/** + * Emitted when a reasoning summary part is completed. + */ +export interface ResponseReasoningSummaryPartDoneEvent { + /** + * The ID of the item this summary part is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary part is associated with. + */ + output_index: number; + + /** + * The completed summary part. + */ + part: ResponseReasoningSummaryPartDoneEvent.Part; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_part.done`. + */ + type: 'response.reasoning_summary_part.done'; +} + +export namespace ResponseReasoningSummaryPartDoneEvent { + /** + * The completed summary part. + */ + export interface Part { + /** + * The text of the summary part. + */ + text: string; + + /** + * The type of the summary part. Always `summary_text`. + */ + type: 'summary_text'; + } +} + +/** + * Emitted when a delta is added to a reasoning summary text. + */ +export interface ResponseReasoningSummaryTextDeltaEvent { + /** + * The text delta that was added to the summary. + */ + delta: string; + + /** + * The ID of the item this summary text delta is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary text delta is associated with. + */ + output_index: number; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_text.delta`. + */ + type: 'response.reasoning_summary_text.delta'; +} + +/** + * Emitted when a reasoning summary text is completed. + */ +export interface ResponseReasoningSummaryTextDoneEvent { + /** + * The ID of the item this summary text is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary text is associated with. + */ + output_index: number; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The full text of the completed reasoning summary. + */ + text: string; + + /** + * The type of the event. Always `response.reasoning_summary_text.done`. + */ + type: 'response.reasoning_summary_text.done'; +} + /** * Emitted when there is a partial refusal text. */ @@ -2252,6 +2406,10 @@ export type ResponseStreamEvent = | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent + | ResponseReasoningSummaryPartAddedEvent + | ResponseReasoningSummaryPartDoneEvent + | ResponseReasoningSummaryTextDeltaEvent + | ResponseReasoningSummaryTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextAnnotationDeltaEvent @@ -2967,6 +3125,10 @@ export declare namespace Responses { type ResponseOutputRefusal as ResponseOutputRefusal, type ResponseOutputText as ResponseOutputText, type ResponseReasoningItem as ResponseReasoningItem, + type ResponseReasoningSummaryPartAddedEvent as ResponseReasoningSummaryPartAddedEvent, + type ResponseReasoningSummaryPartDoneEvent as ResponseReasoningSummaryPartDoneEvent, + type ResponseReasoningSummaryTextDeltaEvent as ResponseReasoningSummaryTextDeltaEvent, + type ResponseReasoningSummaryTextDoneEvent as ResponseReasoningSummaryTextDoneEvent, type ResponseRefusalDeltaEvent as ResponseRefusalDeltaEvent, type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, type ResponseStatus as ResponseStatus, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts index fabc2602a..45d1c4f9b 100644 --- a/tests/api-resources/evals/evals.test.ts +++ b/tests/api-resources/evals/evals.test.ts @@ -47,7 +47,6 @@ describe('resource evals', () => { ], metadata: { foo: 'string' }, name: 'name', - share_with_openai: true, }); }); diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts index e7aceae3e..1e4b40a94 100644 --- a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -61,10 +61,10 @@ describe('resource permissions', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - // OpenAPI spec is slightly incorrect - test.skip('del', async () => { + test('del', async () => { const responsePromise = client.fineTuning.checkpoints.permissions.del( 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -75,13 +75,14 @@ describe('resource permissions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // OpenAPI spec is slightly incorrect - test.skip('del: request options instead of params are passed correctly', async () => { + test('del: request options instead of 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.del('ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', { - path: '/_stainless_unknown_path', - }), + client.fineTuning.checkpoints.permissions.del( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + { path: '/_stainless_unknown_path' }, + ), ).rejects.toThrow(OpenAI.NotFoundError); }); }); diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 4f15e20ac..e9b460254 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -54,6 +54,7 @@ describe('resource images', () => { mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1, + quality: 'high', response_format: 'url', size: '1024x1024', user: 'user-1234', @@ -74,9 +75,13 @@ describe('resource images', () => { test('generate: required and optional params', async () => { const response = await client.images.generate({ prompt: 'A cute baby sea otter', + background: 'transparent', model: 'string', + moderation: 'low', n: 1, - quality: 'standard', + output_compression: 100, + output_format: 'png', + quality: 'medium', response_format: 'url', size: '1024x1024', style: 'vivid', From f99e7c3ca9348a8611665b54a68a9e377dc61ea9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:32:08 +0000 Subject: [PATCH 313/509] release: 4.96.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2f61d58b0..5b0015f5b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.95.1" + ".": "4.96.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f864e203..47717a4eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.96.0 (2025-04-23) + +Full Changelog: [v4.95.1...v4.96.0](https://github.com/openai/openai-node/compare/v4.95.1...v4.96.0) + +### Features + +* **api:** adding new image model support ([a00d331](https://github.com/openai/openai-node/commit/a00d33190edd08df7d9c088c00ab7b77673f88ba)) + + +### Bug Fixes + +* **types:** export AssistantStream ([#1472](https://github.com/openai/openai-node/issues/1472)) ([626c844](https://github.com/openai/openai-node/commit/626c844a758a68ffbff48873d4773be2e3868952)) + + +### Chores + +* **ci:** add timeout thresholds for CI jobs ([e465063](https://github.com/openai/openai-node/commit/e46506351097f1de39c866c28b6ec20fa724fc36)) + ## 4.95.1 (2025-04-18) Full Changelog: [v4.95.0...v4.95.1](https://github.com/openai/openai-node/compare/v4.95.0...v4.95.1) diff --git a/jsr.json b/jsr.json index 8271c8522..6b574ce15 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.95.1", + "version": "4.96.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 76fe7d4d0..7b4e86f8e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.95.1", + "version": "4.96.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index cd1995322..1215a5e79 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.95.1'; // x-release-please-version +export const VERSION = '4.96.0'; // x-release-please-version From ead76fc6429ac52a1c8b008ac5c0afcefaa0bae5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:55:23 +0000 Subject: [PATCH 314/509] chore(ci): run on more branches and use depot runners --- .github/workflows/ci.yml | 20 ++++++++++---------- .github/workflows/publish-jsr.yml | 2 +- .github/workflows/publish-npm.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0aac41b2..9b293f4c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - master - pull_request: - branches: - - master - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -30,7 +30,7 @@ jobs: build: timeout-minutes: 5 name: build - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 permissions: contents: read id-token: write @@ -65,7 +65,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -83,7 +83,7 @@ jobs: examples: timeout-minutes: 10 name: examples - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 if: github.repository == 'openai/openai-node' steps: diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index 1e46d6bfb..efb18bb16 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -7,7 +7,7 @@ on: jobs: publish: name: publish - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 permissions: contents: read id-token: write diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 5a3711b53..cf1d07e09 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -7,7 +7,7 @@ on: jobs: publish: name: publish - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 environment: publish steps: diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 37bc09e80..1c794642c 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 environment: publish if: github.repository == 'openai/openai-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') From 214da398c76f46d40994665f3ca7e10e203e9579 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 19:58:52 +0000 Subject: [PATCH 315/509] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/publish-jsr.yml | 2 +- .github/workflows/publish-npm.yml | 2 +- .github/workflows/release-doctor.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b293f4c2..49a043930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -30,7 +30,7 @@ jobs: build: timeout-minutes: 5 name: build - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} permissions: contents: read id-token: write @@ -65,7 +65,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -83,7 +83,7 @@ jobs: examples: timeout-minutes: 10 name: examples - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-node' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.repository == 'openai/openai-node' steps: diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index efb18bb16..1e46d6bfb 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -7,7 +7,7 @@ on: jobs: publish: name: publish - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest permissions: contents: read id-token: write diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index cf1d07e09..5a3711b53 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -7,7 +7,7 @@ on: jobs: publish: name: publish - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest environment: publish steps: diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 1c794642c..37bc09e80 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -8,7 +8,7 @@ on: jobs: release_doctor: name: release doctor - runs-on: depot-ubuntu-24.04 + runs-on: ubuntu-latest environment: publish if: github.repository == 'openai/openai-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') From 3e7c92c8a76c1f747610d63d9d69a88b796ee9fc Mon Sep 17 00:00:00 2001 From: Isaac Batista Date: Mon, 28 Apr 2025 12:31:09 -0300 Subject: [PATCH 316/509] fix(types): export ParseableToolsParams (#1486) --- src/lib/ResponsesParser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ResponsesParser.ts b/src/lib/ResponsesParser.ts index 8d762d5bb..c64c6ffa0 100644 --- a/src/lib/ResponsesParser.ts +++ b/src/lib/ResponsesParser.ts @@ -14,7 +14,7 @@ import { } from '../resources/responses/responses'; import { type AutoParseableTextFormat, isAutoParsableResponseFormat } from '../lib/parser'; -type ParseableToolsParams = Array | ChatCompletionTool | null; +export type ParseableToolsParams = Array | ChatCompletionTool | null; export type ResponseCreateParamsWithTools = ResponseCreateParamsBase & { tools?: ParseableToolsParams; From 593fea4f86d46035540f5a34314d6f4b31960dd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 05:07:54 +0000 Subject: [PATCH 317/509] release: 4.96.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 5b0015f5b..20d7ece71 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.96.0" + ".": "4.96.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 47717a4eb..3a78e5928 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.96.1 (2025-04-29) + +Full Changelog: [v4.96.0...v4.96.1](https://github.com/openai/openai-node/compare/v4.96.0...v4.96.1) + +### Bug Fixes + +* **types:** export ParseableToolsParams ([#1486](https://github.com/openai/openai-node/issues/1486)) ([eb055b2](https://github.com/openai/openai-node/commit/eb055b26ce90e5fe1b101a95a4390956d519e168)) + + +### Chores + +* **ci:** only use depot for staging repos ([e80af47](https://github.com/openai/openai-node/commit/e80af47590056baa8f456e8d60c37f0d00ff08c4)) +* **ci:** run on more branches and use depot runners ([b04a801](https://github.com/openai/openai-node/commit/b04a801d0356105eacddbb4d10f4359719585dd6)) + ## 4.96.0 (2025-04-23) Full Changelog: [v4.95.1...v4.96.0](https://github.com/openai/openai-node/compare/v4.95.1...v4.96.0) diff --git a/jsr.json b/jsr.json index 6b574ce15..73ea2185e 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.96.0", + "version": "4.96.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 7b4e86f8e..54046d4f2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.96.0", + "version": "4.96.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 1215a5e79..45539224e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.96.0'; // x-release-please-version +export const VERSION = '4.96.1'; // x-release-please-version From 37ab638baee4f68f3149f4a4f96a136f32966739 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:08:58 +0000 Subject: [PATCH 318/509] release: 4.96.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 20d7ece71..88f780d30 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.96.1" + ".": "4.96.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a78e5928..d724d8922 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.96.2 (2025-04-29) + +Full Changelog: [v4.96.1...v4.96.2](https://github.com/openai/openai-node/compare/v4.96.1...v4.96.2) + +### Bug Fixes + +* **types:** export ParseableToolsParams ([#1486](https://github.com/openai/openai-node/issues/1486)) ([3e7c92c](https://github.com/openai/openai-node/commit/3e7c92c8a76c1f747610d63d9d69a88b796ee9fc)) + + +### Chores + +* **ci:** only use depot for staging repos ([214da39](https://github.com/openai/openai-node/commit/214da398c76f46d40994665f3ca7e10e203e9579)) +* **ci:** run on more branches and use depot runners ([ead76fc](https://github.com/openai/openai-node/commit/ead76fc6429ac52a1c8b008ac5c0afcefaa0bae5)) + ## 4.96.1 (2025-04-29) Full Changelog: [v4.96.0...v4.96.1](https://github.com/openai/openai-node/compare/v4.96.0...v4.96.1) diff --git a/jsr.json b/jsr.json index 73ea2185e..8eca06e74 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.96.1", + "version": "4.96.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 54046d4f2..d563394c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.96.1", + "version": "4.96.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 45539224e..1674d74fe 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.96.1'; // x-release-please-version +export const VERSION = '4.96.2'; // x-release-please-version From 0989ddcfd5ed0a149bbc67d61f93e0f49c397c72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:45:48 +0000 Subject: [PATCH 319/509] docs(readme): fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8515c81ed..bbf72226a 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ async function main() { main(); ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | From 995075b632051b5bb33c0381056107b2fe93931e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:11:59 +0000 Subject: [PATCH 320/509] chore(docs): add missing deprecation warnings --- src/resources/chat/completions/completions.ts | 8 ++++---- src/resources/fine-tuning/jobs/jobs.ts | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 17edac02c..251020337 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1169,7 +1169,7 @@ export interface ChatCompletionCreateParamsBase { frequency_penalty?: number | null; /** - * Deprecated in favor of `tool_choice`. + * @deprecated Deprecated in favor of `tool_choice`. * * Controls which (if any) function is called by the model. * @@ -1187,7 +1187,7 @@ export interface ChatCompletionCreateParamsBase { function_call?: 'none' | 'auto' | ChatCompletionFunctionCallOption; /** - * Deprecated in favor of `tools`. + * @deprecated Deprecated in favor of `tools`. * * A list of functions the model may generate JSON inputs for. */ @@ -1220,8 +1220,8 @@ export interface ChatCompletionCreateParamsBase { max_completion_tokens?: number | null; /** - * The maximum number of [tokens](/tokenizer) that can be generated in the chat - * completion. This value can be used to control + * @deprecated The maximum number of [tokens](/tokenizer) that can be generated in + * the chat completion. This value can be used to control * [costs](https://openai.com/api/pricing/) for text generated via API. * * This value is now deprecated in favor of `max_completion_tokens`, and is not diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 9be03c302..2198e8174 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -466,8 +466,9 @@ export interface JobCreateParams { training_file: string; /** - * The hyperparameters used for the fine-tuning job. This value is now deprecated - * in favor of `method`, and should be passed in under the `method` parameter. + * @deprecated The hyperparameters used for the fine-tuning job. This value is now + * deprecated in favor of `method`, and should be passed in under the `method` + * parameter. */ hyperparameters?: JobCreateParams.Hyperparameters; From dfbdc65d3ed17f0063d02906239371b88e04e5fd Mon Sep 17 00:00:00 2001 From: mini-peanut Date: Fri, 2 May 2025 09:00:11 +0800 Subject: [PATCH 321/509] docs: fix "procesing" -> "processing" in realtime examples (#1406) --- examples/azure/realtime/websocket.ts | 4 ++-- examples/azure/realtime/ws.ts | 4 ++-- examples/realtime/websocket.ts | 4 ++-- examples/realtime/ws.ts | 4 ++-- realtime.md | 7 +++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/azure/realtime/websocket.ts b/examples/azure/realtime/websocket.ts index bec74e654..4175b4a71 100644 --- a/examples/azure/realtime/websocket.ts +++ b/examples/azure/realtime/websocket.ts @@ -40,7 +40,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -57,4 +57,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts index 6ab7b742a..e86a79092 100644 --- a/examples/azure/realtime/ws.ts +++ b/examples/azure/realtime/ws.ts @@ -40,7 +40,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -57,4 +57,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/realtime/websocket.ts b/examples/realtime/websocket.ts index 0da131bc3..f1c46dd41 100644 --- a/examples/realtime/websocket.ts +++ b/examples/realtime/websocket.ts @@ -28,7 +28,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -45,4 +45,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts index 08c6fbcb6..1ce6b2045 100644 --- a/examples/realtime/ws.ts +++ b/examples/realtime/ws.ts @@ -28,7 +28,7 @@ async function main() { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -45,4 +45,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); +main(); \ No newline at end of file diff --git a/realtime.md b/realtime.md index 2fcd17e9e..7e8d84a3c 100644 --- a/realtime.md +++ b/realtime.md @@ -39,7 +39,7 @@ rt.socket.on('open', () => { rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); @@ -80,8 +80,7 @@ It is **highly recommended** that you register an `error` event listener and han const rt = new OpenAIRealtimeWS({ model: 'gpt-4o-realtime-preview-2024-12-17' }); rt.on('error', (err) => { // in a real world scenario this should be logged somewhere as you - // likely want to continue procesing events regardless of any errors + // likely want to continue processing events regardless of any errors throw err; }); -``` - +``` \ No newline at end of file From 31cd88fae84f630c8e86e1acab6c4cd9283c886c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 19:09:26 +0000 Subject: [PATCH 322/509] feat(api): add image sizes, reasoning encryption --- .stats.yml | 6 +-- src/resources/audio/speech.ts | 2 +- src/resources/images.ts | 24 +++++++-- src/resources/responses/responses.ts | 79 ++++++++++++++++++---------- tests/api-resources/images.test.ts | 1 + 5 files changed, 74 insertions(+), 38 deletions(-) diff --git a/.stats.yml b/.stats.yml index d92408173..0c8278866 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml -openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03 -config_hash: b597cd9a31e9e5ec709e2eefb4c54122 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml +openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6 +config_hash: d9b6b6e6bc85744663e300eebc482067 diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 4b99ee5f4..e218c8299 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -66,7 +66,7 @@ export interface SpeechCreateParams { /** * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - * the default. + * the default. Does not work with `gpt-4o-mini-tts`. */ speed?: number; } diff --git a/src/resources/images.ts b/src/resources/images.ts index de1882d30..32f1e123c 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -162,10 +162,13 @@ export interface ImageCreateVariationParams { export interface ImageEditParams { /** - * The image(s) to edit. Must be a supported image file or an array of images. For - * `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than - * 25MB. For `dall-e-2`, you can only provide one image, and it should be a square - * `png` file less than 4MB. + * The image(s) to edit. Must be a supported image file or an array of images. + * + * For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than + * 25MB. You can provide up to 16 images. + * + * For `dall-e-2`, you can only provide one image, and it should be a square `png` + * file less than 4MB. */ image: Core.Uploadable | Array; @@ -175,6 +178,17 @@ export interface ImageEditParams { */ prompt: string; + /** + * Allows to set transparency for the background of the generated image(s). This + * parameter is only supported for `gpt-image-1`. Must be one of `transparent`, + * `opaque` or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * If `transparent`, the output format needs to support transparency, so it should + * be set to either `png` (default value) or `webp`. + */ + background?: 'transparent' | 'opaque' | 'auto' | null; + /** * An additional image whose fully transparent areas (e.g. where alpha is zero) * indicate where `image` should be edited. If there are multiple images provided, @@ -215,7 +229,7 @@ export interface ImageEditParams { * (landscape), `1024x1536` (portrait), or `auto` (default value) for * `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. */ - size?: '256x256' | '512x512' | '1024x1024' | null; + size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto' | null; /** * A unique identifier representing your end-user, which can help OpenAI to monitor diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 771b8daf2..0a6e3666d 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -158,7 +158,7 @@ export interface ComputerTool { /** * The type of computer environment to control. */ - environment: 'mac' | 'windows' | 'ubuntu' | 'browser'; + environment: 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser'; /** * The type of the computer use tool. Always `computer_use_preview`. @@ -209,9 +209,9 @@ export interface FileSearchTool { vector_store_ids: Array; /** - * A filter to apply based on file attributes. + * A filter to apply. */ - filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + filters?: Shared.ComparisonFilter | Shared.CompoundFilter | null; /** * The maximum number of results to return. This number should be between 1 and 50 @@ -258,12 +258,12 @@ export interface FunctionTool { /** * A JSON schema object describing the parameters of the function. */ - parameters: Record; + parameters: Record | null; /** * Whether to enforce strict parameter validation. Default `true`. */ - strict: boolean; + strict: boolean | null; /** * The type of the function tool. Always `function`. @@ -1581,11 +1581,17 @@ export interface ResponseInProgressEvent { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ export type ResponseIncludable = | 'file_search_call.results' | 'message.input_image.image_url' - | 'computer_call_output.output.image_url'; + | 'computer_call_output.output.image_url' + | 'reasoning.encrypted_content'; /** * An event that is emitted when a response finishes as incomplete. @@ -1650,7 +1656,7 @@ export interface ResponseInputFile { /** * The ID of the file to be sent to the model. */ - file_id?: string; + file_id?: string | null; /** * The name of the file to be sent to the model. @@ -1667,7 +1673,7 @@ export interface ResponseInputImage { * The detail level of the image to be sent to the model. One of `high`, `low`, or * `auto`. Defaults to `auto`. */ - detail: 'high' | 'low' | 'auto'; + detail: 'low' | 'high' | 'auto'; /** * The type of the input item. Always `input_image`. @@ -1758,19 +1764,19 @@ export namespace ResponseInputItem { /** * The ID of the computer tool call output. */ - id?: string; + id?: string | null; /** * The safety checks reported by the API that have been acknowledged by the * developer. */ - acknowledged_safety_checks?: Array; + acknowledged_safety_checks?: Array | null; /** * The status of the message input. One of `in_progress`, `completed`, or * `incomplete`. Populated when input items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } export namespace ComputerCallOutput { @@ -1786,12 +1792,12 @@ export namespace ResponseInputItem { /** * The type of the pending safety check. */ - code: string; + code?: string | null; /** * Details about the pending safety check. */ - message: string; + message?: string | null; } } @@ -1818,13 +1824,13 @@ export namespace ResponseInputItem { * The unique ID of the function tool call output. Populated when this item is * returned via API. */ - id?: string; + id?: string | null; /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } /** @@ -1839,7 +1845,7 @@ export namespace ResponseInputItem { /** * The type of item to reference. Always `item_reference`. */ - type: 'item_reference'; + type?: 'item_reference' | null; } } @@ -2119,7 +2125,9 @@ export namespace ResponseOutputText { /** * A description of the chain of thought used by a reasoning model while generating - * a response. + * a response. Be sure to include these items in your `input` to the Responses API + * for subsequent turns of a conversation if you are manually + * [managing context](https://platform.openai.com/docs/guides/conversation-state). */ export interface ResponseReasoningItem { /** @@ -2137,6 +2145,12 @@ export interface ResponseReasoningItem { */ type: 'reasoning'; + /** + * The encrypted content of the reasoning item - populated when a response is + * generated with `reasoning.encrypted_content` in the `include` parameter. + */ + encrypted_content?: string | null; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -2730,11 +2744,9 @@ export interface ResponseWebSearchCallSearchingEvent { } /** - * A tool that searches for relevant content from uploaded files. Learn more about - * the - * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + * A tool that can be used to generate a response. */ -export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool; +export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool; /** * Use this option to force the model to call a specific function. @@ -2788,10 +2800,8 @@ export interface ToolChoiceTypes { */ export interface WebSearchTool { /** - * The type of the web search tool. One of: - * - * - `web_search_preview` - * - `web_search_preview_2025_03_11` + * The type of the web search tool. One of `web_search_preview` or + * `web_search_preview_2025_03_11`. */ type: 'web_search_preview' | 'web_search_preview_2025_03_11'; @@ -2801,10 +2811,16 @@ export interface WebSearchTool { */ search_context_size?: 'low' | 'medium' | 'high'; + /** + * The user's location. + */ user_location?: WebSearchTool.UserLocation | null; } export namespace WebSearchTool { + /** + * The user's location. + */ export interface UserLocation { /** * The type of location approximation. Always `approximate`. @@ -2814,24 +2830,24 @@ export namespace WebSearchTool { /** * Free text input for the city of the user, e.g. `San Francisco`. */ - city?: string; + city?: string | null; /** * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of * the user, e.g. `US`. */ - country?: string; + country?: string | null; /** * Free text input for the region of the user, e.g. `California`. */ - region?: string; + region?: string | null; /** * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the * user, e.g. `America/Los_Angeles`. */ - timezone?: string; + timezone?: string | null; } } @@ -2869,6 +2885,11 @@ export interface ResponseCreateParamsBase { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ include?: Array | null; diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index e9b460254..04fca0a2a 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -51,6 +51,7 @@ describe('resource images', () => { const response = await client.images.edit({ image: await toFile(Buffer.from('# my file contents'), 'README.md'), prompt: 'A cute baby sea otter wearing a beret', + background: 'transparent', mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1, From 5bb454391f34c6c0d9e8b3b22d0e407c31641bfa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 19:10:25 +0000 Subject: [PATCH 323/509] release: 4.97.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 88f780d30..4e19f03d6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.96.2" + ".": "4.97.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d724d8922..6fa637742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.97.0 (2025-05-02) + +Full Changelog: [v4.96.2...v4.97.0](https://github.com/openai/openai-node/compare/v4.96.2...v4.97.0) + +### Features + +* **api:** add image sizes, reasoning encryption ([9c2113a](https://github.com/openai/openai-node/commit/9c2113af7c7ea9a797a0e39d07d9ad8627c96acb)) + + +### Chores + +* **docs:** add missing deprecation warnings ([253392c](https://github.com/openai/openai-node/commit/253392c93adca88e0ee83f784183b2128ff64a16)) + + +### Documentation + +* fix "procesing" -> "processing" in realtime examples ([#1406](https://github.com/openai/openai-node/issues/1406)) ([8717b9f](https://github.com/openai/openai-node/commit/8717b9fce87d03e51d40ee58f5d6259408405e1f)) +* **readme:** fix typo ([cab3478](https://github.com/openai/openai-node/commit/cab3478f195f9de5c21033a1b3684f52ad347ffc)) + ## 4.96.2 (2025-04-29) Full Changelog: [v4.96.1...v4.96.2](https://github.com/openai/openai-node/compare/v4.96.1...v4.96.2) diff --git a/jsr.json b/jsr.json index 8eca06e74..fd3ca4a41 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.96.2", + "version": "4.97.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index d563394c0..8b9281b35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.96.2", + "version": "4.97.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 1674d74fe..97cbc5900 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.96.2'; // x-release-please-version +export const VERSION = '4.97.0'; // x-release-please-version From 6469d5323b653f19e90a7470d81c914c640c6f8b Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 5 May 2025 09:32:07 +0100 Subject: [PATCH 324/509] chore(internal): fix formatting --- examples/azure/realtime/websocket.ts | 2 +- examples/azure/realtime/ws.ts | 2 +- examples/realtime/websocket.ts | 2 +- examples/realtime/ws.ts | 2 +- examples/tsconfig.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/azure/realtime/websocket.ts b/examples/azure/realtime/websocket.ts index 4175b4a71..91fe3b7b9 100644 --- a/examples/azure/realtime/websocket.ts +++ b/examples/azure/realtime/websocket.ts @@ -57,4 +57,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); \ No newline at end of file +main(); diff --git a/examples/azure/realtime/ws.ts b/examples/azure/realtime/ws.ts index e86a79092..8b22aeef0 100644 --- a/examples/azure/realtime/ws.ts +++ b/examples/azure/realtime/ws.ts @@ -57,4 +57,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); \ No newline at end of file +main(); diff --git a/examples/realtime/websocket.ts b/examples/realtime/websocket.ts index f1c46dd41..6fb4740af 100644 --- a/examples/realtime/websocket.ts +++ b/examples/realtime/websocket.ts @@ -45,4 +45,4 @@ async function main() { rt.socket.addEventListener('close', () => console.log('\nConnection closed!')); } -main(); \ No newline at end of file +main(); diff --git a/examples/realtime/ws.ts b/examples/realtime/ws.ts index 1ce6b2045..6cc950b76 100644 --- a/examples/realtime/ws.ts +++ b/examples/realtime/ws.ts @@ -45,4 +45,4 @@ async function main() { rt.socket.on('close', () => console.log('\nConnection closed!')); } -main(); \ No newline at end of file +main(); diff --git a/examples/tsconfig.json b/examples/tsconfig.json index 6c3477462..3c43903cf 100644 --- a/examples/tsconfig.json +++ b/examples/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "../tsconfig.json" + "extends": "../tsconfig.json" } From bbf5d45259a8bfba62e2217955597ec0f6cfead4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 19:19:08 +0000 Subject: [PATCH 325/509] chore(ci): bump node version for release workflows --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish-jsr.yml | 2 +- .github/workflows/publish-npm.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49a043930..09f1636b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: Bootstrap run: ./scripts/bootstrap @@ -92,7 +92,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: Install dependencies run: | yarn install diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index 1e46d6bfb..e74673c1f 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20' - name: Install dependencies run: | diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 5a3711b53..0662a79c5 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20' - name: Install dependencies run: | From e8d2092e51015b05fe7ef33ef5a9d7652846b137 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 22:24:41 +0000 Subject: [PATCH 326/509] docs: add examples to tsdocs --- src/resources/audio/speech.ts | 12 +++++ src/resources/audio/transcriptions.ts | 9 ++++ src/resources/audio/translations.ts | 8 +++ src/resources/beta/assistants.ts | 36 +++++++++++++ src/resources/beta/realtime/sessions.ts | 6 +++ .../beta/realtime/transcription-sessions.ts | 6 +++ src/resources/beta/threads/messages.ts | 43 +++++++++++++++ src/resources/beta/threads/runs/runs.ts | 52 +++++++++++++++++++ src/resources/beta/threads/runs/steps.ts | 21 ++++++++ src/resources/beta/threads/threads.ts | 33 ++++++++++++ src/resources/chat/completions/completions.ts | 38 ++++++++++++++ src/resources/chat/completions/messages.ts | 10 ++++ src/resources/completions.ts | 8 +++ src/resources/embeddings.ts | 9 ++++ .../fine-tuning/checkpoints/permissions.ts | 28 ++++++++++ src/resources/fine-tuning/jobs/checkpoints.ts | 10 ++++ src/resources/fine-tuning/jobs/jobs.ts | 40 ++++++++++++++ src/resources/images.ts | 22 ++++++++ src/resources/responses/input-items.ts | 10 ++++ src/resources/responses/responses.ts | 22 ++++++++ 20 files changed, 423 insertions(+) diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index e218c8299..ccd37c092 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -7,6 +7,18 @@ import { type Response } from '../../_shims/index'; export class Speech extends APIResource { /** * Generates audio from the input text. + * + * @example + * ```ts + * const speech = await client.audio.speech.create({ + * input: 'input', + * model: 'string', + * voice: 'ash', + * }); + * + * const content = await speech.blob(); + * console.log(content); + * ``` */ create(body: SpeechCreateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/audio/speech', { diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index ba4fec6c5..8d563e0ba 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -9,6 +9,15 @@ import { Stream } from '../../streaming'; export class Transcriptions extends APIResource { /** * Transcribes audio into the input language. + * + * @example + * ```ts + * const transcription = + * await client.audio.transcriptions.create({ + * file: fs.createReadStream('speech.mp3'), + * model: 'gpt-4o-transcribe', + * }); + * ``` */ create( body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index df312f876..1edb71a7d 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -8,6 +8,14 @@ import * as TranscriptionsAPI from './transcriptions'; export class Translations extends APIResource { /** * Translates audio into English. + * + * @example + * ```ts + * const translation = await client.audio.translations.create({ + * file: fs.createReadStream('speech.mp3'), + * model: 'whisper-1', + * }); + * ``` */ create( body: TranslationCreateParams<'json' | undefined>, diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 00a6ff2cf..95581bbc8 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -14,6 +14,13 @@ import { AssistantStream } from '../../lib/AssistantStream'; export class Assistants extends APIResource { /** * Create an assistant with a model and instructions. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.create({ + * model: 'gpt-4o', + * }); + * ``` */ create(body: AssistantCreateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/assistants', { @@ -25,6 +32,13 @@ export class Assistants extends APIResource { /** * Retrieves an assistant. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.retrieve( + * 'assistant_id', + * ); + * ``` */ retrieve(assistantId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/assistants/${assistantId}`, { @@ -35,6 +49,13 @@ export class Assistants extends APIResource { /** * Modifies an assistant. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.update( + * 'assistant_id', + * ); + * ``` */ update( assistantId: string, @@ -50,6 +71,14 @@ export class Assistants extends APIResource { /** * Returns a list of assistants. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const assistant of client.beta.assistants.list()) { + * // ... + * } + * ``` */ list( query?: AssistantListParams, @@ -72,6 +101,13 @@ export class Assistants extends APIResource { /** * Delete an assistant. + * + * @example + * ```ts + * const assistantDeleted = await client.beta.assistants.del( + * 'assistant_id', + * ); + * ``` */ del(assistantId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/assistants/${assistantId}`, { diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 28a44431e..a55a2678c 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -12,6 +12,12 @@ export class Sessions extends APIResource { * It responds with a session object, plus a `client_secret` key which contains a * usable ephemeral API token that can be used to authenticate browser clients for * the Realtime API. + * + * @example + * ```ts + * const session = + * await client.beta.realtime.sessions.create(); + * ``` */ create(body: SessionCreateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/realtime/sessions', { diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index a54ec1125..61e58a8e8 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -12,6 +12,12 @@ export class TranscriptionSessions extends APIResource { * It responds with a session object, plus a `client_secret` key which contains a * usable ephemeral API token that can be used to authenticate browser clients for * the Realtime API. + * + * @example + * ```ts + * const transcriptionSession = + * await client.beta.realtime.transcriptionSessions.create(); + * ``` */ create( body: TranscriptionSessionCreateParams, diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 29fd2b29f..c3834ebe6 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -10,6 +10,14 @@ import { CursorPage, type CursorPageParams } from '../../../pagination'; export class Messages extends APIResource { /** * Create a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.create( + * 'thread_id', + * { content: 'string', role: 'user' }, + * ); + * ``` */ create( threadId: string, @@ -25,6 +33,14 @@ export class Messages extends APIResource { /** * Retrieve a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.retrieve( + * 'thread_id', + * 'message_id', + * ); + * ``` */ retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/messages/${messageId}`, { @@ -35,6 +51,14 @@ export class Messages extends APIResource { /** * Modifies a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.update( + * 'thread_id', + * 'message_id', + * ); + * ``` */ update( threadId: string, @@ -51,6 +75,16 @@ export class Messages extends APIResource { /** * Returns a list of messages for a given thread. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const message of client.beta.threads.messages.list( + * 'thread_id', + * )) { + * // ... + * } + * ``` */ list( threadId: string, @@ -75,6 +109,15 @@ export class Messages extends APIResource { /** * Deletes a message. + * + * @example + * ```ts + * const messageDeleted = + * await client.beta.threads.messages.del( + * 'thread_id', + * 'message_id', + * ); + * ``` */ del(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}/messages/${messageId}`, { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 15bfb4204..25356df3c 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -45,6 +45,14 @@ export class Runs extends APIResource { /** * Create a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.create( + * 'thread_id', + * { assistant_id: 'assistant_id' }, + * ); + * ``` */ create( threadId: string, @@ -78,6 +86,14 @@ export class Runs extends APIResource { /** * Retrieves a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.retrieve( + * 'thread_id', + * 'run_id', + * ); + * ``` */ retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/runs/${runId}`, { @@ -88,6 +104,14 @@ export class Runs extends APIResource { /** * Modifies a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.update( + * 'thread_id', + * 'run_id', + * ); + * ``` */ update( threadId: string, @@ -104,6 +128,16 @@ export class Runs extends APIResource { /** * Returns a list of runs belonging to a thread. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const run of client.beta.threads.runs.list( + * 'thread_id', + * )) { + * // ... + * } + * ``` */ list( threadId: string, @@ -128,6 +162,14 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.cancel( + * 'thread_id', + * 'run_id', + * ); + * ``` */ cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, { @@ -229,6 +271,16 @@ export class Runs extends APIResource { * `submit_tool_outputs`, this endpoint can be used to submit the outputs from the * tool calls once they're all completed. All outputs must be submitted in a single * request. + * + * @example + * ```ts + * const run = + * await client.beta.threads.runs.submitToolOutputs( + * 'thread_id', + * 'run_id', + * { tool_outputs: [{}] }, + * ); + * ``` */ submitToolOutputs( threadId: string, diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index c491b4e83..abd8d40ed 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -10,6 +10,16 @@ import { CursorPage, type CursorPageParams } from '../../../../pagination'; export class Steps extends APIResource { /** * Retrieves a run step. + * + * @example + * ```ts + * const runStep = + * await client.beta.threads.runs.steps.retrieve( + * 'thread_id', + * 'run_id', + * 'step_id', + * ); + * ``` */ retrieve( threadId: string, @@ -43,6 +53,17 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const runStep of client.beta.threads.runs.steps.list( + * 'thread_id', + * 'run_id', + * )) { + * // ... + * } + * ``` */ list( threadId: string, diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 2e5ab1cc8..c0c6bc8e4 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -73,6 +73,11 @@ export class Threads extends APIResource { /** * Create a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.create(); + * ``` */ create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; @@ -92,6 +97,13 @@ export class Threads extends APIResource { /** * Retrieves a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.retrieve( + * 'thread_id', + * ); + * ``` */ retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}`, { @@ -102,6 +114,13 @@ export class Threads extends APIResource { /** * Modifies a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.update( + * 'thread_id', + * ); + * ``` */ update(threadId: string, body: ThreadUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}`, { @@ -113,6 +132,13 @@ export class Threads extends APIResource { /** * Delete a thread. + * + * @example + * ```ts + * const threadDeleted = await client.beta.threads.del( + * 'thread_id', + * ); + * ``` */ del(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}`, { @@ -123,6 +149,13 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. + * + * @example + * ```ts + * const run = await client.beta.threads.createAndRun({ + * assistant_id: 'assistant_id', + * }); + * ``` */ createAndRun( body: ThreadCreateAndRunParamsNonStreaming, diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 251020337..6481f8e0f 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -33,6 +33,16 @@ export class Completions extends APIResource { * supported for reasoning models are noted below. For the current state of * unsupported parameters in reasoning models, * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning). + * + * @example + * ```ts + * const chatCompletion = await client.chat.completions.create( + * { + * messages: [{ content: 'string', role: 'developer' }], + * model: 'gpt-4o', + * }, + * ); + * ``` */ create( body: ChatCompletionCreateParamsNonStreaming, @@ -58,6 +68,12 @@ export class Completions extends APIResource { /** * Get a stored chat completion. Only Chat Completions that have been created with * the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * const chatCompletion = + * await client.chat.completions.retrieve('completion_id'); + * ``` */ retrieve(completionId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/chat/completions/${completionId}`, options); @@ -67,6 +83,14 @@ export class Completions extends APIResource { * Modify a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be modified. Currently, the only * supported modification is to update the `metadata` field. + * + * @example + * ```ts + * const chatCompletion = await client.chat.completions.update( + * 'completion_id', + * { metadata: { foo: 'string' } }, + * ); + * ``` */ update( completionId: string, @@ -79,6 +103,14 @@ export class Completions extends APIResource { /** * List stored Chat Completions. Only Chat Completions that have been stored with * the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const chatCompletion of client.chat.completions.list()) { + * // ... + * } + * ``` */ list( query?: ChatCompletionListParams, @@ -98,6 +130,12 @@ export class Completions extends APIResource { /** * Delete a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be deleted. + * + * @example + * ```ts + * const chatCompletionDeleted = + * await client.chat.completions.del('completion_id'); + * ``` */ del(completionId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/chat/completions/${completionId}`, options); diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index 519a33aff..ab3eb73f6 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -11,6 +11,16 @@ export class Messages extends APIResource { /** * Get the messages in a stored chat completion. Only Chat Completions that have * been created with the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const chatCompletionStoreMessage of client.chat.completions.messages.list( + * 'completion_id', + * )) { + * // ... + * } + * ``` */ list( completionId: string, diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 5cbec5e3c..07cb49ed9 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -10,6 +10,14 @@ import { Stream } from '../streaming'; export class Completions extends APIResource { /** * Creates a completion for the provided prompt and parameters. + * + * @example + * ```ts + * const completion = await client.completions.create({ + * model: 'string', + * prompt: 'This is a test.', + * }); + * ``` */ create(body: CompletionCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise; create( diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index a4be9ca3c..cc040abff 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -6,6 +6,15 @@ import * as Core from '../core'; export class Embeddings extends APIResource { /** * Creates an embedding vector representing the input text. + * + * @example + * ```ts + * const createEmbeddingResponse = + * await client.embeddings.create({ + * input: 'The quick brown fox jumped over the lazy dog', + * model: 'text-embedding-3-small', + * }); + * ``` */ create( body: EmbeddingCreateParams, diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index e808b2001..dc25bab7f 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -11,6 +11,17 @@ export class Permissions extends APIResource { * * This enables organization owners to share fine-tuned models with other projects * in their organization. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create( + * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + * { project_ids: ['string'] }, + * )) { + * // ... + * } + * ``` */ create( fineTunedModelCheckpoint: string, @@ -29,6 +40,14 @@ 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', + * ); + * ``` */ retrieve( fineTunedModelCheckpoint: string, @@ -58,6 +77,15 @@ export class Permissions extends APIResource { * * Organization owners can use this endpoint to delete a permission for a * fine-tuned model checkpoint. + * + * @example + * ```ts + * const permission = + * await client.fineTuning.checkpoints.permissions.del( + * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + * 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + * ); + * ``` */ del( fineTunedModelCheckpoint: string, diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index b3018ac5f..10902e715 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -8,6 +8,16 @@ import { CursorPage, type CursorPageParams } from '../../../pagination'; export class Checkpoints extends APIResource { /** * List checkpoints for a fine-tuning job. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJobCheckpoint of client.fineTuning.jobs.checkpoints.list( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } + * ``` */ list( fineTuningJobId: string, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 2198e8174..0bc812917 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -23,6 +23,14 @@ export class Jobs extends APIResource { * of the fine-tuned models once complete. * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.create({ + * model: 'gpt-4o-mini', + * training_file: 'file-abc123', + * }); + * ``` */ create(body: JobCreateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/fine_tuning/jobs', { body, ...options }); @@ -32,6 +40,13 @@ export class Jobs extends APIResource { * Get info about a fine-tuning job. * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.retrieve( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` */ retrieve(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/fine_tuning/jobs/${fineTuningJobId}`, options); @@ -39,6 +54,14 @@ export class Jobs extends APIResource { /** * List your organization's fine-tuning jobs + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJob of client.fineTuning.jobs.list()) { + * // ... + * } + * ``` */ list( query?: JobListParams, @@ -57,6 +80,13 @@ export class Jobs extends APIResource { /** * Immediately cancel a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.cancel( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` */ cancel(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`, options); @@ -64,6 +94,16 @@ export class Jobs extends APIResource { /** * Get status updates for a fine-tuning job. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJobEvent of client.fineTuning.jobs.listEvents( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } + * ``` */ listEvents( fineTuningJobId: string, diff --git a/src/resources/images.ts b/src/resources/images.ts index 32f1e123c..c6b14833a 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -6,6 +6,13 @@ import * as Core from '../core'; export class Images extends APIResource { /** * Creates a variation of a given image. This endpoint only supports `dall-e-2`. + * + * @example + * ```ts + * const imagesResponse = await client.images.createVariation({ + * image: fs.createReadStream('otter.png'), + * }); + * ``` */ createVariation( body: ImageCreateVariationParams, @@ -17,6 +24,14 @@ export class Images extends APIResource { /** * Creates an edited or extended image given one or more source images and a * prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`. + * + * @example + * ```ts + * const imagesResponse = await client.images.edit({ + * image: fs.createReadStream('path/to/file'), + * prompt: 'A cute baby sea otter wearing a beret', + * }); + * ``` */ edit(body: ImageEditParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/images/edits', Core.multipartFormRequestOptions({ body, ...options })); @@ -25,6 +40,13 @@ export class Images extends APIResource { /** * Creates an image given a prompt. * [Learn more](https://platform.openai.com/docs/guides/images). + * + * @example + * ```ts + * const imagesResponse = await client.images.generate({ + * prompt: 'A cute baby sea otter', + * }); + * ``` */ generate(body: ImageGenerateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/images/generations', { body, ...options }); diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index c88bb441d..74707f184 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -10,6 +10,16 @@ import { type CursorPageParams } from '../../pagination'; export class InputItems extends APIResource { /** * Returns a list of input items for a given response. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const responseItem of client.responses.inputItems.list( + * 'response_id', + * )) { + * // ... + * } + * ``` */ list( responseId: string, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 0a6e3666d..1440e865e 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -61,6 +61,14 @@ export class Responses extends APIResource { * [web search](https://platform.openai.com/docs/guides/tools-web-search) or * [file search](https://platform.openai.com/docs/guides/tools-file-search) to use * your own data as input for the model's response. + * + * @example + * ```ts + * const response = await client.responses.create({ + * input: 'string', + * model: 'gpt-4o', + * }); + * ``` */ create(body: ResponseCreateParamsNonStreaming, options?: Core.RequestOptions): APIPromise; create( @@ -90,6 +98,13 @@ export class Responses extends APIResource { /** * Retrieves a model response with the given ID. + * + * @example + * ```ts + * const response = await client.responses.retrieve( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` */ retrieve( responseId: string, @@ -110,6 +125,13 @@ export class Responses extends APIResource { /** * Deletes a model response with the given ID. + * + * @example + * ```ts + * await client.responses.del( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` */ del(responseId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/responses/${responseId}`, { From fabe6ec948c08c11588f6168f0a7560bf307d780 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 17:23:50 +0000 Subject: [PATCH 327/509] feat(api): Add reinforcement fine-tuning api support --- .stats.yml | 8 +- api.md | 43 +- src/index.ts | 11 +- src/resources/evals/evals.ts | 732 ++---------------- src/resources/evals/index.ts | 3 - src/resources/fine-tuning/alpha.ts | 3 + src/resources/fine-tuning/alpha/alpha.ts | 27 + src/resources/fine-tuning/alpha/graders.ts | 168 ++++ src/resources/fine-tuning/alpha/index.ts | 10 + src/resources/fine-tuning/fine-tuning.ts | 28 + src/resources/fine-tuning/index.ts | 10 + src/resources/fine-tuning/jobs/jobs.ts | 203 +---- src/resources/fine-tuning/methods.ts | 152 ++++ src/resources/graders.ts | 3 + src/resources/graders/grader-models.ts | 296 +++++++ src/resources/graders/graders.ts | 31 + src/resources/graders/index.ts | 12 + src/resources/index.ts | 4 +- .../fine-tuning/alpha/graders.test.ts | 53 ++ .../fine-tuning/jobs/jobs.test.ts | 56 +- 20 files changed, 1019 insertions(+), 834 deletions(-) create mode 100644 src/resources/fine-tuning/alpha.ts create mode 100644 src/resources/fine-tuning/alpha/alpha.ts create mode 100644 src/resources/fine-tuning/alpha/graders.ts create mode 100644 src/resources/fine-tuning/alpha/index.ts create mode 100644 src/resources/fine-tuning/methods.ts create mode 100644 src/resources/graders.ts create mode 100644 src/resources/graders/grader-models.ts create mode 100644 src/resources/graders/graders.ts create mode 100644 src/resources/graders/index.ts create mode 100644 tests/api-resources/fine-tuning/alpha/graders.test.ts diff --git a/.stats.yml b/.stats.yml index 0c8278866..5f1bee851 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml -openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6 -config_hash: d9b6b6e6bc85744663e300eebc482067 +configured_endpoints: 101 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-794a6ed3c3d3d77887564755168056af8a426b17cf1ec721e3a300503dc22a41.yml +openapi_spec_hash: 25a81c220713cd5b0bafc221d1dfa79a +config_hash: 0b768ed1b56c6d82816f0fa40dc4aaf5 diff --git a/api.md b/api.md index 49e6548a8..cad696e7e 100644 --- a/api.md +++ b/api.md @@ -207,6 +207,17 @@ Methods: # FineTuning +## Methods + +Types: + +- DpoHyperparameters +- DpoMethod +- ReinforcementHyperparameters +- ReinforcementMethod +- SupervisedHyperparameters +- SupervisedMethod + ## Jobs Types: @@ -224,6 +235,8 @@ Methods: - client.fineTuning.jobs.list({ ...params }) -> FineTuningJobsPage - client.fineTuning.jobs.cancel(fineTuningJobId) -> FineTuningJob - client.fineTuning.jobs.listEvents(fineTuningJobId, { ...params }) -> FineTuningJobEventsPage +- client.fineTuning.jobs.pause(fineTuningJobId) -> FineTuningJob +- client.fineTuning.jobs.resume(fineTuningJobId) -> FineTuningJob ### Checkpoints @@ -251,6 +264,33 @@ Methods: - client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse - client.fineTuning.checkpoints.permissions.del(fineTunedModelCheckpoint, permissionId) -> PermissionDeleteResponse +## Alpha + +### Graders + +Types: + +- GraderRunResponse +- GraderValidateResponse + +Methods: + +- client.fineTuning.alpha.graders.run({ ...params }) -> GraderRunResponse +- client.fineTuning.alpha.graders.validate({ ...params }) -> GraderValidateResponse + +# Graders + +## GraderModels + +Types: + +- LabelModelGrader +- MultiGrader +- PythonGrader +- ScoreModelGrader +- StringCheckGrader +- TextSimilarityGrader + # VectorStores Types: @@ -669,10 +709,7 @@ Methods: Types: - EvalCustomDataSourceConfig -- EvalLabelModelGrader - EvalStoredCompletionsDataSourceConfig -- EvalStringCheckGrader -- EvalTextSimilarityGrader - EvalCreateResponse - EvalRetrieveResponse - EvalUpdateResponse diff --git a/src/index.ts b/src/index.ts index 9e8d7ce37..537c18f43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,19 +71,17 @@ import { EvalCreateResponse, EvalCustomDataSourceConfig, EvalDeleteResponse, - EvalLabelModelGrader, EvalListParams, EvalListResponse, EvalListResponsesPage, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, - EvalStringCheckGrader, - EvalTextSimilarityGrader, EvalUpdateParams, EvalUpdateResponse, Evals, } from './resources/evals/evals'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { Graders } from './resources/graders/graders'; import { Responses } from './resources/responses/responses'; import { Upload, @@ -305,6 +303,7 @@ export class OpenAI extends Core.APIClient { moderations: API.Moderations = new API.Moderations(this); 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); beta: API.Beta = new API.Beta(this); batches: API.Batches = new API.Batches(this); @@ -366,6 +365,7 @@ OpenAI.Moderations = Moderations; OpenAI.Models = Models; OpenAI.ModelsPage = ModelsPage; OpenAI.FineTuning = FineTuning; +OpenAI.Graders = Graders; OpenAI.VectorStores = VectorStores; OpenAI.VectorStoresPage = VectorStoresPage; OpenAI.VectorStoreSearchResponsesPage = VectorStoreSearchResponsesPage; @@ -487,6 +487,8 @@ export declare namespace OpenAI { export { FineTuning as FineTuning }; + export { Graders as Graders }; + export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, @@ -531,10 +533,7 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLabelModelGrader as EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader as EvalStringCheckGrader, - type EvalTextSimilarityGrader as EvalTextSimilarityGrader, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, type EvalUpdateResponse as EvalUpdateResponse, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index caef7acc0..0f7166df4 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; +import * as GraderModelsAPI from '../graders/grader-models'; import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { @@ -103,83 +104,6 @@ export interface EvalCustomDataSourceConfig { type: 'custom'; } -/** - * A LabelModelGrader object which uses a model to assign labels to each item in - * the evaluation. - */ -export interface EvalLabelModelGrader { - input: Array; - - /** - * The labels to assign to each item in the evaluation. - */ - labels: Array; - - /** - * The model to use for the evaluation. Must support structured outputs. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The labels that indicate a passing result. Must be a subset of labels. - */ - passing_labels: Array; - - /** - * The object type, which is always `label_model`. - */ - type: 'label_model'; -} - -export namespace EvalLabelModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A StoredCompletionsDataSourceConfig which specifies the metadata property of * your stored completions query. This is usually metadata like `usecase=chatbot` @@ -210,83 +134,6 @@ export interface EvalStoredCompletionsDataSourceConfig { metadata?: Shared.Metadata | null; } -/** - * A StringCheckGrader object that performs a string comparison between input and - * reference using a specified operation. - */ -export interface EvalStringCheckGrader { - /** - * The input text. This may include template strings. - */ - input: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. - */ - operation: 'eq' | 'ne' | 'like' | 'ilike'; - - /** - * The reference text. This may include template strings. - */ - reference: string; - - /** - * The object type, which is always `string_check`. - */ - type: 'string_check'; -} - -/** - * A TextSimilarityGrader object which grades text based on similarity metrics. - */ -export interface EvalTextSimilarityGrader { - /** - * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, - * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. - */ - evaluation_metric: - | 'fuzzy_match' - | 'bleu' - | 'gleu' - | 'meteor' - | 'rouge_1' - | 'rouge_2' - | 'rouge_3' - | 'rouge_4' - | 'rouge_5' - | 'rouge_l'; - - /** - * The text being graded. - */ - input: string; - - /** - * A float score where a value greater than or equal indicates a passing grade. - */ - pass_threshold: number; - - /** - * The text being graded against. - */ - reference: string; - - /** - * The type of grader. - */ - type: 'text_similarity'; - - /** - * The name of the grader. - */ - name?: string; -} - /** * An Eval object with a data source config and testing criteria. An Eval * represents a task to be done for your LLM integration. Like: @@ -335,39 +182,29 @@ export interface EvalCreateResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalCreateResponse.Python - | EvalCreateResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalCreateResponse.EvalGraderTextSimilarity + | EvalCreateResponse.EvalGraderPython + | EvalCreateResponse.EvalGraderScoreModel >; } export namespace EvalCreateResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -377,85 +214,11 @@ export namespace EvalCreateResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -507,39 +270,29 @@ export interface EvalRetrieveResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalRetrieveResponse.Python - | EvalRetrieveResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalRetrieveResponse.EvalGraderTextSimilarity + | EvalRetrieveResponse.EvalGraderPython + | EvalRetrieveResponse.EvalGraderScoreModel >; } export namespace EvalRetrieveResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -549,85 +302,11 @@ export namespace EvalRetrieveResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -679,39 +358,29 @@ export interface EvalUpdateResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalUpdateResponse.Python - | EvalUpdateResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalUpdateResponse.EvalGraderTextSimilarity + | EvalUpdateResponse.EvalGraderPython + | EvalUpdateResponse.EvalGraderScoreModel >; } export namespace EvalUpdateResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -721,85 +390,11 @@ export namespace EvalUpdateResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -851,39 +446,29 @@ export interface EvalListResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalListResponse.Python - | EvalListResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalListResponse.EvalGraderTextSimilarity + | EvalListResponse.EvalGraderPython + | EvalListResponse.EvalGraderScoreModel >; } export namespace EvalListResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -893,85 +478,11 @@ export namespace EvalListResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -987,15 +498,15 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; /** * A list of graders for all eval runs in this group. */ testing_criteria: Array< | EvalCreateParams.LabelModel - | EvalStringCheckGrader - | EvalTextSimilarityGrader + | GraderModelsAPI.StringCheckGrader + | EvalCreateParams.TextSimilarity | EvalCreateParams.Python | EvalCreateParams.ScoreModel >; @@ -1048,14 +559,14 @@ export namespace EvalCreateParams { * completions query. This is usually metadata like `usecase=chatbot` or * `prompt-version=v2`, etc. */ - export interface Logs { + export interface StoredCompletions { /** - * The type of data source. Always `logs`. + * The type of data source. Always `stored_completions`. */ - type: 'logs'; + type: 'stored_completions'; /** - * Metadata filters for the logs data source. + * Metadata filters for the stored completions data source. */ metadata?: Record; } @@ -1154,29 +665,19 @@ export namespace EvalCreateParams { } /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { + export interface TextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface Python extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -1186,85 +687,11 @@ export namespace EvalCreateParams { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface ScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -1306,10 +733,7 @@ Evals.RunListResponsesPage = RunListResponsesPage; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLabelModelGrader as EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader as EvalStringCheckGrader, - type EvalTextSimilarityGrader as EvalTextSimilarityGrader, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, type EvalUpdateResponse as EvalUpdateResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index a246fe4e7..b2627fbf3 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -4,10 +4,7 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, - type EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader, - type EvalTextSimilarityGrader, type EvalCreateResponse, type EvalRetrieveResponse, type EvalUpdateResponse, diff --git a/src/resources/fine-tuning/alpha.ts b/src/resources/fine-tuning/alpha.ts new file mode 100644 index 000000000..446b6431e --- /dev/null +++ b/src/resources/fine-tuning/alpha.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './alpha/index'; diff --git a/src/resources/fine-tuning/alpha/alpha.ts b/src/resources/fine-tuning/alpha/alpha.ts new file mode 100644 index 000000000..77d695195 --- /dev/null +++ b/src/resources/fine-tuning/alpha/alpha.ts @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as GradersAPI from './graders'; +import { + GraderRunParams, + GraderRunResponse, + GraderValidateParams, + GraderValidateResponse, + Graders, +} from './graders'; + +export class Alpha extends APIResource { + graders: GradersAPI.Graders = new GradersAPI.Graders(this._client); +} + +Alpha.Graders = Graders; + +export declare namespace Alpha { + export { + Graders as Graders, + type GraderRunResponse as GraderRunResponse, + type GraderValidateResponse as GraderValidateResponse, + type GraderRunParams as GraderRunParams, + type GraderValidateParams as GraderValidateParams, + }; +} diff --git a/src/resources/fine-tuning/alpha/graders.ts b/src/resources/fine-tuning/alpha/graders.ts new file mode 100644 index 000000000..a9ef57f71 --- /dev/null +++ b/src/resources/fine-tuning/alpha/graders.ts @@ -0,0 +1,168 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as GraderModelsAPI from '../../graders/grader-models'; + +export class Graders extends APIResource { + /** + * Run a grader. + * + * @example + * ```ts + * const response = await client.fineTuning.alpha.graders.run({ + * grader: { + * input: 'input', + * name: 'name', + * operation: 'eq', + * reference: 'reference', + * type: 'string_check', + * }, + * model_sample: 'model_sample', + * reference_answer: 'string', + * }); + * ``` + */ + run(body: GraderRunParams, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post('/fine_tuning/alpha/graders/run', { body, ...options }); + } + + /** + * Validate a grader. + * + * @example + * ```ts + * const response = + * await client.fineTuning.alpha.graders.validate({ + * grader: { + * input: 'input', + * name: 'name', + * operation: 'eq', + * reference: 'reference', + * type: 'string_check', + * }, + * }); + * ``` + */ + validate( + body: GraderValidateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/fine_tuning/alpha/graders/validate', { body, ...options }); + } +} + +export interface GraderRunResponse { + metadata: GraderRunResponse.Metadata; + + model_grader_token_usage_per_model: Record; + + reward: number; + + sub_rewards: Record; +} + +export namespace GraderRunResponse { + export interface Metadata { + errors: Metadata.Errors; + + execution_time: number; + + name: string; + + sampled_model_name: string | null; + + scores: Record; + + token_usage: number | null; + + type: string; + } + + export namespace Metadata { + export interface Errors { + formula_parse_error: boolean; + + invalid_variable_error: boolean; + + model_grader_parse_error: boolean; + + model_grader_refusal_error: boolean; + + model_grader_server_error: boolean; + + model_grader_server_error_details: string | null; + + other_error: boolean; + + python_grader_runtime_error: boolean; + + python_grader_runtime_error_details: string | null; + + python_grader_server_error: boolean; + + python_grader_server_error_type: string | null; + + sample_parse_error: boolean; + + truncated_observation_error: boolean; + + unresponsive_reward_error: boolean; + } + } +} + +export interface GraderValidateResponse { + /** + * The grader used for the fine-tuning job. + */ + grader?: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; +} + +export interface GraderRunParams { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; + + /** + * The model sample to be evaluated. + */ + model_sample: string; + + /** + * The reference answer for the evaluation. + */ + reference_answer: string | unknown | Array | number; +} + +export interface GraderValidateParams { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; +} + +export declare namespace Graders { + export { + type GraderRunResponse as GraderRunResponse, + type GraderValidateResponse as GraderValidateResponse, + type GraderRunParams as GraderRunParams, + type GraderValidateParams as GraderValidateParams, + }; +} diff --git a/src/resources/fine-tuning/alpha/index.ts b/src/resources/fine-tuning/alpha/index.ts new file mode 100644 index 000000000..47b229bc3 --- /dev/null +++ b/src/resources/fine-tuning/alpha/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Alpha } from './alpha'; +export { + Graders, + type GraderRunResponse, + type GraderValidateResponse, + type GraderRunParams, + type GraderValidateParams, +} from './graders'; diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index 9b0a01992..8fb54983b 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -1,6 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as MethodsAPI from './methods'; +import { + DpoHyperparameters, + DpoMethod, + Methods, + ReinforcementHyperparameters, + ReinforcementMethod, + SupervisedHyperparameters, + SupervisedMethod, +} from './methods'; +import * as AlphaAPI from './alpha/alpha'; +import { Alpha } from './alpha/alpha'; import * as CheckpointsAPI from './checkpoints/checkpoints'; import { Checkpoints } from './checkpoints/checkpoints'; import * as JobsAPI from './jobs/jobs'; @@ -19,16 +31,30 @@ import { } from './jobs/jobs'; export class FineTuning extends APIResource { + methods: MethodsAPI.Methods = new MethodsAPI.Methods(this._client); jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); + alpha: AlphaAPI.Alpha = new AlphaAPI.Alpha(this._client); } +FineTuning.Methods = Methods; FineTuning.Jobs = Jobs; FineTuning.FineTuningJobsPage = FineTuningJobsPage; FineTuning.FineTuningJobEventsPage = FineTuningJobEventsPage; FineTuning.Checkpoints = Checkpoints; +FineTuning.Alpha = Alpha; export declare namespace FineTuning { + export { + Methods as Methods, + type DpoHyperparameters as DpoHyperparameters, + type DpoMethod as DpoMethod, + type ReinforcementHyperparameters as ReinforcementHyperparameters, + type ReinforcementMethod as ReinforcementMethod, + type SupervisedHyperparameters as SupervisedHyperparameters, + type SupervisedMethod as SupervisedMethod, + }; + export { Jobs as Jobs, type FineTuningJob as FineTuningJob, @@ -44,4 +70,6 @@ export declare namespace FineTuning { }; export { Checkpoints as Checkpoints }; + + export { Alpha as Alpha }; } diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index d23161c62..878ac402d 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Alpha } from './alpha/index'; export { Checkpoints } from './checkpoints/index'; export { FineTuning } from './fine-tuning'; export { @@ -15,3 +16,12 @@ export { type JobListParams, type JobListEventsParams, } from './jobs/index'; +export { + Methods, + type DpoHyperparameters, + type DpoMethod, + type ReinforcementHyperparameters, + type ReinforcementMethod, + type SupervisedHyperparameters, + type SupervisedMethod, +} from './methods'; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 0bc812917..08616cd4f 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; +import * as MethodsAPI from '../methods'; import * as CheckpointsAPI from './checkpoints'; import { CheckpointListParams, @@ -127,6 +128,34 @@ export class Jobs extends APIResource { ...options, }); } + + /** + * Pause a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.pause( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` + */ + pause(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/fine_tuning/jobs/${fineTuningJobId}/pause`, options); + } + + /** + * Resume a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.resume( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` + */ + resume(fineTuningJobId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/fine_tuning/jobs/${fineTuningJobId}/resume`, options); + } } export class FineTuningJobsPage extends CursorPage {} @@ -293,97 +322,24 @@ export namespace FineTuningJob { */ export interface Method { /** - * Configuration for the DPO fine-tuning method. - */ - dpo?: Method.Dpo; - - /** - * Configuration for the supervised fine-tuning method. + * The type of method. Is either `supervised`, `dpo`, or `reinforcement`. */ - supervised?: Method.Supervised; + type: 'supervised' | 'dpo' | 'reinforcement'; /** - * The type of method. Is either `supervised` or `dpo`. + * Configuration for the DPO fine-tuning method. */ - type?: 'supervised' | 'dpo'; - } + dpo?: MethodsAPI.DpoMethod; - export namespace Method { /** - * Configuration for the DPO fine-tuning method. + * Configuration for the reinforcement fine-tuning method. */ - export interface Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Dpo.Hyperparameters; - } - - export namespace Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * The beta value for the DPO method. A higher beta value will increase the weight - * of the penalty between the policy and reference model. - */ - beta?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + reinforcement?: MethodsAPI.ReinforcementMethod; /** * Configuration for the supervised fine-tuning method. */ - export interface Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Supervised.Hyperparameters; - } - - export namespace Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + supervised?: MethodsAPI.SupervisedMethod; } } @@ -637,97 +593,24 @@ export namespace JobCreateParams { */ export interface Method { /** - * Configuration for the DPO fine-tuning method. - */ - dpo?: Method.Dpo; - - /** - * Configuration for the supervised fine-tuning method. + * The type of method. Is either `supervised`, `dpo`, or `reinforcement`. */ - supervised?: Method.Supervised; + type: 'supervised' | 'dpo' | 'reinforcement'; /** - * The type of method. Is either `supervised` or `dpo`. + * Configuration for the DPO fine-tuning method. */ - type?: 'supervised' | 'dpo'; - } + dpo?: MethodsAPI.DpoMethod; - export namespace Method { /** - * Configuration for the DPO fine-tuning method. + * Configuration for the reinforcement fine-tuning method. */ - export interface Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Dpo.Hyperparameters; - } - - export namespace Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * The beta value for the DPO method. A higher beta value will increase the weight - * of the penalty between the policy and reference model. - */ - beta?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + reinforcement?: MethodsAPI.ReinforcementMethod; /** * Configuration for the supervised fine-tuning method. */ - export interface Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Supervised.Hyperparameters; - } - - export namespace Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + supervised?: MethodsAPI.SupervisedMethod; } } diff --git a/src/resources/fine-tuning/methods.ts b/src/resources/fine-tuning/methods.ts new file mode 100644 index 000000000..aa459c74c --- /dev/null +++ b/src/resources/fine-tuning/methods.ts @@ -0,0 +1,152 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as GraderModelsAPI from '../graders/grader-models'; + +export class Methods extends APIResource {} + +/** + * The hyperparameters used for the DPO fine-tuning job. + */ +export interface DpoHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * The beta value for the DPO method. A higher beta value will increase the weight + * of the penalty between the policy and reference model. + */ + beta?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; +} + +/** + * Configuration for the DPO fine-tuning method. + */ +export interface DpoMethod { + /** + * The hyperparameters used for the DPO fine-tuning job. + */ + hyperparameters?: DpoHyperparameters; +} + +/** + * The hyperparameters used for the reinforcement fine-tuning job. + */ +export interface ReinforcementHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Multiplier on amount of compute used for exploring search space during training. + */ + compute_multiplier?: 'auto' | number; + + /** + * The number of training steps between evaluation runs. + */ + eval_interval?: 'auto' | number; + + /** + * Number of evaluation samples to generate per training step. + */ + eval_samples?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + + /** + * Level of reasoning effort. + */ + reasoning_effort?: 'default' | 'low' | 'medium' | 'high'; +} + +/** + * Configuration for the reinforcement fine-tuning method. + */ +export interface ReinforcementMethod { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; + + /** + * The hyperparameters used for the reinforcement fine-tuning job. + */ + hyperparameters?: ReinforcementHyperparameters; +} + +/** + * The hyperparameters used for the fine-tuning job. + */ +export interface SupervisedHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; +} + +/** + * Configuration for the supervised fine-tuning method. + */ +export interface SupervisedMethod { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: SupervisedHyperparameters; +} + +export declare namespace Methods { + export { + type DpoHyperparameters as DpoHyperparameters, + type DpoMethod as DpoMethod, + type ReinforcementHyperparameters as ReinforcementHyperparameters, + type ReinforcementMethod as ReinforcementMethod, + type SupervisedHyperparameters as SupervisedHyperparameters, + type SupervisedMethod as SupervisedMethod, + }; +} diff --git a/src/resources/graders.ts b/src/resources/graders.ts new file mode 100644 index 000000000..2ea9aa959 --- /dev/null +++ b/src/resources/graders.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './graders/index'; diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts new file mode 100644 index 000000000..9ee08f75f --- /dev/null +++ b/src/resources/graders/grader-models.ts @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as ResponsesAPI from '../responses/responses'; + +export class GraderModels extends APIResource {} + +/** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ +export interface LabelModelGrader { + input: Array; + + /** + * The labels to assign to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; +} + +export namespace LabelModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A MultiGrader object combines the output of multiple graders to produce a single + * score. + */ +export interface MultiGrader { + /** + * A formula to calculate the output based on grader results. + */ + calculate_output: string; + + graders: Record< + string, + StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader + >; + + /** + * The name of the grader. + */ + name: string; + + /** + * The type of grader. + */ + type: 'multi'; +} + +/** + * A PythonGrader object that runs a python script on the input. + */ +export interface PythonGrader { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; +} + +/** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ +export interface ScoreModelGrader { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; +} + +export namespace ScoreModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A StringCheckGrader object that performs a string comparison between input and + * reference using a specified operation. + */ +export interface StringCheckGrader { + /** + * The input text. This may include template strings. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. + */ + operation: 'eq' | 'ne' | 'like' | 'ilike'; + + /** + * The reference text. This may include template strings. + */ + reference: string; + + /** + * The object type, which is always `string_check`. + */ + type: 'string_check'; +} + +/** + * A TextSimilarityGrader object which grades text based on similarity metrics. + */ +export interface TextSimilarityGrader { + /** + * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, + * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + */ + evaluation_metric: + | 'fuzzy_match' + | 'bleu' + | 'gleu' + | 'meteor' + | 'rouge_1' + | 'rouge_2' + | 'rouge_3' + | 'rouge_4' + | 'rouge_5' + | 'rouge_l'; + + /** + * The text being graded. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The text being graded against. + */ + reference: string; + + /** + * The type of grader. + */ + type: 'text_similarity'; +} + +export declare namespace GraderModels { + export { + type LabelModelGrader as LabelModelGrader, + type MultiGrader as MultiGrader, + type PythonGrader as PythonGrader, + type ScoreModelGrader as ScoreModelGrader, + type StringCheckGrader as StringCheckGrader, + type TextSimilarityGrader as TextSimilarityGrader, + }; +} diff --git a/src/resources/graders/graders.ts b/src/resources/graders/graders.ts new file mode 100644 index 000000000..de3297450 --- /dev/null +++ b/src/resources/graders/graders.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as GraderModelsAPI from './grader-models'; +import { + GraderModels, + LabelModelGrader, + MultiGrader, + PythonGrader, + ScoreModelGrader, + StringCheckGrader, + TextSimilarityGrader, +} from './grader-models'; + +export class Graders extends APIResource { + graderModels: GraderModelsAPI.GraderModels = new GraderModelsAPI.GraderModels(this._client); +} + +Graders.GraderModels = GraderModels; + +export declare namespace Graders { + export { + GraderModels as GraderModels, + type LabelModelGrader as LabelModelGrader, + type MultiGrader as MultiGrader, + type PythonGrader as PythonGrader, + type ScoreModelGrader as ScoreModelGrader, + type StringCheckGrader as StringCheckGrader, + type TextSimilarityGrader as TextSimilarityGrader, + }; +} diff --git a/src/resources/graders/index.ts b/src/resources/graders/index.ts new file mode 100644 index 000000000..82d557a6a --- /dev/null +++ b/src/resources/graders/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + GraderModels, + type LabelModelGrader, + type MultiGrader, + type PythonGrader, + type ScoreModelGrader, + type StringCheckGrader, + type TextSimilarityGrader, +} from './grader-models'; +export { Graders } from './graders'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 0d8ec9220..9d827615c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -33,10 +33,7 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, - type EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader, - type EvalTextSimilarityGrader, type EvalCreateResponse, type EvalRetrieveResponse, type EvalUpdateResponse, @@ -57,6 +54,7 @@ export { type FileListParams, } from './files'; export { FineTuning } from './fine-tuning/fine-tuning'; +export { Graders } from './graders/graders'; export { Images, type Image, diff --git a/tests/api-resources/fine-tuning/alpha/graders.test.ts b/tests/api-resources/fine-tuning/alpha/graders.test.ts new file mode 100644 index 000000000..8e47a4c42 --- /dev/null +++ b/tests/api-resources/fine-tuning/alpha/graders.test.ts @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource graders', () => { + test('run: only required params', async () => { + const responsePromise = client.fineTuning.alpha.graders.run({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + model_sample: 'model_sample', + reference_answer: 'string', + }); + 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('run: required and optional params', async () => { + const response = await client.fineTuning.alpha.graders.run({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + model_sample: 'model_sample', + reference_answer: 'string', + }); + }); + + test('validate: only required params', async () => { + const responsePromise = client.fineTuning.alpha.graders.validate({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + }); + 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('validate: required and optional params', async () => { + const response = await client.fineTuning.alpha.graders.validate({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + }); + }); +}); diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index 4de83a8b7..fe8c9efee 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -35,6 +35,7 @@ describe('resource jobs', () => { }, ], method: { + type: 'supervised', dpo: { hyperparameters: { batch_size: 'auto', @@ -43,10 +44,27 @@ describe('resource jobs', () => { n_epochs: 'auto', }, }, + reinforcement: { + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + hyperparameters: { + batch_size: 'auto', + compute_multiplier: 'auto', + eval_interval: 'auto', + eval_samples: 'auto', + learning_rate_multiplier: 'auto', + n_epochs: 'auto', + reasoning_effort: 'default', + }, + }, supervised: { hyperparameters: { batch_size: 'auto', learning_rate_multiplier: 'auto', n_epochs: 'auto' }, }, - type: 'supervised', }, seed: 42, suffix: 'x', @@ -143,4 +161,40 @@ describe('resource jobs', () => { ), ).rejects.toThrow(OpenAI.NotFoundError); }); + + test('pause', async () => { + const responsePromise = client.fineTuning.jobs.pause('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('pause: request options instead of 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.jobs.pause('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('resume', async () => { + const responsePromise = client.fineTuning.jobs.resume('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('resume: request options instead of 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.jobs.resume('ft-AF1WoRqd3aJAHsqc9NY7iL8F', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); }); From bc9f15fc7d1f4acf625adc3603577b06d59cdc5c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 17:24:55 +0000 Subject: [PATCH 328/509] release: 4.98.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4e19f03d6..a279d9124 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.97.0" + ".": "4.98.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa637742..2f1a39177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 4.98.0 (2025-05-08) + +Full Changelog: [v4.97.0...v4.98.0](https://github.com/openai/openai-node/compare/v4.97.0...v4.98.0) + +### Features + +* **api:** Add reinforcement fine-tuning api support ([4aa7a79](https://github.com/openai/openai-node/commit/4aa7a7954c63caa26cc1640ace56093fe1cafa04)) + + +### Chores + +* **ci:** bump node version for release workflows ([2961f63](https://github.com/openai/openai-node/commit/2961f63c4d5b8ae8efdf8ea6581aa83c6b0f722e)) +* **internal:** fix formatting ([91a44fe](https://github.com/openai/openai-node/commit/91a44fe11c0847dc50d48a03a8d409ac4bece37a)) + + +### Documentation + +* add examples to tsdocs ([7d841b7](https://github.com/openai/openai-node/commit/7d841b7f98eb542a398fb9de12056125e8d6cb22)) + ## 4.97.0 (2025-05-02) Full Changelog: [v4.96.2...v4.97.0](https://github.com/openai/openai-node/compare/v4.96.2...v4.97.0) diff --git a/jsr.json b/jsr.json index fd3ca4a41..25bbc9ac2 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.97.0", + "version": "4.98.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 8b9281b35..d34efceb0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.97.0", + "version": "4.98.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 97cbc5900..f64cc03ff 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.97.0'; // x-release-please-version +export const VERSION = '4.98.0'; // x-release-please-version From d1aa00afc760f73624a8a109600c03deba40e72b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:33:35 +0000 Subject: [PATCH 329/509] chore(internal): minor client file refactoring --- src/client.ts | 50 +++--------------------------------- src/internal/types.ts | 2 ++ src/internal/utils/log.ts | 30 +++++++++++++++++++++- src/internal/utils/values.ts | 8 ++++++ 4 files changed, 43 insertions(+), 47 deletions(-) diff --git a/src/client.ts b/src/client.ts index d7d77fc06..563638ef9 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,10 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; -import type { HTTPMethod, PromiseOrValue, MergedRequestInit } from './internal/types'; +import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types'; import { uuid4 } from './internal/utils/uuid'; -import { validatePositiveInteger, isAbsoluteURL, hasOwn } from './internal/utils/values'; +import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; +import { type Logger, type LogLevel, parseLogLevel } from './internal/utils/log'; +export type { Logger, LogLevel } from './internal/utils/log'; import { castToError, isAbortError } from './internal/errors'; import type { APIResponseProps } from './internal/parse'; import { getPlatformHeaders } from './internal/detect-platform'; @@ -148,48 +150,6 @@ import { ChatCompletionsPage, } from './resources/chat/completions/completions'; -const safeJSON = (text: string) => { - try { - return JSON.parse(text); - } catch (err) { - return undefined; - } -}; - -type LogFn = (message: string, ...rest: unknown[]) => void; -export type Logger = { - error: LogFn; - warn: LogFn; - info: LogFn; - debug: LogFn; -}; -export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug'; -const parseLogLevel = ( - maybeLevel: string | undefined, - sourceName: string, - client: OpenAI, -): LogLevel | undefined => { - if (!maybeLevel) { - return undefined; - } - const levels: Record = { - off: true, - error: true, - warn: true, - info: true, - debug: true, - }; - if (hasOwn(levels, maybeLevel)) { - return maybeLevel; - } - loggerFor(client).warn( - `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify( - Object.keys(levels), - )}`, - ); - return undefined; -}; - export interface ClientOptions { /** * Defaults to process.env['OPENAI_API_KEY']. @@ -279,8 +239,6 @@ export interface ClientOptions { logger?: Logger | undefined; } -type FinalizedRequestInit = RequestInit & { headers: Headers }; - /** * API Client for interfacing with the OpenAI API. */ diff --git a/src/internal/types.ts b/src/internal/types.ts index c3bce5a21..d7928cd35 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -5,6 +5,8 @@ export type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete'; export type KeysEnum = { [P in keyof Required]: true }; +export type FinalizedRequestInit = RequestInit & { headers: Headers }; + type NotAny = [unknown] extends [T] ? never : T; /** diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index f75d46bba..1aec41276 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -1,9 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import type { LogLevel, Logger } from '../../client'; +import { hasOwn } from './values'; import { type OpenAI } from '../../client'; import { RequestOptions } from '../request-options'; +type LogFn = (message: string, ...rest: unknown[]) => void; +export type Logger = { + error: LogFn; + warn: LogFn; + info: LogFn; + debug: LogFn; +}; +export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug'; + const levelNumbers = { off: 0, error: 200, @@ -12,6 +21,25 @@ const levelNumbers = { debug: 500, }; +export const parseLogLevel = ( + maybeLevel: string | undefined, + sourceName: string, + client: OpenAI, +): LogLevel | undefined => { + if (!maybeLevel) { + return undefined; + } + if (hasOwn(levelNumbers, maybeLevel)) { + return maybeLevel; + } + loggerFor(client).warn( + `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify( + Object.keys(levelNumbers), + )}`, + ); + return undefined; +}; + function noop() {} function makeLogFn(fnLevel: keyof Logger, logger: Logger | undefined, logLevel: LogLevel) { diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts index bb66cfdc1..08255c4b1 100644 --- a/src/internal/utils/values.ts +++ b/src/internal/utils/values.ts @@ -92,3 +92,11 @@ export const maybeCoerceBoolean = (value: unknown): boolean | undefined => { } return coerceBoolean(value); }; + +export const safeJSON = (text: string) => { + try { + return JSON.parse(text); + } catch (err) { + return undefined; + } +}; From 5d75cb95019ae77eafb0c878b355f09a1f87c3bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:56:01 +0000 Subject: [PATCH 330/509] chore: add missing type alias exports --- src/client.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client.ts b/src/client.ts index 563638ef9..485fa6821 100644 --- a/src/client.ts +++ b/src/client.ts @@ -137,6 +137,7 @@ import { ChatCompletionModality, ChatCompletionNamedToolChoice, ChatCompletionPredictionContent, + ChatCompletionReasoningEffort, ChatCompletionRole, ChatCompletionStoreMessage, ChatCompletionStreamOptions, @@ -920,6 +921,7 @@ export declare namespace OpenAI { type ChatCompletionToolChoiceOption as ChatCompletionToolChoiceOption, type ChatCompletionToolMessageParam as ChatCompletionToolMessageParam, type ChatCompletionUserMessageParam as ChatCompletionUserMessageParam, + type ChatCompletionReasoningEffort as ChatCompletionReasoningEffort, type ChatCompletionsPage as ChatCompletionsPage, type ChatCompletionCreateParams as ChatCompletionCreateParams, type ChatCompletionCreateParamsNonStreaming as ChatCompletionCreateParamsNonStreaming, From 3ca89652489e911890d0be9a2e93341ef026a20f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 17:53:48 +0000 Subject: [PATCH 331/509] fix(api): correct some Responses types --- .stats.yml | 2 +- src/resources/batches.ts | 8 +++--- src/resources/chat/completions/completions.ts | 18 ++++++++----- src/resources/responses/responses.ts | 26 +++++++++++++++---- src/resources/shared.ts | 4 +-- tests/api-resources/batches.test.ts | 4 +-- 6 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 53c73037d..1e04d7c26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c8579861bc21d4d2155a5b9e8e7d54faee8083730673c4d32cbbe573d7fb4116.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f763c1a35c8b9b02f1e31b9b2e09e21f98bfe8413e5079c86cbb07da2dd7779b.yml diff --git a/src/resources/batches.ts b/src/resources/batches.ts index db32d782b..36477851a 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -216,11 +216,11 @@ export interface BatchCreateParams { /** * The endpoint to be used for all requests in the batch. Currently - * `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are supported. - * Note that `/v1/embeddings` batches are also restricted to a maximum of 50,000 - * embedding inputs across all requests in the batch. + * `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` + * are supported. Note that `/v1/embeddings` batches are also restricted to a + * maximum of 50,000 embedding inputs across all requests in the batch. */ - endpoint: '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions'; + endpoint: '/v1/responses' | '/v1/chat/completions' | '/v1/embeddings' | '/v1/completions'; /** * The ID of an uploaded file that contains requests for the new batch. diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 8204e2a8b..d6ece1236 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -366,10 +366,13 @@ export interface ChatCompletionChunk { /** * An optional field that will only be present when you set * `stream_options: {"include_usage": true}` in your request. When present, it - * contains a null value except for the last chunk which contains the token usage - * statistics for the entire request. + * contains a null value **except for the last chunk** which contains the token + * usage statistics for the entire request. + * + * **NOTE:** If the stream is interrupted or cancelled, you may not receive the + * final usage chunk which contains the total token usage for the request. */ - usage?: CompletionsAPI.CompletionUsage | null; + usage?: CompletionsAPI.CompletionUsage; } export namespace ChatCompletionChunk { @@ -540,7 +543,7 @@ export namespace ChatCompletionContentPart { /** * The name of the file, used when passing the file to the model as a string. */ - file_name?: string; + filename?: string; } } } @@ -919,8 +922,11 @@ export interface ChatCompletionStreamOptions { /** * If set, an additional chunk will be streamed before the `data: [DONE]` message. * The `usage` field on this chunk shows the token usage statistics for the entire - * request, and the `choices` field will always be an empty array. All other chunks - * will also include a `usage` field, but with a null value. + * request, and the `choices` field will always be an empty array. + * + * All other chunks will also include a `usage` field, but with a null value. + * **NOTE:** If the stream is interrupted, you may not receive the final usage + * chunk which contains the total token usage for the request. */ include_usage?: boolean; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index d89f7580d..6b3200e6a 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -1290,11 +1290,6 @@ export interface ResponseFunctionCallArgumentsDoneEvent { * for more information. */ export interface ResponseFunctionToolCall { - /** - * The unique ID of the function tool call. - */ - id: string; - /** * A JSON string of the arguments to pass to the function. */ @@ -1315,6 +1310,11 @@ export interface ResponseFunctionToolCall { */ type: 'function_call'; + /** + * The unique ID of the function tool call. + */ + id?: string; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -2233,6 +2233,11 @@ export interface ResponseUsage { */ input_tokens: number; + /** + * A detailed breakdown of the input tokens. + */ + input_tokens_details: ResponseUsage.InputTokensDetails; + /** * The number of output tokens. */ @@ -2250,6 +2255,17 @@ export interface ResponseUsage { } export namespace ResponseUsage { + /** + * A detailed breakdown of the input tokens. + */ + export interface InputTokensDetails { + /** + * The number of tokens that were retrieved from the cache. + * [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching). + */ + cached_tokens: number; + } + /** * A detailed breakdown of the output tokens. */ diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 86b2d2dee..5fbdbba6a 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -171,10 +171,10 @@ export interface Reasoning { * supported values are `low`, `medium`, and `high`. Reducing reasoning effort can * result in faster responses and fewer tokens used on reasoning in a response. */ - effort: ReasoningEffort | null; + effort?: ReasoningEffort | null; /** - * **o-series models only** + * **computer_use_preview only** * * A summary of the reasoning performed by the model. This can be useful for * debugging and understanding the model's reasoning process. One of `concise` or diff --git a/tests/api-resources/batches.test.ts b/tests/api-resources/batches.test.ts index 870fbec9d..c895f0809 100644 --- a/tests/api-resources/batches.test.ts +++ b/tests/api-resources/batches.test.ts @@ -11,7 +11,7 @@ describe('resource batches', () => { test('create: only required params', async () => { const responsePromise = client.batches.create({ completion_window: '24h', - endpoint: '/v1/chat/completions', + endpoint: '/v1/responses', input_file_id: 'input_file_id', }); const rawResponse = await responsePromise.asResponse(); @@ -26,7 +26,7 @@ describe('resource batches', () => { test('create: required and optional params', async () => { const response = await client.batches.create({ completion_window: '24h', - endpoint: '/v1/chat/completions', + endpoint: '/v1/responses', input_file_id: 'input_file_id', metadata: { foo: 'string' }, }); From 96ed4dbd0c142d30d6cf80c2f850e77e02bd47a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Mar 2025 20:45:42 +0000 Subject: [PATCH 332/509] fix(types): improve responses type names --- .stats.yml | 2 +- api.md | 8 +- src/resources/responses/index.ts | 7 +- src/resources/responses/input-items.ts | 190 +------------------------ src/resources/responses/responses.ts | 188 ++++++++++++++++++++---- 5 files changed, 180 insertions(+), 215 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1e04d7c26..b03256223 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f763c1a35c8b9b02f1e31b9b2e09e21f98bfe8413e5079c86cbb07da2dd7779b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f3bce04386c4fcfd5037e0477fbaa39010003fd1558eb5185fe4a71dd6a05fdd.yml diff --git a/api.md b/api.md index 4657d4337..f72833427 100644 --- a/api.md +++ b/api.md @@ -547,6 +547,8 @@ Types: - ResponseCodeInterpreterToolCall - ResponseCompletedEvent - ResponseComputerToolCall +- ResponseComputerToolCallOutputItem +- ResponseComputerToolCallOutputScreenshot - ResponseContent - ResponseContentPartAddedEvent - ResponseContentPartDoneEvent @@ -563,6 +565,8 @@ Types: - ResponseFunctionCallArgumentsDeltaEvent - ResponseFunctionCallArgumentsDoneEvent - ResponseFunctionToolCall +- ResponseFunctionToolCallItem +- ResponseFunctionToolCallOutputItem - ResponseFunctionWebSearch - ResponseInProgressEvent - ResponseIncludable @@ -574,7 +578,9 @@ Types: - ResponseInputImage - ResponseInputItem - ResponseInputMessageContentList +- ResponseInputMessageItem - ResponseInputText +- ResponseItem - ResponseOutputAudio - ResponseOutputItem - ResponseOutputItemAddedEvent @@ -615,4 +621,4 @@ Types: Methods: -- client.responses.inputItems.list(responseID, { ...params }) -> ResponseItemListDataPage +- client.responses.inputItems.list(responseID, { ...params }) -> ResponseItemsPage diff --git a/src/resources/responses/index.ts b/src/resources/responses/index.ts index 164665eb2..ad3f9a386 100644 --- a/src/resources/responses/index.ts +++ b/src/resources/responses/index.ts @@ -1,9 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - InputItems, - type ResponseItemList, - type InputItemListParams, - type ResponseItemListDataPage, -} from './input-items'; +export { InputItems, type ResponseItemList, type InputItemListParams } from './input-items'; export { Responses } from './responses'; diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index b38d1be95..6bbef6366 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../resource'; import * as ResponsesAPI from './responses'; +import { ResponseItemsPage } from './responses'; import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; @@ -14,45 +15,15 @@ export class InputItems extends APIResource { responseID: string, query: InputItemListParams | null | undefined = {}, options?: RequestOptions, - ): PagePromise< - ResponseItemListDataPage, - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - > { + ): PagePromise { return this._client.getAPIList( path`/responses/${responseID}/input_items`, - CursorPage< - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - >, + CursorPage, { query, ...options }, ); } } -export type ResponseItemListDataPage = CursorPage< - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput ->; - /** * A list of Response items. */ @@ -60,16 +31,7 @@ export interface ResponseItemList { /** * A list of items used to generate this response. */ - data: Array< - | ResponseItemList.Message - | ResponsesAPI.ResponseOutputMessage - | ResponsesAPI.ResponseFileSearchToolCall - | ResponsesAPI.ResponseComputerToolCall - | ResponseItemList.ComputerCallOutput - | ResponsesAPI.ResponseFunctionWebSearch - | ResponsesAPI.ResponseFunctionToolCall - | ResponseItemList.FunctionCallOutput - >; + data: Array; /** * The ID of the first item in the list. @@ -92,142 +54,6 @@ export interface ResponseItemList { object: 'list'; } -export namespace ResponseItemList { - export interface Message { - /** - * The unique ID of the message input. - */ - id: string; - - /** - * A list of one or many input items to the model, containing different content - * types. - */ - content: ResponsesAPI.ResponseInputMessageContentList; - - /** - * The role of the message input. One of `user`, `system`, or `developer`. - */ - role: 'user' | 'system' | 'developer'; - - /** - * The status of item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - - /** - * The type of the message input. Always set to `message`. - */ - type?: 'message'; - } - - export interface ComputerCallOutput { - /** - * The unique ID of the computer call tool output. - */ - id: string; - - /** - * The ID of the computer tool call that produced the output. - */ - call_id: string; - - /** - * A computer screenshot image used with the computer use tool. - */ - output: ComputerCallOutput.Output; - - /** - * The type of the computer tool call output. Always `computer_call_output`. - */ - type: 'computer_call_output'; - - /** - * The safety checks reported by the API that have been acknowledged by the - * developer. - */ - acknowledged_safety_checks?: Array; - - /** - * The status of the message input. One of `in_progress`, `completed`, or - * `incomplete`. Populated when input items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } - - export namespace ComputerCallOutput { - /** - * A computer screenshot image used with the computer use tool. - */ - export interface Output { - /** - * Specifies the event type. For a computer screenshot, this property is always set - * to `computer_screenshot`. - */ - type: 'computer_screenshot'; - - /** - * The identifier of an uploaded file that contains the screenshot. - */ - file_id?: string; - - /** - * The URL of the screenshot image. - */ - image_url?: string; - } - - /** - * A pending safety check for the computer call. - */ - export interface AcknowledgedSafetyCheck { - /** - * The ID of the pending safety check. - */ - id: string; - - /** - * The type of the pending safety check. - */ - code: string; - - /** - * Details about the pending safety check. - */ - message: string; - } - } - - export interface FunctionCallOutput { - /** - * The unique ID of the function call tool output. - */ - id: string; - - /** - * The unique ID of the function tool call generated by the model. - */ - call_id: string; - - /** - * A JSON string of the output of the function tool call. - */ - output: string; - - /** - * The type of the function tool call output. Always `function_call_output`. - */ - type: 'function_call_output'; - - /** - * The status of the item. One of `in_progress`, `completed`, or `incomplete`. - * Populated when items are returned via API. - */ - status?: 'in_progress' | 'completed' | 'incomplete'; - } -} - export interface InputItemListParams extends CursorPageParams { /** * An item ID to list items before, used in pagination. @@ -244,9 +70,7 @@ export interface InputItemListParams extends CursorPageParams { } export declare namespace InputItems { - export { - type ResponseItemList as ResponseItemList, - type ResponseItemListDataPage as ResponseItemListDataPage, - type InputItemListParams as InputItemListParams, - }; + export { type ResponseItemList as ResponseItemList, type InputItemListParams as InputItemListParams }; } + +export { type ResponseItemsPage }; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 6b3200e6a..968d208d3 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -4,8 +4,9 @@ import { APIResource } from '../../resource'; import * as ResponsesAPI from './responses'; import * as Shared from '../shared'; import * as InputItemsAPI from './input-items'; -import { InputItemListParams, InputItems, ResponseItemList, ResponseItemListDataPage } from './input-items'; +import { InputItemListParams, InputItems, ResponseItemList } from './input-items'; import { APIPromise } from '../../api-promise'; +import { CursorPage } from '../../pagination'; import { Stream } from '../../streaming'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; @@ -67,6 +68,8 @@ export class Responses extends APIResource { } } +export type ResponseItemsPage = CursorPage; + /** * A tool that controls a virtual computer. Learn more about the * [computer tool](https://platform.openai.com/docs/guides/tools-computer-use). @@ -894,6 +897,83 @@ export namespace ResponseComputerToolCall { } } +export interface ResponseComputerToolCallOutputItem { + /** + * The unique ID of the computer call tool output. + */ + id: string; + + /** + * The ID of the computer tool call that produced the output. + */ + call_id: string; + + /** + * A computer screenshot image used with the computer use tool. + */ + output: ResponseComputerToolCallOutputScreenshot; + + /** + * The type of the computer tool call output. Always `computer_call_output`. + */ + type: 'computer_call_output'; + + /** + * The safety checks reported by the API that have been acknowledged by the + * developer. + */ + acknowledged_safety_checks?: Array; + + /** + * The status of the message input. One of `in_progress`, `completed`, or + * `incomplete`. Populated when input items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + +export namespace ResponseComputerToolCallOutputItem { + /** + * A pending safety check for the computer call. + */ + export interface AcknowledgedSafetyCheck { + /** + * The ID of the pending safety check. + */ + id: string; + + /** + * The type of the pending safety check. + */ + code: string; + + /** + * Details about the pending safety check. + */ + message: string; + } +} + +/** + * A computer screenshot image used with the computer use tool. + */ +export interface ResponseComputerToolCallOutputScreenshot { + /** + * Specifies the event type. For a computer screenshot, this property is always set + * to `computer_screenshot`. + */ + type: 'computer_screenshot'; + + /** + * The identifier of an uploaded file that contains the screenshot. + */ + file_id?: string; + + /** + * The URL of the screenshot image. + */ + image_url?: string; +} + /** * Multi-modal input and output contents. */ @@ -1322,6 +1402,46 @@ export interface ResponseFunctionToolCall { status?: 'in_progress' | 'completed' | 'incomplete'; } +/** + * A tool call to run a function. See the + * [function calling guide](https://platform.openai.com/docs/guides/function-calling) + * for more information. + */ +export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { + /** + * The unique ID of the function call tool output. + */ + id: string; +} + +export interface ResponseFunctionToolCallOutputItem { + /** + * The unique ID of the function call tool output. + */ + id: string; + + /** + * The unique ID of the function tool call generated by the model. + */ + call_id: string; + + /** + * A JSON string of the output of the function tool call. + */ + output: string; + + /** + * The type of the function tool call output. Always `function_call_output`. + */ + type: 'function_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; +} + /** * The results of a web search tool call. See the * [web search guide](https://platform.openai.com/docs/guides/tools-web-search) for @@ -1535,7 +1655,7 @@ export namespace ResponseInputItem { /** * A computer screenshot image used with the computer use tool. */ - output: ComputerCallOutput.Output; + output: ResponsesAPI.ResponseComputerToolCallOutputScreenshot; /** * The type of the computer tool call output. Always `computer_call_output`. @@ -1561,27 +1681,6 @@ export namespace ResponseInputItem { } export namespace ComputerCallOutput { - /** - * A computer screenshot image used with the computer use tool. - */ - export interface Output { - /** - * Specifies the event type. For a computer screenshot, this property is always set - * to `computer_screenshot`. - */ - type: 'computer_screenshot'; - - /** - * The identifier of an uploaded file that contains the screenshot. - */ - file_id?: string; - - /** - * The URL of the screenshot image. - */ - image_url?: string; - } - /** * A pending safety check for the computer call. */ @@ -1657,6 +1756,35 @@ export namespace ResponseInputItem { */ export type ResponseInputMessageContentList = Array; +export interface ResponseInputMessageItem { + /** + * The unique ID of the message input. + */ + id: string; + + /** + * A list of one or many input items to the model, containing different content + * types. + */ + content: ResponseInputMessageContentList; + + /** + * The role of the message input. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The status of item. One of `in_progress`, `completed`, or `incomplete`. + * Populated when items are returned via API. + */ + status?: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the message input. Always set to `message`. + */ + type?: 'message'; +} + /** * A text input to the model. */ @@ -1672,6 +1800,19 @@ export interface ResponseInputText { type: 'input_text'; } +/** + * Content item used to generate a response. + */ +export type ResponseItem = + | ResponseInputMessageItem + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseComputerToolCall + | ResponseComputerToolCallOutputItem + | ResponseFunctionWebSearch + | ResponseFunctionToolCallItem + | ResponseFunctionToolCallOutputItem; + /** * An audio output from the model. */ @@ -2655,7 +2796,6 @@ export declare namespace Responses { export { InputItems as InputItems, type ResponseItemList as ResponseItemList, - type ResponseItemListDataPage as ResponseItemListDataPage, type InputItemListParams as InputItemListParams, }; } From 0da1c1653896f872b9f17e8a3248c8206994c535 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:14:44 +0000 Subject: [PATCH 333/509] chore(exports): cleaner resource index imports --- src/resources.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/resources.ts diff --git a/src/resources.ts b/src/resources.ts new file mode 100644 index 000000000..b283d5781 --- /dev/null +++ b/src/resources.ts @@ -0,0 +1 @@ +export * from './resources/index'; From 09af7ffd42458c6c26d9325060fcb8925aca7c81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 18:28:49 +0000 Subject: [PATCH 334/509] chore(exports): stop using path fallbacks --- scripts/utils/postprocess-files.cjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs index d16c8641c..deae575e3 100644 --- a/scripts/utils/postprocess-files.cjs +++ b/scripts/utils/postprocess-files.cjs @@ -50,14 +50,14 @@ async function postprocess() { if (entry.isDirectory() && entry.name !== 'src' && entry.name !== 'internal' && entry.name !== 'bin') { const subpath = './' + entry.name; newExports[subpath + '/*.mjs'] = { - default: [subpath + '/*.mjs', subpath + '/*/index.mjs'], + default: subpath + '/*.mjs', }; newExports[subpath + '/*.js'] = { - default: [subpath + '/*.js', subpath + '/*/index.js'], + default: subpath + '/*.js', }; newExports[subpath + '/*'] = { - import: [subpath + '/*.mjs', subpath + '/*/index.mjs'], - require: [subpath + '/*.js', subpath + '/*/index.js'], + import: subpath + '/*.mjs', + require: subpath + '/*.js', }; } else if (entry.isFile() && /\.[cm]?js$/.test(entry.name)) { const { name, ext } = path.parse(entry.name); From 3540b069fcec32ab5acbdf3def579f21759dada6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 20:34:55 +0000 Subject: [PATCH 335/509] feat(api): o1-pro now available through the API --- .stats.yml | 2 +- api.md | 2 ++ src/client.ts | 2 ++ src/resources/responses/responses.ts | 6 +++--- src/resources/shared.ts | 27 ++++++++++++++++++++++----- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/.stats.yml b/.stats.yml index b03256223..e0b06dc22 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f3bce04386c4fcfd5037e0477fbaa39010003fd1558eb5185fe4a71dd6a05fdd.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b26121d5df6eb5d3032a45a267473798b15fcfec76dd44a3256cf1238be05fa4.yml diff --git a/api.md b/api.md index f72833427..539dc45a1 100644 --- a/api.md +++ b/api.md @@ -2,6 +2,7 @@ Types: +- AllModels - ChatModel - ComparisonFilter - CompoundFilter @@ -14,6 +15,7 @@ Types: - ResponseFormatJSONObject - ResponseFormatJSONSchema - ResponseFormatText +- ResponsesModel # Completions diff --git a/src/client.ts b/src/client.ts index 485fa6821..71c6c1f18 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1022,6 +1022,7 @@ export declare namespace OpenAI { export { Responses as Responses }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; @@ -1034,4 +1035,5 @@ export declare namespace OpenAI { export type ResponseFormatJSONObject = API.ResponseFormatJSONObject; export type ResponseFormatJSONSchema = API.ResponseFormatJSONSchema; export type ResponseFormatText = API.ResponseFormatText; + export type ResponsesModel = API.ResponsesModel; } diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 968d208d3..f4764b7f8 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -255,7 +255,7 @@ export interface Response { * [model guide](https://platform.openai.com/docs/models) to browse and compare * available models. */ - model: (string & {}) | Shared.ChatModel; + model: Shared.ResponsesModel; /** * The object type of this resource - always set to `response`. @@ -1409,7 +1409,7 @@ export interface ResponseFunctionToolCall { */ export interface ResponseFunctionToolCallItem extends ResponseFunctionToolCall { /** - * The unique ID of the function call tool output. + * The unique ID of the function tool call. */ id: string; } @@ -2607,7 +2607,7 @@ export interface ResponseCreateParamsBase { * [model guide](https://platform.openai.com/docs/models) to browse and compare * available models. */ - model: (string & {}) | Shared.ChatModel; + model: Shared.ResponsesModel; /** * Specify additional output data to include in the model response. Currently diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 5fbdbba6a..2c0fb1c32 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export type AllModels = + | string + | ChatModel + | string + | ChatModel + | 'o1-pro' + | 'o1-pro-2025-03-19' + | 'computer-use-preview' + | 'computer-use-preview-2025-03-11'; + export type ChatModel = | 'o3-mini' | 'o3-mini-2025-01-31' @@ -9,11 +19,6 @@ export type ChatModel = | 'o1-preview-2024-09-12' | 'o1-mini' | 'o1-mini-2024-09-12' - | 'computer-use-preview' - | 'computer-use-preview-2025-02-04' - | 'computer-use-preview-2025-03-11' - | 'gpt-4.5-preview' - | 'gpt-4.5-preview-2025-02-27' | 'gpt-4o' | 'gpt-4o-2024-11-20' | 'gpt-4o-2024-08-06' @@ -23,6 +28,10 @@ export type ChatModel = | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' + | 'gpt-4o-search-preview' + | 'gpt-4o-mini-search-preview' + | 'gpt-4o-search-preview-2025-03-11' + | 'gpt-4o-mini-search-preview-2025-03-11' | 'chatgpt-4o-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' @@ -265,3 +274,11 @@ export interface ResponseFormatText { */ type: 'text'; } + +export type ResponsesModel = + | (string & {}) + | ChatModel + | 'o1-pro' + | 'o1-pro-2025-03-19' + | 'computer-use-preview' + | 'computer-use-preview-2025-03-11'; From 1eab9edf9e5eb08e7c3d0d0ff21f378cacf7cb5b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:08:12 +0000 Subject: [PATCH 336/509] feat(api): new models for TTS, STT, + new audio features for Realtime --- .stats.yml | 4 +- api.md | 18 + src/resources/audio/audio.ts | 17 +- src/resources/audio/index.ts | 6 + src/resources/audio/speech.ts | 10 +- src/resources/audio/transcriptions.ts | 231 +++++++- src/resources/audio/translations.ts | 2 +- src/resources/beta/realtime/index.ts | 5 + src/resources/beta/realtime/realtime.ts | 522 ++++++++++++++++-- src/resources/beta/realtime/sessions.ts | 236 ++++++-- .../beta/realtime/transcription-sessions.ts | 307 ++++++++++ src/resources/chat/completions/completions.ts | 2 +- tests/api-resources/audio/speech.test.ts | 1 + .../audio/transcriptions.test.ts | 6 +- .../realtime/transcription-sessions.test.ts | 21 + 15 files changed, 1251 insertions(+), 137 deletions(-) create mode 100644 src/resources/beta/realtime/transcription-sessions.ts create mode 100644 tests/api-resources/beta/realtime/transcription-sessions.test.ts diff --git a/.stats.yml b/.stats.yml index e0b06dc22..abb937131 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b26121d5df6eb5d3032a45a267473798b15fcfec76dd44a3256cf1238be05fa4.yml +configured_endpoints: 82 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c22f59c66aec7914b6ee653d3098d1c1c8c16c180d2a158e819c8ddbf476f74b.yml diff --git a/api.md b/api.md index 539dc45a1..b3470ccf5 100644 --- a/api.md +++ b/api.md @@ -140,7 +140,11 @@ Types: Types: - Transcription +- TranscriptionInclude - TranscriptionSegment +- TranscriptionStreamEvent +- TranscriptionTextDeltaEvent +- TranscriptionTextDoneEvent - TranscriptionVerbose - TranscriptionWord - TranscriptionCreateResponse @@ -305,7 +309,9 @@ Types: - ConversationItemDeleteEvent - ConversationItemDeletedEvent - ConversationItemInputAudioTranscriptionCompletedEvent +- ConversationItemInputAudioTranscriptionDeltaEvent - ConversationItemInputAudioTranscriptionFailedEvent +- ConversationItemRetrieveEvent - ConversationItemTruncateEvent - ConversationItemTruncatedEvent - ConversationItemWithReference @@ -342,6 +348,8 @@ Types: - SessionCreatedEvent - SessionUpdateEvent - SessionUpdatedEvent +- TranscriptionSessionUpdate +- TranscriptionSessionUpdatedEvent ### Sessions @@ -354,6 +362,16 @@ Methods: - client.beta.realtime.sessions.create({ ...params }) -> SessionCreateResponse +### TranscriptionSessions + +Types: + +- TranscriptionSession + +Methods: + +- client.beta.realtime.transcriptionSessions.create({ ...params }) -> TranscriptionSession + ## Assistants Types: diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index b9a7ad4f8..071fe5929 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -7,8 +7,14 @@ import * as TranscriptionsAPI from './transcriptions'; import { Transcription, TranscriptionCreateParams, + TranscriptionCreateParamsNonStreaming, + TranscriptionCreateParamsStreaming, TranscriptionCreateResponse, + TranscriptionInclude, TranscriptionSegment, + TranscriptionStreamEvent, + TranscriptionTextDeltaEvent, + TranscriptionTextDoneEvent, TranscriptionVerbose, TranscriptionWord, Transcriptions, @@ -28,11 +34,12 @@ export class Audio extends APIResource { speech: SpeechAPI.Speech = new SpeechAPI.Speech(this._client); } -export type AudioModel = 'whisper-1'; +export type AudioModel = 'whisper-1' | 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe'; /** * The format of the output, in one of these options: `json`, `text`, `srt`, - * `verbose_json`, or `vtt`. + * `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, + * the only supported format is `json`. */ export type AudioResponseFormat = 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; @@ -46,11 +53,17 @@ export declare namespace Audio { export { Transcriptions as Transcriptions, type Transcription as Transcription, + type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, + type TranscriptionStreamEvent as TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, }; export { diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index 2bbe9e3ab..deed39ede 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -5,11 +5,17 @@ export { Speech, type SpeechModel, type SpeechCreateParams } from './speech'; export { Transcriptions, type Transcription, + type TranscriptionInclude, type TranscriptionSegment, + type TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent, type TranscriptionVerbose, type TranscriptionWord, type TranscriptionCreateResponse, type TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming, } from './transcriptions'; export { Translations, diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 81dc3e47d..efd722887 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -19,7 +19,7 @@ export class Speech extends APIResource { } } -export type SpeechModel = 'tts-1' | 'tts-1-hd'; +export type SpeechModel = 'tts-1' | 'tts-1-hd' | 'gpt-4o-mini-tts'; export interface SpeechCreateParams { /** @@ -29,7 +29,7 @@ export interface SpeechCreateParams { /** * One of the available [TTS models](https://platform.openai.com/docs/models#tts): - * `tts-1` or `tts-1-hd` + * `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`. */ model: (string & {}) | SpeechModel; @@ -41,6 +41,12 @@ export interface SpeechCreateParams { */ voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; + /** + * Control the voice of your generated audio with additional instructions. Does not + * work with `tts-1` or `tts-1-hd`. + */ + instructions?: string; + /** * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, * `wav`, and `pcm`. diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 253bd1e40..b6ff12aa6 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -1,8 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as TranscriptionsAPI from './transcriptions'; import * as AudioAPI from './audio'; import { APIPromise } from '../../api-promise'; +import { Stream } from '../../streaming'; import { type Uploadable } from '../../uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; @@ -12,25 +14,41 @@ export class Transcriptions extends APIResource { * Transcribes audio into the input language. */ create( - body: TranscriptionCreateParams<'json' | undefined>, + body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, options?: RequestOptions, ): APIPromise; create( - body: TranscriptionCreateParams<'verbose_json'>, + body: TranscriptionCreateParamsNonStreaming<'verbose_json'>, options?: RequestOptions, ): APIPromise; create( - body: TranscriptionCreateParams<'srt' | 'vtt' | 'text'>, + body: TranscriptionCreateParamsNonStreaming<'srt' | 'vtt' | 'text'>, options?: RequestOptions, ): APIPromise; - create(body: TranscriptionCreateParams, options?: RequestOptions): APIPromise; + create(body: TranscriptionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; + create( + body: TranscriptionCreateParamsStreaming, + options?: RequestOptions, + ): APIPromise>; + create( + body: TranscriptionCreateParamsStreaming, + options?: RequestOptions, + ): APIPromise>; create( body: TranscriptionCreateParams, options?: RequestOptions, - ): APIPromise { + ): APIPromise> { return this._client.post( '/audio/transcriptions', - multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client), + multipartFormRequestOptions( + { + body, + ...options, + stream: body.stream ?? false, + __metadata: { model: body.model }, + }, + this._client, + ), ); } } @@ -44,8 +62,36 @@ export interface Transcription { * The transcribed text. */ text: string; + + /** + * The log probabilities of the tokens in the transcription. Only returned with the + * models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added + * to the `include` array. + */ + logprobs?: Array; +} + +export namespace Transcription { + export interface Logprob { + /** + * The token in the transcription. + */ + token?: string; + + /** + * The bytes of the token. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } } +export type TranscriptionInclude = 'logprobs'; + export interface TranscriptionSegment { /** * Unique identifier of the segment. @@ -101,6 +147,103 @@ export interface TranscriptionSegment { tokens: Array; } +/** + * Emitted when there is an additional text delta. This is also the first event + * emitted when the transcription starts. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export type TranscriptionStreamEvent = TranscriptionTextDeltaEvent | TranscriptionTextDoneEvent; + +/** + * Emitted when there is an additional text delta. This is also the first event + * emitted when the transcription starts. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export interface TranscriptionTextDeltaEvent { + /** + * The text delta that was additionally transcribed. + */ + delta: string; + + /** + * The type of the event. Always `transcript.text.delta`. + */ + type: 'transcript.text.delta'; + + /** + * The log probabilities of the delta. Only included if you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `include[]` parameter set to `logprobs`. + */ + logprobs?: Array; +} + +export namespace TranscriptionTextDeltaEvent { + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token?: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } +} + +/** + * Emitted when the transcription is complete. Contains the complete transcription + * text. Only emitted when you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `Stream` parameter set to `true`. + */ +export interface TranscriptionTextDoneEvent { + /** + * The text that was transcribed. + */ + text: string; + + /** + * The type of the event. Always `transcript.text.done`. + */ + type: 'transcript.text.done'; + + /** + * The log probabilities of the individual tokens in the transcription. Only + * included if you + * [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription) + * with the `include[]` parameter set to `logprobs`. + */ + logprobs?: Array; +} + +export namespace TranscriptionTextDoneEvent { + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token?: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes?: Array; + + /** + * The log probability of the token. + */ + logprob?: number; + } +} + /** * Represents a verbose json transcription response returned by model, based on the * provided input. @@ -155,7 +298,11 @@ export interface TranscriptionWord { */ export type TranscriptionCreateResponse = Transcription | TranscriptionVerbose; -export interface TranscriptionCreateParams< +export type TranscriptionCreateParams< + ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, +> = TranscriptionCreateParamsNonStreaming | TranscriptionCreateParamsStreaming; + +export interface TranscriptionCreateParamsBase< ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, > { /** @@ -165,11 +312,21 @@ export interface TranscriptionCreateParams< file: Uploadable; /** - * ID of the model to use. Only `whisper-1` (which is powered by our open source - * Whisper V2 model) is currently available. + * ID of the model to use. The options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source + * Whisper V2 model). */ model: (string & {}) | AudioAPI.AudioModel; + /** + * Additional information to include in the transcription response. `logprobs` will + * return the log probabilities of the tokens in the response to understand the + * model's confidence in the transcription. `logprobs` only works with + * response_format set to `json` and only with the models `gpt-4o-transcribe` and + * `gpt-4o-mini-transcribe`. + */ + include?: Array; + /** * 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`) @@ -187,10 +344,23 @@ export interface TranscriptionCreateParams< /** * The format of the output, in one of these options: `json`, `text`, `srt`, - * `verbose_json`, or `vtt`. + * `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, + * the only supported format is `json`. */ response_format?: ResponseFormat; + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream?: boolean | null; + /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the * output more random, while lower values like 0.2 will make it more focused and @@ -210,13 +380,54 @@ export interface TranscriptionCreateParams< timestamp_granularities?: Array<'word' | 'segment'>; } +export namespace TranscriptionCreateParams { + export type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming; + export type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming; +} + +export interface TranscriptionCreateParamsNonStreaming< + ResponseFormat extends AudioAPI.AudioResponseFormat | undefined = AudioAPI.AudioResponseFormat | undefined, +> extends TranscriptionCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream?: false | null; +} + +export interface TranscriptionCreateParamsStreaming extends TranscriptionCreateParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions) + * for more information. + * + * Note: Streaming is not supported for the `whisper-1` model and will be ignored. + */ + stream: true; +} + export declare namespace Transcriptions { export { type Transcription as Transcription, + type TranscriptionInclude as TranscriptionInclude, type TranscriptionSegment as TranscriptionSegment, + type TranscriptionStreamEvent as TranscriptionStreamEvent, + type TranscriptionTextDeltaEvent as TranscriptionTextDeltaEvent, + type TranscriptionTextDoneEvent as TranscriptionTextDoneEvent, type TranscriptionVerbose as TranscriptionVerbose, type TranscriptionWord as TranscriptionWord, type TranscriptionCreateResponse as TranscriptionCreateResponse, type TranscriptionCreateParams as TranscriptionCreateParams, + type TranscriptionCreateParamsNonStreaming as TranscriptionCreateParamsNonStreaming, + type TranscriptionCreateParamsStreaming as TranscriptionCreateParamsStreaming, }; } diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 4c309e441..55155d592 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -88,7 +88,7 @@ export interface TranslationCreateParams< * The format of the output, in one of these options: `json`, `text`, `srt`, * `verbose_json`, or `vtt`. */ - response_format?: ResponseFormat; + response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the diff --git a/src/resources/beta/realtime/index.ts b/src/resources/beta/realtime/index.ts index 66c3ecaae..ba51d8a66 100644 --- a/src/resources/beta/realtime/index.ts +++ b/src/resources/beta/realtime/index.ts @@ -2,3 +2,8 @@ export { Realtime } from './realtime'; export { Sessions, type Session, type SessionCreateResponse, type SessionCreateParams } from './sessions'; +export { + TranscriptionSessions, + type TranscriptionSession, + type TranscriptionSessionCreateParams, +} from './transcription-sessions'; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5e2b1c833..d0a74840b 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -10,9 +10,17 @@ import { SessionCreateResponse, Sessions, } from './sessions'; +import * as TranscriptionSessionsAPI from './transcription-sessions'; +import { + TranscriptionSession, + TranscriptionSessionCreateParams, + TranscriptionSessions, +} from './transcription-sessions'; export class Realtime extends APIResource { sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client); + transcriptionSessions: TranscriptionSessionsAPI.TranscriptionSessions = + new TranscriptionSessionsAPI.TranscriptionSessions(this._client); } /** @@ -300,6 +308,91 @@ export interface ConversationItemInputAudioTranscriptionCompletedEvent { * The event type, must be `conversation.item.input_audio_transcription.completed`. */ type: 'conversation.item.input_audio_transcription.completed'; + + /** + * The log probabilities of the transcription. + */ + logprobs?: Array | null; +} + +export namespace ConversationItemInputAudioTranscriptionCompletedEvent { + /** + * A log probability object. + */ + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes: Array; + + /** + * The log probability of the token. + */ + logprob: number; + } +} + +/** + * Returned when the text value of an input audio transcription content part is + * updated. + */ +export interface ConversationItemInputAudioTranscriptionDeltaEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The ID of the item. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.input_audio_transcription.delta`. + */ + type: 'conversation.item.input_audio_transcription.delta'; + + /** + * The index of the content part in the item's content array. + */ + content_index?: number; + + /** + * The text delta. + */ + delta?: string; + + /** + * The log probabilities of the transcription. + */ + logprobs?: Array | null; +} + +export namespace ConversationItemInputAudioTranscriptionDeltaEvent { + /** + * A log probability object. + */ + export interface Logprob { + /** + * The token that was used to generate the log probability. + */ + token: string; + + /** + * The bytes that were used to generate the log probability. + */ + bytes: Array; + + /** + * The log probability of the token. + */ + logprob: number; + } } /** @@ -361,6 +454,30 @@ export namespace ConversationItemInputAudioTranscriptionFailedEvent { } } +/** + * Send this event when you want to retrieve the server's representation of a + * specific item in the conversation history. This is useful, for example, to + * inspect user audio after noise cancellation and VAD. The server will respond + * with a `conversation.item.retrieved` event, unless the item does not exist in + * the conversation history, in which case the server will respond with an error. + */ +export interface ConversationItemRetrieveEvent { + /** + * The ID of the item to retrieve. + */ + item_id: string; + + /** + * The event type, must be `conversation.item.retrieve`. + */ + type: 'conversation.item.retrieve'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + /** * Send this event to truncate a previous assistant message’s audio. The server * will produce audio faster than realtime, so this event is useful when the user @@ -789,18 +906,20 @@ export namespace RateLimitsUpdatedEvent { } /** - * All events that the client can send to the Realtime API + * A realtime client event. */ export type RealtimeClientEvent = - | SessionUpdateEvent - | InputAudioBufferAppendEvent - | InputAudioBufferCommitEvent - | InputAudioBufferClearEvent | ConversationItemCreateEvent - | ConversationItemTruncateEvent | ConversationItemDeleteEvent + | ConversationItemRetrieveEvent + | ConversationItemTruncateEvent + | InputAudioBufferAppendEvent + | InputAudioBufferClearEvent + | InputAudioBufferCommitEvent + | ResponseCancelEvent | ResponseCreateEvent - | ResponseCancelEvent; + | SessionUpdateEvent + | TranscriptionSessionUpdate; /** * The response resource. @@ -1009,37 +1128,63 @@ export namespace RealtimeResponseUsage { } /** - * All events that the Realtime API can send back + * A realtime server event. */ export type RealtimeServerEvent = - | ErrorEvent - | SessionCreatedEvent - | SessionUpdatedEvent | ConversationCreatedEvent - | InputAudioBufferCommittedEvent - | InputAudioBufferClearedEvent - | InputAudioBufferSpeechStartedEvent - | InputAudioBufferSpeechStoppedEvent | ConversationItemCreatedEvent + | ConversationItemDeletedEvent | ConversationItemInputAudioTranscriptionCompletedEvent + | ConversationItemInputAudioTranscriptionDeltaEvent | ConversationItemInputAudioTranscriptionFailedEvent + | RealtimeServerEvent.ConversationItemRetrieved | ConversationItemTruncatedEvent - | ConversationItemDeletedEvent + | ErrorEvent + | InputAudioBufferClearedEvent + | InputAudioBufferCommittedEvent + | InputAudioBufferSpeechStartedEvent + | InputAudioBufferSpeechStoppedEvent + | RateLimitsUpdatedEvent + | ResponseAudioDeltaEvent + | ResponseAudioDoneEvent + | ResponseAudioTranscriptDeltaEvent + | ResponseAudioTranscriptDoneEvent + | ResponseContentPartAddedEvent + | ResponseContentPartDoneEvent | ResponseCreatedEvent | ResponseDoneEvent + | ResponseFunctionCallArgumentsDeltaEvent + | ResponseFunctionCallArgumentsDoneEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent - | ResponseContentPartAddedEvent - | ResponseContentPartDoneEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent - | ResponseAudioTranscriptDeltaEvent - | ResponseAudioTranscriptDoneEvent - | ResponseAudioDeltaEvent - | ResponseAudioDoneEvent - | ResponseFunctionCallArgumentsDeltaEvent - | ResponseFunctionCallArgumentsDoneEvent - | RateLimitsUpdatedEvent; + | SessionCreatedEvent + | SessionUpdatedEvent + | TranscriptionSessionUpdatedEvent; + +export namespace RealtimeServerEvent { + /** + * Returned when a conversation item is retrieved with + * `conversation.item.retrieve`. + */ + export interface ConversationItemRetrieved { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The item to add to the conversation. + */ + item: RealtimeAPI.ConversationItem; + + /** + * The event type, must be `conversation.item.retrieved`. + */ + type: 'conversation.item.retrieved'; + } +} /** * Returned when the model-generated audio is updated. @@ -1834,15 +1979,24 @@ export namespace SessionUpdateEvent { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: Session.InputAudioTranscription; @@ -1891,7 +2045,8 @@ export namespace SessionUpdateEvent { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -1907,9 +2062,16 @@ export namespace SessionUpdateEvent { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ turn_detection?: Session.TurnDetection; @@ -1922,15 +2084,31 @@ export namespace SessionUpdateEvent { } export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** @@ -1941,16 +2119,17 @@ export namespace SessionUpdateEvent { language?: string; /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * The model to use for transcription, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ 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. + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". */ prompt?: string; } @@ -1979,48 +2158,62 @@ export namespace SessionUpdateEvent { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: string; + type?: 'server_vad' | 'semantic_vad'; } } } @@ -2046,7 +2239,216 @@ export interface SessionUpdatedEvent { type: 'session.updated'; } +/** + * Send this event to update a transcription session. + */ +export interface TranscriptionSessionUpdate { + /** + * Realtime transcription session object configuration. + */ + session: TranscriptionSessionUpdate.Session; + + /** + * The event type, must be `transcription_session.update`. + */ + type: 'transcription_session.update'; + + /** + * Optional client-generated ID used to identify this event. + */ + event_id?: string; +} + +export namespace TranscriptionSessionUpdate { + /** + * Realtime transcription session object configuration. + */ + export interface Session { + /** + * The set of items to include in the transcription. Current available items are: + * + * - `item.input_audio_transcription.logprobs` + */ + include?: Array; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + input_audio_transcription?: Session.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + turn_detection?: Session.TurnDetection; + } + + export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; + } + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. + */ + create_response?: boolean; + + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. + */ + interrupt_response?: boolean; + + /** + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection. + */ + type?: 'server_vad' | 'semantic_vad'; + } + } +} + +/** + * Returned when a transcription session is updated with a + * `transcription_session.update` event, unless there is an error. + */ +export interface TranscriptionSessionUpdatedEvent { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * A new Realtime transcription session configuration. + * + * When a session is created on the server via REST API, the session object also + * contains an ephemeral key. Default TTL for keys is one minute. This property is + * not present when a session is updated via the WebSocket API. + */ + session: TranscriptionSessionsAPI.TranscriptionSession; + + /** + * The event type, must be `transcription_session.updated`. + */ + type: 'transcription_session.updated'; +} + Realtime.Sessions = Sessions; +Realtime.TranscriptionSessions = TranscriptionSessions; export declare namespace Realtime { export { @@ -2055,4 +2457,10 @@ export declare namespace Realtime { type SessionCreateResponse as SessionCreateResponse, type SessionCreateParams as SessionCreateParams, }; + + export { + TranscriptionSessions as TranscriptionSessions, + type TranscriptionSession as TranscriptionSession, + type TranscriptionSessionCreateParams as TranscriptionSessionCreateParams, + }; } diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 0ece95bcd..e1c439c1c 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -29,7 +29,7 @@ export class Sessions extends APIResource { */ export interface Session { /** - * Unique identifier for the session object. + * Unique identifier for the session that looks like `sess_1234567890abcdef`. */ id?: string; @@ -40,12 +40,24 @@ export interface Session { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: Session.InputAudioNoiseReduction; + /** * 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 + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: Session.InputAudioTranscription; @@ -81,7 +93,6 @@ export interface Session { * The Realtime model used for this session. */ model?: - | (string & {}) | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' @@ -95,7 +106,8 @@ export interface Session { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -111,11 +123,18 @@ export interface Session { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ - turn_detection?: Session.TurnDetection | null; + turn_detection?: Session.TurnDetection; /** * The voice the model uses to respond. Voice cannot be changed during the session @@ -126,19 +145,54 @@ export interface Session { } export namespace Session { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ model?: string; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; } export interface Tool { @@ -165,48 +219,62 @@ export namespace Session { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: 'server_vad'; + type?: 'server_vad' | 'semantic_vad'; } } @@ -396,15 +464,24 @@ export interface SessionCreateParams { */ input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: SessionCreateParams.InputAudioNoiseReduction; + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ input_audio_transcription?: SessionCreateParams.InputAudioTranscription; @@ -453,7 +530,8 @@ export interface SessionCreateParams { output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; /** - * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. + * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a + * temperature of 0.8 is highly recommended for best performance. */ temperature?: number; @@ -469,9 +547,16 @@ export interface SessionCreateParams { tools?: Array; /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ turn_detection?: SessionCreateParams.TurnDetection; @@ -484,15 +569,31 @@ export interface SessionCreateParams { } export namespace SessionCreateParams { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + /** * 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 - * [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. + * [the /audio/transcriptions endpoint](https://platform.openai.com/docs/api-reference/audio/createTranscription) + * and should be treated as guidance of input audio content rather than precisely + * what the model heard. The client can optionally set the language and prompt for + * transcription, these offer additional guidance to the transcription service. */ export interface InputAudioTranscription { /** @@ -503,16 +604,17 @@ export namespace SessionCreateParams { language?: string; /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * The model to use for transcription, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. */ 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. + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". */ prompt?: string; } @@ -541,48 +643,62 @@ export namespace SessionCreateParams { } /** - * Configuration for turn detection. Can be set to `null` to turn off. Server VAD - * means that the model will detect the start and end of speech based on audio - * volume and respond at the end of user speech. + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. */ export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. `true` by default. + * occurs. */ create_response?: boolean; + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. `true` by default. + * occurs. */ interrupt_response?: boolean; /** - * Amount of audio to include before the VAD detected speech (in milliseconds). - * Defaults to 300ms. + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. */ prefix_padding_ms?: number; /** - * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. - * With shorter values the model will respond more quickly, but may jump in on - * short pauses from the user. + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. */ silence_duration_ms?: number; /** - * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher - * threshold will require louder audio to activate the model, and thus might - * perform better in noisy environments. + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. */ threshold?: number; /** - * Type of turn detection, only `server_vad` is currently supported. + * Type of turn detection. */ - type?: string; + type?: 'server_vad' | 'semantic_vad'; } } diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts new file mode 100644 index 000000000..f31ee9210 --- /dev/null +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -0,0 +1,307 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { APIPromise } from '../../../api-promise'; +import { buildHeaders } from '../../../internal/headers'; +import { RequestOptions } from '../../../internal/request-options'; + +export class TranscriptionSessions extends APIResource { + /** + * Create an ephemeral API token for use in client-side applications with the + * Realtime API specifically for realtime transcriptions. Can be configured with + * the same session parameters as the `transcription_session.update` client event. + * + * It responds with a session object, plus a `client_secret` key which contains a + * usable ephemeral API token that can be used to authenticate browser clients for + * the Realtime API. + */ + create(body: TranscriptionSessionCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/realtime/transcription_sessions', { + body, + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]), + }); + } +} + +/** + * A new Realtime transcription session configuration. + * + * When a session is created on the server via REST API, the session object also + * contains an ephemeral key. Default TTL for keys is one minute. This property is + * not present when a session is updated via the WebSocket API. + */ +export interface TranscriptionSession { + /** + * Ephemeral key returned by the API. Only present when the session is created on + * the server via REST API. + */ + client_secret: TranscriptionSession.ClientSecret; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. + */ + input_audio_format?: string; + + /** + * Configuration of the transcription model. + */ + input_audio_transcription?: TranscriptionSession.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + turn_detection?: TranscriptionSession.TurnDetection; +} + +export namespace TranscriptionSession { + /** + * Ephemeral key returned by the API. Only present when the session is created on + * the server via REST API. + */ + export interface ClientSecret { + /** + * Timestamp for when the token expires. Currently, all tokens expire after one + * minute. + */ + 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; + } + + /** + * Configuration of the transcription model. + */ + 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. Can be `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, or `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * 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; + } + + /** + * Configuration for turn detection. Can be set to `null` to turn off. Server VAD + * means that the model will detect the start and end of speech based on audio + * volume and respond at the end of user speech. + */ + export interface TurnDetection { + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + * Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). Defaults to 500ms. + * With shorter values the model will respond more quickly, but may jump in on + * short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Activation threshold for VAD (0.0 to 1.0), this defaults to 0.5. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection, only `server_vad` is currently supported. + */ + type?: string; + } +} + +export interface TranscriptionSessionCreateParams { + /** + * The set of items to include in the transcription. Current available items are: + * + * - `item.input_audio_transcription.logprobs` + */ + include?: Array; + + /** + * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For + * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel + * (mono), and little-endian byte order. + */ + input_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + input_audio_noise_reduction?: TranscriptionSessionCreateParams.InputAudioNoiseReduction; + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + input_audio_transcription?: TranscriptionSessionCreateParams.InputAudioTranscription; + + /** + * The set of modalities the model can respond with. To disable audio, set this to + * ["text"]. + */ + modalities?: Array<'text' | 'audio'>; + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + turn_detection?: TranscriptionSessionCreateParams.TurnDetection; +} + +export namespace TranscriptionSessionCreateParams { + /** + * Configuration for input audio noise reduction. This can be set to `null` to turn + * off. Noise reduction filters audio added to the input audio buffer before it is + * sent to VAD and the model. Filtering the audio can improve VAD and turn + * detection accuracy (reducing false positives) and model performance by improving + * perception of the input audio. + */ + export interface InputAudioNoiseReduction { + /** + * Type of noise reduction. `near_field` is for close-talking microphones such as + * headphones, `far_field` is for far-field microphones such as laptop or + * conference room microphones. + */ + type?: 'near_field' | 'far_field'; + } + + /** + * Configuration for input audio transcription. The client can optionally set the + * language and prompt for transcription, these offer additional guidance to the + * transcription service. + */ + 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, current options are `gpt-4o-transcribe`, + * `gpt-4o-mini-transcribe`, and `whisper-1`. + */ + model?: 'gpt-4o-transcribe' | 'gpt-4o-mini-transcribe' | 'whisper-1'; + + /** + * An optional text to guide the model's style or continue a previous audio + * segment. For `whisper-1`, the + * [prompt is a list of keywords](https://platform.openai.com/docs/guides/speech-to-text#prompting). + * For `gpt-4o-transcribe` models, the prompt is a free text string, for example + * "expect words related to technology". + */ + prompt?: string; + } + + /** + * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be + * set to `null` to turn off, in which case the client must manually trigger model + * response. Server VAD means that the model will detect the start and end of + * speech based on audio volume and respond at the end of user speech. Semantic VAD + * is more advanced and uses a turn detection model (in conjuction with VAD) to + * semantically estimate whether the user has finished speaking, then dynamically + * sets a timeout based on this probability. For example, if user audio trails off + * with "uhhm", the model will score a low probability of turn end and wait longer + * for the user to continue speaking. This can be useful for more natural + * conversations, but may have a higher latency. + */ + export interface TurnDetection { + /** + * Whether or not to automatically generate a response when a VAD stop event + * occurs. + */ + create_response?: boolean; + + /** + * Used only for `semantic_vad` mode. The eagerness of the model to respond. `low` + * will wait longer for the user to continue speaking, `high` will respond more + * quickly. `auto` is the default and is equivalent to `medium`. + */ + eagerness?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * Whether or not to automatically interrupt any ongoing response with output to + * the default conversation (i.e. `conversation` of `auto`) when a VAD start event + * occurs. + */ + interrupt_response?: boolean; + + /** + * Used only for `server_vad` mode. Amount of audio to include before the VAD + * detected speech (in milliseconds). Defaults to 300ms. + */ + prefix_padding_ms?: number; + + /** + * Used only for `server_vad` mode. Duration of silence to detect speech stop (in + * milliseconds). Defaults to 500ms. With shorter values the model will respond + * more quickly, but may jump in on short pauses from the user. + */ + silence_duration_ms?: number; + + /** + * Used only for `server_vad` mode. Activation threshold for VAD (0.0 to 1.0), this + * defaults to 0.5. A higher threshold will require louder audio to activate the + * model, and thus might perform better in noisy environments. + */ + threshold?: number; + + /** + * Type of turn detection. + */ + type?: 'server_vad' | 'semantic_vad'; + } +} + +export declare namespace TranscriptionSessions { + export { + type TranscriptionSession as TranscriptionSession, + type TranscriptionSessionCreateParams as TranscriptionSessionCreateParams, + }; +} diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index d6ece1236..0aa8d923d 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -372,7 +372,7 @@ export interface ChatCompletionChunk { * **NOTE:** If the stream is interrupted or cancelled, you may not receive the * final usage chunk which contains the total token usage for the request. */ - usage?: CompletionsAPI.CompletionUsage; + usage?: CompletionsAPI.CompletionUsage | null; } export namespace ChatCompletionChunk { diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index 904d75e5d..cbec6cfac 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -14,6 +14,7 @@ describe('resource speech', () => { input: 'input', model: 'string', voice: 'alloy', + instructions: 'instructions', response_format: 'mp3', speed: 0.25, }); diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 6e5d560d0..62d478701 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -11,7 +11,7 @@ describe('resource transcriptions', () => { test('create: only required params', async () => { const responsePromise = client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'whisper-1', + model: 'gpt-4o-transcribe', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -25,10 +25,12 @@ describe('resource transcriptions', () => { test('create: required and optional params', async () => { const response = await client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'whisper-1', + model: 'gpt-4o-transcribe', + include: ['logprobs'], language: 'language', prompt: 'prompt', response_format: 'json', + stream: false, temperature: 0, timestamp_granularities: ['word'], }); diff --git a/tests/api-resources/beta/realtime/transcription-sessions.test.ts b/tests/api-resources/beta/realtime/transcription-sessions.test.ts new file mode 100644 index 000000000..2c7cbbb15 --- /dev/null +++ b/tests/api-resources/beta/realtime/transcription-sessions.test.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource transcriptionSessions', () => { + test('create', async () => { + const responsePromise = client.beta.realtime.transcriptionSessions.create({}); + 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); + }); +}); From bee2ce5841f25b1f56cdc1fd0b36b0758d2c9bdc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:58:45 +0000 Subject: [PATCH 337/509] fix(client): remove duplicate types --- src/resources/shared.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 2c0fb1c32..3e8ded763 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export type AllModels = - | string - | ChatModel - | string + | (string & {}) | ChatModel | 'o1-pro' | 'o1-pro-2025-03-19' From 6c1be40685bc342190aee7cc0f3905ce3d4dc7db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 17:52:01 -0400 Subject: [PATCH 338/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index abb937131..2df281d34 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-c22f59c66aec7914b6ee653d3098d1c1c8c16c180d2a158e819c8ddbf476f74b.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml From c735a3c24ac8255df50f89c519fb7dfc617db045 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 22:42:17 +0000 Subject: [PATCH 339/509] chore(internal): codegen related update --- MIGRATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIGRATION.md b/MIGRATION.md index b84a1d6f9..c375b825c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -286,7 +286,7 @@ import fs from 'fs'; fs.createReadStream('path/to/file'); ``` -Note that this function previously only worked on Node.j. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead. +Note that this function previously only worked on Node.js. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead. ### Shims removal From a81602996a1d9c3ceda79d88fe163a1e6b823e77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 25 Mar 2025 19:07:49 +0000 Subject: [PATCH 340/509] fix(exports): add missing type exports --- src/resources/beta/beta.ts | 106 +++++++++++++++++++++++- src/resources/beta/realtime/realtime.ts | 52 ++++++++++++ src/resources/responses/responses.ts | 83 +++++++++++++++++++ 3 files changed, 239 insertions(+), 2 deletions(-) diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index f279bc835..98d11a66c 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -22,7 +22,58 @@ import { ThreadStreamEvent, } from './assistants'; import * as RealtimeAPI from './realtime/realtime'; -import { Realtime } from './realtime/realtime'; +import { + ConversationCreatedEvent, + ConversationItem, + ConversationItemContent, + ConversationItemCreateEvent, + ConversationItemCreatedEvent, + ConversationItemDeleteEvent, + ConversationItemDeletedEvent, + ConversationItemInputAudioTranscriptionCompletedEvent, + ConversationItemInputAudioTranscriptionDeltaEvent, + ConversationItemInputAudioTranscriptionFailedEvent, + ConversationItemRetrieveEvent, + ConversationItemTruncateEvent, + ConversationItemTruncatedEvent, + ConversationItemWithReference, + ErrorEvent, + InputAudioBufferAppendEvent, + InputAudioBufferClearEvent, + InputAudioBufferClearedEvent, + InputAudioBufferCommitEvent, + InputAudioBufferCommittedEvent, + InputAudioBufferSpeechStartedEvent, + InputAudioBufferSpeechStoppedEvent, + RateLimitsUpdatedEvent, + Realtime, + RealtimeClientEvent, + RealtimeResponse, + RealtimeResponseStatus, + RealtimeResponseUsage, + RealtimeServerEvent, + ResponseAudioDeltaEvent, + ResponseAudioDoneEvent, + ResponseAudioTranscriptDeltaEvent, + ResponseAudioTranscriptDoneEvent, + ResponseCancelEvent, + ResponseContentPartAddedEvent, + ResponseContentPartDoneEvent, + ResponseCreateEvent, + ResponseCreatedEvent, + ResponseDoneEvent, + ResponseFunctionCallArgumentsDeltaEvent, + ResponseFunctionCallArgumentsDoneEvent, + ResponseOutputItemAddedEvent, + ResponseOutputItemDoneEvent, + ResponseTextDeltaEvent, + ResponseTextDoneEvent, + SessionCreatedEvent, + SessionUpdateEvent, + SessionUpdatedEvent, + TranscriptionSessionUpdate, + TranscriptionSessionUpdatedEvent, +} from './realtime/realtime'; import * as ThreadsAPI from './threads/threads'; import { AssistantResponseFormatOption, @@ -54,7 +105,58 @@ Beta.Assistants = Assistants; Beta.Threads = Threads; export declare namespace Beta { - export { Realtime as Realtime }; + export { + Realtime as Realtime, + type ConversationCreatedEvent as ConversationCreatedEvent, + type ConversationItem as ConversationItem, + type ConversationItemContent as ConversationItemContent, + type ConversationItemCreateEvent as ConversationItemCreateEvent, + type ConversationItemCreatedEvent as ConversationItemCreatedEvent, + type ConversationItemDeleteEvent as ConversationItemDeleteEvent, + type ConversationItemDeletedEvent as ConversationItemDeletedEvent, + type ConversationItemInputAudioTranscriptionCompletedEvent as ConversationItemInputAudioTranscriptionCompletedEvent, + type ConversationItemInputAudioTranscriptionDeltaEvent as ConversationItemInputAudioTranscriptionDeltaEvent, + type ConversationItemInputAudioTranscriptionFailedEvent as ConversationItemInputAudioTranscriptionFailedEvent, + type ConversationItemRetrieveEvent as ConversationItemRetrieveEvent, + type ConversationItemTruncateEvent as ConversationItemTruncateEvent, + type ConversationItemTruncatedEvent as ConversationItemTruncatedEvent, + type ConversationItemWithReference as ConversationItemWithReference, + type ErrorEvent as ErrorEvent, + type InputAudioBufferAppendEvent as InputAudioBufferAppendEvent, + type InputAudioBufferClearEvent as InputAudioBufferClearEvent, + type InputAudioBufferClearedEvent as InputAudioBufferClearedEvent, + type InputAudioBufferCommitEvent as InputAudioBufferCommitEvent, + type InputAudioBufferCommittedEvent as InputAudioBufferCommittedEvent, + type InputAudioBufferSpeechStartedEvent as InputAudioBufferSpeechStartedEvent, + type InputAudioBufferSpeechStoppedEvent as InputAudioBufferSpeechStoppedEvent, + type RateLimitsUpdatedEvent as RateLimitsUpdatedEvent, + type RealtimeClientEvent as RealtimeClientEvent, + type RealtimeResponse as RealtimeResponse, + type RealtimeResponseStatus as RealtimeResponseStatus, + type RealtimeResponseUsage as RealtimeResponseUsage, + type RealtimeServerEvent as RealtimeServerEvent, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCancelEvent as ResponseCancelEvent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreateEvent as ResponseCreateEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseDoneEvent as ResponseDoneEvent, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type SessionCreatedEvent as SessionCreatedEvent, + type SessionUpdateEvent as SessionUpdateEvent, + type SessionUpdatedEvent as SessionUpdatedEvent, + type TranscriptionSessionUpdate as TranscriptionSessionUpdate, + type TranscriptionSessionUpdatedEvent as TranscriptionSessionUpdatedEvent, + }; export { Chat as Chat }; diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index d0a74840b..224d94f37 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2451,6 +2451,58 @@ Realtime.Sessions = Sessions; Realtime.TranscriptionSessions = TranscriptionSessions; export declare namespace Realtime { + export { + type ConversationCreatedEvent as ConversationCreatedEvent, + type ConversationItem as ConversationItem, + type ConversationItemContent as ConversationItemContent, + type ConversationItemCreateEvent as ConversationItemCreateEvent, + type ConversationItemCreatedEvent as ConversationItemCreatedEvent, + type ConversationItemDeleteEvent as ConversationItemDeleteEvent, + type ConversationItemDeletedEvent as ConversationItemDeletedEvent, + type ConversationItemInputAudioTranscriptionCompletedEvent as ConversationItemInputAudioTranscriptionCompletedEvent, + type ConversationItemInputAudioTranscriptionDeltaEvent as ConversationItemInputAudioTranscriptionDeltaEvent, + type ConversationItemInputAudioTranscriptionFailedEvent as ConversationItemInputAudioTranscriptionFailedEvent, + type ConversationItemRetrieveEvent as ConversationItemRetrieveEvent, + type ConversationItemTruncateEvent as ConversationItemTruncateEvent, + type ConversationItemTruncatedEvent as ConversationItemTruncatedEvent, + type ConversationItemWithReference as ConversationItemWithReference, + type ErrorEvent as ErrorEvent, + type InputAudioBufferAppendEvent as InputAudioBufferAppendEvent, + type InputAudioBufferClearEvent as InputAudioBufferClearEvent, + type InputAudioBufferClearedEvent as InputAudioBufferClearedEvent, + type InputAudioBufferCommitEvent as InputAudioBufferCommitEvent, + type InputAudioBufferCommittedEvent as InputAudioBufferCommittedEvent, + type InputAudioBufferSpeechStartedEvent as InputAudioBufferSpeechStartedEvent, + type InputAudioBufferSpeechStoppedEvent as InputAudioBufferSpeechStoppedEvent, + type RateLimitsUpdatedEvent as RateLimitsUpdatedEvent, + type RealtimeClientEvent as RealtimeClientEvent, + type RealtimeResponse as RealtimeResponse, + type RealtimeResponseStatus as RealtimeResponseStatus, + type RealtimeResponseUsage as RealtimeResponseUsage, + type RealtimeServerEvent as RealtimeServerEvent, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCancelEvent as ResponseCancelEvent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreateEvent as ResponseCreateEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseDoneEvent as ResponseDoneEvent, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type SessionCreatedEvent as SessionCreatedEvent, + type SessionUpdateEvent as SessionUpdateEvent, + type SessionUpdatedEvent as SessionUpdatedEvent, + type TranscriptionSessionUpdate as TranscriptionSessionUpdate, + type TranscriptionSessionUpdatedEvent as TranscriptionSessionUpdatedEvent, + }; + export { Sessions as Sessions, type SessionsAPISession as Session, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index f4764b7f8..8fb697c93 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -2793,6 +2793,89 @@ export interface ResponseRetrieveParams { Responses.InputItems = InputItems; export declare namespace Responses { + export { + type ComputerTool as ComputerTool, + type EasyInputMessage as EasyInputMessage, + type FileSearchTool as FileSearchTool, + type FunctionTool as FunctionTool, + type Response as Response, + type ResponseAudioDeltaEvent as ResponseAudioDeltaEvent, + type ResponseAudioDoneEvent as ResponseAudioDoneEvent, + type ResponseAudioTranscriptDeltaEvent as ResponseAudioTranscriptDeltaEvent, + type ResponseAudioTranscriptDoneEvent as ResponseAudioTranscriptDoneEvent, + type ResponseCodeInterpreterCallCodeDeltaEvent as ResponseCodeInterpreterCallCodeDeltaEvent, + type ResponseCodeInterpreterCallCodeDoneEvent as ResponseCodeInterpreterCallCodeDoneEvent, + type ResponseCodeInterpreterCallCompletedEvent as ResponseCodeInterpreterCallCompletedEvent, + type ResponseCodeInterpreterCallInProgressEvent as ResponseCodeInterpreterCallInProgressEvent, + type ResponseCodeInterpreterCallInterpretingEvent as ResponseCodeInterpreterCallInterpretingEvent, + type ResponseCodeInterpreterToolCall as ResponseCodeInterpreterToolCall, + type ResponseCompletedEvent as ResponseCompletedEvent, + type ResponseComputerToolCall as ResponseComputerToolCall, + type ResponseComputerToolCallOutputItem as ResponseComputerToolCallOutputItem, + type ResponseComputerToolCallOutputScreenshot as ResponseComputerToolCallOutputScreenshot, + type ResponseContent as ResponseContent, + type ResponseContentPartAddedEvent as ResponseContentPartAddedEvent, + type ResponseContentPartDoneEvent as ResponseContentPartDoneEvent, + type ResponseCreatedEvent as ResponseCreatedEvent, + type ResponseError as ResponseError, + type ResponseErrorEvent as ResponseErrorEvent, + type ResponseFailedEvent as ResponseFailedEvent, + type ResponseFileSearchCallCompletedEvent as ResponseFileSearchCallCompletedEvent, + type ResponseFileSearchCallInProgressEvent as ResponseFileSearchCallInProgressEvent, + type ResponseFileSearchCallSearchingEvent as ResponseFileSearchCallSearchingEvent, + type ResponseFileSearchToolCall as ResponseFileSearchToolCall, + type ResponseFormatTextConfig as ResponseFormatTextConfig, + type ResponseFormatTextJSONSchemaConfig as ResponseFormatTextJSONSchemaConfig, + type ResponseFunctionCallArgumentsDeltaEvent as ResponseFunctionCallArgumentsDeltaEvent, + type ResponseFunctionCallArgumentsDoneEvent as ResponseFunctionCallArgumentsDoneEvent, + type ResponseFunctionToolCall as ResponseFunctionToolCall, + type ResponseFunctionToolCallItem as ResponseFunctionToolCallItem, + type ResponseFunctionToolCallOutputItem as ResponseFunctionToolCallOutputItem, + type ResponseFunctionWebSearch as ResponseFunctionWebSearch, + type ResponseInProgressEvent as ResponseInProgressEvent, + type ResponseIncludable as ResponseIncludable, + type ResponseIncompleteEvent as ResponseIncompleteEvent, + type ResponseInput as ResponseInput, + type ResponseInputAudio as ResponseInputAudio, + type ResponseInputContent as ResponseInputContent, + type ResponseInputFile as ResponseInputFile, + type ResponseInputImage as ResponseInputImage, + type ResponseInputItem as ResponseInputItem, + type ResponseInputMessageContentList as ResponseInputMessageContentList, + type ResponseInputMessageItem as ResponseInputMessageItem, + type ResponseInputText as ResponseInputText, + type ResponseItem as ResponseItem, + type ResponseOutputAudio as ResponseOutputAudio, + type ResponseOutputItem as ResponseOutputItem, + type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, + type ResponseOutputItemDoneEvent as ResponseOutputItemDoneEvent, + type ResponseOutputMessage as ResponseOutputMessage, + type ResponseOutputRefusal as ResponseOutputRefusal, + type ResponseOutputText as ResponseOutputText, + type ResponseReasoningItem as ResponseReasoningItem, + type ResponseRefusalDeltaEvent as ResponseRefusalDeltaEvent, + type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, + type ResponseStatus as ResponseStatus, + type ResponseStreamEvent as ResponseStreamEvent, + type ResponseTextAnnotationDeltaEvent as ResponseTextAnnotationDeltaEvent, + type ResponseTextConfig as ResponseTextConfig, + type ResponseTextDeltaEvent as ResponseTextDeltaEvent, + type ResponseTextDoneEvent as ResponseTextDoneEvent, + type ResponseUsage as ResponseUsage, + type ResponseWebSearchCallCompletedEvent as ResponseWebSearchCallCompletedEvent, + type ResponseWebSearchCallInProgressEvent as ResponseWebSearchCallInProgressEvent, + type ResponseWebSearchCallSearchingEvent as ResponseWebSearchCallSearchingEvent, + type Tool as Tool, + type ToolChoiceFunction as ToolChoiceFunction, + type ToolChoiceOptions as ToolChoiceOptions, + type ToolChoiceTypes as ToolChoiceTypes, + type WebSearchTool as WebSearchTool, + type ResponseCreateParams as ResponseCreateParams, + type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, + type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, + type ResponseRetrieveParams as ResponseRetrieveParams, + }; + export { InputItems as InputItems, type ResponseItemList as ResponseItemList, From 1b0a94d088c2891fcad0ca0de3a1e4e205a7c9cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 17:33:07 +0000 Subject: [PATCH 341/509] chore: add hash of OpenAPI spec/config inputs to .stats.yml --- .stats.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.stats.yml b/.stats.yml index 2df281d34..fe9320429 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml +openapi_spec_hash: 0c255269b89767eae26f4d4dc22d3cbd +config_hash: d36e491b0afc4f79e3afad4b3c9bec70 From 0c21914d90b0ef1073d99c539cf9ef18912b8d0b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 19:33:42 +0000 Subject: [PATCH 342/509] chore(client): more accurate streaming errors --- src/streaming.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/streaming.ts b/src/streaming.ts index 47c366071..5b9c19cfa 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -30,7 +30,7 @@ export class Stream implements AsyncIterable { async function* iterator(): AsyncIterator { if (consumed) { - throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); + throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); } consumed = true; let done = false; @@ -55,7 +55,7 @@ export class Stream implements AsyncIterable { } if (data && data.error) { - throw new APIError(undefined, data.error, undefined, undefined); + throw new APIError(undefined, data.error, undefined, response.headers); } yield data; @@ -113,7 +113,7 @@ export class Stream implements AsyncIterable { async function* iterator(): AsyncIterator { if (consumed) { - throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); + throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); } consumed = true; let done = false; From 38c9d548fded9000cde85270b38085c61905b5c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 19:56:16 +0000 Subject: [PATCH 343/509] chore(client): move misc public files to new `core/` directory, deprecate old paths --- MIGRATION.md | 61 ++-- src/api-promise.ts | 103 +----- src/client.ts | 10 +- src/core/README.md | 3 + src/core/api-promise.ts | 101 ++++++ src/core/error.ts | 154 ++++++++ src/core/pagination.ts | 204 +++++++++++ src/core/resource.ts | 11 + src/core/streaming.ts | 336 +++++++++++++++++ src/core/uploads.ts | 2 + src/error.ts | 156 +------- src/index.ts | 10 +- src/internal/README.md | 3 + src/internal/decoders/line.ts | 2 +- src/internal/parse.ts | 2 +- src/internal/request-options.ts | 2 +- src/internal/utils/base64.ts | 2 +- src/internal/utils/path.ts | 2 +- src/internal/utils/values.ts | 2 +- src/lib/ChatCompletionStream.ts | 2 +- src/pagination.ts | 206 +---------- src/resource.ts | 13 +- src/resources/audio/audio.ts | 2 +- src/resources/audio/speech.ts | 4 +- src/resources/audio/transcriptions.ts | 8 +- src/resources/audio/translations.ts | 6 +- src/resources/batches.ts | 6 +- src/resources/beta/assistants.ts | 6 +- src/resources/beta/beta.ts | 2 +- src/resources/beta/realtime/realtime.ts | 2 +- src/resources/beta/realtime/sessions.ts | 4 +- .../beta/realtime/transcription-sessions.ts | 4 +- src/resources/beta/threads/messages.ts | 6 +- src/resources/beta/threads/runs/runs.ts | 8 +- src/resources/beta/threads/runs/steps.ts | 6 +- src/resources/beta/threads/threads.ts | 6 +- src/resources/chat/chat.ts | 2 +- src/resources/chat/completions/completions.ts | 8 +- src/resources/chat/completions/messages.ts | 4 +- src/resources/completions.ts | 6 +- src/resources/embeddings.ts | 4 +- src/resources/files.ts | 8 +- src/resources/fine-tuning/fine-tuning.ts | 2 +- src/resources/fine-tuning/jobs/checkpoints.ts | 4 +- src/resources/fine-tuning/jobs/jobs.ts | 6 +- src/resources/images.ts | 6 +- src/resources/models.ts | 6 +- src/resources/moderations.ts | 4 +- src/resources/responses/input-items.ts | 4 +- src/resources/responses/responses.ts | 8 +- src/resources/uploads/parts.ts | 6 +- src/resources/uploads/uploads.ts | 4 +- src/resources/vector-stores/file-batches.ts | 6 +- src/resources/vector-stores/files.ts | 6 +- src/resources/vector-stores/vector-stores.ts | 6 +- src/streaming.ts | 338 +----------------- src/uploads.ts | 4 +- tests/form.test.ts | 2 +- tests/index.test.ts | 2 +- tests/streaming.test.ts | 2 +- tests/uploads.test.ts | 4 +- 61 files changed, 969 insertions(+), 940 deletions(-) create mode 100644 src/core/README.md create mode 100644 src/core/api-promise.ts create mode 100644 src/core/error.ts create mode 100644 src/core/pagination.ts create mode 100644 src/core/resource.ts create mode 100644 src/core/streaming.ts create mode 100644 src/core/uploads.ts create mode 100644 src/internal/README.md diff --git a/MIGRATION.md b/MIGRATION.md index c375b825c..c5e26d3c2 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -321,49 +321,48 @@ The `headers` property on `APIError` objects is now an instance of the Web [Head ### Removed exports -#### `Response` - -```typescript -// Before -import { Response } from 'openai'; - -// After -// `Response` must now come from the builtin types -``` - #### Resource classes -If you were importing resource classes from the root package then you must now import them from the file they are defined in: +If you were importing resource classes from the root package then you must now import them from the file they are defined in. +This was never valid at the type level and only worked in CommonJS files. ```typescript // Before -import { Completions } from 'openai'; +const { Completions } = require('openai'); // After -import { Completions } from 'openai/resources/completions'; +const { OpenAI } = require('openai'); +OpenAI.Completions; // or import directly from openai/resources/completions ``` -#### `openai/core` +#### Refactor of `openai/core`, `error`, `pagination`, `resource`, `streaming` and `uploads` -The `openai/core` file was intended to be internal-only but it was publicly accessible, as such it has been refactored and split up into internal files. +Much of the `openai/core` file was intended to be internal-only but it was publicly accessible, as such it has been refactored and split up into internal and public files, with public-facing code moved to a new `core` folder and internal code moving to the private `internal` folder. -If you were relying on anything that was only exported from `openai/core` and is also not accessible anywhere else, please open an issue and we'll consider adding it to the public API. - -#### `APIClient` - -The `APIClient` base client class has been removed as it is no longer needed. If you were importing this class then you must now import the main client class: +At the same time, we moved some public-facing files which were previously at the top level into `core` to make the file structure cleaner and more clear: ```typescript // Before -import { APIClient } from 'openai/core'; +import 'openai/error'; +import 'openai/pagination'; +import 'openai/resource'; +import 'openai/streaming'; +import 'openai/uploads'; // After -import { OpenAI } from 'openai'; +import 'openai/core/error'; +import 'openai/core/pagination'; +import 'openai/core/resource'; +import 'openai/core/streaming'; +import 'openai/core/uploads'; ``` -#### Cleaned up `openai/uploads` exports +If you were relying on anything that was only exported from `openai/core` and is also not accessible anywhere else, please open an issue and we'll consider adding it to the public API. + +#### Cleaned up `uploads` exports -The following exports have been removed from `openai/uploads` as they were not intended to be a part of the public API: +As part of the `core` refactor, `openai/uploads` was moved to `openai/core/uploads` +and the following exports were removed, as they were not intended to be a part of the public API: - `fileFromPath` - `BlobPart` @@ -382,5 +381,17 @@ The following exports have been removed from `openai/uploads` as they were not i Note that `Uploadable` & `toFile` **are** still exported: ```typescript -import { type Uploadable, toFile } from 'openai/uploads'; +import { type Uploadable, toFile } from 'openai/core/uploads'; +``` + +#### `APIClient` + +The `APIClient` base client class has been removed as it is no longer needed. If you were importing this class then you must now import the main client class: + +```typescript +// Before +import { APIClient } from 'openai/core'; + +// After +import { OpenAI } from 'openai'; ``` diff --git a/src/api-promise.ts b/src/api-promise.ts index c9d9a9a9f..8c775ee69 100644 --- a/src/api-promise.ts +++ b/src/api-promise.ts @@ -1,101 +1,2 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { type OpenAI } from './client'; - -import { type PromiseOrValue } from './internal/types'; -import { - type APIResponseProps, - defaultParseResponse, - type WithRequestID, - addRequestID, -} from './internal/parse'; - -/** - * A subclass of `Promise` providing additional helper methods - * for interacting with the SDK. - */ -export class APIPromise extends Promise> { - private parsedPromise: Promise> | undefined; - #client: OpenAI; - - constructor( - client: OpenAI, - private responsePromise: Promise, - private parseResponse: ( - client: OpenAI, - props: APIResponseProps, - ) => PromiseOrValue> = defaultParseResponse, - ) { - super((resolve) => { - // this is maybe a bit weird but this has to be a no-op to not implicitly - // parse the response body; instead .then, .catch, .finally are overridden - // to parse the response - resolve(null as any); - }); - this.#client = client; - } - - _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { - return new APIPromise(this.#client, this.responsePromise, async (client, props) => - addRequestID(transform(await this.parseResponse(client, props), props), props.response), - ); - } - - /** - * Gets the raw `Response` instance instead of parsing the response - * data. - * - * If you want to parse the response body but still get the `Response` - * instance, you can use {@link withResponse()}. - * - * 👋 Getting the wrong TypeScript type for `Response`? - * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` - * to your `tsconfig.json`. - */ - asResponse(): Promise { - return this.responsePromise.then((p) => p.response); - } - - /** - * Gets the parsed response data, the raw `Response` instance and the ID of the request, - * returned via the X-Request-ID header which is useful for debugging requests and reporting - * issues to OpenAI. - * - * If you just want to get the raw `Response` instance without parsing it, - * you can use {@link asResponse()}. - * - * 👋 Getting the wrong TypeScript type for `Response`? - * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` - * to your `tsconfig.json`. - */ - async withResponse(): Promise<{ data: T; response: Response; request_id: string | null }> { - const [data, response] = await Promise.all([this.parse(), this.asResponse()]); - return { data, response, request_id: response.headers.get('x-request-id') }; - } - - private parse(): Promise> { - if (!this.parsedPromise) { - this.parsedPromise = this.responsePromise.then((data) => - this.parseResponse(this.#client, data), - ) as any as Promise>; - } - return this.parsedPromise; - } - - override then, TResult2 = never>( - onfulfilled?: ((value: WithRequestID) => TResult1 | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, - ): Promise { - return this.parse().then(onfulfilled, onrejected); - } - - override catch( - onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null, - ): Promise | TResult> { - return this.parse().catch(onrejected); - } - - override finally(onfinally?: (() => void) | undefined | null): Promise> { - return this.parse().finally(onfinally); - } -} +/** @deprecated Import from ./core/api-promise instead */ +export * from './core/api-promise'; diff --git a/src/client.ts b/src/client.ts index 71c6c1f18..41f128ebe 100644 --- a/src/client.ts +++ b/src/client.ts @@ -14,12 +14,12 @@ import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; import * as qs from './internal/qs'; import { VERSION } from './version'; -import * as Errors from './error'; -import * as Pagination from './pagination'; -import { AbstractPage, type CursorPageParams, CursorPageResponse, PageResponse } from './pagination'; -import * as Uploads from './uploads'; +import * as Errors from './core/error'; +import * as Pagination from './core/pagination'; +import { AbstractPage, type CursorPageParams, CursorPageResponse, PageResponse } from './core/pagination'; +import * as Uploads from './core/uploads'; import * as API from './resources/index'; -import { APIPromise } from './api-promise'; +import { APIPromise } from './core/api-promise'; import { type Fetch } from './internal/builtin-types'; import { isRunningInBrowser } from './internal/detect-platform'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; diff --git a/src/core/README.md b/src/core/README.md new file mode 100644 index 000000000..485fce861 --- /dev/null +++ b/src/core/README.md @@ -0,0 +1,3 @@ +# `core` + +This directory holds public modules implementing non-resource-specific SDK functionality. diff --git a/src/core/api-promise.ts b/src/core/api-promise.ts new file mode 100644 index 000000000..9e6c756c8 --- /dev/null +++ b/src/core/api-promise.ts @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { type OpenAI } from '../client'; + +import { type PromiseOrValue } from '../internal/types'; +import { + type APIResponseProps, + defaultParseResponse, + type WithRequestID, + addRequestID, +} from '../internal/parse'; + +/** + * A subclass of `Promise` providing additional helper methods + * for interacting with the SDK. + */ +export class APIPromise extends Promise> { + private parsedPromise: Promise> | undefined; + #client: OpenAI; + + constructor( + client: OpenAI, + private responsePromise: Promise, + private parseResponse: ( + client: OpenAI, + props: APIResponseProps, + ) => PromiseOrValue> = defaultParseResponse, + ) { + super((resolve) => { + // this is maybe a bit weird but this has to be a no-op to not implicitly + // parse the response body; instead .then, .catch, .finally are overridden + // to parse the response + resolve(null as any); + }); + this.#client = client; + } + + _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { + return new APIPromise(this.#client, this.responsePromise, async (client, props) => + addRequestID(transform(await this.parseResponse(client, props), props), props.response), + ); + } + + /** + * Gets the raw `Response` instance instead of parsing the response + * data. + * + * If you want to parse the response body but still get the `Response` + * instance, you can use {@link withResponse()}. + * + * 👋 Getting the wrong TypeScript type for `Response`? + * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` + * to your `tsconfig.json`. + */ + asResponse(): Promise { + return this.responsePromise.then((p) => p.response); + } + + /** + * Gets the parsed response data, the raw `Response` instance and the ID of the request, + * returned via the X-Request-ID header which is useful for debugging requests and reporting + * issues to OpenAI. + * + * If you just want to get the raw `Response` instance without parsing it, + * you can use {@link asResponse()}. + * + * 👋 Getting the wrong TypeScript type for `Response`? + * Try setting `"moduleResolution": "NodeNext"` or add `"lib": ["DOM"]` + * to your `tsconfig.json`. + */ + async withResponse(): Promise<{ data: T; response: Response; request_id: string | null }> { + const [data, response] = await Promise.all([this.parse(), this.asResponse()]); + return { data, response, request_id: response.headers.get('x-request-id') }; + } + + private parse(): Promise> { + if (!this.parsedPromise) { + this.parsedPromise = this.responsePromise.then((data) => + this.parseResponse(this.#client, data), + ) as any as Promise>; + } + return this.parsedPromise; + } + + override then, TResult2 = never>( + onfulfilled?: ((value: WithRequestID) => TResult1 | PromiseLike) | undefined | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null, + ): Promise { + return this.parse().then(onfulfilled, onrejected); + } + + override catch( + onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null, + ): Promise | TResult> { + return this.parse().catch(onrejected); + } + + override finally(onfinally?: (() => void) | undefined | null): Promise> { + return this.parse().finally(onfinally); + } +} diff --git a/src/core/error.ts b/src/core/error.ts new file mode 100644 index 000000000..c18cc0e33 --- /dev/null +++ b/src/core/error.ts @@ -0,0 +1,154 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { castToError } from '../internal/errors'; + +export class OpenAIError extends Error {} + +export class APIError< + TStatus extends number | undefined = number | undefined, + THeaders extends Headers | undefined = Headers | undefined, + TError extends Object | undefined = Object | undefined, +> extends OpenAIError { + /** HTTP status for the response that caused the error */ + readonly status: TStatus; + /** HTTP headers for the response that caused the error */ + readonly headers: THeaders; + /** JSON body of the response that caused the error */ + readonly error: TError; + + readonly code: string | null | undefined; + readonly param: string | null | undefined; + readonly type: string | undefined; + + readonly requestID: string | null | undefined; + + constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { + super(`${APIError.makeMessage(status, error, message)}`); + this.status = status; + this.headers = headers; + this.requestID = headers?.get('x-request-id'); + this.error = error; + + const data = error as Record; + this.code = data?.['code']; + this.param = data?.['param']; + this.type = data?.['type']; + } + + private static makeMessage(status: number | undefined, error: any, message: string | undefined) { + const msg = + error?.message ? + typeof error.message === 'string' ? + error.message + : JSON.stringify(error.message) + : error ? JSON.stringify(error) + : message; + + if (status && msg) { + return `${status} ${msg}`; + } + if (status) { + return `${status} status code (no body)`; + } + if (msg) { + return msg; + } + return '(no status code or body)'; + } + + static generate( + status: number | undefined, + errorResponse: Object | undefined, + message: string | undefined, + headers: Headers | undefined, + ): APIError { + if (!status || !headers) { + return new APIConnectionError({ message, cause: castToError(errorResponse) }); + } + + const error = (errorResponse as Record)?.['error']; + + if (status === 400) { + return new BadRequestError(status, error, message, headers); + } + + if (status === 401) { + return new AuthenticationError(status, error, message, headers); + } + + if (status === 403) { + return new PermissionDeniedError(status, error, message, headers); + } + + if (status === 404) { + return new NotFoundError(status, error, message, headers); + } + + if (status === 409) { + return new ConflictError(status, error, message, headers); + } + + if (status === 422) { + return new UnprocessableEntityError(status, error, message, headers); + } + + if (status === 429) { + return new RateLimitError(status, error, message, headers); + } + + if (status >= 500) { + return new InternalServerError(status, error, message, headers); + } + + return new APIError(status, error, message, headers); + } +} + +export class APIUserAbortError extends APIError { + constructor({ message }: { message?: string } = {}) { + super(undefined, undefined, message || 'Request was aborted.', undefined); + } +} + +export class APIConnectionError extends APIError { + constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) { + super(undefined, undefined, message || 'Connection error.', undefined); + // in some environments the 'cause' property is already declared + // @ts-ignore + if (cause) this.cause = cause; + } +} + +export class APIConnectionTimeoutError extends APIConnectionError { + constructor({ message }: { message?: string } = {}) { + super({ message: message ?? 'Request timed out.' }); + } +} + +export class BadRequestError extends APIError<400, Headers> {} + +export class AuthenticationError extends APIError<401, Headers> {} + +export class PermissionDeniedError extends APIError<403, Headers> {} + +export class NotFoundError extends APIError<404, Headers> {} + +export class ConflictError extends APIError<409, Headers> {} + +export class UnprocessableEntityError extends APIError<422, Headers> {} + +export class RateLimitError extends APIError<429, Headers> {} + +export class InternalServerError extends APIError {} + +export class LengthFinishReasonError extends OpenAIError { + constructor() { + super(`Could not parse response content as the length limit was reached`); + } +} + +export class ContentFilterFinishReasonError extends OpenAIError { + constructor() { + super(`Could not parse response content as the request was rejected by the content filter`); + } +} diff --git a/src/core/pagination.ts b/src/core/pagination.ts new file mode 100644 index 000000000..6120ba4e8 --- /dev/null +++ b/src/core/pagination.ts @@ -0,0 +1,204 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { OpenAIError } from './error'; +import { FinalRequestOptions } from '../internal/request-options'; +import { defaultParseResponse, WithRequestID } from '../internal/parse'; +import { APIPromise } from './api-promise'; +import { type OpenAI } from '../client'; +import { type APIResponseProps } from '../internal/parse'; +import { maybeObj } from '../internal/utils/values'; + +export type PageRequestOptions = Pick; + +export abstract class AbstractPage implements AsyncIterable { + #client: OpenAI; + protected options: FinalRequestOptions; + + protected response: Response; + protected body: unknown; + + constructor(client: OpenAI, response: Response, body: unknown, options: FinalRequestOptions) { + this.#client = client; + this.options = options; + this.response = response; + this.body = body; + } + + abstract nextPageRequestOptions(): PageRequestOptions | null; + + abstract getPaginatedItems(): Item[]; + + hasNextPage(): boolean { + const items = this.getPaginatedItems(); + if (!items.length) return false; + return this.nextPageRequestOptions() != null; + } + + async getNextPage(): Promise { + const nextOptions = this.nextPageRequestOptions(); + if (!nextOptions) { + throw new OpenAIError( + 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.', + ); + } + + return await this.#client.requestAPIList(this.constructor as any, nextOptions); + } + + async *iterPages(): AsyncGenerator { + let page: this = this; + yield page; + while (page.hasNextPage()) { + page = await page.getNextPage(); + yield page; + } + } + + async *[Symbol.asyncIterator](): AsyncGenerator { + for await (const page of this.iterPages()) { + for (const item of page.getPaginatedItems()) { + yield item; + } + } + } +} + +/** + * This subclass of Promise will resolve to an instantiated Page once the request completes. + * + * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: + * + * for await (const item of client.items.list()) { + * console.log(item) + * } + */ +export class PagePromise< + PageClass extends AbstractPage, + Item = ReturnType[number], + > + extends APIPromise + implements AsyncIterable +{ + constructor( + client: OpenAI, + request: Promise, + Page: new (...args: ConstructorParameters) => PageClass, + ) { + super( + client, + request, + async (client, props) => + new Page( + client, + props.response, + await defaultParseResponse(client, props), + props.options, + ) as WithRequestID, + ); + } + + /** + * Allow auto-paginating iteration on an unawaited list call, eg: + * + * for await (const item of client.items.list()) { + * console.log(item) + * } + */ + async *[Symbol.asyncIterator]() { + const page = await this; + for await (const item of page) { + yield item; + } + } +} + +export interface PageResponse { + data: Array; + + object: string; +} + +/** + * Note: no pagination actually occurs yet, this is for forwards-compatibility. + */ +export class Page extends AbstractPage implements PageResponse { + data: Array; + + object: string; + + constructor(client: OpenAI, response: Response, body: PageResponse, options: FinalRequestOptions) { + super(client, response, body, options); + + this.data = body.data || []; + this.object = body.object; + } + + getPaginatedItems(): Item[] { + return this.data ?? []; + } + + nextPageRequestOptions(): PageRequestOptions | null { + return null; + } +} + +export interface CursorPageResponse { + data: Array; + + has_more: boolean; +} + +export interface CursorPageParams { + after?: string; + + limit?: number; +} + +export class CursorPage + extends AbstractPage + implements CursorPageResponse +{ + data: Array; + + has_more: boolean; + + constructor( + client: OpenAI, + response: Response, + body: CursorPageResponse, + options: FinalRequestOptions, + ) { + super(client, response, body, options); + + this.data = body.data || []; + this.has_more = body.has_more || false; + } + + getPaginatedItems(): Item[] { + return this.data ?? []; + } + + override hasNextPage(): boolean { + if (this.has_more === false) { + return false; + } + + return super.hasNextPage(); + } + + nextPageRequestOptions(): PageRequestOptions | null { + const data = this.getPaginatedItems(); + const id = data[data.length - 1]?.id; + if (!id) { + return null; + } + + return { + ...this.options, + query: { + ...maybeObj(this.options.query), + after: id, + }, + }; + } +} diff --git a/src/core/resource.ts b/src/core/resource.ts new file mode 100644 index 000000000..8ba97f70a --- /dev/null +++ b/src/core/resource.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import type { OpenAI } from '../client'; + +export class APIResource { + protected _client: OpenAI; + + constructor(client: OpenAI) { + this._client = client; + } +} diff --git a/src/core/streaming.ts b/src/core/streaming.ts new file mode 100644 index 000000000..e47c088d2 --- /dev/null +++ b/src/core/streaming.ts @@ -0,0 +1,336 @@ +import { OpenAIError } from './error'; +import { type ReadableStream } from '../internal/shim-types'; +import { makeReadableStream } from '../internal/shims'; +import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line'; +import { ReadableStreamToAsyncIterable } from '../internal/shims'; +import { isAbortError } from '../internal/errors'; + +import { APIError } from './error'; + +type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; + +export type ServerSentEvent = { + event: string | null; + data: string; + raw: string[]; +}; + +export class Stream implements AsyncIterable { + controller: AbortController; + + constructor( + private iterator: () => AsyncIterator, + controller: AbortController, + ) { + this.controller = controller; + } + + static fromSSEResponse(response: Response, controller: AbortController): Stream { + let consumed = false; + + async function* iterator(): AsyncIterator { + if (consumed) { + throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); + } + consumed = true; + let done = false; + try { + for await (const sse of _iterSSEMessages(response, controller)) { + if (done) continue; + + if (sse.data.startsWith('[DONE]')) { + done = true; + continue; + } + + if (sse.event === null) { + let data; + + try { + data = JSON.parse(sse.data); + } catch (e) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e; + } + + if (data && data.error) { + throw new APIError(undefined, data.error, undefined, response.headers); + } + + yield data; + } else { + let data; + try { + data = JSON.parse(sse.data); + } catch (e) { + console.error(`Could not parse message into JSON:`, sse.data); + console.error(`From chunk:`, sse.raw); + throw e; + } + // TODO: Is this where the error should be thrown? + if (sse.event == 'error') { + throw new APIError(undefined, data.error, data.message, undefined); + } + yield { event: sse.event, data: data } as any; + } + } + done = true; + } catch (e) { + // If the user calls `stream.controller.abort()`, we should exit without throwing. + if (isAbortError(e)) return; + throw e; + } finally { + // If the user `break`s, abort the ongoing request. + if (!done) controller.abort(); + } + } + + return new Stream(iterator, controller); + } + + /** + * Generates a Stream from a newline-separated ReadableStream + * where each item is a JSON value. + */ + static fromReadableStream(readableStream: ReadableStream, controller: AbortController): Stream { + let consumed = false; + + async function* iterLines(): AsyncGenerator { + const lineDecoder = new LineDecoder(); + + const iter = ReadableStreamToAsyncIterable(readableStream); + for await (const chunk of iter) { + for (const line of lineDecoder.decode(chunk)) { + yield line; + } + } + + for (const line of lineDecoder.flush()) { + yield line; + } + } + + async function* iterator(): AsyncIterator { + if (consumed) { + throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); + } + consumed = true; + let done = false; + try { + for await (const line of iterLines()) { + if (done) continue; + if (line) yield JSON.parse(line); + } + done = true; + } catch (e) { + // If the user calls `stream.controller.abort()`, we should exit without throwing. + if (isAbortError(e)) return; + throw e; + } finally { + // If the user `break`s, abort the ongoing request. + if (!done) controller.abort(); + } + } + + return new Stream(iterator, controller); + } + + [Symbol.asyncIterator](): AsyncIterator { + return this.iterator(); + } + + /** + * Splits the stream into two streams which can be + * independently read from at different speeds. + */ + tee(): [Stream, Stream] { + const left: Array>> = []; + const right: Array>> = []; + const iterator = this.iterator(); + + const teeIterator = (queue: Array>>): AsyncIterator => { + return { + next: () => { + if (queue.length === 0) { + const result = iterator.next(); + left.push(result); + right.push(result); + } + return queue.shift()!; + }, + }; + }; + + return [ + new Stream(() => teeIterator(left), this.controller), + new Stream(() => teeIterator(right), this.controller), + ]; + } + + /** + * Converts this stream to a newline-separated ReadableStream of + * JSON stringified values in the stream + * which can be turned back into a Stream with `Stream.fromReadableStream()`. + */ + toReadableStream(): ReadableStream { + const self = this; + let iter: AsyncIterator; + const encoder: { + encode(str: string): Uint8Array; + } = new (globalThis as any).TextEncoder(); + + return makeReadableStream({ + async start() { + iter = self[Symbol.asyncIterator](); + }, + async pull(ctrl: any) { + try { + const { value, done } = await iter.next(); + if (done) return ctrl.close(); + + const bytes = encoder.encode(JSON.stringify(value) + '\n'); + + ctrl.enqueue(bytes); + } catch (err) { + ctrl.error(err); + } + }, + async cancel() { + await iter.return?.(); + }, + }); + } +} + +export async function* _iterSSEMessages( + response: Response, + controller: AbortController, +): AsyncGenerator { + if (!response.body) { + controller.abort(); + if ( + typeof (globalThis as any).navigator !== 'undefined' && + (globalThis as any).navigator.product === 'ReactNative' + ) { + throw new OpenAIError( + `The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`, + ); + } + throw new OpenAIError(`Attempted to iterate over a response with no body`); + } + + const sseDecoder = new SSEDecoder(); + const lineDecoder = new LineDecoder(); + + const iter = ReadableStreamToAsyncIterable(response.body); + for await (const sseChunk of iterSSEChunks(iter)) { + for (const line of lineDecoder.decode(sseChunk)) { + const sse = sseDecoder.decode(line); + if (sse) yield sse; + } + } + + for (const line of lineDecoder.flush()) { + const sse = sseDecoder.decode(line); + if (sse) yield sse; + } +} + +/** + * Given an async iterable iterator, iterates over it and yields full + * SSE chunks, i.e. yields when a double new-line is encountered. + */ +async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGenerator { + let data = new Uint8Array(); + + for await (const chunk of iterator) { + if (chunk == null) { + continue; + } + + const binaryChunk = + chunk instanceof ArrayBuffer ? new Uint8Array(chunk) + : typeof chunk === 'string' ? new (globalThis as any).TextEncoder().encode(chunk) + : chunk; + + let newData = new Uint8Array(data.length + binaryChunk.length); + newData.set(data); + newData.set(binaryChunk, data.length); + data = newData; + + let patternIndex; + while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { + yield data.slice(0, patternIndex); + data = data.slice(patternIndex); + } + } + + if (data.length > 0) { + yield data; + } +} + +class SSEDecoder { + private data: string[]; + private event: string | null; + private chunks: string[]; + + constructor() { + this.event = null; + this.data = []; + this.chunks = []; + } + + decode(line: string) { + if (line.endsWith('\r')) { + line = line.substring(0, line.length - 1); + } + + if (!line) { + // empty line and we didn't previously encounter any messages + if (!this.event && !this.data.length) return null; + + const sse: ServerSentEvent = { + event: this.event, + data: this.data.join('\n'), + raw: this.chunks, + }; + + this.event = null; + this.data = []; + this.chunks = []; + + return sse; + } + + this.chunks.push(line); + + if (line.startsWith(':')) { + return null; + } + + let [fieldname, _, value] = partition(line, ':'); + + if (value.startsWith(' ')) { + value = value.substring(1); + } + + if (fieldname === 'event') { + this.event = value; + } else if (fieldname === 'data') { + this.data.push(value); + } + + return null; + } +} + +function partition(str: string, delimiter: string): [string, string, string] { + const index = str.indexOf(delimiter); + if (index !== -1) { + return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; + } + + return [str, '', '']; +} diff --git a/src/core/uploads.ts b/src/core/uploads.ts new file mode 100644 index 000000000..2882ca6d1 --- /dev/null +++ b/src/core/uploads.ts @@ -0,0 +1,2 @@ +export { type Uploadable } from '../internal/uploads'; +export { toFile, type ToFileInput } from '../internal/to-file'; diff --git a/src/error.ts b/src/error.ts index 74251d51f..fc55f46c0 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1,154 +1,2 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { castToError } from './internal/errors'; - -export class OpenAIError extends Error {} - -export class APIError< - TStatus extends number | undefined = number | undefined, - THeaders extends Headers | undefined = Headers | undefined, - TError extends Object | undefined = Object | undefined, -> extends OpenAIError { - /** HTTP status for the response that caused the error */ - readonly status: TStatus; - /** HTTP headers for the response that caused the error */ - readonly headers: THeaders; - /** JSON body of the response that caused the error */ - readonly error: TError; - - readonly code: string | null | undefined; - readonly param: string | null | undefined; - readonly type: string | undefined; - - readonly requestID: string | null | undefined; - - constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { - super(`${APIError.makeMessage(status, error, message)}`); - this.status = status; - this.headers = headers; - this.requestID = headers?.get('x-request-id'); - this.error = error; - - const data = error as Record; - this.code = data?.['code']; - this.param = data?.['param']; - this.type = data?.['type']; - } - - private static makeMessage(status: number | undefined, error: any, message: string | undefined) { - const msg = - error?.message ? - typeof error.message === 'string' ? - error.message - : JSON.stringify(error.message) - : error ? JSON.stringify(error) - : message; - - if (status && msg) { - return `${status} ${msg}`; - } - if (status) { - return `${status} status code (no body)`; - } - if (msg) { - return msg; - } - return '(no status code or body)'; - } - - static generate( - status: number | undefined, - errorResponse: Object | undefined, - message: string | undefined, - headers: Headers | undefined, - ): APIError { - if (!status || !headers) { - return new APIConnectionError({ message, cause: castToError(errorResponse) }); - } - - const error = (errorResponse as Record)?.['error']; - - if (status === 400) { - return new BadRequestError(status, error, message, headers); - } - - if (status === 401) { - return new AuthenticationError(status, error, message, headers); - } - - if (status === 403) { - return new PermissionDeniedError(status, error, message, headers); - } - - if (status === 404) { - return new NotFoundError(status, error, message, headers); - } - - if (status === 409) { - return new ConflictError(status, error, message, headers); - } - - if (status === 422) { - return new UnprocessableEntityError(status, error, message, headers); - } - - if (status === 429) { - return new RateLimitError(status, error, message, headers); - } - - if (status >= 500) { - return new InternalServerError(status, error, message, headers); - } - - return new APIError(status, error, message, headers); - } -} - -export class APIUserAbortError extends APIError { - constructor({ message }: { message?: string } = {}) { - super(undefined, undefined, message || 'Request was aborted.', undefined); - } -} - -export class APIConnectionError extends APIError { - constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) { - super(undefined, undefined, message || 'Connection error.', undefined); - // in some environments the 'cause' property is already declared - // @ts-ignore - if (cause) this.cause = cause; - } -} - -export class APIConnectionTimeoutError extends APIConnectionError { - constructor({ message }: { message?: string } = {}) { - super({ message: message ?? 'Request timed out.' }); - } -} - -export class BadRequestError extends APIError<400, Headers> {} - -export class AuthenticationError extends APIError<401, Headers> {} - -export class PermissionDeniedError extends APIError<403, Headers> {} - -export class NotFoundError extends APIError<404, Headers> {} - -export class ConflictError extends APIError<409, Headers> {} - -export class UnprocessableEntityError extends APIError<422, Headers> {} - -export class RateLimitError extends APIError<429, Headers> {} - -export class InternalServerError extends APIError {} - -export class LengthFinishReasonError extends OpenAIError { - constructor() { - super(`Could not parse response content as the length limit was reached`); - } -} - -export class ContentFilterFinishReasonError extends OpenAIError { - constructor() { - super(`Could not parse response content as the request was rejected by the content filter`); - } -} +/** @deprecated Import from ./core/error instead */ +export * from './core/error'; diff --git a/src/index.ts b/src/index.ts index 9fb1eeb03..8f1e39b3c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,10 +2,10 @@ export { OpenAI as default } from './client'; -export { type Uploadable, toFile } from './uploads'; -export { APIPromise } from './api-promise'; +export { type Uploadable, toFile } from './core/uploads'; +export { APIPromise } from './core/api-promise'; export { OpenAI, type ClientOptions } from './client'; -export { PagePromise } from './pagination'; +export { PagePromise } from './core/pagination'; export { OpenAIError, APIError, @@ -20,6 +20,6 @@ export { InternalServerError, PermissionDeniedError, UnprocessableEntityError, -} from './error'; +} from './core/error'; -export { AzureOpenAI } from './azure'; +export { AzureOpenAI } from './azure'; \ No newline at end of file diff --git a/src/internal/README.md b/src/internal/README.md new file mode 100644 index 000000000..3ef5a25ba --- /dev/null +++ b/src/internal/README.md @@ -0,0 +1,3 @@ +# `internal` + +The modules in this directory are not importable outside this package and will change between releases. diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 335ad7e30..1af727b34 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -1,4 +1,4 @@ -import { OpenAIError } from '../../error'; +import { OpenAIError } from '../../core/error'; export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; diff --git a/src/internal/parse.ts b/src/internal/parse.ts index 14147338d..5355c7728 100644 --- a/src/internal/parse.ts +++ b/src/internal/parse.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { FinalRequestOptions } from './request-options'; -import { Stream } from '../streaming'; +import { Stream } from '../core/streaming'; import { type OpenAI } from '../client'; import { formatRequestDetails, loggerFor } from './utils/log'; import type { AbstractPage } from '../pagination'; diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 1c7a81e0b..78daa4199 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -3,7 +3,7 @@ import { NullableHeaders } from './headers'; import type { BodyInit } from './builtin-types'; -import { Stream } from '../streaming'; +import { Stream } from '../core/streaming'; import type { HTTPMethod, MergedRequestInit } from './types'; import { type HeadersLike } from './headers'; diff --git a/src/internal/utils/base64.ts b/src/internal/utils/base64.ts index 978bacde2..84854e241 100644 --- a/src/internal/utils/base64.ts +++ b/src/internal/utils/base64.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { OpenAIError } from '../../error'; +import { OpenAIError } from '../../core/error'; export const toBase64 = (data: string | Uint8Array | null | undefined): string => { if (!data) return ''; diff --git a/src/internal/utils/path.ts b/src/internal/utils/path.ts index b40291903..0dceb10f1 100644 --- a/src/internal/utils/path.ts +++ b/src/internal/utils/path.ts @@ -1,4 +1,4 @@ -import { OpenAIError } from '../../error'; +import { OpenAIError } from '../../core/error'; /** * Percent-encode everything that isn't safe to have in a path without encoding safe chars. diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts index 08255c4b1..aee03b055 100644 --- a/src/internal/utils/values.ts +++ b/src/internal/utils/values.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { OpenAIError } from '../../error'; +import { OpenAIError } from '../../core/error'; // https://url.spec.whatwg.org/#url-scheme-string const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index ce64e1aad..35f2a95d6 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -12,7 +12,7 @@ import { type ChatCompletionCreateParamsStreaming, type ChatCompletionCreateParamsBase, type ChatCompletionRole, -} from '../resources/chat/completions'; +} from '../resources/chat/completions/completions'; import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, diff --git a/src/pagination.ts b/src/pagination.ts index fdcc7e131..90bf015e1 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -1,204 +1,2 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { OpenAIError } from './error'; -import { FinalRequestOptions } from './internal/request-options'; -import { defaultParseResponse, WithRequestID } from './internal/parse'; -import { APIPromise } from './api-promise'; -import { type OpenAI } from './client'; -import { type APIResponseProps } from './internal/parse'; -import { maybeObj } from './internal/utils/values'; - -export type PageRequestOptions = Pick; - -export abstract class AbstractPage implements AsyncIterable { - #client: OpenAI; - protected options: FinalRequestOptions; - - protected response: Response; - protected body: unknown; - - constructor(client: OpenAI, response: Response, body: unknown, options: FinalRequestOptions) { - this.#client = client; - this.options = options; - this.response = response; - this.body = body; - } - - abstract nextPageRequestOptions(): PageRequestOptions | null; - - abstract getPaginatedItems(): Item[]; - - hasNextPage(): boolean { - const items = this.getPaginatedItems(); - if (!items.length) return false; - return this.nextPageRequestOptions() != null; - } - - async getNextPage(): Promise { - const nextOptions = this.nextPageRequestOptions(); - if (!nextOptions) { - throw new OpenAIError( - 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.', - ); - } - - return await this.#client.requestAPIList(this.constructor as any, nextOptions); - } - - async *iterPages(): AsyncGenerator { - let page: this = this; - yield page; - while (page.hasNextPage()) { - page = await page.getNextPage(); - yield page; - } - } - - async *[Symbol.asyncIterator](): AsyncGenerator { - for await (const page of this.iterPages()) { - for (const item of page.getPaginatedItems()) { - yield item; - } - } - } -} - -/** - * This subclass of Promise will resolve to an instantiated Page once the request completes. - * - * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg: - * - * for await (const item of client.items.list()) { - * console.log(item) - * } - */ -export class PagePromise< - PageClass extends AbstractPage, - Item = ReturnType[number], - > - extends APIPromise - implements AsyncIterable -{ - constructor( - client: OpenAI, - request: Promise, - Page: new (...args: ConstructorParameters) => PageClass, - ) { - super( - client, - request, - async (client, props) => - new Page( - client, - props.response, - await defaultParseResponse(client, props), - props.options, - ) as WithRequestID, - ); - } - - /** - * Allow auto-paginating iteration on an unawaited list call, eg: - * - * for await (const item of client.items.list()) { - * console.log(item) - * } - */ - async *[Symbol.asyncIterator]() { - const page = await this; - for await (const item of page) { - yield item; - } - } -} - -export interface PageResponse { - data: Array; - - object: string; -} - -/** - * Note: no pagination actually occurs yet, this is for forwards-compatibility. - */ -export class Page extends AbstractPage implements PageResponse { - data: Array; - - object: string; - - constructor(client: OpenAI, response: Response, body: PageResponse, options: FinalRequestOptions) { - super(client, response, body, options); - - this.data = body.data || []; - this.object = body.object; - } - - getPaginatedItems(): Item[] { - return this.data ?? []; - } - - nextPageRequestOptions(): PageRequestOptions | null { - return null; - } -} - -export interface CursorPageResponse { - data: Array; - - has_more: boolean; -} - -export interface CursorPageParams { - after?: string; - - limit?: number; -} - -export class CursorPage - extends AbstractPage - implements CursorPageResponse -{ - data: Array; - - has_more: boolean; - - constructor( - client: OpenAI, - response: Response, - body: CursorPageResponse, - options: FinalRequestOptions, - ) { - super(client, response, body, options); - - this.data = body.data || []; - this.has_more = body.has_more || false; - } - - getPaginatedItems(): Item[] { - return this.data ?? []; - } - - override hasNextPage(): boolean { - if (this.has_more === false) { - return false; - } - - return super.hasNextPage(); - } - - nextPageRequestOptions(): PageRequestOptions | null { - const data = this.getPaginatedItems(); - const id = data[data.length - 1]?.id; - if (!id) { - return null; - } - - return { - ...this.options, - query: { - ...maybeObj(this.options.query), - after: id, - }, - }; - } -} +/** @deprecated Import from ./core/pagination instead */ +export * from './core/pagination'; diff --git a/src/resource.ts b/src/resource.ts index ea299e176..363e3516b 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -1,11 +1,2 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import type { OpenAI } from './client'; - -export class APIResource { - protected _client: OpenAI; - - constructor(client: OpenAI) { - this._client = client; - } -} +/** @deprecated Import from ./core/resource instead */ +export * from './core/resource'; diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index 071fe5929..081db7d99 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as SpeechAPI from './speech'; import { Speech, SpeechCreateParams, SpeechModel } from './speech'; import * as TranscriptionsAPI from './transcriptions'; diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index efd722887..7a795f0e6 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import { APIPromise } from '../../api-promise'; +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index b6ff12aa6..675aa9409 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as TranscriptionsAPI from './transcriptions'; import * as AudioAPI from './audio'; -import { APIPromise } from '../../api-promise'; -import { Stream } from '../../streaming'; -import { type Uploadable } from '../../uploads'; +import { APIPromise } from '../../core/api-promise'; +import { Stream } from '../../core/streaming'; +import { type Uploadable } from '../../core/uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 55155d592..5f07a1ddb 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as AudioAPI from './audio'; import * as TranscriptionsAPI from './transcriptions'; -import { APIPromise } from '../../api-promise'; -import { type Uploadable } from '../../uploads'; +import { APIPromise } from '../../core/api-promise'; +import { type Uploadable } from '../../core/uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; diff --git a/src/resources/batches.ts b/src/resources/batches.ts index 36477851a..b52a27226 100644 --- a/src/resources/batches.ts +++ b/src/resources/batches.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; +import { APIResource } from '../core/resource'; import * as BatchesAPI from './batches'; import * as Shared from './shared'; -import { APIPromise } from '../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; +import { APIPromise } from '../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 3753ee9c8..217782aa7 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; import * as MessagesAPI from './threads/messages'; import * as ThreadsAPI from './threads/threads'; import * as RunsAPI from './threads/runs/runs'; import * as StepsAPI from './threads/runs/steps'; -import { APIPromise } from '../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 98d11a66c..1f16f7264 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as AssistantsAPI from './assistants'; import * as ChatAPI from './chat/chat'; import { diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 224d94f37..b0fa02919 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as RealtimeAPI from './realtime'; import * as Shared from '../../shared'; import * as SessionsAPI from './sessions'; diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index e1c439c1c..3e0f939ef 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { APIPromise } from '../../../api-promise'; +import { APIResource } from '../../../core/resource'; +import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index f31ee9210..c530c4091 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { APIPromise } from '../../../api-promise'; +import { APIResource } from '../../../core/resource'; +import { APIPromise } from '../../../core/api-promise'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 3bba148b9..a4a7377c2 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 401b3ec59..0d786d759 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; +import { APIResource } from '../../../../core/resource'; import * as RunsAPI from './runs'; import * as Shared from '../../../shared'; import * as AssistantsAPI from '../../assistants'; @@ -31,9 +31,9 @@ import { ToolCallDeltaObject, ToolCallsStepDetails, } from './steps'; -import { APIPromise } from '../../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; -import { Stream } from '../../../../streaming'; +import { APIPromise } from '../../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../../core/pagination'; +import { Stream } from '../../../../core/streaming'; import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; import { AssistantStream, RunCreateParamsBaseStream } from '../../../../lib/AssistantStream'; diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 918cdde37..68be569e5 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; +import { APIResource } from '../../../../core/resource'; import * as StepsAPI from './steps'; import * as Shared from '../../../shared'; -import { APIPromise } from '../../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../../pagination'; +import { APIPromise } from '../../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../../core/pagination'; import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; import { path } from '../../../../internal/utils/path'; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 22ccd7f02..b06ac458f 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as ThreadsAPI from './threads'; import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; @@ -65,8 +65,8 @@ import { Runs, RunsPage, } from './runs/runs'; -import { APIPromise } from '../../../api-promise'; -import { Stream } from '../../../streaming'; +import { APIPromise } from '../../../core/api-promise'; +import { Stream } from '../../../core/streaming'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; diff --git a/src/resources/chat/chat.ts b/src/resources/chat/chat.ts index 19ddd9c2e..5bf388470 100644 --- a/src/resources/chat/chat.ts +++ b/src/resources/chat/chat.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; import * as CompletionsAPI from './completions/completions'; import { diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 0aa8d923d..191c6250c 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as CompletionsCompletionsAPI from './completions'; import * as CompletionsAPI from '../../completions'; import * as Shared from '../../shared'; import * as MessagesAPI from './messages'; import { MessageListParams, Messages } from './messages'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; -import { Stream } from '../../../streaming'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { Stream } from '../../../core/streaming'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index 82478a8ab..0ea05d2f7 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as CompletionsAPI from './completions'; import { ChatCompletionStoreMessagesPage } from './completions'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 742f682fe..4777a359d 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; +import { APIResource } from '../core/resource'; import * as CompletionsAPI from './completions'; import * as CompletionsCompletionsAPI from './chat/completions/completions'; -import { APIPromise } from '../api-promise'; -import { Stream } from '../streaming'; +import { APIPromise } from '../core/api-promise'; +import { Stream } from '../core/streaming'; import { RequestOptions } from '../internal/request-options'; export class Completions extends APIResource { diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index dcd542a1a..b9c48efad 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import { APIPromise } from '../api-promise'; +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class Embeddings extends APIResource { diff --git a/src/resources/files.ts b/src/resources/files.ts index 3183b87f8..e0b66b77a 100644 --- a/src/resources/files.ts +++ b/src/resources/files.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import { APIPromise } from '../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../pagination'; -import { type Uploadable } from '../uploads'; +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination'; +import { type Uploadable } from '../core/uploads'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { sleep } from '../internal/utils/sleep'; diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index 593a4a89e..be9eb0f89 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as JobsAPI from './jobs/jobs'; import { FineTuningJob, diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index 134715cec..1b014aa75 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { APIResource } from '../../../core/resource'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 4531ec138..79cfe6156 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; +import { APIResource } from '../../../core/resource'; import * as Shared from '../../shared'; import * as CheckpointsAPI from './checkpoints'; import { @@ -9,8 +9,8 @@ import { FineTuningJobCheckpoint, FineTuningJobCheckpointsPage, } from './checkpoints'; -import { APIPromise } from '../../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../../pagination'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; diff --git a/src/resources/images.ts b/src/resources/images.ts index d8eb5be4c..491255563 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import { APIPromise } from '../api-promise'; -import { type Uploadable } from '../uploads'; +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { type Uploadable } from '../core/uploads'; import { RequestOptions } from '../internal/request-options'; import { multipartFormRequestOptions } from '../internal/uploads'; diff --git a/src/resources/models.ts b/src/resources/models.ts index 69ba58279..25a730ebf 100644 --- a/src/resources/models.ts +++ b/src/resources/models.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import { APIPromise } from '../api-promise'; -import { Page, PagePromise } from '../pagination'; +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { Page, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; diff --git a/src/resources/moderations.ts b/src/resources/moderations.ts index 478850e5e..2792e0f30 100644 --- a/src/resources/moderations.ts +++ b/src/resources/moderations.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import { APIPromise } from '../api-promise'; +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; import { RequestOptions } from '../internal/request-options'; export class Moderations extends APIResource { diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 6bbef6366..b49f30b81 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as ResponsesAPI from './responses'; import { ResponseItemsPage } from './responses'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 8fb697c93..7077aeb9a 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as ResponsesAPI from './responses'; import * as Shared from '../shared'; import * as InputItemsAPI from './input-items'; import { InputItemListParams, InputItems, ResponseItemList } from './input-items'; -import { APIPromise } from '../../api-promise'; -import { CursorPage } from '../../pagination'; -import { Stream } from '../../streaming'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage } from '../../core/pagination'; +import { Stream } from '../../core/streaming'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; diff --git a/src/resources/uploads/parts.ts b/src/resources/uploads/parts.ts index 18568c3e4..4e3509f9f 100644 --- a/src/resources/uploads/parts.ts +++ b/src/resources/uploads/parts.ts @@ -1,8 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import { APIPromise } from '../../api-promise'; -import { type Uploadable } from '../../uploads'; +import { APIResource } from '../../core/resource'; +import { APIPromise } from '../../core/api-promise'; +import { type Uploadable } from '../../core/uploads'; import { RequestOptions } from '../../internal/request-options'; import { multipartFormRequestOptions } from '../../internal/uploads'; import { path } from '../../internal/utils/path'; diff --git a/src/resources/uploads/uploads.ts b/src/resources/uploads/uploads.ts index 96ed91f6a..e4ac1752a 100644 --- a/src/resources/uploads/uploads.ts +++ b/src/resources/uploads/uploads.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as FilesAPI from '../files'; import * as PartsAPI from './parts'; import { PartCreateParams, Parts, UploadPart } from './parts'; -import { APIPromise } from '../../api-promise'; +import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; diff --git a/src/resources/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts index fb155a3bb..5b5fddeb7 100644 --- a/src/resources/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as FilesAPI from './files'; import { VectorStoreFilesPage } from './files'; import * as VectorStoresAPI from './vector-stores'; -import { APIPromise } from '../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise } from '../../pagination'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { sleep } from '../../internal/utils/sleep'; diff --git a/src/resources/vector-stores/files.ts b/src/resources/vector-stores/files.ts index 3d3928ac6..897f0dfd1 100644 --- a/src/resources/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as VectorStoresAPI from './vector-stores'; -import { APIPromise } from '../../api-promise'; -import { CursorPage, type CursorPageParams, PagePromise, Page } from '../../pagination'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise, Page } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { sleep } from '../../internal/utils'; diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index ef942cded..de08d0494 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; +import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; import * as FileBatchesAPI from './file-batches'; import { @@ -26,8 +26,8 @@ import { VectorStoreFileDeleted, VectorStoreFilesPage, } from './files'; -import { APIPromise } from '../../api-promise'; -import { CursorPage, type CursorPageParams, Page, PagePromise } from '../../pagination'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, Page, PagePromise } from '../../core/pagination'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; diff --git a/src/streaming.ts b/src/streaming.ts index 5b9c19cfa..9e6da1063 100644 --- a/src/streaming.ts +++ b/src/streaming.ts @@ -1,336 +1,2 @@ -import { OpenAIError } from './error'; -import { type ReadableStream } from './internal/shim-types'; -import { makeReadableStream } from './internal/shims'; -import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line'; -import { ReadableStreamToAsyncIterable } from './internal/shims'; -import { isAbortError } from './internal/errors'; - -import { APIError } from './error'; - -type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; - -export type ServerSentEvent = { - event: string | null; - data: string; - raw: string[]; -}; - -export class Stream implements AsyncIterable { - controller: AbortController; - - constructor( - private iterator: () => AsyncIterator, - controller: AbortController, - ) { - this.controller = controller; - } - - static fromSSEResponse(response: Response, controller: AbortController): Stream { - let consumed = false; - - async function* iterator(): AsyncIterator { - if (consumed) { - throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); - } - consumed = true; - let done = false; - try { - for await (const sse of _iterSSEMessages(response, controller)) { - if (done) continue; - - if (sse.data.startsWith('[DONE]')) { - done = true; - continue; - } - - if (sse.event === null) { - let data; - - try { - data = JSON.parse(sse.data); - } catch (e) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e; - } - - if (data && data.error) { - throw new APIError(undefined, data.error, undefined, response.headers); - } - - yield data; - } else { - let data; - try { - data = JSON.parse(sse.data); - } catch (e) { - console.error(`Could not parse message into JSON:`, sse.data); - console.error(`From chunk:`, sse.raw); - throw e; - } - // TODO: Is this where the error should be thrown? - if (sse.event == 'error') { - throw new APIError(undefined, data.error, data.message, undefined); - } - yield { event: sse.event, data: data } as any; - } - } - done = true; - } catch (e) { - // If the user calls `stream.controller.abort()`, we should exit without throwing. - if (isAbortError(e)) return; - throw e; - } finally { - // If the user `break`s, abort the ongoing request. - if (!done) controller.abort(); - } - } - - return new Stream(iterator, controller); - } - - /** - * Generates a Stream from a newline-separated ReadableStream - * where each item is a JSON value. - */ - static fromReadableStream(readableStream: ReadableStream, controller: AbortController): Stream { - let consumed = false; - - async function* iterLines(): AsyncGenerator { - const lineDecoder = new LineDecoder(); - - const iter = ReadableStreamToAsyncIterable(readableStream); - for await (const chunk of iter) { - for (const line of lineDecoder.decode(chunk)) { - yield line; - } - } - - for (const line of lineDecoder.flush()) { - yield line; - } - } - - async function* iterator(): AsyncIterator { - if (consumed) { - throw new OpenAIError('Cannot iterate over a consumed stream, use `.tee()` to split the stream.'); - } - consumed = true; - let done = false; - try { - for await (const line of iterLines()) { - if (done) continue; - if (line) yield JSON.parse(line); - } - done = true; - } catch (e) { - // If the user calls `stream.controller.abort()`, we should exit without throwing. - if (isAbortError(e)) return; - throw e; - } finally { - // If the user `break`s, abort the ongoing request. - if (!done) controller.abort(); - } - } - - return new Stream(iterator, controller); - } - - [Symbol.asyncIterator](): AsyncIterator { - return this.iterator(); - } - - /** - * Splits the stream into two streams which can be - * independently read from at different speeds. - */ - tee(): [Stream, Stream] { - const left: Array>> = []; - const right: Array>> = []; - const iterator = this.iterator(); - - const teeIterator = (queue: Array>>): AsyncIterator => { - return { - next: () => { - if (queue.length === 0) { - const result = iterator.next(); - left.push(result); - right.push(result); - } - return queue.shift()!; - }, - }; - }; - - return [ - new Stream(() => teeIterator(left), this.controller), - new Stream(() => teeIterator(right), this.controller), - ]; - } - - /** - * Converts this stream to a newline-separated ReadableStream of - * JSON stringified values in the stream - * which can be turned back into a Stream with `Stream.fromReadableStream()`. - */ - toReadableStream(): ReadableStream { - const self = this; - let iter: AsyncIterator; - const encoder: { - encode(str: string): Uint8Array; - } = new (globalThis as any).TextEncoder(); - - return makeReadableStream({ - async start() { - iter = self[Symbol.asyncIterator](); - }, - async pull(ctrl: any) { - try { - const { value, done } = await iter.next(); - if (done) return ctrl.close(); - - const bytes = encoder.encode(JSON.stringify(value) + '\n'); - - ctrl.enqueue(bytes); - } catch (err) { - ctrl.error(err); - } - }, - async cancel() { - await iter.return?.(); - }, - }); - } -} - -export async function* _iterSSEMessages( - response: Response, - controller: AbortController, -): AsyncGenerator { - if (!response.body) { - controller.abort(); - if ( - typeof (globalThis as any).navigator !== 'undefined' && - (globalThis as any).navigator.product === 'ReactNative' - ) { - throw new OpenAIError( - `The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`, - ); - } - throw new OpenAIError(`Attempted to iterate over a response with no body`); - } - - const sseDecoder = new SSEDecoder(); - const lineDecoder = new LineDecoder(); - - const iter = ReadableStreamToAsyncIterable(response.body); - for await (const sseChunk of iterSSEChunks(iter)) { - for (const line of lineDecoder.decode(sseChunk)) { - const sse = sseDecoder.decode(line); - if (sse) yield sse; - } - } - - for (const line of lineDecoder.flush()) { - const sse = sseDecoder.decode(line); - if (sse) yield sse; - } -} - -/** - * Given an async iterable iterator, iterates over it and yields full - * SSE chunks, i.e. yields when a double new-line is encountered. - */ -async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGenerator { - let data = new Uint8Array(); - - for await (const chunk of iterator) { - if (chunk == null) { - continue; - } - - const binaryChunk = - chunk instanceof ArrayBuffer ? new Uint8Array(chunk) - : typeof chunk === 'string' ? new (globalThis as any).TextEncoder().encode(chunk) - : chunk; - - let newData = new Uint8Array(data.length + binaryChunk.length); - newData.set(data); - newData.set(binaryChunk, data.length); - data = newData; - - let patternIndex; - while ((patternIndex = findDoubleNewlineIndex(data)) !== -1) { - yield data.slice(0, patternIndex); - data = data.slice(patternIndex); - } - } - - if (data.length > 0) { - yield data; - } -} - -class SSEDecoder { - private data: string[]; - private event: string | null; - private chunks: string[]; - - constructor() { - this.event = null; - this.data = []; - this.chunks = []; - } - - decode(line: string) { - if (line.endsWith('\r')) { - line = line.substring(0, line.length - 1); - } - - if (!line) { - // empty line and we didn't previously encounter any messages - if (!this.event && !this.data.length) return null; - - const sse: ServerSentEvent = { - event: this.event, - data: this.data.join('\n'), - raw: this.chunks, - }; - - this.event = null; - this.data = []; - this.chunks = []; - - return sse; - } - - this.chunks.push(line); - - if (line.startsWith(':')) { - return null; - } - - let [fieldname, _, value] = partition(line, ':'); - - if (value.startsWith(' ')) { - value = value.substring(1); - } - - if (fieldname === 'event') { - this.event = value; - } else if (fieldname === 'data') { - this.data.push(value); - } - - return null; - } -} - -function partition(str: string, delimiter: string): [string, string, string] { - const index = str.indexOf(delimiter); - if (index !== -1) { - return [str.substring(0, index), delimiter, str.substring(index + delimiter.length)]; - } - - return [str, '', '']; -} +/** @deprecated Import from ./core/streaming instead */ +export * from './core/streaming'; diff --git a/src/uploads.ts b/src/uploads.ts index 79d3073ea..b2ef64710 100644 --- a/src/uploads.ts +++ b/src/uploads.ts @@ -1,2 +1,2 @@ -export { type Uploadable } from './internal/uploads'; -export { toFile, type ToFileInput } from './internal/to-file'; +/** @deprecated Import from ./core/uploads instead */ +export * from './core/uploads'; diff --git a/tests/form.test.ts b/tests/form.test.ts index 5ca5b75f2..08cae4da0 100644 --- a/tests/form.test.ts +++ b/tests/form.test.ts @@ -1,5 +1,5 @@ import { multipartFormRequestOptions, createForm } from 'openai/internal/uploads'; -import { toFile } from 'openai/uploads'; +import { toFile } from 'openai/core/uploads'; describe('form data validation', () => { test('valid values do not error', async () => { diff --git a/tests/index.test.ts b/tests/index.test.ts index 07c99ba87..e1989722a 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIPromise } from 'openai/api-promise'; +import { APIPromise } from 'openai/core/api-promise'; import util from 'node:util'; import OpenAI from 'openai'; diff --git a/tests/streaming.test.ts b/tests/streaming.test.ts index 857cf4620..a1abbaba4 100644 --- a/tests/streaming.test.ts +++ b/tests/streaming.test.ts @@ -1,5 +1,5 @@ import assert from 'assert'; -import { _iterSSEMessages } from 'openai/streaming'; +import { _iterSSEMessages } from 'openai/core/streaming'; import { ReadableStreamFrom } from 'openai/internal/shims'; describe('streaming decoding', () => { diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 508fce58f..902a788a4 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -1,6 +1,6 @@ import fs from 'fs'; import type { ResponseLike } from 'openai/internal/to-file'; -import { toFile } from 'openai/uploads'; +import { toFile } from 'openai/core/uploads'; import { File } from 'node:buffer'; class MyClass { @@ -97,7 +97,7 @@ describe('missing File error message', () => { }); test('is thrown', async () => { - const uploads = await import('openai/uploads'); + const uploads = await import('openai/core/uploads'); await expect( uploads.toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })), ).rejects.toMatchInlineSnapshot( From 28130c7fe172dd90fcf2036dc72750e485e42645 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Mar 2025 20:32:36 +0000 Subject: [PATCH 344/509] chore(api): updates to supported Voice IDs --- .stats.yml | 4 +- src/resources/audio/speech.ts | 18 +++++- src/resources/beta/realtime/realtime.ts | 61 +++++++++++++++---- src/resources/beta/realtime/sessions.ts | 47 ++++++++++++-- .../beta/realtime/transcription-sessions.ts | 4 +- src/resources/chat/completions/completions.ts | 14 ++++- src/resources/responses/input-items.ts | 6 ++ src/resources/responses/responses.ts | 20 +++--- tests/api-resources/audio/speech.test.ts | 2 +- .../chat/completions/completions.test.ts | 2 +- .../responses/input-items.test.ts | 2 +- 11 files changed, 143 insertions(+), 37 deletions(-) diff --git a/.stats.yml b/.stats.yml index fe9320429..4d1276a5e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5ad6884898c07591750dde560118baf7074a59aecd1f367f930c5e42b04e848a.yml -openapi_spec_hash: 0c255269b89767eae26f4d4dc22d3cbd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml +openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e config_hash: d36e491b0afc4f79e3afad4b3c9bec70 diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 7a795f0e6..451234e6b 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -35,11 +35,23 @@ export interface SpeechCreateParams { /** * The voice to use when generating the audio. Supported voices are `alloy`, `ash`, - * `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the - * voices are available in the + * `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and + * `verse`. Previews of the voices are available in the * [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options). */ - voice: 'alloy' | 'ash' | 'coral' | 'echo' | 'fable' | 'onyx' | 'nova' | 'sage' | 'shimmer'; + voice: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; /** * Control the voice of your generated audio with additional instructions. Does not diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index b0fa02919..f4e1becfc 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -1005,9 +1005,22 @@ export interface RealtimeResponse { /** * 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'; + * `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and + * `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } /** @@ -1620,9 +1633,22 @@ export namespace ResponseCreateEvent { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Response { @@ -2078,9 +2104,22 @@ export namespace SessionUpdateEvent { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Session { @@ -2376,7 +2415,7 @@ export namespace TranscriptionSessionUpdate { export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. + * occurs. Not available for transcription sessions. */ create_response?: boolean; @@ -2390,7 +2429,7 @@ export namespace TranscriptionSessionUpdate { /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. + * occurs. Not available for transcription sessions. */ interrupt_response?: boolean; diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 3e0f939ef..324421197 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -141,7 +141,19 @@ export interface Session { * once the model has responded with audio at least once. Current voice options are * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace Session { @@ -363,7 +375,19 @@ export interface SessionCreateResponse { * once the model has responded with audio at least once. Current voice options are * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace SessionCreateResponse { @@ -563,9 +587,22 @@ export interface SessionCreateParams { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. - */ - voice?: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. + */ + voice?: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } export namespace SessionCreateParams { diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index c530c4091..8040c5056 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -254,7 +254,7 @@ export namespace TranscriptionSessionCreateParams { export interface TurnDetection { /** * Whether or not to automatically generate a response when a VAD stop event - * occurs. + * occurs. Not available for transcription sessions. */ create_response?: boolean; @@ -268,7 +268,7 @@ export namespace TranscriptionSessionCreateParams { /** * Whether or not to automatically interrupt any ongoing response with output to * the default conversation (i.e. `conversation` of `auto`) when a VAD start event - * occurs. + * occurs. Not available for transcription sessions. */ interrupt_response?: boolean; diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 191c6250c..720e8a583 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -314,7 +314,19 @@ export interface ChatCompletionAudioParam { * The voice the model uses to respond. Supported voices are `alloy`, `ash`, * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. */ - voice: 'alloy' | 'ash' | 'ballad' | 'coral' | 'echo' | 'sage' | 'shimmer' | 'verse'; + voice: + | (string & {}) + | 'alloy' + | 'ash' + | 'ballad' + | 'coral' + | 'echo' + | 'fable' + | 'onyx' + | 'nova' + | 'sage' + | 'shimmer' + | 'verse'; } /** diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index b49f30b81..c04fbe283 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -60,6 +60,12 @@ export interface InputItemListParams extends CursorPageParams { */ before?: string; + /** + * Additional fields to include in the response. See the `include` parameter for + * Response creation above for more information. + */ + include?: Array; + /** * The order to return the input items in. Default is `asc`. * diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 7077aeb9a..83835a0f7 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -233,8 +233,8 @@ export interface Response { * context. * * When using along with `previous_response_id`, the instructions from a previous - * response will be not be carried over to the next response. This makes it simple - * to swap out system (or developer) messages in new responses. + * response will not be carried over to the next response. This makes it simple to + * swap out system (or developer) messages in new responses. */ instructions: string | null; @@ -1284,6 +1284,12 @@ export type ResponseFormatTextConfig = * [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs). */ export interface ResponseFormatTextJSONSchemaConfig { + /** + * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores + * and dashes, with a maximum length of 64. + */ + name: string; + /** * The schema for the response format, described as a JSON Schema object. Learn how * to build JSON schemas [here](https://json-schema.org/). @@ -1301,12 +1307,6 @@ export interface ResponseFormatTextJSONSchemaConfig { */ description?: string; - /** - * The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores - * and dashes, with a maximum length of 64. - */ - name?: string; - /** * Whether to enable strict schema adherence when generating the output. If set to * true, the model will always follow the exact schema defined in the `schema` @@ -2626,8 +2626,8 @@ export interface ResponseCreateParamsBase { * context. * * When using along with `previous_response_id`, the instructions from a previous - * response will be not be carried over to the next response. This makes it simple - * to swap out system (or developer) messages in new responses. + * response will not be carried over to the next response. This makes it simple to + * swap out system (or developer) messages in new responses. */ instructions?: string | null; diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index cbec6cfac..191c6a313 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -13,7 +13,7 @@ describe('resource speech', () => { const response = await client.audio.speech.create({ input: 'input', model: 'string', - voice: 'alloy', + voice: 'ash', instructions: 'instructions', response_format: 'mp3', speed: 0.25, diff --git a/tests/api-resources/chat/completions/completions.test.ts b/tests/api-resources/chat/completions/completions.test.ts index f95953719..b593ab4eb 100644 --- a/tests/api-resources/chat/completions/completions.test.ts +++ b/tests/api-resources/chat/completions/completions.test.ts @@ -26,7 +26,7 @@ describe('resource completions', () => { const response = await client.chat.completions.create({ messages: [{ content: 'string', role: 'developer', name: 'name' }], model: 'gpt-4o', - audio: { format: 'wav', voice: 'alloy' }, + audio: { format: 'wav', voice: 'ash' }, frequency_penalty: -2, function_call: 'none', functions: [{ name: 'name', description: 'description', parameters: { foo: 'bar' } }], diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts index abc8185f6..a96128939 100644 --- a/tests/api-resources/responses/input-items.test.ts +++ b/tests/api-resources/responses/input-items.test.ts @@ -24,7 +24,7 @@ describe('resource inputItems', () => { await expect( client.responses.inputItems.list( 'response_id', - { after: 'after', before: 'before', limit: 0, order: 'asc' }, + { after: 'after', before: 'before', include: ['file_search_call.results'], limit: 0, order: 'asc' }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); From 9697139a5f38bcc2dffa3322ff575eb1fc8b4e35 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 16:07:22 +0000 Subject: [PATCH 345/509] feat(api): add `get /chat/completions` endpoint --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4d1276a5e..1e1104a06 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: d36e491b0afc4f79e3afad4b3c9bec70 +config_hash: 9351ea829c2b41da3b48a38c934c92ee From f2c5aba736f99550a9a7837be22b39b36a7495d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 19:41:58 +0000 Subject: [PATCH 346/509] feat(api): add `get /responses/{response_id}/input_items` endpoint --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 1e1104a06..f6a90d243 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 9351ea829c2b41da3b48a38c934c92ee +config_hash: e25e31d8446b6bc0e3ef7103b6993cce From 00bdda332097787a1b09ef903b3304d3e61cde1c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 00:26:26 +0000 Subject: [PATCH 347/509] chore: Remove deprecated/unused remote spec feature --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f6a90d243..2ccfd3411 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: e25e31d8446b6bc0e3ef7103b6993cce +config_hash: 2daae06cc598821ccf87201de0861e40 From 4560dc62f8c65e9857085409e382760aa601d60b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:12:29 +0000 Subject: [PATCH 348/509] feat(api): manual updates --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2ccfd3411..71ac95541 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6663c59193eb95b201e492de17dcbd5e126ba03d18ce66287a3e2c632ca56fe7.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 2daae06cc598821ccf87201de0861e40 +config_hash: 31a12443afeef2933b34e2de23c40954 From 678ae6b7112ed9b27d092b3234dd034d572deb9c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 23:18:34 +0000 Subject: [PATCH 349/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 71ac95541..baad2afc1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 31a12443afeef2933b34e2de23c40954 +config_hash: 178ba1bfb1237bf6b94abb3408072aa7 From 5a272a76515b09810fcb5d0ca63dd6050d1a8023 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 13:33:34 +0000 Subject: [PATCH 350/509] fix(client): send `X-Stainless-Timeout` in seconds --- src/client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.ts b/src/client.ts index 41f128ebe..002151aca 100644 --- a/src/client.ts +++ b/src/client.ts @@ -770,7 +770,7 @@ export class OpenAI { Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount), - ...(options.timeout ? { 'X-Stainless-Timeout': String(options.timeout) } : {}), + ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), 'OpenAI-Organization': this.organization, 'OpenAI-Project': this.project, From 0cb0c863b3bda6e6d72b3b5cdba3c8791db9bb77 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:49:57 +0000 Subject: [PATCH 351/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index baad2afc1..675edb075 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 178ba1bfb1237bf6b94abb3408072aa7 +config_hash: 578c5bff4208d560c0c280f13324409f From 8957ff47e6dc6cbaf750482c76929e99e5eca48c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 2 Apr 2025 20:55:22 +0000 Subject: [PATCH 352/509] chore(internal): add aliases for Record and Array --- src/internal/builtin-types.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts index b2e598a81..c23d3bded 100644 --- a/src/internal/builtin-types.ts +++ b/src/internal/builtin-types.ts @@ -39,9 +39,23 @@ type _HeadersInit = RequestInit['headers']; */ type _BodyInit = RequestInit['body']; +/** + * An alias to the builtin `Array` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Array = Array; + +/** + * An alias to the builtin `Record` type so we can + * easily alias it in import statements if there are name clashes. + */ +type _Record = Record; + export type { + _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, + _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response, From b6bf4694cbd0ab86e7d6689289faed9ddbfb46ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:23:00 +0000 Subject: [PATCH 353/509] fix(api): improve type resolution when importing as a package --- packages/mcp-server/src/tools.ts | 1 + 1 file changed, 1 insertion(+) create mode 100644 packages/mcp-server/src/tools.ts diff --git a/packages/mcp-server/src/tools.ts b/packages/mcp-server/src/tools.ts new file mode 100644 index 000000000..7e516de7c --- /dev/null +++ b/packages/mcp-server/src/tools.ts @@ -0,0 +1 @@ +export * from './tools/index'; From 179a607a89fabda32ebad62cc7ee86b5332a29f4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 18:37:49 +0000 Subject: [PATCH 354/509] feat(api): manual updates --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 675edb075..aebb90c8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 82 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: 578c5bff4208d560c0c280f13324409f +config_hash: bcd2cacdcb9fae9938f273cd167f613c From 732d87001cbd9aa095e7b58dc843e86547e3f510 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 19:55:08 +0000 Subject: [PATCH 355/509] chore(docs): improve migration doc --- MIGRATION.md | 284 +++++++++++++++++++++++++-------------------------- 1 file changed, 141 insertions(+), 143 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index c5e26d3c2..0ee18b224 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -102,10 +102,10 @@ For example, for a method that would call an endpoint at `/v1/parents/{parent_id ```ts // Before -client.parents.children.create('p_123', 'c_456'); +client.parents.children.retrieve('p_123', 'c_456'); // After -client.example.create('c_456', { parent_id: 'p_123' }); +client.parents.children.retrieve('c_456', { parent_id: 'p_123' }); ``` This affects the following methods: @@ -136,73 +136,11 @@ For example: ```diff - client.example.retrieve(encodeURIComponent('string/with/slash')) -+ client.example.retrieve('string/with/slash') // renders example/string%2Fwith%2Fslash ++ client.example.retrieve('string/with/slash') // retrieves /example/string%2Fwith%2Fslash ``` Previously without the `encodeURIComponent()` call we would have used the path `/example/string/with/slash`; now we'll use `/example/string%2Fwith%2Fslash`. -### Removed `httpAgent` in favor of `fetchOptions` - -The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options). -This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation. - -If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies). - -Before: - -```ts -import OpenAI from 'openai'; -import http from 'http'; -import { HttpsProxyAgent } from 'https-proxy-agent'; - -// Configure the default for all requests: -const client = new OpenAI({ - httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), -}); -``` - -After: - -```ts -import OpenAI from 'openai'; -import * as undici from 'undici'; - -const proxyAgent = new undici.ProxyAgent(process.env.PROXY_URL); -const client = new OpenAI({ - fetchOptions: { - dispatcher: proxyAgent, - }, -}); -``` - -### HTTP method naming - -Some methods could not be named intuitively due to an internal naming conflict. This has been resolved and the methods are now correctly named. - -```ts -// Before -client.chat.completions.del(); -client.files.del(); -client.models.del(); -client.vectorStores.del(); -client.vectorStores.files.del(); -client.beta.assistants.del(); -client.beta.threads.del(); -client.beta.threads.messages.del(); -client.responses.del(); - -// After -client.chat.completions.delete(); -client.files.delete(); -client.models.delete(); -client.vectorStores.delete(); -client.vectorStores.files.delete(); -client.beta.assistants.delete(); -client.beta.threads.delete(); -client.beta.threads.messages.delete(); -client.responses.delete(); -``` - ### Removed request options overloads When making requests with no required body, query or header parameters, you must now explicitly pass `null`, `undefined` or an empty object `{}` to the params argument in order to customise request options. @@ -234,106 +172,69 @@ This affects the following methods: - `client.responses.retrieve()` - `client.responses.inputItems.list()` -### Pagination changes - -Note that the `for await` syntax is _not_ affected. This still works as-is: - -```ts -// Automatically fetches more pages as needed. -for await (const fineTuningJob of client.fineTuning.jobs.list()) { - console.log(fineTuningJob); -} -``` - -#### Simplified interface +### HTTP method naming -The pagination interface has been simplified: +Previously some methods could not be named intuitively due to an internal naming conflict. This has been fixed and the affected methods are now correctly named. ```ts // Before -page.nextPageParams(); -page.nextPageInfo(); -// Required manually handling { url } | { params } type +client.chat.completions.del(); +client.files.del(); +client.models.del(); +client.vectorStores.del(); +client.vectorStores.files.del(); +client.beta.assistants.del(); +client.beta.threads.del(); +client.beta.threads.messages.del(); +client.responses.del(); // After -page.nextPageRequestOptions(); +client.chat.completions.delete(); +client.files.delete(); +client.models.delete(); +client.vectorStores.delete(); +client.vectorStores.files.delete(); +client.beta.assistants.delete(); +client.beta.threads.delete(); +client.beta.threads.messages.delete(); +client.responses.delete(); ``` -#### Removed unnecessary classes - -Page classes for individual methods are now type aliases: - -```ts -// Before -export class FineTuningJobsPage extends CursorPage {} - -// After -export type FineTuningJobsPage = CursorPage; -``` +### Removed `httpAgent` in favor of `fetchOptions` -If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level. +The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options). +This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation. -### File handling +If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies). -The deprecated `fileFromPath` helper has been removed in favor of native Node.js streams: +Before: ```ts -// Before -OpenAI.fileFromPath('path/to/file'); +import OpenAI from 'openai'; +import http from 'http'; +import { HttpsProxyAgent } from 'https-proxy-agent'; -// After -import fs from 'fs'; -fs.createReadStream('path/to/file'); +// Configure the default for all requests: +const client = new OpenAI({ + httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), +}); ``` -Note that this function previously only worked on Node.js. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead. - -### Shims removal - -Previously you could configure the types that the SDK used like this: +After: ```ts -// Tell TypeScript and the package to use the global Web fetch instead of node-fetch. -import 'openai/shims/web'; import OpenAI from 'openai'; -``` - -The `openai/shims` imports have been removed. Your global types must now be [correctly configured](#minimum-types-requirements). - -### `openai/src` directory removed - -Previously IDEs may have auto-completed imports from the `openai/src` directory, however this -directory was only included for an improved go-to-definition experience and should not have been used at runtime. - -If you have any `openai/src` imports, you must replace it with `openai`. - -```ts -// Before -import OpenAI from 'openai/src'; +import * as undici from 'undici'; -// After -import OpenAI from 'openai'; +const proxyAgent = new undici.ProxyAgent(process.env.PROXY_URL); +const client = new OpenAI({ + fetchOptions: { + dispatcher: proxyAgent, + }, +}); ``` -### Headers - -The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record`. - -### Removed exports - -#### Resource classes - -If you were importing resource classes from the root package then you must now import them from the file they are defined in. -This was never valid at the type level and only worked in CommonJS files. - -```typescript -// Before -const { Completions } = require('openai'); - -// After -const { OpenAI } = require('openai'); -OpenAI.Completions; // or import directly from openai/resources/completions -``` +### Changed exports #### Refactor of `openai/core`, `error`, `pagination`, `resource`, `streaming` and `uploads` @@ -359,6 +260,20 @@ import 'openai/core/uploads'; If you were relying on anything that was only exported from `openai/core` and is also not accessible anywhere else, please open an issue and we'll consider adding it to the public API. +#### Resource classes + +Previously under certain circumstances it was possible to import resource classes like `Completions` directly from the root of the package. This was never valid at the type level and only worked in CommonJS files. +Now you must always either reference them as static class properties or import them directly from the files in which they are defined. + +```typescript +// Before +const { Completions } = require('openai'); + +// After +const { OpenAI } = require('openai'); +OpenAI.Completions; // or import directly from openai/resources/completions +``` + #### Cleaned up `uploads` exports As part of the `core` refactor, `openai/uploads` was moved to `openai/core/uploads` @@ -395,3 +310,86 @@ import { APIClient } from 'openai/core'; // After import { OpenAI } from 'openai'; ``` + +### File handling + +The deprecated `fileFromPath` helper has been removed in favor of native Node.js streams: + +```ts +// Before +OpenAI.fileFromPath('path/to/file'); + +// After +import fs from 'fs'; +fs.createReadStream('path/to/file'); +``` + +Note that this function previously only worked on Node.js. If you're using Bun, you can use [`Bun.file`](https://bun.sh/docs/api/file-io) instead. + +### Shims removal + +Previously you could configure the types that the SDK used like this: + +```ts +// Tell TypeScript and the package to use the global Web fetch instead of node-fetch. +import 'openai/shims/web'; +import OpenAI from 'openai'; +``` + +The `openai/shims` imports have been removed. Your global types must now be [correctly configured](#minimum-types-requirements). + +### Pagination changes + +The `for await` syntax **is not affected**. This still works as-is: + +```ts +// Automatically fetches more pages as needed. +for await (const fineTuningJob of client.fineTuning.jobs.list()) { + console.log(fineTuningJob); +} +``` + +The interface for manually paginating through list results has been simplified: + +```ts +// Before +page.nextPageParams(); +page.nextPageInfo(); +// Required manually handling { url } | { params } type + +// After +page.nextPageRequestOptions(); +``` + +#### Removed unnecessary classes + +Page classes for individual methods are now type aliases: + +```ts +// Before +export class FineTuningJobsPage extends CursorPage {} + +// After +export type FineTuningJobsPage = CursorPage; +``` + +If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level. + +### `openai/src` directory removed + +Previously IDEs may have auto-completed imports from the `openai/src` directory, however this +directory was only included for an improved go-to-definition experience and should not have been used at runtime. + +If you have any `openai/src/*` imports, you will need to replace them with `openai/*`. + +```ts +// Before +import OpenAI from 'openai/src'; + +// After +import OpenAI from 'openai'; +``` + +### Headers + +The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record`. From 752f4f182116df46e4e25d6f94dcffbe504b89fd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 21:09:13 +0000 Subject: [PATCH 356/509] fix(mcp): remove unused tools.ts --- packages/mcp-server/src/tools.ts | 1 - 1 file changed, 1 deletion(-) delete mode 100644 packages/mcp-server/src/tools.ts diff --git a/packages/mcp-server/src/tools.ts b/packages/mcp-server/src/tools.ts deleted file mode 100644 index 7e516de7c..000000000 --- a/packages/mcp-server/src/tools.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './tools/index'; From ee01414c206f18a537f3616bcf1e208aab311030 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 12:35:25 +0000 Subject: [PATCH 357/509] fix(client): send all configured auth headers --- src/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/client.ts b/src/client.ts index 002151aca..5ff149e9a 100644 --- a/src/client.ts +++ b/src/client.ts @@ -332,8 +332,8 @@ export class OpenAI { return; } - protected authHeaders(opts: FinalRequestOptions): Headers | undefined { - return new Headers({ Authorization: `Bearer ${this.apiKey}` }); + protected authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined { + return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]); } protected stringifyQuery(query: Record): string { From 0b30331a7e89ed9c400bb1b9ebfb33867a00f8bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 14:25:51 +0000 Subject: [PATCH 358/509] chore(tests): improve enum examples --- tests/api-resources/images.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 9f00da3b3..fab30e32d 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -27,7 +27,7 @@ describe('resource images', () => { model: 'dall-e-2', n: 1, response_format: 'url', - size: '256x256', + size: '1024x1024', user: 'user-1234', }); }); @@ -54,7 +54,7 @@ describe('resource images', () => { model: 'dall-e-2', n: 1, response_format: 'url', - size: '256x256', + size: '1024x1024', user: 'user-1234', }); }); @@ -77,7 +77,7 @@ describe('resource images', () => { n: 1, quality: 'standard', response_format: 'url', - size: '256x256', + size: '1024x1024', style: 'vivid', user: 'user-1234', }); From 70092d768426b8e0dd4bca21e7a3dea009e25b9f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 18:49:44 +0000 Subject: [PATCH 359/509] feat(api): Add evalapi to sdk Adding the evalsapi to the sdk. --- .stats.yml | 8 +- MIGRATION.md | 20 +- api.md | 72 ++ src/client.ts | 37 + src/resources/evals.ts | 3 + src/resources/evals/evals.ts | 776 ++++++++++++ src/resources/evals/index.ts | 36 + src/resources/evals/runs.ts | 3 + src/resources/evals/runs/index.ts | 27 + src/resources/evals/runs/output-items.ts | 413 +++++++ src/resources/evals/runs/runs.ts | 1073 +++++++++++++++++ src/resources/fine-tuning/checkpoints.ts | 3 + .../fine-tuning/checkpoints/checkpoints.ts | 31 + .../fine-tuning/checkpoints/index.ts | 12 + .../fine-tuning/checkpoints/permissions.ts | 183 +++ src/resources/fine-tuning/fine-tuning.ts | 6 + src/resources/fine-tuning/index.ts | 1 + src/resources/index.ts | 17 + tests/api-resources/evals/evals.test.ts | 395 ++++++ .../evals/runs/output-items.test.ts | 52 + tests/api-resources/evals/runs/runs.test.ts | 101 ++ .../checkpoints/permissions.test.ts | 66 + 22 files changed, 3330 insertions(+), 5 deletions(-) create mode 100644 src/resources/evals.ts create mode 100644 src/resources/evals/evals.ts create mode 100644 src/resources/evals/index.ts create mode 100644 src/resources/evals/runs.ts create mode 100644 src/resources/evals/runs/index.ts create mode 100644 src/resources/evals/runs/output-items.ts create mode 100644 src/resources/evals/runs/runs.ts create mode 100644 src/resources/fine-tuning/checkpoints.ts create mode 100644 src/resources/fine-tuning/checkpoints/checkpoints.ts create mode 100644 src/resources/fine-tuning/checkpoints/index.ts create mode 100644 src/resources/fine-tuning/checkpoints/permissions.ts create mode 100644 tests/api-resources/evals/evals.test.ts create mode 100644 tests/api-resources/evals/runs/output-items.test.ts create mode 100644 tests/api-resources/evals/runs/runs.test.ts create mode 100644 tests/api-resources/fine-tuning/checkpoints/permissions.test.ts diff --git a/.stats.yml b/.stats.yml index aebb90c8c..ebe07c137 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 82 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4bce8217a697c729ac98046d4caf2c9e826b54c427fb0ab4f98e549a2e0ce31c.yml -openapi_spec_hash: 7996d2c34cc44fe2ce9ffe93c0ab774e -config_hash: bcd2cacdcb9fae9938f273cd167f613c +configured_endpoints: 97 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-472fe3036ea745365257fe870c0330917fb3153705c2826f49873cd631319b0a.yml +openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 +config_hash: ef19d36c307306f14f2e1cd5c834a151 diff --git a/MIGRATION.md b/MIGRATION.md index 0ee18b224..448d99b6e 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -108,7 +108,9 @@ client.parents.children.retrieve('p_123', 'c_456'); client.parents.children.retrieve('c_456', { parent_id: 'p_123' }); ``` -This affects the following methods: +
+ +This affects the following methods - `client.vectorStores.files.retrieve()` - `client.vectorStores.files.update()` @@ -126,6 +128,13 @@ This affects the following methods: - `client.beta.threads.messages.retrieve()` - `client.beta.threads.messages.update()` - `client.beta.threads.messages.delete()` +- `client.evals.runs.retrieve()` +- `client.evals.runs.delete()` +- `client.evals.runs.cancel()` +- `client.evals.runs.outputItems.retrieve()` +- `client.evals.runs.outputItems.list()` + +
### URI encoded path parameters @@ -162,6 +171,7 @@ This affects the following methods: - `client.fineTuning.jobs.list()` - `client.fineTuning.jobs.listEvents()` - `client.fineTuning.jobs.checkpoints.list()` +- `client.fineTuning.checkpoints.permissions.retrieve()` - `client.vectorStores.list()` - `client.vectorStores.files.list()` - `client.beta.assistants.list()` @@ -171,6 +181,8 @@ This affects the following methods: - `client.batches.list()` - `client.responses.retrieve()` - `client.responses.inputItems.list()` +- `client.evals.list()` +- `client.evals.runs.list()` ### HTTP method naming @@ -181,23 +193,29 @@ Previously some methods could not be named intuitively due to an internal naming client.chat.completions.del(); client.files.del(); client.models.del(); +client.fineTuning.checkpoints.permissions.del(); client.vectorStores.del(); client.vectorStores.files.del(); client.beta.assistants.del(); client.beta.threads.del(); client.beta.threads.messages.del(); client.responses.del(); +client.evals.del(); +client.evals.runs.del(); // After client.chat.completions.delete(); client.files.delete(); client.models.delete(); +client.fineTuning.checkpoints.permissions.delete(); client.vectorStores.delete(); client.vectorStores.files.delete(); client.beta.assistants.delete(); client.beta.threads.delete(); client.beta.threads.messages.delete(); client.responses.delete(); +client.evals.delete(); +client.evals.runs.delete(); ``` ### Removed `httpAgent` in favor of `fetchOptions` diff --git a/api.md b/api.md index b3470ccf5..8ed2e9964 100644 --- a/api.md +++ b/api.md @@ -233,6 +233,22 @@ Methods: - client.fineTuning.jobs.checkpoints.list(fineTuningJobID, { ...params }) -> FineTuningJobCheckpointsPage +## Checkpoints + +### Permissions + +Types: + +- PermissionCreateResponse +- PermissionRetrieveResponse +- PermissionDeleteResponse + +Methods: + +- client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage +- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse +- client.fineTuning.checkpoints.permissions.delete(fineTunedModelCheckpoint) -> PermissionDeleteResponse + # VectorStores Types: @@ -642,3 +658,59 @@ Types: Methods: - client.responses.inputItems.list(responseID, { ...params }) -> ResponseItemsPage + +# Evals + +Types: + +- EvalCustomDataSourceConfig +- EvalLabelModelGrader +- EvalStoredCompletionsDataSourceConfig +- EvalStringCheckGrader +- EvalTextSimilarityGrader +- EvalCreateResponse +- EvalRetrieveResponse +- EvalUpdateResponse +- EvalListResponse +- EvalDeleteResponse + +Methods: + +- client.evals.create({ ...params }) -> EvalCreateResponse +- client.evals.retrieve(evalID) -> EvalRetrieveResponse +- client.evals.update(evalID, { ...params }) -> EvalUpdateResponse +- client.evals.list({ ...params }) -> EvalListResponsesPage +- client.evals.delete(evalID) -> EvalDeleteResponse + +## Runs + +Types: + +- CreateEvalCompletionsRunDataSource +- CreateEvalJSONLRunDataSource +- EvalAPIError +- RunCreateResponse +- RunRetrieveResponse +- RunListResponse +- RunDeleteResponse +- RunCancelResponse + +Methods: + +- client.evals.runs.create(evalID, { ...params }) -> RunCreateResponse +- client.evals.runs.retrieve(runID, { ...params }) -> RunRetrieveResponse +- client.evals.runs.list(evalID, { ...params }) -> RunListResponsesPage +- client.evals.runs.delete(runID, { ...params }) -> RunDeleteResponse +- client.evals.runs.cancel(runID, { ...params }) -> RunCancelResponse + +### OutputItems + +Types: + +- OutputItemRetrieveResponse +- OutputItemListResponse + +Methods: + +- client.evals.runs.outputItems.retrieve(outputItemID, { ...params }) -> OutputItemRetrieveResponse +- client.evals.runs.outputItems.list(runID, { ...params }) -> OutputItemListResponsesPage diff --git a/src/client.ts b/src/client.ts index 5ff149e9a..4469a5628 100644 --- a/src/client.ts +++ b/src/client.ts @@ -85,6 +85,23 @@ import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; +import { + EvalCreateParams, + EvalCreateResponse, + EvalCustomDataSourceConfig, + EvalDeleteResponse, + EvalLabelModelGrader, + EvalListParams, + EvalListResponse, + EvalListResponsesPage, + EvalRetrieveResponse, + EvalStoredCompletionsDataSourceConfig, + EvalStringCheckGrader, + EvalTextSimilarityGrader, + EvalUpdateParams, + EvalUpdateResponse, + Evals, +} from './resources/evals/evals'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; import { Responses } from './resources/responses/responses'; import { @@ -856,6 +873,7 @@ export class OpenAI { batches: API.Batches = new API.Batches(this); uploads: API.Uploads = new API.Uploads(this); responses: API.Responses = new API.Responses(this); + evals: API.Evals = new API.Evals(this); } OpenAI.Completions = Completions; OpenAI.Chat = Chat; @@ -871,6 +889,7 @@ OpenAI.Beta = Beta; OpenAI.Batches = Batches; OpenAI.Uploads = UploadsAPIUploads; OpenAI.Responses = Responses; +OpenAI.Evals = Evals; export declare namespace OpenAI { export type RequestOptions = Opts.RequestOptions; @@ -1022,6 +1041,24 @@ export declare namespace OpenAI { export { Responses as Responses }; + export { + Evals as Evals, + type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLabelModelGrader as EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader as EvalStringCheckGrader, + type EvalTextSimilarityGrader as EvalTextSimilarityGrader, + type EvalCreateResponse as EvalCreateResponse, + type EvalRetrieveResponse as EvalRetrieveResponse, + type EvalUpdateResponse as EvalUpdateResponse, + type EvalListResponse as EvalListResponse, + type EvalDeleteResponse as EvalDeleteResponse, + type EvalListResponsesPage as EvalListResponsesPage, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, + type EvalListParams as EvalListParams, + }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; diff --git a/src/resources/evals.ts b/src/resources/evals.ts new file mode 100644 index 000000000..b611710e1 --- /dev/null +++ b/src/resources/evals.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './evals/index'; diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts new file mode 100644 index 000000000..ca5d82b42 --- /dev/null +++ b/src/resources/evals/evals.ts @@ -0,0 +1,776 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as Shared from '../shared'; +import * as RunsAPI from './runs/runs'; +import { + CreateEvalCompletionsRunDataSource, + CreateEvalJSONLRunDataSource, + EvalAPIError, + RunCancelParams, + RunCancelResponse, + RunCreateParams, + RunCreateResponse, + RunDeleteParams, + RunDeleteResponse, + RunListParams, + RunListResponse, + RunListResponsesPage, + RunRetrieveParams, + RunRetrieveResponse, + Runs, +} from './runs/runs'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class Evals extends APIResource { + runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); + + /** + * Create the structure of an evaluation that can be used to test a model's + * performance. An evaluation is a set of testing criteria and a datasource. After + * creating an evaluation, you can run it on different models and model parameters. + * We support several types of graders and datasources. For more information, see + * the [Evals guide](https://platform.openai.com/docs/guides/evals). + */ + create(body: EvalCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/evals', { body, ...options }); + } + + /** + * Get an evaluation by ID. + */ + retrieve(evalID: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/evals/${evalID}`, options); + } + + /** + * Update certain properties of an evaluation. + */ + update(evalID: string, body: EvalUpdateParams, options?: RequestOptions): APIPromise { + return this._client.post(path`/evals/${evalID}`, { body, ...options }); + } + + /** + * List evaluations for a project. + */ + list( + query: EvalListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/evals', CursorPage, { query, ...options }); + } + + /** + * Delete an evaluation. + */ + delete(evalID: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/evals/${evalID}`, options); + } +} + +export type EvalListResponsesPage = CursorPage; + +/** + * A CustomDataSourceConfig which specifies the schema of your `item` and + * optionally `sample` namespaces. The response schema defines the shape of the + * data that will be: + * + * - Used to define your testing criteria and + * - What data is required when creating a run + */ +export interface EvalCustomDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `custom`. + */ + type: 'custom'; +} + +/** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ +export interface EvalLabelModelGrader { + input: Array; + + /** + * The labels to assign to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; +} + +export namespace EvalLabelModelGrader { + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface Assistant { + content: Assistant.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace Assistant { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A StoredCompletionsDataSourceConfig which specifies the metadata property of + * your stored completions query. This is usually metadata like `usecase=chatbot` + * or `prompt-version=v2`, etc. The schema returned by this data source config is + * used to defined what variables are available in your evals. `item` and `sample` + * are both defined when using this data source config. + */ +export interface EvalStoredCompletionsDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `stored_completions`. + */ + type: 'stored_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?: Shared.Metadata | null; +} + +/** + * A StringCheckGrader object that performs a string comparison between input and + * reference using a specified operation. + */ +export interface EvalStringCheckGrader { + /** + * The input text. This may include template strings. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. + */ + operation: 'eq' | 'ne' | 'like' | 'ilike'; + + /** + * The reference text. This may include template strings. + */ + reference: string; + + /** + * The object type, which is always `string_check`. + */ + type: 'string_check'; +} + +/** + * A TextSimilarityGrader object which grades text based on similarity metrics. + */ +export interface EvalTextSimilarityGrader { + /** + * The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, + * `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + */ + evaluation_metric: + | 'fuzzy_match' + | 'bleu' + | 'gleu' + | 'meteor' + | 'rouge_1' + | 'rouge_2' + | 'rouge_3' + | 'rouge_4' + | 'rouge_5' + | 'rouge_l' + | 'cosine'; + + /** + * The text being graded. + */ + input: string; + + /** + * A float score where a value greater than or equal indicates a passing grade. + */ + pass_threshold: number; + + /** + * The text being graded against. + */ + reference: string; + + /** + * The type of grader. + */ + type: 'text_similarity'; + + /** + * The name of the grader. + */ + name?: string; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalCreateResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalRetrieveResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalUpdateResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +/** + * An Eval object with a data source config and testing criteria. An Eval + * represents a task to be done for your LLM integration. Like: + * + * - Improve the quality of my chatbot + * - See how well my chatbot handles customer support + * - Check if o3-mini is better at my usecase than gpt-4o + */ +export interface EvalListResponse { + /** + * Unique identifier for the evaluation. + */ + id: string; + + /** + * The Unix timestamp (in seconds) for when the eval was created. + */ + created_at: number; + + /** + * Configuration of data sources used in runs of the evaluation. + */ + data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + + /** + * 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 name of the evaluation. + */ + name: string; + + /** + * The object type. + */ + object: 'eval'; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai: boolean; + + /** + * A list of testing criteria. + */ + testing_criteria: Array; +} + +export interface EvalDeleteResponse { + deleted: boolean; + + eval_id: string; + + object: string; +} + +export interface EvalCreateParams { + /** + * The configuration for the data source used for the evaluation runs. + */ + data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + + /** + * A list of graders for all eval runs in this group. + */ + testing_criteria: Array; + + /** + * 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 name of the evaluation. + */ + name?: string; + + /** + * Indicates whether the evaluation is shared with OpenAI. + */ + share_with_openai?: boolean; +} + +export namespace EvalCreateParams { + /** + * A CustomDataSourceConfig object that defines the schema for the data source used + * for the evaluation runs. This schema is used to define the shape of the data + * that will be: + * + * - Used to define your testing criteria and + * - What data is required when creating a run + */ + export interface Custom { + /** + * The json schema for the run data source items. + */ + item_schema: Record; + + /** + * The type of data source. Always `custom`. + */ + type: 'custom'; + + /** + * Whether to include the sample schema in the data source. + */ + include_sample_schema?: boolean; + } + + /** + * A data source config which specifies the metadata property of your stored + * completions query. This is usually metadata like `usecase=chatbot` or + * `prompt-version=v2`, etc. + */ + export interface StoredCompletions { + /** + * The type of data source. Always `stored_completions`. + */ + type: 'stored_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?: Shared.Metadata | null; + } + + /** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ + export interface LabelModel { + input: Array; + + /** + * The labels to classify to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; + } + + export namespace LabelModel { + export interface SimpleInputMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface OutputMessage { + content: OutputMessage.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace OutputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } + } +} + +export interface EvalUpdateParams { + /** + * 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; + + /** + * Rename the evaluation. + */ + name?: string; +} + +export interface EvalListParams extends CursorPageParams { + /** + * Sort order for evals by timestamp. Use `asc` for ascending order or `desc` for + * descending order. + */ + order?: 'asc' | 'desc'; + + /** + * Evals can be ordered by creation time or last updated time. Use `created_at` for + * creation time or `updated_at` for last updated time. + */ + order_by?: 'created_at' | 'updated_at'; +} + +Evals.Runs = Runs; + +export declare namespace Evals { + export { + type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLabelModelGrader as EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader as EvalStringCheckGrader, + type EvalTextSimilarityGrader as EvalTextSimilarityGrader, + type EvalCreateResponse as EvalCreateResponse, + type EvalRetrieveResponse as EvalRetrieveResponse, + type EvalUpdateResponse as EvalUpdateResponse, + type EvalListResponse as EvalListResponse, + type EvalDeleteResponse as EvalDeleteResponse, + type EvalListResponsesPage as EvalListResponsesPage, + type EvalCreateParams as EvalCreateParams, + type EvalUpdateParams as EvalUpdateParams, + type EvalListParams as EvalListParams, + }; + + export { + Runs as Runs, + type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type EvalAPIError as EvalAPIError, + type RunCreateResponse as RunCreateResponse, + type RunRetrieveResponse as RunRetrieveResponse, + type RunListResponse as RunListResponse, + type RunDeleteResponse as RunDeleteResponse, + type RunCancelResponse as RunCancelResponse, + type RunListResponsesPage as RunListResponsesPage, + type RunCreateParams as RunCreateParams, + type RunRetrieveParams as RunRetrieveParams, + type RunListParams as RunListParams, + type RunDeleteParams as RunDeleteParams, + type RunCancelParams as RunCancelParams, + }; +} diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts new file mode 100644 index 000000000..4d1e30a09 --- /dev/null +++ b/src/resources/evals/index.ts @@ -0,0 +1,36 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Evals, + type EvalCustomDataSourceConfig, + type EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader, + type EvalTextSimilarityGrader, + type EvalCreateResponse, + type EvalRetrieveResponse, + type EvalUpdateResponse, + type EvalListResponse, + type EvalDeleteResponse, + type EvalCreateParams, + type EvalUpdateParams, + type EvalListParams, + type EvalListResponsesPage, +} from './evals'; +export { + Runs, + type CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource, + type EvalAPIError, + type RunCreateResponse, + type RunRetrieveResponse, + type RunListResponse, + type RunDeleteResponse, + type RunCancelResponse, + type RunCreateParams, + type RunRetrieveParams, + type RunListParams, + type RunDeleteParams, + type RunCancelParams, + type RunListResponsesPage, +} from './runs/index'; diff --git a/src/resources/evals/runs.ts b/src/resources/evals/runs.ts new file mode 100644 index 000000000..a3cc2bc7f --- /dev/null +++ b/src/resources/evals/runs.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './runs/index'; diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts new file mode 100644 index 000000000..e51e04c11 --- /dev/null +++ b/src/resources/evals/runs/index.ts @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + OutputItems, + type OutputItemRetrieveResponse, + type OutputItemListResponse, + type OutputItemRetrieveParams, + type OutputItemListParams, + type OutputItemListResponsesPage, +} from './output-items'; +export { + Runs, + type CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource, + type EvalAPIError, + type RunCreateResponse, + type RunRetrieveResponse, + type RunListResponse, + type RunDeleteResponse, + type RunCancelResponse, + type RunCreateParams, + type RunRetrieveParams, + type RunListParams, + type RunDeleteParams, + type RunCancelParams, + type RunListResponsesPage, +} from './runs'; diff --git a/src/resources/evals/runs/output-items.ts b/src/resources/evals/runs/output-items.ts new file mode 100644 index 000000000..e7c33f27e --- /dev/null +++ b/src/resources/evals/runs/output-items.ts @@ -0,0 +1,413 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as RunsAPI from './runs'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class OutputItems extends APIResource { + /** + * Get an evaluation run output item by ID. + */ + retrieve( + outputItemID: string, + params: OutputItemRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { eval_id, run_id } = params; + return this._client.get(path`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options); + } + + /** + * Get a list of output items for an evaluation run. + */ + list( + runID: string, + params: OutputItemListParams, + options?: RequestOptions, + ): PagePromise { + const { eval_id, ...query } = params; + return this._client.getAPIList( + path`/evals/${eval_id}/runs/${runID}/output_items`, + CursorPage, + { query, ...options }, + ); + } +} + +export type OutputItemListResponsesPage = CursorPage; + +/** + * A schema representing an evaluation run output item. + */ +export interface OutputItemRetrieveResponse { + /** + * Unique identifier for the evaluation run output item. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Details of the input data source item. + */ + datasource_item: Record; + + /** + * The identifier for the data source item. + */ + datasource_item_id: number; + + /** + * The identifier of the evaluation group. + */ + eval_id: string; + + /** + * The type of the object. Always "eval.run.output_item". + */ + object: 'eval.run.output_item'; + + /** + * A list of results from the evaluation run. + */ + results: Array>; + + /** + * The identifier of the evaluation run associated with this output item. + */ + run_id: string; + + /** + * A sample containing the input and output of the evaluation run. + */ + sample: OutputItemRetrieveResponse.Sample; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace OutputItemRetrieveResponse { + /** + * A sample containing the input and output of the evaluation run. + */ + export interface Sample { + /** + * An object representing an error response from the Eval API. + */ + error: RunsAPI.EvalAPIError; + + /** + * The reason why the sample generation was finished. + */ + finish_reason: string; + + /** + * An array of input messages. + */ + input: Array; + + /** + * The maximum number of tokens allowed for completion. + */ + max_completion_tokens: number; + + /** + * The model used for generating the sample. + */ + model: string; + + /** + * An array of output messages. + */ + output: Array; + + /** + * The seed used for generating the sample. + */ + seed: number; + + /** + * The sampling temperature used. + */ + temperature: number; + + /** + * The top_p value used for sampling. + */ + top_p: number; + + /** + * Token usage details for the sample. + */ + usage: Sample.Usage; + } + + export namespace Sample { + /** + * An input message. + */ + export interface Input { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message sender (e.g., system, user, developer). + */ + role: string; + } + + export interface Output { + /** + * The content of the message. + */ + content?: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role?: string; + } + + /** + * Token usage details for the sample. + */ + export interface Usage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + } +} + +/** + * A schema representing an evaluation run output item. + */ +export interface OutputItemListResponse { + /** + * Unique identifier for the evaluation run output item. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Details of the input data source item. + */ + datasource_item: Record; + + /** + * The identifier for the data source item. + */ + datasource_item_id: number; + + /** + * The identifier of the evaluation group. + */ + eval_id: string; + + /** + * The type of the object. Always "eval.run.output_item". + */ + object: 'eval.run.output_item'; + + /** + * A list of results from the evaluation run. + */ + results: Array>; + + /** + * The identifier of the evaluation run associated with this output item. + */ + run_id: string; + + /** + * A sample containing the input and output of the evaluation run. + */ + sample: OutputItemListResponse.Sample; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace OutputItemListResponse { + /** + * A sample containing the input and output of the evaluation run. + */ + export interface Sample { + /** + * An object representing an error response from the Eval API. + */ + error: RunsAPI.EvalAPIError; + + /** + * The reason why the sample generation was finished. + */ + finish_reason: string; + + /** + * An array of input messages. + */ + input: Array; + + /** + * The maximum number of tokens allowed for completion. + */ + max_completion_tokens: number; + + /** + * The model used for generating the sample. + */ + model: string; + + /** + * An array of output messages. + */ + output: Array; + + /** + * The seed used for generating the sample. + */ + seed: number; + + /** + * The sampling temperature used. + */ + temperature: number; + + /** + * The top_p value used for sampling. + */ + top_p: number; + + /** + * Token usage details for the sample. + */ + usage: Sample.Usage; + } + + export namespace Sample { + /** + * An input message. + */ + export interface Input { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message sender (e.g., system, user, developer). + */ + role: string; + } + + export interface Output { + /** + * The content of the message. + */ + content?: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role?: string; + } + + /** + * Token usage details for the sample. + */ + export interface Usage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + } +} + +export interface OutputItemRetrieveParams { + /** + * The ID of the evaluation to retrieve runs for. + */ + eval_id: string; + + /** + * The ID of the run to retrieve. + */ + run_id: string; +} + +export interface OutputItemListParams extends CursorPageParams { + /** + * Path param: The ID of the evaluation to retrieve runs for. + */ + eval_id: string; + + /** + * Query param: Sort order for output items by timestamp. Use `asc` for ascending + * order or `desc` for descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; + + /** + * Query param: Filter output items by status. Use `failed` to filter by failed + * output items or `pass` to filter by passed output items. + */ + status?: 'fail' | 'pass'; +} + +export declare namespace OutputItems { + export { + type OutputItemRetrieveResponse as OutputItemRetrieveResponse, + type OutputItemListResponse as OutputItemListResponse, + type OutputItemListResponsesPage as OutputItemListResponsesPage, + type OutputItemRetrieveParams as OutputItemRetrieveParams, + type OutputItemListParams as OutputItemListParams, + }; +} diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts new file mode 100644 index 000000000..ca5c265d9 --- /dev/null +++ b/src/resources/evals/runs/runs.ts @@ -0,0 +1,1073 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as Shared from '../../shared'; +import * as OutputItemsAPI from './output-items'; +import { + OutputItemListParams, + OutputItemListResponse, + OutputItemListResponsesPage, + OutputItemRetrieveParams, + OutputItemRetrieveResponse, + OutputItems, +} from './output-items'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Runs extends APIResource { + outputItems: OutputItemsAPI.OutputItems = new OutputItemsAPI.OutputItems(this._client); + + /** + * Create a new evaluation run. This is the endpoint that will kick off grading. + */ + create(evalID: string, body: RunCreateParams, options?: RequestOptions): APIPromise { + return this._client.post(path`/evals/${evalID}/runs`, { body, ...options }); + } + + /** + * Get an evaluation run by ID. + */ + retrieve( + runID: string, + params: RunRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { eval_id } = params; + return this._client.get(path`/evals/${eval_id}/runs/${runID}`, options); + } + + /** + * Get a list of runs for an evaluation. + */ + list( + evalID: string, + query: RunListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(path`/evals/${evalID}/runs`, CursorPage, { + query, + ...options, + }); + } + + /** + * Delete an eval run. + */ + delete(runID: string, params: RunDeleteParams, options?: RequestOptions): APIPromise { + const { eval_id } = params; + return this._client.delete(path`/evals/${eval_id}/runs/${runID}`, options); + } + + /** + * Cancel an ongoing evaluation run. + */ + cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise { + const { eval_id } = params; + return this._client.post(path`/evals/${eval_id}/runs/${runID}`, options); + } +} + +export type RunListResponsesPage = CursorPage; + +/** + * A CompletionsRunDataSource object describing a model sampling configuration. + */ +export interface CreateEvalCompletionsRunDataSource { + input_messages: + | CreateEvalCompletionsRunDataSource.Template + | CreateEvalCompletionsRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model: string; + + /** + * A StoredCompletionsRunDataSource configuration describing a set of filters + */ + source: + | CreateEvalCompletionsRunDataSource.FileContent + | CreateEvalCompletionsRunDataSource.FileID + | CreateEvalCompletionsRunDataSource.StoredCompletions; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + sampling_params?: CreateEvalCompletionsRunDataSource.SamplingParams; +} + +export namespace CreateEvalCompletionsRunDataSource { + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + export interface InputMessage { + content: InputMessage.Content; + + /** + * The role of the message. One of `user`, `system`, or `developer`. + */ + role: 'user' | 'system' | 'developer'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace InputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `input_text`. + */ + type: 'input_text'; + } + } + + export interface OutputMessage { + content: OutputMessage.Content; + + /** + * The role of the message. Must be `assistant` for output. + */ + role: 'assistant'; + + /** + * The type of item, which is always `message`. + */ + type: 'message'; + } + + export namespace OutputMessage { + export interface Content { + /** + * The text content. + */ + text: string; + + /** + * The type of content, which is always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A StoredCompletionsRunDataSource configuration describing a set of filters + */ + export interface StoredCompletions { + /** + * An optional Unix timestamp to filter items created after this time. + */ + created_after: number | null; + + /** + * An optional Unix timestamp to filter items created before this time. + */ + created_before: number | null; + + /** + * An optional maximum number of items to return. + */ + limit: number | null; + + /** + * 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; + + /** + * An optional model to filter by (e.g., 'gpt-4o'). + */ + model: string | null; + + /** + * The type of source. Always `stored_completions`. + */ + type: 'stored_completions'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } +} + +/** + * A JsonlRunDataSource object with that specifies a JSONL file that matches the + * eval + */ +export interface CreateEvalJSONLRunDataSource { + source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; + + /** + * The type of data source. Always `jsonl`. + */ + type: 'jsonl'; +} + +export namespace CreateEvalJSONLRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } +} + +/** + * An object representing an error response from the Eval API. + */ +export interface EvalAPIError { + /** + * The error code. + */ + code: string; + + /** + * The error message. + */ + message: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCreateResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCreateResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCreateResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +/** + * A schema representing an evaluation run. + */ +export interface RunRetrieveResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunRetrieveResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunRetrieveResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +/** + * A schema representing an evaluation run. + */ +export interface RunListResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunListResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunDeleteResponse { + deleted?: boolean; + + object?: string; + + run_id?: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCancelResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCancelResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCancelResponse { + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunCreateParams { + /** + * Details about the run's data source. + */ + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + + /** + * 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 name of the run. + */ + name?: string; +} + +export interface RunRetrieveParams { + /** + * The ID of the evaluation to retrieve runs for. + */ + eval_id: string; +} + +export interface RunListParams extends CursorPageParams { + /** + * Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for + * descending order. Defaults to `asc`. + */ + order?: 'asc' | 'desc'; + + /** + * Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" | + * "canceled". + */ + status?: 'queued' | 'in_progress' | 'completed' | 'canceled' | 'failed'; +} + +export interface RunDeleteParams { + /** + * The ID of the evaluation to delete the run from. + */ + eval_id: string; +} + +export interface RunCancelParams { + /** + * The ID of the evaluation whose run you want to cancel. + */ + eval_id: string; +} + +Runs.OutputItems = OutputItems; + +export declare namespace Runs { + export { + type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, + type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type EvalAPIError as EvalAPIError, + type RunCreateResponse as RunCreateResponse, + type RunRetrieveResponse as RunRetrieveResponse, + type RunListResponse as RunListResponse, + type RunDeleteResponse as RunDeleteResponse, + type RunCancelResponse as RunCancelResponse, + type RunListResponsesPage as RunListResponsesPage, + type RunCreateParams as RunCreateParams, + type RunRetrieveParams as RunRetrieveParams, + type RunListParams as RunListParams, + type RunDeleteParams as RunDeleteParams, + type RunCancelParams as RunCancelParams, + }; + + export { + OutputItems as OutputItems, + type OutputItemRetrieveResponse as OutputItemRetrieveResponse, + type OutputItemListResponse as OutputItemListResponse, + type OutputItemListResponsesPage as OutputItemListResponsesPage, + type OutputItemRetrieveParams as OutputItemRetrieveParams, + type OutputItemListParams as OutputItemListParams, + }; +} diff --git a/src/resources/fine-tuning/checkpoints.ts b/src/resources/fine-tuning/checkpoints.ts new file mode 100644 index 000000000..eb09063f6 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './checkpoints/index'; diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts new file mode 100644 index 000000000..91cab6fc9 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as PermissionsAPI from './permissions'; +import { + PermissionCreateParams, + PermissionCreateResponse, + PermissionCreateResponsesPage, + PermissionDeleteResponse, + PermissionRetrieveParams, + PermissionRetrieveResponse, + Permissions, +} from './permissions'; + +export class Checkpoints extends APIResource { + permissions: PermissionsAPI.Permissions = new PermissionsAPI.Permissions(this._client); +} + +Checkpoints.Permissions = Permissions; + +export declare namespace Checkpoints { + export { + Permissions as Permissions, + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionCreateParams as PermissionCreateParams, + type PermissionRetrieveParams as PermissionRetrieveParams, + }; +} diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts new file mode 100644 index 000000000..c5b018cea --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Checkpoints } from './checkpoints'; +export { + Permissions, + type PermissionCreateResponse, + type PermissionRetrieveResponse, + type PermissionDeleteResponse, + type PermissionCreateParams, + type PermissionRetrieveParams, + type PermissionCreateResponsesPage, +} from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts new file mode 100644 index 000000000..ba1e79ca8 --- /dev/null +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import { APIPromise } from '../../../core/api-promise'; +import { Page, PagePromise } from '../../../core/pagination'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Permissions extends APIResource { + /** + * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). + * + * This enables organization owners to share fine-tuned models with other projects + * in their organization. + */ + create( + fineTunedModelCheckpoint: string, + body: PermissionCreateParams, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList( + path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + Page, + { body, method: 'post', ...options }, + ); + } + + /** + * **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. + */ + retrieve( + fineTunedModelCheckpoint: string, + query: PermissionRetrieveParams | null | undefined = {}, + options?: RequestOptions, + ): APIPromise { + return this._client.get(path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, { + query, + ...options, + }); + } + + /** + * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). + * + * Organization owners can use this endpoint to delete a permission for a + * fine-tuned model checkpoint. + */ + delete(fineTunedModelCheckpoint: string, options?: RequestOptions): APIPromise { + return this._client.delete( + path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + options, + ); + } +} + +// Note: no pagination actually occurs yet, this is for forwards-compatibility. +export type PermissionCreateResponsesPage = Page; + +/** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ +export interface PermissionCreateResponse { + /** + * 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 PermissionRetrieveResponse { + data: Array; + + has_more: boolean; + + object: 'list'; + + first_id?: string | null; + + last_id?: string | null; +} + +export namespace PermissionRetrieveResponse { + /** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ + export interface Data { + /** + * 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. + */ + id: string; + + /** + * Whether the fine-tuned model checkpoint permission was successfully deleted. + */ + deleted: boolean; + + /** + * The object type, which is always "checkpoint.permission". + */ + object: 'checkpoint.permission'; +} + +export interface PermissionCreateParams { + /** + * The project identifiers to grant access to. + */ + project_ids: Array; +} + +export interface PermissionRetrieveParams { + /** + * Identifier for the last permission ID from the previous pagination request. + */ + after?: string; + + /** + * Number of permissions to retrieve. + */ + limit?: number; + + /** + * The order in which to retrieve permissions. + */ + order?: 'ascending' | 'descending'; + + /** + * The ID of the project to get permissions for. + */ + project_id?: string; +} + +export declare namespace Permissions { + export { + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionRetrieveResponse as PermissionRetrieveResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionCreateParams as PermissionCreateParams, + type PermissionRetrieveParams as PermissionRetrieveParams, + }; +} diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index be9eb0f89..6836f2127 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -1,6 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import * as CheckpointsAPI from './checkpoints/checkpoints'; +import { Checkpoints } from './checkpoints/checkpoints'; import * as JobsAPI from './jobs/jobs'; import { FineTuningJob, @@ -18,9 +20,11 @@ import { export class FineTuning extends APIResource { jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); + checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); } FineTuning.Jobs = Jobs; +FineTuning.Checkpoints = Checkpoints; export declare namespace FineTuning { export { @@ -36,4 +40,6 @@ export declare namespace FineTuning { type JobListParams as JobListParams, type JobListEventsParams as JobListEventsParams, }; + + export { Checkpoints as Checkpoints }; } diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 52ef721b8..29e57394a 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Checkpoints } from './checkpoints/index'; export { FineTuning } from './fine-tuning'; export { Jobs, diff --git a/src/resources/index.ts b/src/resources/index.ts index 99a703037..11b37eb14 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -29,6 +29,23 @@ export { type EmbeddingModel, type EmbeddingCreateParams, } from './embeddings'; +export { + Evals, + type EvalCustomDataSourceConfig, + type EvalLabelModelGrader, + type EvalStoredCompletionsDataSourceConfig, + type EvalStringCheckGrader, + type EvalTextSimilarityGrader, + type EvalCreateResponse, + type EvalRetrieveResponse, + type EvalUpdateResponse, + type EvalListResponse, + type EvalDeleteResponse, + type EvalCreateParams, + type EvalUpdateParams, + type EvalListParams, + type EvalListResponsesPage, +} from './evals/evals'; export { Files, type FileContent, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts new file mode 100644 index 000000000..f8efe2713 --- /dev/null +++ b/tests/api-resources/evals/evals.test.ts @@ -0,0 +1,395 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource evals', () => { + test('create: only required params', async () => { + const responsePromise = client.evals.create({ + data_source_config: { + item_schema: { + '0': 'bar', + '1': 'bar', + '2': 'bar', + '3': 'bar', + '4': 'bar', + '5': 'bar', + '6': 'bar', + '7': 'bar', + '8': 'bar', + '9': 'bar', + '10': 'bar', + '11': 'bar', + '12': 'bar', + '13': 'bar', + '14': 'bar', + '15': 'bar', + '16': 'bar', + '17': 'bar', + '18': 'bar', + '19': 'bar', + '20': 'bar', + '21': 'bar', + '22': 'bar', + '23': 'bar', + '24': 'bar', + '25': 'bar', + '26': 'bar', + '27': 'bar', + '28': 'bar', + '29': 'bar', + '30': 'bar', + '31': 'bar', + '32': 'bar', + '33': 'bar', + '34': 'bar', + '35': 'bar', + '36': 'bar', + '37': 'bar', + '38': 'bar', + '39': 'bar', + '40': 'bar', + '41': 'bar', + '42': 'bar', + '43': 'bar', + '44': 'bar', + '45': 'bar', + '46': 'bar', + '47': 'bar', + '48': 'bar', + '49': 'bar', + '50': 'bar', + '51': 'bar', + '52': 'bar', + '53': 'bar', + '54': 'bar', + '55': 'bar', + '56': 'bar', + '57': 'bar', + '58': 'bar', + '59': 'bar', + '60': 'bar', + '61': 'bar', + '62': 'bar', + '63': 'bar', + '64': 'bar', + '65': 'bar', + '66': 'bar', + '67': 'bar', + '68': 'bar', + '69': 'bar', + '70': 'bar', + '71': 'bar', + '72': 'bar', + '73': 'bar', + '74': 'bar', + '75': 'bar', + '76': 'bar', + '77': 'bar', + '78': 'bar', + '79': 'bar', + '80': 'bar', + '81': 'bar', + '82': 'bar', + '83': 'bar', + '84': 'bar', + '85': 'bar', + '86': 'bar', + '87': 'bar', + '88': 'bar', + '89': 'bar', + '90': 'bar', + '91': 'bar', + '92': 'bar', + '93': 'bar', + '94': 'bar', + '95': 'bar', + '96': 'bar', + '97': 'bar', + '98': 'bar', + '99': 'bar', + '100': 'bar', + '101': 'bar', + '102': 'bar', + '103': 'bar', + '104': 'bar', + '105': 'bar', + '106': 'bar', + '107': 'bar', + '108': 'bar', + '109': 'bar', + '110': 'bar', + '111': 'bar', + '112': 'bar', + '113': 'bar', + '114': 'bar', + '115': 'bar', + '116': 'bar', + '117': 'bar', + '118': 'bar', + '119': 'bar', + '120': 'bar', + '121': 'bar', + '122': 'bar', + '123': 'bar', + '124': 'bar', + '125': 'bar', + '126': 'bar', + '127': 'bar', + '128': 'bar', + '129': 'bar', + '130': 'bar', + '131': 'bar', + '132': 'bar', + '133': 'bar', + '134': 'bar', + '135': 'bar', + '136': 'bar', + '137': 'bar', + '138': 'bar', + '139': 'bar', + }, + type: 'custom', + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + }); + 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('create: required and optional params', async () => { + const response = await client.evals.create({ + data_source_config: { + item_schema: { + '0': 'bar', + '1': 'bar', + '2': 'bar', + '3': 'bar', + '4': 'bar', + '5': 'bar', + '6': 'bar', + '7': 'bar', + '8': 'bar', + '9': 'bar', + '10': 'bar', + '11': 'bar', + '12': 'bar', + '13': 'bar', + '14': 'bar', + '15': 'bar', + '16': 'bar', + '17': 'bar', + '18': 'bar', + '19': 'bar', + '20': 'bar', + '21': 'bar', + '22': 'bar', + '23': 'bar', + '24': 'bar', + '25': 'bar', + '26': 'bar', + '27': 'bar', + '28': 'bar', + '29': 'bar', + '30': 'bar', + '31': 'bar', + '32': 'bar', + '33': 'bar', + '34': 'bar', + '35': 'bar', + '36': 'bar', + '37': 'bar', + '38': 'bar', + '39': 'bar', + '40': 'bar', + '41': 'bar', + '42': 'bar', + '43': 'bar', + '44': 'bar', + '45': 'bar', + '46': 'bar', + '47': 'bar', + '48': 'bar', + '49': 'bar', + '50': 'bar', + '51': 'bar', + '52': 'bar', + '53': 'bar', + '54': 'bar', + '55': 'bar', + '56': 'bar', + '57': 'bar', + '58': 'bar', + '59': 'bar', + '60': 'bar', + '61': 'bar', + '62': 'bar', + '63': 'bar', + '64': 'bar', + '65': 'bar', + '66': 'bar', + '67': 'bar', + '68': 'bar', + '69': 'bar', + '70': 'bar', + '71': 'bar', + '72': 'bar', + '73': 'bar', + '74': 'bar', + '75': 'bar', + '76': 'bar', + '77': 'bar', + '78': 'bar', + '79': 'bar', + '80': 'bar', + '81': 'bar', + '82': 'bar', + '83': 'bar', + '84': 'bar', + '85': 'bar', + '86': 'bar', + '87': 'bar', + '88': 'bar', + '89': 'bar', + '90': 'bar', + '91': 'bar', + '92': 'bar', + '93': 'bar', + '94': 'bar', + '95': 'bar', + '96': 'bar', + '97': 'bar', + '98': 'bar', + '99': 'bar', + '100': 'bar', + '101': 'bar', + '102': 'bar', + '103': 'bar', + '104': 'bar', + '105': 'bar', + '106': 'bar', + '107': 'bar', + '108': 'bar', + '109': 'bar', + '110': 'bar', + '111': 'bar', + '112': 'bar', + '113': 'bar', + '114': 'bar', + '115': 'bar', + '116': 'bar', + '117': 'bar', + '118': 'bar', + '119': 'bar', + '120': 'bar', + '121': 'bar', + '122': 'bar', + '123': 'bar', + '124': 'bar', + '125': 'bar', + '126': 'bar', + '127': 'bar', + '128': 'bar', + '129': 'bar', + '130': 'bar', + '131': 'bar', + '132': 'bar', + '133': 'bar', + '134': 'bar', + '135': 'bar', + '136': 'bar', + '137': 'bar', + '138': 'bar', + '139': 'bar', + }, + type: 'custom', + include_sample_schema: true, + }, + testing_criteria: [ + { + input: [{ content: 'content', role: 'role' }], + labels: ['string'], + model: 'model', + name: 'name', + passing_labels: ['string'], + type: 'label_model', + }, + ], + metadata: { foo: 'string' }, + name: 'name', + share_with_openai: true, + }); + }); + + test('retrieve', async () => { + const responsePromise = client.evals.retrieve('eval_id'); + 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('update', async () => { + const responsePromise = client.evals.update('eval_id', {}); + 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', async () => { + const responsePromise = client.evals.list(); + 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.evals.list( + { after: 'after', limit: 0, order: 'asc', order_by: 'created_at' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete', async () => { + const responsePromise = client.evals.delete('eval_id'); + 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); + }); +}); diff --git a/tests/api-resources/evals/runs/output-items.test.ts b/tests/api-resources/evals/runs/output-items.test.ts new file mode 100644 index 000000000..e173b2a28 --- /dev/null +++ b/tests/api-resources/evals/runs/output-items.test.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource outputItems', () => { + test('retrieve: only required params', async () => { + const responsePromise = client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + 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('retrieve: required and optional params', async () => { + const response = await client.evals.runs.outputItems.retrieve('output_item_id', { + eval_id: 'eval_id', + run_id: 'run_id', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.evals.runs.outputItems.list('run_id', { eval_id: 'eval_id' }); + 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: required and optional params', async () => { + const response = await client.evals.runs.outputItems.list('run_id', { + eval_id: 'eval_id', + after: 'after', + limit: 0, + order: 'asc', + status: 'fail', + }); + }); +}); diff --git a/tests/api-resources/evals/runs/runs.test.ts b/tests/api-resources/evals/runs/runs.test.ts new file mode 100644 index 000000000..d17cd2a9a --- /dev/null +++ b/tests/api-resources/evals/runs/runs.test.ts @@ -0,0 +1,101 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource runs', () => { + test('create: only required params', async () => { + const responsePromise = client.evals.runs.create('eval_id', { + data_source: { source: { content: [{ item: { foo: 'bar' } }], type: 'file_content' }, type: 'jsonl' }, + }); + 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('create: required and optional params', async () => { + const response = await client.evals.runs.create('eval_id', { + data_source: { + source: { content: [{ item: { foo: 'bar' }, sample: { foo: 'bar' } }], type: 'file_content' }, + type: 'jsonl', + }, + metadata: { foo: 'string' }, + name: 'name', + }); + }); + + test('retrieve: only required params', async () => { + const responsePromise = client.evals.runs.retrieve('run_id', { eval_id: 'eval_id' }); + 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('retrieve: required and optional params', async () => { + const response = await client.evals.runs.retrieve('run_id', { eval_id: 'eval_id' }); + }); + + test('list', async () => { + const responsePromise = client.evals.runs.list('eval_id'); + 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.evals.runs.list( + 'eval_id', + { after: 'after', limit: 0, order: 'asc', status: 'queued' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete: only required params', async () => { + const responsePromise = client.evals.runs.delete('run_id', { eval_id: 'eval_id' }); + 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('delete: required and optional params', async () => { + const response = await client.evals.runs.delete('run_id', { eval_id: 'eval_id' }); + }); + + test('cancel: only required params', async () => { + const responsePromise = client.evals.runs.cancel('run_id', { eval_id: 'eval_id' }); + 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('cancel: required and optional params', async () => { + const response = await client.evals.runs.cancel('run_id', { eval_id: 'eval_id' }); + }); +}); diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts new file mode 100644 index 000000000..1e0be0537 --- /dev/null +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -0,0 +1,66 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource permissions', () => { + test('create: only required params', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + ); + 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('create: required and optional params', async () => { + const response = await client.fineTuning.checkpoints.permissions.create( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + { project_ids: ['string'] }, + ); + }); + + test('retrieve', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.retrieve('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('retrieve: 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.retrieve( + 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + { after: 'after', limit: 0, order: 'ascending', project_id: 'project_id' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete', async () => { + const responsePromise = client.fineTuning.checkpoints.permissions.delete( + 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + ); + 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); + }); +}); From db23ff3a179229557de07eefcda879492435b572 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:44:34 +0000 Subject: [PATCH 360/509] chore(internal): fix examples --- .stats.yml | 4 +- .../beta/threads/runs/runs.test.ts | 2 +- .../beta/threads/threads.test.ts | 2 +- tests/api-resources/evals/evals.test.ts | 293 +----------------- tests/api-resources/images.test.ts | 6 +- tests/api-resources/moderations.test.ts | 5 +- 6 files changed, 10 insertions(+), 302 deletions(-) diff --git a/.stats.yml b/.stats.yml index ebe07c137..4a82ee242 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-472fe3036ea745365257fe870c0330917fb3153705c2826f49873cd631319b0a.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: ef19d36c307306f14f2e1cd5c834a151 +config_hash: d6c61213488683418adb860a9ee1501b diff --git a/tests/api-resources/beta/threads/runs/runs.test.ts b/tests/api-resources/beta/threads/runs/runs.test.ts index 118a4f324..becea1425 100644 --- a/tests/api-resources/beta/threads/runs/runs.test.ts +++ b/tests/api-resources/beta/threads/runs/runs.test.ts @@ -36,7 +36,7 @@ describe('resource runs', () => { max_completion_tokens: 256, max_prompt_tokens: 256, metadata: { foo: 'string' }, - model: 'gpt-4o', + model: 'string', parallel_tool_calls: true, reasoning_effort: 'low', response_format: 'auto', diff --git a/tests/api-resources/beta/threads/threads.test.ts b/tests/api-resources/beta/threads/threads.test.ts index 532bacb7c..342e673b3 100644 --- a/tests/api-resources/beta/threads/threads.test.ts +++ b/tests/api-resources/beta/threads/threads.test.ts @@ -99,7 +99,7 @@ describe('resource threads', () => { max_completion_tokens: 256, max_prompt_tokens: 256, metadata: { foo: 'string' }, - model: 'gpt-4o', + model: 'string', parallel_tool_calls: true, response_format: 'auto', stream: false, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts index f8efe2713..7d896e55f 100644 --- a/tests/api-resources/evals/evals.test.ts +++ b/tests/api-resources/evals/evals.test.ts @@ -10,151 +10,7 @@ const client = new OpenAI({ describe('resource evals', () => { test('create: only required params', async () => { const responsePromise = client.evals.create({ - data_source_config: { - item_schema: { - '0': 'bar', - '1': 'bar', - '2': 'bar', - '3': 'bar', - '4': 'bar', - '5': 'bar', - '6': 'bar', - '7': 'bar', - '8': 'bar', - '9': 'bar', - '10': 'bar', - '11': 'bar', - '12': 'bar', - '13': 'bar', - '14': 'bar', - '15': 'bar', - '16': 'bar', - '17': 'bar', - '18': 'bar', - '19': 'bar', - '20': 'bar', - '21': 'bar', - '22': 'bar', - '23': 'bar', - '24': 'bar', - '25': 'bar', - '26': 'bar', - '27': 'bar', - '28': 'bar', - '29': 'bar', - '30': 'bar', - '31': 'bar', - '32': 'bar', - '33': 'bar', - '34': 'bar', - '35': 'bar', - '36': 'bar', - '37': 'bar', - '38': 'bar', - '39': 'bar', - '40': 'bar', - '41': 'bar', - '42': 'bar', - '43': 'bar', - '44': 'bar', - '45': 'bar', - '46': 'bar', - '47': 'bar', - '48': 'bar', - '49': 'bar', - '50': 'bar', - '51': 'bar', - '52': 'bar', - '53': 'bar', - '54': 'bar', - '55': 'bar', - '56': 'bar', - '57': 'bar', - '58': 'bar', - '59': 'bar', - '60': 'bar', - '61': 'bar', - '62': 'bar', - '63': 'bar', - '64': 'bar', - '65': 'bar', - '66': 'bar', - '67': 'bar', - '68': 'bar', - '69': 'bar', - '70': 'bar', - '71': 'bar', - '72': 'bar', - '73': 'bar', - '74': 'bar', - '75': 'bar', - '76': 'bar', - '77': 'bar', - '78': 'bar', - '79': 'bar', - '80': 'bar', - '81': 'bar', - '82': 'bar', - '83': 'bar', - '84': 'bar', - '85': 'bar', - '86': 'bar', - '87': 'bar', - '88': 'bar', - '89': 'bar', - '90': 'bar', - '91': 'bar', - '92': 'bar', - '93': 'bar', - '94': 'bar', - '95': 'bar', - '96': 'bar', - '97': 'bar', - '98': 'bar', - '99': 'bar', - '100': 'bar', - '101': 'bar', - '102': 'bar', - '103': 'bar', - '104': 'bar', - '105': 'bar', - '106': 'bar', - '107': 'bar', - '108': 'bar', - '109': 'bar', - '110': 'bar', - '111': 'bar', - '112': 'bar', - '113': 'bar', - '114': 'bar', - '115': 'bar', - '116': 'bar', - '117': 'bar', - '118': 'bar', - '119': 'bar', - '120': 'bar', - '121': 'bar', - '122': 'bar', - '123': 'bar', - '124': 'bar', - '125': 'bar', - '126': 'bar', - '127': 'bar', - '128': 'bar', - '129': 'bar', - '130': 'bar', - '131': 'bar', - '132': 'bar', - '133': 'bar', - '134': 'bar', - '135': 'bar', - '136': 'bar', - '137': 'bar', - '138': 'bar', - '139': 'bar', - }, - type: 'custom', - }, + data_source_config: { item_schema: { foo: 'bar' }, type: 'custom' }, testing_criteria: [ { input: [{ content: 'content', role: 'role' }], @@ -177,152 +33,7 @@ describe('resource evals', () => { test('create: required and optional params', async () => { const response = await client.evals.create({ - data_source_config: { - item_schema: { - '0': 'bar', - '1': 'bar', - '2': 'bar', - '3': 'bar', - '4': 'bar', - '5': 'bar', - '6': 'bar', - '7': 'bar', - '8': 'bar', - '9': 'bar', - '10': 'bar', - '11': 'bar', - '12': 'bar', - '13': 'bar', - '14': 'bar', - '15': 'bar', - '16': 'bar', - '17': 'bar', - '18': 'bar', - '19': 'bar', - '20': 'bar', - '21': 'bar', - '22': 'bar', - '23': 'bar', - '24': 'bar', - '25': 'bar', - '26': 'bar', - '27': 'bar', - '28': 'bar', - '29': 'bar', - '30': 'bar', - '31': 'bar', - '32': 'bar', - '33': 'bar', - '34': 'bar', - '35': 'bar', - '36': 'bar', - '37': 'bar', - '38': 'bar', - '39': 'bar', - '40': 'bar', - '41': 'bar', - '42': 'bar', - '43': 'bar', - '44': 'bar', - '45': 'bar', - '46': 'bar', - '47': 'bar', - '48': 'bar', - '49': 'bar', - '50': 'bar', - '51': 'bar', - '52': 'bar', - '53': 'bar', - '54': 'bar', - '55': 'bar', - '56': 'bar', - '57': 'bar', - '58': 'bar', - '59': 'bar', - '60': 'bar', - '61': 'bar', - '62': 'bar', - '63': 'bar', - '64': 'bar', - '65': 'bar', - '66': 'bar', - '67': 'bar', - '68': 'bar', - '69': 'bar', - '70': 'bar', - '71': 'bar', - '72': 'bar', - '73': 'bar', - '74': 'bar', - '75': 'bar', - '76': 'bar', - '77': 'bar', - '78': 'bar', - '79': 'bar', - '80': 'bar', - '81': 'bar', - '82': 'bar', - '83': 'bar', - '84': 'bar', - '85': 'bar', - '86': 'bar', - '87': 'bar', - '88': 'bar', - '89': 'bar', - '90': 'bar', - '91': 'bar', - '92': 'bar', - '93': 'bar', - '94': 'bar', - '95': 'bar', - '96': 'bar', - '97': 'bar', - '98': 'bar', - '99': 'bar', - '100': 'bar', - '101': 'bar', - '102': 'bar', - '103': 'bar', - '104': 'bar', - '105': 'bar', - '106': 'bar', - '107': 'bar', - '108': 'bar', - '109': 'bar', - '110': 'bar', - '111': 'bar', - '112': 'bar', - '113': 'bar', - '114': 'bar', - '115': 'bar', - '116': 'bar', - '117': 'bar', - '118': 'bar', - '119': 'bar', - '120': 'bar', - '121': 'bar', - '122': 'bar', - '123': 'bar', - '124': 'bar', - '125': 'bar', - '126': 'bar', - '127': 'bar', - '128': 'bar', - '129': 'bar', - '130': 'bar', - '131': 'bar', - '132': 'bar', - '133': 'bar', - '134': 'bar', - '135': 'bar', - '136': 'bar', - '137': 'bar', - '138': 'bar', - '139': 'bar', - }, - type: 'custom', - include_sample_schema: true, - }, + data_source_config: { item_schema: { foo: 'bar' }, type: 'custom', include_sample_schema: true }, testing_criteria: [ { input: [{ content: 'content', role: 'role' }], diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index fab30e32d..67b608d7e 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -24,7 +24,7 @@ describe('resource images', () => { test('createVariation: required and optional params', async () => { const response = await client.images.createVariation({ image: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'dall-e-2', + model: 'string', n: 1, response_format: 'url', size: '1024x1024', @@ -51,7 +51,7 @@ describe('resource images', () => { image: await toFile(Buffer.from('# my file contents'), 'README.md'), prompt: 'A cute baby sea otter wearing a beret', mask: await toFile(Buffer.from('# my file contents'), 'README.md'), - model: 'dall-e-2', + model: 'string', n: 1, response_format: 'url', size: '1024x1024', @@ -73,7 +73,7 @@ describe('resource images', () => { test('generate: required and optional params', async () => { const response = await client.images.generate({ prompt: 'A cute baby sea otter', - model: 'dall-e-3', + model: 'string', n: 1, quality: 'standard', response_format: 'url', diff --git a/tests/api-resources/moderations.test.ts b/tests/api-resources/moderations.test.ts index d50175b2d..c3dce6843 100644 --- a/tests/api-resources/moderations.test.ts +++ b/tests/api-resources/moderations.test.ts @@ -20,9 +20,6 @@ describe('resource moderations', () => { }); test('create: required and optional params', async () => { - const response = await client.moderations.create({ - input: 'I want to kill them.', - model: 'omni-moderation-2024-09-26', - }); + const response = await client.moderations.create({ input: 'I want to kill them.', model: 'string' }); }); }); From 5b81f62ac12969cf0a6da8bf0bfde81ff025e092 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:46:27 +0000 Subject: [PATCH 361/509] chore(internal): skip broken test --- .stats.yml | 2 +- .../api-resources/fine-tuning/checkpoints/permissions.test.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4a82ee242..c39ce1186 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: d6c61213488683418adb860a9ee1501b +config_hash: 43dc8df20ffec9d1503f91866cb2b7d9 diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts index 1e0be0537..ce632add1 100644 --- a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -51,7 +51,8 @@ describe('resource permissions', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - test('delete', async () => { + // OpenAPI spec is slightly incorrect + test.skip('delete', async () => { const responsePromise = client.fineTuning.checkpoints.permissions.delete( 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', ); From 959eace6ec132a83f731fa496d5b8b7a11fa6bb2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:05:16 +0000 Subject: [PATCH 362/509] feat(api): manual updates --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c39ce1186..d4a4370a7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-32de3bc513663c5fac922c49be41c222b6ee8c0b841d8966bcdfa489d441daa3.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: 43dc8df20ffec9d1503f91866cb2b7d9 +config_hash: 69e3afd56ccb0f0f822a7a9dc130fc99 From e4a7f674f719a87bb78378a5ce4639d84620e17a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:26:33 +0000 Subject: [PATCH 363/509] chore: workaround build errors --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d4a4370a7..9d8d07c6a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 -config_hash: 69e3afd56ccb0f0f822a7a9dc130fc99 +config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea From 3dcbe171d4d2a93e645828b39395363f064136b0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:31:41 +0000 Subject: [PATCH 364/509] chore(internal): upload builds and expand CI branch coverage --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++--------- scripts/utils/upload-artifact.sh | 25 +++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100755 scripts/utils/upload-artifact.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41cd0bd37..84f140261 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,19 +1,18 @@ name: CI on: push: - branches: - - master - pull_request: - branches: - - master - - next - - alpha + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'preview-head/**' + - 'preview-base/**' + - 'preview/**' jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -32,6 +31,9 @@ jobs: name: build runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 @@ -45,10 +47,24 @@ jobs: - name: Check build run: ./scripts/build + + - name: Get GitHub OIDC Token + if: github.repository == 'stainless-sdks/openai-typescript' + id: github-oidc + uses: actions/github-script@v6 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + if: github.repository == 'stainless-sdks/openai-typescript' + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh test: name: test runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 000000000..0ee2e688a --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -exuo pipefail + +RESPONSE=$(curl -X POST "$URL" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(tar -cz dist | curl -v -X PUT \ + -H "Content-Type: application/gzip" \ + --data-binary @- "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/openai-typescript/$SHA'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi From ee3f48333a1d73a096f3417b2701fd722e4fbc68 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 18:02:16 +0000 Subject: [PATCH 365/509] chore(internal): improve node 18 shims --- package.json | 4 ++ scripts/build | 2 - src/internal/shims/crypto.node.d.mts | 1 - src/internal/shims/crypto.node.d.ts | 10 ---- src/internal/shims/crypto.node.js | 11 ---- src/internal/shims/crypto.node.mjs | 2 - src/internal/shims/crypto.ts | 18 ++++++ src/internal/shims/file.node.d.mts | 1 - src/internal/shims/file.node.d.ts | 20 ------- src/internal/shims/file.node.js | 11 ---- src/internal/shims/file.node.mjs | 2 - src/internal/shims/file.ts | 32 +++++++++++ src/internal/shims/getBuiltinModule.ts | 64 ++++++++++++++++++++++ src/internal/shims/nullGetBuiltinModule.ts | 1 + src/internal/to-file.ts | 4 +- src/internal/uploads.ts | 9 +-- src/internal/utils/uuid.ts | 16 ++++-- tests/uploads.test.ts | 2 +- 18 files changed, 136 insertions(+), 74 deletions(-) delete mode 100644 src/internal/shims/crypto.node.d.mts delete mode 100644 src/internal/shims/crypto.node.d.ts delete mode 100644 src/internal/shims/crypto.node.js delete mode 100644 src/internal/shims/crypto.node.mjs create mode 100644 src/internal/shims/crypto.ts delete mode 100644 src/internal/shims/file.node.d.mts delete mode 100644 src/internal/shims/file.node.d.ts delete mode 100644 src/internal/shims/file.node.js delete mode 100644 src/internal/shims/file.node.mjs create mode 100644 src/internal/shims/file.ts create mode 100644 src/internal/shims/getBuiltinModule.ts create mode 100644 src/internal/shims/nullGetBuiltinModule.ts diff --git a/package.json b/package.json index 5638a355c..2c8f80f06 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,10 @@ "resolutions": { "synckit": "0.8.8" }, + "browser": { + "./internal/shims/getBuiltinModule.mjs": "./internal/shims/nullGetBuiltinModule.mjs", + "./internal/shims/getBuiltinModule.js": "./internal/shims/nullGetBuiltinModule.js" + }, "imports": { "openai": ".", "openai/*": "./src/*" diff --git a/scripts/build b/scripts/build index e9ebac741..5cec10804 100755 --- a/scripts/build +++ b/scripts/build @@ -35,8 +35,6 @@ node scripts/utils/fix-index-exports.cjs cp tsconfig.dist-src.json dist/src/tsconfig.json cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts -mkdir -p dist/internal/shims -cp src/internal/shims/*.{mjs,js,d.ts,d.mts} dist/internal/shims node scripts/utils/postprocess-files.cjs diff --git a/src/internal/shims/crypto.node.d.mts b/src/internal/shims/crypto.node.d.mts deleted file mode 100644 index 5cc196301..000000000 --- a/src/internal/shims/crypto.node.d.mts +++ /dev/null @@ -1 +0,0 @@ -export { crypto } from './crypto.node.js'; diff --git a/src/internal/shims/crypto.node.d.ts b/src/internal/shims/crypto.node.d.ts deleted file mode 100644 index dc7caac8d..000000000 --- a/src/internal/shims/crypto.node.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export declare const crypto: { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ - getRandomValues(array: T): T; - /** - * Available only in secure contexts. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) - */ - randomUUID?: () => string; -}; diff --git a/src/internal/shims/crypto.node.js b/src/internal/shims/crypto.node.js deleted file mode 100644 index 83062a3d7..000000000 --- a/src/internal/shims/crypto.node.js +++ /dev/null @@ -1,11 +0,0 @@ -if (typeof require !== 'undefined') { - if (globalThis.crypto) { - exports.crypto = globalThis.crypto; - } else { - try { - // Use [require][0](...) and not require(...) so bundlers don't try to bundle the - // crypto module. - exports.crypto = [require][0]('node:crypto').webcrypto; - } catch (e) {} - } -} diff --git a/src/internal/shims/crypto.node.mjs b/src/internal/shims/crypto.node.mjs deleted file mode 100644 index 24c6f3b9e..000000000 --- a/src/internal/shims/crypto.node.mjs +++ /dev/null @@ -1,2 +0,0 @@ -import * as mod from './crypto.node.js'; -export const crypto = globalThis.crypto || mod.crypto; diff --git a/src/internal/shims/crypto.ts b/src/internal/shims/crypto.ts new file mode 100644 index 000000000..905f81c6f --- /dev/null +++ b/src/internal/shims/crypto.ts @@ -0,0 +1,18 @@ +import { getBuiltinModule } from './getBuiltinModule'; + +type Crypto = { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ + getRandomValues(array: T): T; + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) + */ + randomUUID?: () => string; +}; +export let getCrypto: () => Crypto | undefined = function lazyGetCrypto() { + if (getCrypto !== lazyGetCrypto) return getCrypto(); + const crypto: Crypto = (globalThis as any).crypto || (getBuiltinModule?.('node:crypto') as any)?.webcrypto; + getCrypto = () => crypto; + return crypto; +}; diff --git a/src/internal/shims/file.node.d.mts b/src/internal/shims/file.node.d.mts deleted file mode 100644 index 38cc9ff7a..000000000 --- a/src/internal/shims/file.node.d.mts +++ /dev/null @@ -1 +0,0 @@ -export { File } from './file.node.js'; diff --git a/src/internal/shims/file.node.d.ts b/src/internal/shims/file.node.d.ts deleted file mode 100644 index 9dc6b2fcc..000000000 --- a/src/internal/shims/file.node.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// The infer is to make TS show it as a nice union type, -// instead of literally `ConstructorParameters[0]` -type FallbackBlobSource = ConstructorParameters[0] extends infer T ? T : never; -/** - * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. - */ -declare class FallbackFile extends Blob { - constructor(sources: FallbackBlobSource, fileName: string, options?: any); - /** - * The name of the `File`. - */ - readonly name: string; - /** - * The last modified date of the `File`. - */ - readonly lastModified: number; -} -export type File = InstanceType; -export const File: typeof globalThis extends { File: infer fileConstructor } ? fileConstructor -: typeof FallbackFile; diff --git a/src/internal/shims/file.node.js b/src/internal/shims/file.node.js deleted file mode 100644 index 3f8c2ed68..000000000 --- a/src/internal/shims/file.node.js +++ /dev/null @@ -1,11 +0,0 @@ -if (typeof require !== 'undefined') { - if (globalThis.File) { - exports.File = globalThis.File; - } else { - try { - // Use [require][0](...) and not require(...) so bundlers don't try to bundle the - // buffer module. - exports.File = [require][0]('node:buffer').File; - } catch (e) {} - } -} diff --git a/src/internal/shims/file.node.mjs b/src/internal/shims/file.node.mjs deleted file mode 100644 index 1f103f5d3..000000000 --- a/src/internal/shims/file.node.mjs +++ /dev/null @@ -1,2 +0,0 @@ -import * as mod from './file.node.js'; -export const File = globalThis.File || mod.File; diff --git a/src/internal/shims/file.ts b/src/internal/shims/file.ts new file mode 100644 index 000000000..d5dc82091 --- /dev/null +++ b/src/internal/shims/file.ts @@ -0,0 +1,32 @@ +import { getBuiltinModule } from './getBuiltinModule'; + +export let getFile = function lazyGetFile(): FileConstructor { + if (getFile !== lazyGetFile) return getFile(); + // We can drop getBuiltinModule once we no longer support Node < 20.0.0 + const File = (globalThis as any).File ?? (getBuiltinModule?.('node:buffer') as any)?.File; + if (!File) throw new Error('`File` is not defined as a global, which is required for file uploads.'); + getFile = () => File; + return File; +}; + +type FileConstructor = + typeof globalThis extends { File: infer fileConstructor } ? fileConstructor : typeof FallbackFile; +export type File = InstanceType; + +// The infer is to make TS show it as a nice union type, +// instead of literally `ConstructorParameters[0]` +type FallbackBlobSource = ConstructorParameters[0] extends infer T ? T : never; +/** + * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. + */ +declare class FallbackFile extends Blob { + constructor(sources: FallbackBlobSource, fileName: string, options?: any); + /** + * The name of the `File`. + */ + readonly name: string; + /** + * The last modified date of the `File`. + */ + readonly lastModified: number; +} diff --git a/src/internal/shims/getBuiltinModule.ts b/src/internal/shims/getBuiltinModule.ts new file mode 100644 index 000000000..a202f2097 --- /dev/null +++ b/src/internal/shims/getBuiltinModule.ts @@ -0,0 +1,64 @@ +/** + * Load a Node built-in module. ID may or may not be prefixed by `node:` and + * will be normalized. If we used static imports then our bundle size would be bloated by + * injected polyfills, and if we used dynamic require then in addition to bundlers logging warnings, + * our code would not work when bundled to ESM and run in Node 18. + * @param {string} id ID of the built-in to be loaded. + * @returns {object|undefined} exports of the built-in. Undefined if the built-in + * does not exist. + */ +export let getBuiltinModule: null | ((id: string) => object | undefined) = function getBuiltinModuleLazy( + id: string, +): object | undefined { + try { + if (getBuiltinModule !== getBuiltinModuleLazy) return getBuiltinModule!(id); + if ((process as any).getBuiltinModule) { + getBuiltinModule = (process as any).getBuiltinModule; + } else { + /* Fallback implementation for Node 18 */ + function createFallbackGetBuiltinModule(BuiltinModule: any) { + return function getBuiltinModule(id: string): object | undefined { + id = BuiltinModule.normalizeRequirableId(String(id)); + if (!BuiltinModule.canBeRequiredByUsers(id)) { + return; + } + const mod = BuiltinModule.map.get(id); + mod.compileForPublicLoader(); + return mod.exports; + }; + } + const magicKey = Math.random() + ''; + let module: { BuiltinModule: any } | undefined; + try { + const kClone = Object.getOwnPropertySymbols(Blob.prototype).find( + (e) => e.description?.includes('clone'), + )!; + Object.defineProperty(Object.prototype, magicKey, { + get() { + module = this; + throw null; + }, + configurable: true, + }); + structuredClone( + new (class extends Blob { + [kClone]() { + return { + deserializeInfo: 'internal/bootstrap/realm:' + magicKey, + }; + } + })([]), + ); + } catch {} + delete (Object.prototype as any)[magicKey]; + if (module) { + getBuiltinModule = createFallbackGetBuiltinModule(module.BuiltinModule); + } else { + getBuiltinModule = () => undefined; + } + } + return getBuiltinModule!(id); + } catch { + return undefined; + } +}; diff --git a/src/internal/shims/nullGetBuiltinModule.ts b/src/internal/shims/nullGetBuiltinModule.ts new file mode 100644 index 000000000..8bd2280d3 --- /dev/null +++ b/src/internal/shims/nullGetBuiltinModule.ts @@ -0,0 +1 @@ +export const getBuiltinModule = null; diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts index 69b76d3a6..e92ac6944 100644 --- a/src/internal/to-file.ts +++ b/src/internal/to-file.ts @@ -1,4 +1,4 @@ -import { File } from './shims/file.node.js'; +import { type File, getFile } from './shims/file'; import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads'; import type { FilePropertyBag } from './builtin-types'; @@ -90,7 +90,7 @@ export async function toFile( // If we've been given a `File` we don't need to do anything if (isFileLike(value)) { - if (File && value instanceof File) { + if (value instanceof getFile()) { return value; } return makeFile([await value.arrayBuffer()], value.name); diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 2c286497c..116a5ab4e 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -1,7 +1,7 @@ import { type RequestOptions } from './request-options'; import type { FilePropertyBag, Fetch } from './builtin-types'; import type { OpenAI } from '../client'; -import { File } from './shims/file.node.js'; +import { type File, getFile } from './shims/file'; import { ReadableStreamFrom } from './shims'; export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; @@ -32,10 +32,7 @@ export function makeFile( fileName: string | undefined, options?: FilePropertyBag, ): File { - if (typeof File === 'undefined') { - throw new Error('`File` is not defined as a global which is required for file uploads'); - } - + const File = getFile(); return new File(fileBits as any, fileName ?? 'unknown_file', options); } @@ -129,7 +126,7 @@ export const createForm = async >( // We check for Blob not File because Bun.File doesn't inherit from File, // but they both inherit from Blob and have a `name` property at runtime. const isNamedBlob = (value: object) => - (File && value instanceof File) || (value instanceof Blob && 'name' in value); + value instanceof getFile() || (value instanceof Blob && 'name' in value); const isUploadable = (value: unknown) => typeof value === 'object' && diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts index 1349c42c3..5a262c6d3 100644 --- a/src/internal/utils/uuid.ts +++ b/src/internal/utils/uuid.ts @@ -1,13 +1,19 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { crypto } from '../shims/crypto.node.js'; +import { getCrypto } from '../shims/crypto'; /** * https://stackoverflow.com/a/2117523 */ -export function uuid4() { - if (crypto.randomUUID) return crypto.randomUUID(); +export let uuid4 = function () { + const crypto = getCrypto(); + if (crypto?.randomUUID) { + uuid4 = crypto.randomUUID.bind(crypto); + return crypto.randomUUID(); + } + const u8 = new Uint8Array(1); + const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff; return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => - (+c ^ (crypto.getRandomValues(new Uint8Array(1))[0]! & (15 >> (+c / 4)))).toString(16), + (+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16), ); -} +}; diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts index 902a788a4..d66ed412f 100644 --- a/tests/uploads.test.ts +++ b/tests/uploads.test.ts @@ -101,7 +101,7 @@ describe('missing File error message', () => { await expect( uploads.toFile(mockResponse({ url: 'https://example.com/my/audio.mp3' })), ).rejects.toMatchInlineSnapshot( - `[Error: \`File\` is not defined as a global which is required for file uploads]`, + `[Error: \`File\` is not defined as a global, which is required for file uploads.]`, ); }); }); From bb39dbae2830f64ede70f0ae1cea2935d1720911 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 21:08:41 +0000 Subject: [PATCH 366/509] chore(internal): reduce CI branch coverage --- .github/workflows/ci.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84f140261..205e2685a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,12 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'preview-head/**' - - 'preview-base/**' - - 'preview/**' + branches: + - main + pull_request: + branches: + - main + - next jobs: lint: From abfff03f49e62e195d112229127be674cc44497d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 17:56:21 +0000 Subject: [PATCH 367/509] fix(internal): fix file uploads in node 18 jest --- src/internal/shims/getBuiltinModule.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/internal/shims/getBuiltinModule.ts b/src/internal/shims/getBuiltinModule.ts index a202f2097..64daa2ce0 100644 --- a/src/internal/shims/getBuiltinModule.ts +++ b/src/internal/shims/getBuiltinModule.ts @@ -29,11 +29,13 @@ export let getBuiltinModule: null | ((id: string) => object | undefined) = funct } const magicKey = Math.random() + ''; let module: { BuiltinModule: any } | undefined; + let ObjectPrototype: {} = Blob; + for (let next; (next = Reflect.getPrototypeOf(ObjectPrototype)); ObjectPrototype = next); try { const kClone = Object.getOwnPropertySymbols(Blob.prototype).find( (e) => e.description?.includes('clone'), )!; - Object.defineProperty(Object.prototype, magicKey, { + Object.defineProperty(ObjectPrototype, magicKey, { get() { module = this; throw null; @@ -50,7 +52,7 @@ export let getBuiltinModule: null | ((id: string) => object | undefined) = funct })([]), ); } catch {} - delete (Object.prototype as any)[magicKey]; + delete (ObjectPrototype as any)[magicKey]; if (module) { getBuiltinModule = createFallbackGetBuiltinModule(module.BuiltinModule); } else { From 5032c2802bd51885270badf47e27768f62240d25 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 14:30:50 +0000 Subject: [PATCH 368/509] chore(client): minor internal fixes --- src/client.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.ts b/src/client.ts index 4469a5628..0d3887384 100644 --- a/src/client.ts +++ b/src/client.ts @@ -738,17 +738,17 @@ export class OpenAI { } buildRequest( - options: FinalRequestOptions, + inputOptions: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, ): { req: FinalizedRequestInit; url: string; timeout: number } { - options = { ...options }; + const options = { ...inputOptions }; const { method, path, query } = options; const url = this.buildURL(path!, query as Record); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); options.timeout = options.timeout ?? this.timeout; const { bodyHeaders, body } = this.buildBody({ options }); - const reqHeaders = this.buildHeaders({ options, method, bodyHeaders, retryCount }); + const reqHeaders = this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount }); const req: FinalizedRequestInit = { method, From 8a2a7454bee0fbe9e4729d47f6b894e5f25d68f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 16:40:49 +0000 Subject: [PATCH 369/509] feat(api): adding gpt-4.1 family of model IDs --- .stats.yml | 4 ++-- src/resources/beta/assistants.ts | 6 ++++++ src/resources/shared.ts | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9d8d07c6a..b40485bd0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-44b20fa9d24544217fe6bb48852037537030a1ad29b202936425110744fe66fb.yml -openapi_spec_hash: ea86343b5e9858a74e85da8ab2c532f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a555f81249cb084f463dcefa4aba069f9341fdaf3dd6ac27d7f237fc90e8f488.yml +openapi_spec_hash: 8e590296cd1a54b9508510b0c7a2c45a config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 217782aa7..40cc82384 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -1327,6 +1327,12 @@ export interface AssistantUpdateParams { */ model?: | (string & {}) + | 'gpt-4.1' + | 'gpt-4.1-mini' + | 'gpt-4.1-nano' + | 'gpt-4.1-2025-04-14' + | 'gpt-4.1-mini-2025-04-14' + | 'gpt-4.1-nano-2025-04-14' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 3e8ded763..94ef50585 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -9,6 +9,12 @@ export type AllModels = | 'computer-use-preview-2025-03-11'; export type ChatModel = + | 'gpt-4.1' + | 'gpt-4.1-mini' + | 'gpt-4.1-nano' + | 'gpt-4.1-2025-04-14' + | 'gpt-4.1-mini-2025-04-14' + | 'gpt-4.1-nano-2025-04-14' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' From 19cda5d3b908238ae6c6f5609ac3a118d4d8acc2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 16:42:26 +0000 Subject: [PATCH 370/509] feat(api): add o3 and o4-mini model IDs --- .stats.yml | 6 +- src/resources/chat/completions/completions.ts | 55 ++++++++++++++++--- src/resources/completions.ts | 2 + src/resources/responses/responses.ts | 46 +++++++++++++++- src/resources/shared.ts | 19 +++++-- .../api-resources/responses/responses.test.ts | 3 +- 6 files changed, 112 insertions(+), 19 deletions(-) diff --git a/.stats.yml b/.stats.yml index b40485bd0..848c5b5ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a555f81249cb084f463dcefa4aba069f9341fdaf3dd6ac27d7f237fc90e8f488.yml -openapi_spec_hash: 8e590296cd1a54b9508510b0c7a2c45a -config_hash: 5ea32de61ff42fcf5e66cff8d9e247ea +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5633633cc38734869cf7d993f7b549bb8e4d10e0ec45381ec2cd91507cd8eb8f.yml +openapi_spec_hash: c855121b2b2324b99499c9244c21d24d +config_hash: d20837393b73efdb19cd08e04c1cc9a1 diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 720e8a583..94b9108e5 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -129,9 +129,25 @@ export interface ChatCompletion { object: 'chat.completion'; /** - * The service tier used for processing the request. + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ - service_tier?: 'scale' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -308,11 +324,11 @@ export interface ChatCompletionAudioParam { * Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, * or `pcm16`. */ - format: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16'; + format: 'wav' | 'aac' | 'mp3' | 'flac' | 'opus' | 'pcm16'; /** * The voice the model uses to respond. Supported voices are `alloy`, `ash`, - * `ballad`, `coral`, `echo`, `sage`, and `shimmer`. + * `ballad`, `coral`, `echo`, `fable`, `nova`, `onyx`, `sage`, and `shimmer`. */ voice: | (string & {}) @@ -364,9 +380,25 @@ export interface ChatCompletionChunk { object: 'chat.completion.chunk'; /** - * The service tier used for processing the request. + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. */ - service_tier?: 'scale' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -1098,7 +1130,7 @@ export interface ChatCompletionCreateParamsBase { messages: Array; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -1178,7 +1210,7 @@ export interface ChatCompletionCreateParamsBase { * * This value is now deprecated in favor of `max_completion_tokens`, and is not * compatible with - * [o1 series models](https://platform.openai.com/docs/guides/reasoning). + * [o-series models](https://platform.openai.com/docs/guides/reasoning). */ max_tokens?: number | null; @@ -1280,14 +1312,19 @@ export interface ChatCompletionCreateParamsBase { * latency guarentee. * - If set to 'default', the request will be processed using the default service * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). * - When not set, the default behavior is 'auto'. * * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | null; + service_tier?: 'auto' | 'default' | 'flex' | null; /** + * Not supported with latest reasoning models `o3` and `o4-mini`. + * * Up to 4 sequences where the API will stop generating further tokens. The * returned text will not contain the stop sequence. */ diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 4777a359d..1930a0bc0 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -290,6 +290,8 @@ export interface CompletionCreateParamsBase { seed?: number | null; /** + * Not supported with latest reasoning models `o3` and `o4-mini`. + * * Up to 4 sequences where the API will stop generating further tokens. The * returned text will not contain the stop sequence. */ diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 83835a0f7..3bcca579e 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -249,7 +249,7 @@ export interface Response { metadata: Shared.Metadata | null; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -342,6 +342,27 @@ export interface Response { */ reasoning?: Shared.Reasoning | null; + /** + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. + */ + service_tier?: 'auto' | 'default' | 'flex' | null; + /** * The status of the response generation. One of `completed`, `failed`, * `in_progress`, or `incomplete`. @@ -2601,7 +2622,7 @@ export interface ResponseCreateParamsBase { input: string | ResponseInput; /** - * Model ID used to generate the response, like `gpt-4o` or `o1`. OpenAI offers a + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a * wide range of models with different capabilities, performance characteristics, * and price points. Refer to the * [model guide](https://platform.openai.com/docs/models) to browse and compare @@ -2668,6 +2689,27 @@ export interface ResponseCreateParamsBase { */ reasoning?: Shared.Reasoning | null; + /** + * Specifies the latency tier to use for processing the request. This parameter is + * relevant for customers subscribed to the scale tier service: + * + * - If set to 'auto', and the Project is Scale tier enabled, the system will + * 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. + * - If set to 'default', the request will be processed using the default service + * tier with a lower uptime SLA and no latency guarentee. + * - If set to 'flex', the request will be processed with the Flex Processing + * service tier. + * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - When not set, the default behavior is 'auto'. + * + * When this parameter is set, the response body will include the `service_tier` + * utilized. + */ + service_tier?: 'auto' | 'default' | 'flex' | null; + /** * Whether to store the generated model response for later retrieval via API. */ diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 94ef50585..1c0006b18 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -15,6 +15,10 @@ export type ChatModel = | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano-2025-04-14' + | 'o4-mini' + | 'o4-mini-2025-04-16' + | 'o3' + | 'o3-2025-04-16' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o1' @@ -187,13 +191,20 @@ export interface Reasoning { effort?: ReasoningEffort | null; /** - * **computer_use_preview only** + * @deprecated **Deprecated:** use `summary` instead. * * A summary of the reasoning performed by the model. This can be useful for - * debugging and understanding the model's reasoning process. One of `concise` or - * `detailed`. + * debugging and understanding the model's reasoning process. One of `auto`, + * `concise`, or `detailed`. */ - generate_summary?: 'concise' | 'detailed' | null; + generate_summary?: 'auto' | 'concise' | 'detailed' | null; + + /** + * A summary of the reasoning performed by the model. This can be useful for + * debugging and understanding the model's reasoning process. One of `auto`, + * `concise`, or `detailed`. + */ + summary?: 'auto' | 'concise' | 'detailed' | null; } /** diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index e025facc4..40b39ab55 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -29,7 +29,8 @@ describe('resource responses', () => { metadata: { foo: 'string' }, parallel_tool_calls: true, previous_response_id: 'previous_response_id', - reasoning: { effort: 'low', generate_summary: 'concise' }, + reasoning: { effort: 'low', generate_summary: 'auto', summary: 'auto' }, + service_tier: 'auto', store: true, stream: false, temperature: 1, From 11b9534d317f87cdcb1934ead013f058865e675e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 17:01:11 +0000 Subject: [PATCH 371/509] chore(perf): faster base64 decoding --- src/internal/utils/base64.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/internal/utils/base64.ts b/src/internal/utils/base64.ts index 84854e241..aa7b420e2 100644 --- a/src/internal/utils/base64.ts +++ b/src/internal/utils/base64.ts @@ -22,15 +22,17 @@ export const toBase64 = (data: string | Uint8Array | null | undefined): string = export const fromBase64 = (str: string): Uint8Array => { if (typeof (globalThis as any).Buffer !== 'undefined') { - return new Uint8Array((globalThis as any).Buffer.from(str, 'base64')); + const buf = (globalThis as any).Buffer.from(str, 'base64'); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); } if (typeof atob !== 'undefined') { - return new Uint8Array( - atob(str) - .split('') - .map((c) => c.charCodeAt(0)), - ); + const bstr = atob(str); + const buf = new Uint8Array(bstr.length); + for (let i = 0; i < bstr.length; i++) { + buf[i] = bstr.charCodeAt(i); + } + return buf; } throw new OpenAIError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined'); From 5775451a55212687ba998b332c1394528d98121f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:12:52 +0000 Subject: [PATCH 372/509] chore(ci): add timeout thresholds for CI jobs --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 205e2685a..26440957d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: jobs: lint: + timeout-minutes: 10 name: lint runs-on: ubuntu-latest steps: @@ -27,6 +28,7 @@ jobs: run: ./scripts/lint build: + timeout-minutes: 5 name: build runs-on: ubuntu-latest @@ -62,6 +64,7 @@ jobs: SHA: ${{ github.sha }} run: ./scripts/utils/upload-artifact.sh test: + timeout-minutes: 10 name: test runs-on: ubuntu-latest steps: From a0010fdb60fe723ebc70103cceca552aca51855e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 16:29:54 +0000 Subject: [PATCH 373/509] feat(api): adding new image model support --- .stats.yml | 6 +- MIGRATION.md | 1 + api.md | 6 +- src/resources/beta/realtime/realtime.ts | 98 +- src/resources/beta/threads/threads.ts | 4 +- src/resources/evals/evals.ts | 749 +++++++- src/resources/evals/runs/runs.ts | 1699 ++++++++++++++--- .../fine-tuning/checkpoints/checkpoints.ts | 2 + .../fine-tuning/checkpoints/index.ts | 1 + .../fine-tuning/checkpoints/permissions.ts | 17 +- src/resources/images.ts | 202 +- src/resources/responses/responses.ts | 162 ++ tests/api-resources/evals/evals.test.ts | 1 - .../checkpoints/permissions.test.ts | 15 +- tests/api-resources/images.test.ts | 7 +- 15 files changed, 2550 insertions(+), 420 deletions(-) diff --git a/.stats.yml b/.stats.yml index 848c5b5ad..d92408173 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5633633cc38734869cf7d993f7b549bb8e4d10e0ec45381ec2cd91507cd8eb8f.yml -openapi_spec_hash: c855121b2b2324b99499c9244c21d24d -config_hash: d20837393b73efdb19cd08e04c1cc9a1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml +openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03 +config_hash: b597cd9a31e9e5ec709e2eefb4c54122 diff --git a/MIGRATION.md b/MIGRATION.md index 448d99b6e..2e63d6445 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -112,6 +112,7 @@ client.parents.children.retrieve('c_456', { parent_id: 'p_123' }); This affects the following methods +- `client.fineTuning.checkpoints.permissions.delete()` - `client.vectorStores.files.retrieve()` - `client.vectorStores.files.update()` - `client.vectorStores.files.delete()` diff --git a/api.md b/api.md index 8ed2e9964..3a27b52ef 100644 --- a/api.md +++ b/api.md @@ -247,7 +247,7 @@ Methods: - client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage - client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse -- client.fineTuning.checkpoints.permissions.delete(fineTunedModelCheckpoint) -> PermissionDeleteResponse +- client.fineTuning.checkpoints.permissions.delete(permissionID, { ...params }) -> PermissionDeleteResponse # VectorStores @@ -625,6 +625,10 @@ Types: - ResponseOutputRefusal - ResponseOutputText - ResponseReasoningItem +- ResponseReasoningSummaryPartAddedEvent +- ResponseReasoningSummaryPartDoneEvent +- ResponseReasoningSummaryTextDeltaEvent +- ResponseReasoningSummaryTextDoneEvent - ResponseRefusalDeltaEvent - ResponseRefusalDoneEvent - ResponseStatus diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index f4e1becfc..b60c945e8 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -915,12 +915,34 @@ export type RealtimeClientEvent = | ConversationItemTruncateEvent | InputAudioBufferAppendEvent | InputAudioBufferClearEvent + | RealtimeClientEvent.OutputAudioBufferClear | InputAudioBufferCommitEvent | ResponseCancelEvent | ResponseCreateEvent | SessionUpdateEvent | TranscriptionSessionUpdate; +export namespace RealtimeClientEvent { + /** + * **WebRTC Only:** Emit to cut off the current audio response. This will trigger + * the server to stop generating audio and emit a `output_audio_buffer.cleared` + * event. This event should be preceded by a `response.cancel` client event to stop + * the generation of the current response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferClear { + /** + * The event type, must be `output_audio_buffer.clear`. + */ + type: 'output_audio_buffer.clear'; + + /** + * The unique ID of the client event used for error handling. + */ + event_id?: string; + } +} + /** * The response resource. */ @@ -1174,7 +1196,10 @@ export type RealtimeServerEvent = | ResponseTextDoneEvent | SessionCreatedEvent | SessionUpdatedEvent - | TranscriptionSessionUpdatedEvent; + | TranscriptionSessionUpdatedEvent + | RealtimeServerEvent.OutputAudioBufferStarted + | RealtimeServerEvent.OutputAudioBufferStopped + | RealtimeServerEvent.OutputAudioBufferCleared; export namespace RealtimeServerEvent { /** @@ -1197,6 +1222,77 @@ export namespace RealtimeServerEvent { */ type: 'conversation.item.retrieved'; } + + /** + * **WebRTC Only:** Emitted when the server begins streaming audio to the client. + * This event is emitted after an audio content part has been added + * (`response.content_part.added`) to the response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferStarted { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.started`. + */ + type: 'output_audio_buffer.started'; + } + + /** + * **WebRTC Only:** Emitted when the output audio buffer has been completely + * drained on the server, and no more audio is forthcoming. This event is emitted + * after the full response data has been sent to the client (`response.done`). + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferStopped { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.stopped`. + */ + type: 'output_audio_buffer.stopped'; + } + + /** + * **WebRTC Only:** Emitted when the output audio buffer is cleared. This happens + * either in VAD mode when the user has interrupted + * (`input_audio_buffer.speech_started`), or when the client has emitted the + * `output_audio_buffer.clear` event to manually cut off the current audio + * response. + * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + */ + export interface OutputAudioBufferCleared { + /** + * The unique ID of the server event. + */ + event_id: string; + + /** + * The unique ID of the response that produced the audio. + */ + response_id: string; + + /** + * The event type, must be `output_audio_buffer.cleared`. + */ + type: 'output_audio_buffer.cleared'; + } } /** diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index b06ac458f..e03667ccd 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -677,9 +677,7 @@ export interface ThreadCreateAndRunParamsBase { * Override the tools the assistant can use for this run. This is useful for * modifying the behavior on a per-run basis. */ - tools?: Array< - AssistantsAPI.CodeInterpreterTool | AssistantsAPI.FileSearchTool | AssistantsAPI.FunctionTool - > | null; + tools?: Array | null; /** * An alternative to sampling with temperature, called nucleus sampling, where the diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index ca5d82b42..172a1c47b 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; +import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, @@ -99,7 +100,7 @@ export interface EvalCustomDataSourceConfig { * the evaluation. */ export interface EvalLabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -128,57 +129,43 @@ export interface EvalLabelModelGrader { } export namespace EvalLabelModelGrader { - export interface InputMessage { - content: InputMessage.Content; - + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { /** - * The role of the message. One of `user`, `system`, or `developer`. + * Text inputs to the model - can contain template strings. */ - role: 'user' | 'system' | 'developer'; + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; /** - * The type of item, which is always `message`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - type: 'message'; - } - - export namespace InputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `input_text`. - */ - type: 'input_text'; - } - } - - export interface Assistant { - content: Assistant.Content; + role: 'user' | 'assistant' | 'system' | 'developer'; /** - * The role of the message. Must be `assistant` for output. + * The type of the message input. Always `message`. */ - role: 'assistant'; + type?: 'message'; + } + export namespace Input { /** - * The type of item, which is always `message`. + * A text output from the model. */ - type: 'message'; - } - - export namespace Assistant { - export interface Content { + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `output_text`. + * The type of the output text. Always `output_text`. */ type: 'output_text'; } @@ -251,8 +238,8 @@ export interface EvalStringCheckGrader { */ export interface EvalTextSimilarityGrader { /** - * The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`, `gleu`, - * `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, + * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. */ evaluation_metric: | 'fuzzy_match' @@ -264,8 +251,7 @@ export interface EvalTextSimilarityGrader { | 'rouge_3' | 'rouge_4' | 'rouge_5' - | 'rouge_l' - | 'cosine'; + | 'rouge_l'; /** * The text being graded. @@ -338,14 +324,131 @@ export interface EvalCreateResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalCreateResponse.Python + | EvalCreateResponse.ScoreModel + >; +} +export namespace EvalCreateResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. */ - testing_criteria: Array; + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -393,14 +496,131 @@ export interface EvalRetrieveResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalRetrieveResponse.Python + | EvalRetrieveResponse.ScoreModel + >; +} +export namespace EvalRetrieveResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -448,14 +668,131 @@ export interface EvalUpdateResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. + */ + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalUpdateResponse.Python + | EvalUpdateResponse.ScoreModel + >; +} + +export namespace EvalUpdateResponse { + /** + * A PythonGrader object that runs a python script on the input. */ - share_with_openai: boolean; + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } /** - * A list of testing criteria. + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } /** @@ -503,14 +840,131 @@ export interface EvalListResponse { object: 'eval'; /** - * Indicates whether the evaluation is shared with OpenAI. + * A list of testing criteria. */ - share_with_openai: boolean; + testing_criteria: Array< + | EvalLabelModelGrader + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalListResponse.Python + | EvalListResponse.ScoreModel + >; +} +export namespace EvalListResponse { /** - * A list of testing criteria. + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. */ - testing_criteria: Array; + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } } export interface EvalDeleteResponse { @@ -525,12 +979,18 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs; /** * A list of graders for all eval runs in this group. */ - testing_criteria: Array; + testing_criteria: Array< + | EvalCreateParams.LabelModel + | EvalStringCheckGrader + | EvalTextSimilarityGrader + | EvalCreateParams.Python + | EvalCreateParams.ScoreModel + >; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -546,11 +1006,6 @@ export interface EvalCreateParams { * The name of the evaluation. */ name?: string; - - /** - * Indicates whether the evaluation is shared with OpenAI. - */ - share_with_openai?: boolean; } export namespace EvalCreateParams { @@ -564,7 +1019,7 @@ export namespace EvalCreateParams { */ export interface Custom { /** - * The json schema for the run data source items. + * The json schema for each row in the data source. */ item_schema: Record; @@ -574,7 +1029,8 @@ export namespace EvalCreateParams { type: 'custom'; /** - * Whether to include the sample schema in the data source. + * Whether the eval should expect you to populate the sample namespace (ie, by + * generating responses off of your data source) */ include_sample_schema?: boolean; } @@ -584,21 +1040,16 @@ export namespace EvalCreateParams { * completions query. This is usually metadata like `usecase=chatbot` or * `prompt-version=v2`, etc. */ - export interface StoredCompletions { + export interface Logs { /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `logs`. */ - type: 'stored_completions'; + type: 'logs'; /** - * 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 filters for the logs data source. */ - metadata?: Shared.Metadata | null; + metadata?: Record; } /** @@ -606,7 +1057,11 @@ export namespace EvalCreateParams { * the evaluation. */ export interface LabelModel { - input: Array; + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + input: Array; /** * The labels to classify to each item in the evaluation. @@ -647,57 +1102,157 @@ export namespace EvalCreateParams { role: string; } - export interface InputMessage { - content: InputMessage.Content; + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; /** - * The role of the message. One of `user`, `system`, or `developer`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - role: 'user' | 'system' | 'developer'; + role: 'user' | 'assistant' | 'system' | 'developer'; /** - * The type of item, which is always `message`. + * The type of the message input. Always `message`. */ - type: 'message'; + type?: 'message'; } - export namespace InputMessage { - export interface Content { + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `input_text`. + * The type of the output text. Always `output_text`. */ - type: 'input_text'; + type: 'output_text'; } } + } + + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface Python { + /** + * The name of the grader. + */ + name: string; - export interface OutputMessage { - content: OutputMessage.Content; + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + } + + /** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ + export interface ScoreModel { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The threshold for the score. + */ + pass_threshold?: number; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; + } + + export namespace ScoreModel { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { /** - * The role of the message. Must be `assistant` for output. + * Text inputs to the model - can contain template strings. */ - role: 'assistant'; + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; /** - * The type of item, which is always `message`. + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. */ - type: 'message'; + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; } - export namespace OutputMessage { - export interface Content { + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { /** - * The text content. + * The text output from the model. */ text: string; /** - * The type of content, which is always `output_text`. + * The type of the output text. Always `output_text`. */ type: 'output_text'; } diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index ca5c265d9..4f12435e4 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../core/resource'; import * as Shared from '../../shared'; +import * as ResponsesAPI from '../../responses/responses'; import * as OutputItemsAPI from './output-items'; import { OutputItemListParams, @@ -75,15 +76,6 @@ export type RunListResponsesPage = CursorPage; * A CompletionsRunDataSource object describing a model sampling configuration. */ export interface CreateEvalCompletionsRunDataSource { - input_messages: - | CreateEvalCompletionsRunDataSource.Template - | CreateEvalCompletionsRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model: string; - /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -97,105 +89,19 @@ export interface CreateEvalCompletionsRunDataSource { */ type: 'completions'; + input_messages?: + | CreateEvalCompletionsRunDataSource.Template + | CreateEvalCompletionsRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + sampling_params?: CreateEvalCompletionsRunDataSource.SamplingParams; } export namespace CreateEvalCompletionsRunDataSource { - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - export interface InputMessage { - content: InputMessage.Content; - - /** - * The role of the message. One of `user`, `system`, or `developer`. - */ - role: 'user' | 'system' | 'developer'; - - /** - * The type of item, which is always `message`. - */ - type: 'message'; - } - - export namespace InputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `input_text`. - */ - type: 'input_text'; - } - } - - export interface OutputMessage { - content: OutputMessage.Content; - - /** - * The role of the message. Must be `assistant` for output. - */ - role: 'assistant'; - - /** - * The type of item, which is always `message`. - */ - type: 'message'; - } - - export namespace OutputMessage { - export interface Content { - /** - * The text content. - */ - text: string; - - /** - * The type of content, which is always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - export interface FileContent { /** * The content of the jsonl file. @@ -232,20 +138,25 @@ export namespace CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ export interface StoredCompletions { + /** + * The type of source. Always `stored_completions`. + */ + type: 'stored_completions'; + /** * An optional Unix timestamp to filter items created after this time. */ - created_after: number | null; + created_after?: number | null; /** * An optional Unix timestamp to filter items created before this time. */ - created_before: number | null; + created_before?: number | null; /** * An optional maximum number of items to return. */ - limit: number | null; + limit?: number | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -255,17 +166,81 @@ export namespace CreateEvalCompletionsRunDataSource { * Keys are strings with a maximum length of 64 characters. Values are strings with * a maximum length of 512 characters. */ - metadata: Shared.Metadata | null; + metadata?: Shared.Metadata | null; /** * An optional model to filter by (e.g., 'gpt-4o'). */ - model: string | null; + model?: string | null; + } + export interface Template { /** - * The type of source. Always `stored_completions`. + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. */ - type: 'stored_completions'; + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Message { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Message.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Message { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; } export interface SamplingParams { @@ -370,7 +345,10 @@ export interface RunCreateResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCreateResponse.Completions; /** * An object representing an error response from the Eval API. @@ -434,162 +412,240 @@ export interface RunCreateResponse { } export namespace RunCreateResponse { - export interface PerModelUsage { - /** - * The number of tokens retrieved from cache. - */ - cached_tokens: number; - + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { /** - * The number of completion tokens generated. + * A EvalResponsesSource object describing a run data source configuration. */ - completion_tokens: number; + source: Completions.FileContent | Completions.FileID | Completions.Responses; /** - * The number of invocations. + * The type of run data source. Always `completions`. */ - invocation_count: number; + type: 'completions'; - /** - * The name of the model. - */ - model_name: string; + input_messages?: Completions.Template | Completions.ItemReference; /** - * The number of prompt tokens used. + * The name of the model to use for generating completions (e.g. "o3-mini"). */ - prompt_tokens: number; + model?: string; - /** - * The total number of tokens used. - */ - total_tokens: number; + sampling_params?: Completions.SamplingParams; } - export interface PerTestingCriteriaResult { - /** - * Number of tests failed for this criteria. - */ - failed: number; + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; - /** - * Number of tests passed for this criteria. - */ - passed: number; + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } - /** - * A description of the testing criteria. - */ - testing_criteria: string; - } + export namespace FileContent { + export interface Content { + item: Record; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - export interface ResultCounts { - /** - * Number of output items that resulted in an error. - */ - errored: number; + sample?: Record; + } + } - /** - * Number of output items that failed to pass the evaluation. - */ - failed: number; + export interface FileID { + /** + * The identifier of the file. + */ + id: string; - /** - * Number of output items that passed the evaluation. - */ - passed: number; + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } /** - * Total number of executed output items. + * A EvalResponsesSource object describing a run data source configuration. */ - total: number; - } -} + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; -/** - * A schema representing an evaluation run. - */ -export interface RunRetrieveResponse { - /** - * Unique identifier for the evaluation run. - */ - id: string; + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; - /** - * Unix timestamp (in seconds) when the evaluation run was created. - */ - created_at: number; + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; - /** - * Information about the run's data source. - */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; - /** - * An object representing an error response from the Eval API. - */ - error: EvalAPIError; + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; - /** - * The identifier of the associated evaluation. - */ - eval_id: string; + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; - /** - * 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; + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; - /** - * The model that is evaluated, if applicable. - */ - model: string; + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; - /** - * The name of the evaluation run. - */ - name: string; + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; - /** - * The type of the object. Always "eval.run". - */ - object: 'eval.run'; + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; - /** - * Usage statistics for each model during the evaluation run. - */ - per_model_usage: Array; + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; - /** - * Results per testing criteria applied during the evaluation run. - */ - per_testing_criteria_results: Array; + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } - /** - * The URL to the rendered evaluation run report on the UI dashboard. - */ - report_url: string; + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunRetrieveResponse.ResultCounts; + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } - /** - * The status of the evaluation run. - */ - status: string; -} + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } -export namespace RunRetrieveResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -668,7 +724,7 @@ export namespace RunRetrieveResponse { /** * A schema representing an evaluation run. */ -export interface RunListResponse { +export interface RunRetrieveResponse { /** * Unique identifier for the evaluation run. */ @@ -682,7 +738,10 @@ export interface RunListResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunRetrieveResponse.Completions; /** * An object representing an error response from the Eval API. @@ -722,12 +781,12 @@ export interface RunListResponse { /** * Usage statistics for each model during the evaluation run. */ - per_model_usage: Array; + per_model_usage: Array; /** * Results per testing criteria applied during the evaluation run. */ - per_testing_criteria_results: Array; + per_testing_criteria_results: Array; /** * The URL to the rendered evaluation run report on the UI dashboard. @@ -737,7 +796,7 @@ export interface RunListResponse { /** * Counters summarizing the outcomes of the evaluation run. */ - result_counts: RunListResponse.ResultCounts; + result_counts: RunRetrieveResponse.ResultCounts; /** * The status of the evaluation run. @@ -745,7 +804,241 @@ export interface RunListResponse { status: string; } -export namespace RunListResponse { +export namespace RunRetrieveResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Completions.FileContent | Completions.FileID | Completions.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: Completions.Template | Completions.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -821,18 +1114,10 @@ export namespace RunListResponse { } } -export interface RunDeleteResponse { - deleted?: boolean; - - object?: string; - - run_id?: string; -} - /** * A schema representing an evaluation run. */ -export interface RunCancelResponse { +export interface RunListResponse { /** * Unique identifier for the evaluation run. */ @@ -846,7 +1131,10 @@ export interface RunCancelResponse { /** * Information about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunListResponse.Completions; /** * An object representing an error response from the Eval API. @@ -886,12 +1174,12 @@ export interface RunCancelResponse { /** * Usage statistics for each model during the evaluation run. */ - per_model_usage: Array; + per_model_usage: Array; /** * Results per testing criteria applied during the evaluation run. */ - per_testing_criteria_results: Array; + per_testing_criteria_results: Array; /** * The URL to the rendered evaluation run report on the UI dashboard. @@ -901,7 +1189,7 @@ export interface RunCancelResponse { /** * Counters summarizing the outcomes of the evaluation run. */ - result_counts: RunCancelResponse.ResultCounts; + result_counts: RunListResponse.ResultCounts; /** * The status of the evaluation run. @@ -909,25 +1197,660 @@ export interface RunCancelResponse { status: string; } -export namespace RunCancelResponse { - export interface PerModelUsage { +export namespace RunListResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { /** - * The number of tokens retrieved from cache. + * A EvalResponsesSource object describing a run data source configuration. */ - cached_tokens: number; + source: Completions.FileContent | Completions.FileID | Completions.Responses; /** - * The number of completion tokens generated. + * The type of run data source. Always `completions`. */ - completion_tokens: number; + type: 'completions'; - /** - * The number of invocations. - */ - invocation_count: number; + input_messages?: Completions.Template | Completions.ItemReference; /** - * The name of the model. + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. + */ + model_name: string; + + /** + * The number of prompt tokens used. + */ + prompt_tokens: number; + + /** + * The total number of tokens used. + */ + total_tokens: number; + } + + export interface PerTestingCriteriaResult { + /** + * Number of tests failed for this criteria. + */ + failed: number; + + /** + * Number of tests passed for this criteria. + */ + passed: number; + + /** + * A description of the testing criteria. + */ + testing_criteria: string; + } + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + export interface ResultCounts { + /** + * Number of output items that resulted in an error. + */ + errored: number; + + /** + * Number of output items that failed to pass the evaluation. + */ + failed: number; + + /** + * Number of output items that passed the evaluation. + */ + passed: number; + + /** + * Total number of executed output items. + */ + total: number; + } +} + +export interface RunDeleteResponse { + deleted?: boolean; + + object?: string; + + run_id?: string; +} + +/** + * A schema representing an evaluation run. + */ +export interface RunCancelResponse { + /** + * Unique identifier for the evaluation run. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the evaluation run was created. + */ + created_at: number; + + /** + * Information about the run's data source. + */ + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCancelResponse.Completions; + + /** + * An object representing an error response from the Eval API. + */ + error: EvalAPIError; + + /** + * The identifier of the associated evaluation. + */ + eval_id: string; + + /** + * 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 model that is evaluated, if applicable. + */ + model: string; + + /** + * The name of the evaluation run. + */ + name: string; + + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunCancelResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunCancelResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Completions { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Completions.FileContent | Completions.FileID | Completions.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: Completions.Template | Completions.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Completions.SamplingParams; + } + + export namespace Completions { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + + export interface PerModelUsage { + /** + * The number of tokens retrieved from cache. + */ + cached_tokens: number; + + /** + * The number of completion tokens generated. + */ + completion_tokens: number; + + /** + * The number of invocations. + */ + invocation_count: number; + + /** + * The name of the model. */ model_name: string; @@ -989,7 +1912,10 @@ export interface RunCreateParams { /** * Details about the run's data source. */ - data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource; + data_source: + | CreateEvalJSONLRunDataSource + | CreateEvalCompletionsRunDataSource + | RunCreateParams.CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1007,6 +1933,247 @@ export interface RunCreateParams { name?: string; } +export namespace RunCreateParams { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `completions`. + */ + type: 'completions'; + + input_messages?: + | CreateEvalResponsesRunDataSource.Template + | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; + } + + export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Whether to allow parallel tool calls. This is a query parameter used to select + * responses. + */ + allow_parallel_tool_calls?: boolean | null; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional search string for instructions. This is a query parameter used to + * select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } +} + export interface RunRetrieveParams { /** * The ID of the evaluation to retrieve runs for. @@ -1022,8 +2189,8 @@ export interface RunListParams extends CursorPageParams { order?: 'asc' | 'desc'; /** - * Filter runs by status. Use "queued" | "in_progress" | "failed" | "completed" | - * "canceled". + * Filter runs by status. One of `queued` | `in_progress` | `failed` | `completed` + * | `canceled`. */ status?: 'queued' | 'in_progress' | 'completed' | 'canceled' | 'failed'; } diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts index 91cab6fc9..da055b0e4 100644 --- a/src/resources/fine-tuning/checkpoints/checkpoints.ts +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -6,6 +6,7 @@ import { PermissionCreateParams, PermissionCreateResponse, PermissionCreateResponsesPage, + PermissionDeleteParams, PermissionDeleteResponse, PermissionRetrieveParams, PermissionRetrieveResponse, @@ -27,5 +28,6 @@ export declare namespace Checkpoints { type PermissionCreateResponsesPage as PermissionCreateResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, + type PermissionDeleteParams as PermissionDeleteParams, }; } diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts index c5b018cea..7e04fc667 100644 --- a/src/resources/fine-tuning/checkpoints/index.ts +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -8,5 +8,6 @@ export { type PermissionDeleteResponse, type PermissionCreateParams, type PermissionRetrieveParams, + type PermissionDeleteParams, type PermissionCreateResponsesPage, } from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index ba1e79ca8..87a0743eb 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -48,9 +48,14 @@ export class Permissions extends APIResource { * Organization owners can use this endpoint to delete a permission for a * fine-tuned model checkpoint. */ - delete(fineTunedModelCheckpoint: string, options?: RequestOptions): APIPromise { + delete( + permissionID: string, + params: PermissionDeleteParams, + options?: RequestOptions, + ): APIPromise { + const { fine_tuned_model_checkpoint } = params; return this._client.delete( - path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + path`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options, ); } @@ -171,6 +176,13 @@ export interface PermissionRetrieveParams { project_id?: string; } +export interface PermissionDeleteParams { + /** + * The ID of the fine-tuned model checkpoint to delete a permission for. + */ + fine_tuned_model_checkpoint: string; +} + export declare namespace Permissions { export { type PermissionCreateResponse as PermissionCreateResponse, @@ -179,5 +191,6 @@ export declare namespace Permissions { type PermissionCreateResponsesPage as PermissionCreateResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, + type PermissionDeleteParams as PermissionDeleteParams, }; } diff --git a/src/resources/images.ts b/src/resources/images.ts index 491255563..20955d3ab 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -8,7 +8,7 @@ import { multipartFormRequestOptions } from '../internal/uploads'; export class Images extends APIResource { /** - * Creates a variation of a given image. + * Creates a variation of a given image. This endpoint only supports `dall-e-2`. */ createVariation(body: ImageCreateVariationParams, options?: RequestOptions): APIPromise { return this._client.post( @@ -18,7 +18,8 @@ export class Images extends APIResource { } /** - * Creates an edited or extended image given an original image and a prompt. + * Creates an edited or extended image given one or more source images and a + * prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`. */ edit(body: ImageEditParams, options?: RequestOptions): APIPromise { return this._client.post( @@ -29,6 +30,7 @@ export class Images extends APIResource { /** * Creates an image given a prompt. + * [Learn more](https://platform.openai.com/docs/guides/images). */ generate(body: ImageGenerateParams, options?: RequestOptions): APIPromise { return this._client.post('/images/generations', { body, ...options }); @@ -36,33 +38,93 @@ export class Images extends APIResource { } /** - * Represents the url or the content of an image generated by the OpenAI API. + * Represents the content or the URL of an image generated by the OpenAI API. */ export interface Image { /** - * The base64-encoded JSON of the generated image, if `response_format` is - * `b64_json`. + * The base64-encoded JSON of the generated image. Default value for `gpt-image-1`, + * and only present if `response_format` is set to `b64_json` for `dall-e-2` and + * `dall-e-3`. */ b64_json?: string; /** - * The prompt that was used to generate the image, if there was any revision to the - * prompt. + * For `dall-e-3` only, the revised prompt that was used to generate the image. */ revised_prompt?: string; /** - * The URL of the generated image, if `response_format` is `url` (default). + * When using `dall-e-2` or `dall-e-3`, the URL of the generated image if + * `response_format` is set to `url` (default value). Unsupported for + * `gpt-image-1`. */ url?: string; } -export type ImageModel = 'dall-e-2' | 'dall-e-3'; +export type ImageModel = 'dall-e-2' | 'dall-e-3' | 'gpt-image-1'; +/** + * The response from the image generation endpoint. + */ export interface ImagesResponse { + /** + * The Unix timestamp (in seconds) of when the image was created. + */ created: number; - data: Array; + /** + * The list of generated images. + */ + data?: Array; + + /** + * For `gpt-image-1` only, the token usage information for the image generation. + */ + usage?: ImagesResponse.Usage; +} + +export namespace ImagesResponse { + /** + * For `gpt-image-1` only, the token usage information for the image generation. + */ + export interface Usage { + /** + * The number of tokens (images and text) in the input prompt. + */ + input_tokens: number; + + /** + * The input tokens detailed information for the image generation. + */ + input_tokens_details: Usage.InputTokensDetails; + + /** + * The number of image tokens in the output image. + */ + output_tokens: number; + + /** + * The total number of tokens (images and text) used for the image generation. + */ + total_tokens: number; + } + + export namespace Usage { + /** + * The input tokens detailed information for the image generation. + */ + export interface InputTokensDetails { + /** + * The number of image tokens in the input prompt. + */ + image_tokens: number; + + /** + * The number of text tokens in the input prompt. + */ + text_tokens: number; + } + } } export interface ImageCreateVariationParams { @@ -79,8 +141,7 @@ export interface ImageCreateVariationParams { model?: (string & {}) | ImageModel | null; /** - * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only - * `n=1` is supported. + * The number of images to generate. Must be between 1 and 10. */ n?: number | null; @@ -107,27 +168,31 @@ export interface ImageCreateVariationParams { export interface ImageEditParams { /** - * The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask - * is not provided, image must have transparency, which will be used as the mask. + * The image(s) to edit. Must be a supported image file or an array of images. For + * `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than + * 25MB. For `dall-e-2`, you can only provide one image, and it should be a square + * `png` file less than 4MB. */ - image: Uploadable; + image: Uploadable | Array; /** * A text description of the desired image(s). The maximum length is 1000 - * characters. + * characters for `dall-e-2`, and 32000 characters for `gpt-image-1`. */ prompt: string; /** * An additional image whose fully transparent areas (e.g. where alpha is zero) - * indicate where `image` should be edited. Must be a valid PNG file, less than + * indicate where `image` should be edited. If there are multiple images provided, + * the mask will be applied on the first image. Must be a valid PNG file, less than * 4MB, and have the same dimensions as `image`. */ mask?: Uploadable; /** - * The model to use for image generation. Only `dall-e-2` is supported at this - * time. + * The model to use for image generation. Only `dall-e-2` and `gpt-image-1` are + * supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` + * is used. */ model?: (string & {}) | ImageModel | null; @@ -136,16 +201,25 @@ export interface ImageEditParams { */ n?: number | null; + /** + * The quality of the image that will be generated. `high`, `medium` and `low` are + * only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. + * Defaults to `auto`. + */ + quality?: 'standard' | 'low' | 'medium' | 'high' | 'auto' | null; + /** * The format in which the generated images are returned. Must be one of `url` or * `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. + * generated. This parameter is only supported for `dall-e-2`, as `gpt-image-1` + * will always return base64-encoded images. */ response_format?: 'url' | 'b64_json' | null; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024`. + * The size of the generated images. Must be one of `1024x1024`, `1536x1024` + * (landscape), `1024x1536` (portrait), or `auto` (default value) for + * `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. */ size?: '256x256' | '512x512' | '1024x1024' | null; @@ -159,16 +233,36 @@ export interface ImageEditParams { export interface ImageGenerateParams { /** - * A text description of the desired image(s). The maximum length is 1000 - * characters for `dall-e-2` and 4000 characters for `dall-e-3`. + * A text description of the desired image(s). The maximum length is 32000 + * characters for `gpt-image-1`, 1000 characters for `dall-e-2` and 4000 characters + * for `dall-e-3`. */ prompt: string; /** - * The model to use for image generation. + * Allows to set transparency for the background of the generated image(s). This + * parameter is only supported for `gpt-image-1`. Must be one of `transparent`, + * `opaque` or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * If `transparent`, the output format needs to support transparency, so it should + * be set to either `png` (default value) or `webp`. + */ + background?: 'transparent' | 'opaque' | 'auto' | null; + + /** + * The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or + * `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to + * `gpt-image-1` is used. */ model?: (string & {}) | ImageModel | null; + /** + * Control the content-moderation level for images generated by `gpt-image-1`. Must + * be either `low` for less restrictive filtering or `auto` (default value). + */ + moderation?: 'low' | 'auto' | null; + /** * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only * `n=1` is supported. @@ -176,31 +270,59 @@ export interface ImageGenerateParams { n?: number | null; /** - * The quality of the image that will be generated. `hd` creates images with finer - * details and greater consistency across the image. This param is only supported - * for `dall-e-3`. + * The compression level (0-100%) for the generated images. This parameter is only + * supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and + * defaults to 100. */ - quality?: 'standard' | 'hd'; + output_compression?: number | null; /** - * The format in which the generated images are returned. Must be one of `url` or - * `b64_json`. URLs are only valid for 60 minutes after the image has been - * generated. + * The format in which the generated images are returned. This parameter is only + * supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. + */ + output_format?: 'png' | 'jpeg' | 'webp' | null; + + /** + * The quality of the image that will be generated. + * + * - `auto` (default value) will automatically select the best quality for the + * given model. + * - `high`, `medium` and `low` are supported for `gpt-image-1`. + * - `hd` and `standard` are supported for `dall-e-3`. + * - `standard` is the only option for `dall-e-2`. + */ + quality?: 'standard' | 'hd' | 'low' | 'medium' | 'high' | 'auto' | null; + + /** + * The format in which generated images with `dall-e-2` and `dall-e-3` are + * returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes + * after the image has been generated. This parameter isn't supported for + * `gpt-image-1` which will always return base64-encoded images. */ response_format?: 'url' | 'b64_json' | null; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or - * `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or - * `1024x1792` for `dall-e-3` models. + * The size of the generated images. Must be one of `1024x1024`, `1536x1024` + * (landscape), `1024x1536` (portrait), or `auto` (default value) for + * `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and + * one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`. */ - size?: '256x256' | '512x512' | '1024x1024' | '1792x1024' | '1024x1792' | null; + size?: + | 'auto' + | '1024x1024' + | '1536x1024' + | '1024x1536' + | '256x256' + | '512x512' + | '1792x1024' + | '1024x1792' + | null; /** - * The style of the generated images. Must be one of `vivid` or `natural`. Vivid - * causes the model to lean towards generating hyper-real and dramatic images. - * Natural causes the model to produce more natural, less hyper-real looking - * images. This param is only supported for `dall-e-3`. + * The style of the generated images. This parameter is only supported for + * `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean + * towards generating hyper-real and dramatic images. Natural causes the model to + * produce more natural, less hyper-real looking images. */ style?: 'vivid' | 'natural' | null; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 3bcca579e..de9fa3547 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -2086,6 +2086,160 @@ export namespace ResponseReasoningItem { } } +/** + * Emitted when a new reasoning summary part is added. + */ +export interface ResponseReasoningSummaryPartAddedEvent { + /** + * The ID of the item this summary part is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary part is associated with. + */ + output_index: number; + + /** + * The summary part that was added. + */ + part: ResponseReasoningSummaryPartAddedEvent.Part; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_part.added`. + */ + type: 'response.reasoning_summary_part.added'; +} + +export namespace ResponseReasoningSummaryPartAddedEvent { + /** + * The summary part that was added. + */ + export interface Part { + /** + * The text of the summary part. + */ + text: string; + + /** + * The type of the summary part. Always `summary_text`. + */ + type: 'summary_text'; + } +} + +/** + * Emitted when a reasoning summary part is completed. + */ +export interface ResponseReasoningSummaryPartDoneEvent { + /** + * The ID of the item this summary part is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary part is associated with. + */ + output_index: number; + + /** + * The completed summary part. + */ + part: ResponseReasoningSummaryPartDoneEvent.Part; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_part.done`. + */ + type: 'response.reasoning_summary_part.done'; +} + +export namespace ResponseReasoningSummaryPartDoneEvent { + /** + * The completed summary part. + */ + export interface Part { + /** + * The text of the summary part. + */ + text: string; + + /** + * The type of the summary part. Always `summary_text`. + */ + type: 'summary_text'; + } +} + +/** + * Emitted when a delta is added to a reasoning summary text. + */ +export interface ResponseReasoningSummaryTextDeltaEvent { + /** + * The text delta that was added to the summary. + */ + delta: string; + + /** + * The ID of the item this summary text delta is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary text delta is associated with. + */ + output_index: number; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The type of the event. Always `response.reasoning_summary_text.delta`. + */ + type: 'response.reasoning_summary_text.delta'; +} + +/** + * Emitted when a reasoning summary text is completed. + */ +export interface ResponseReasoningSummaryTextDoneEvent { + /** + * The ID of the item this summary text is associated with. + */ + item_id: string; + + /** + * The index of the output item this summary text is associated with. + */ + output_index: number; + + /** + * The index of the summary part within the reasoning summary. + */ + summary_index: number; + + /** + * The full text of the completed reasoning summary. + */ + text: string; + + /** + * The type of the event. Always `response.reasoning_summary_text.done`. + */ + type: 'response.reasoning_summary_text.done'; +} + /** * Emitted when there is a partial refusal text. */ @@ -2180,6 +2334,10 @@ export type ResponseStreamEvent = | ResponseIncompleteEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent + | ResponseReasoningSummaryPartAddedEvent + | ResponseReasoningSummaryPartDoneEvent + | ResponseReasoningSummaryTextDeltaEvent + | ResponseReasoningSummaryTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent | ResponseTextAnnotationDeltaEvent @@ -2895,6 +3053,10 @@ export declare namespace Responses { type ResponseOutputRefusal as ResponseOutputRefusal, type ResponseOutputText as ResponseOutputText, type ResponseReasoningItem as ResponseReasoningItem, + type ResponseReasoningSummaryPartAddedEvent as ResponseReasoningSummaryPartAddedEvent, + type ResponseReasoningSummaryPartDoneEvent as ResponseReasoningSummaryPartDoneEvent, + type ResponseReasoningSummaryTextDeltaEvent as ResponseReasoningSummaryTextDeltaEvent, + type ResponseReasoningSummaryTextDoneEvent as ResponseReasoningSummaryTextDoneEvent, type ResponseRefusalDeltaEvent as ResponseRefusalDeltaEvent, type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, type ResponseStatus as ResponseStatus, diff --git a/tests/api-resources/evals/evals.test.ts b/tests/api-resources/evals/evals.test.ts index 7d896e55f..a852ef8f7 100644 --- a/tests/api-resources/evals/evals.test.ts +++ b/tests/api-resources/evals/evals.test.ts @@ -46,7 +46,6 @@ describe('resource evals', () => { ], metadata: { foo: 'string' }, name: 'name', - share_with_openai: true, }); }); diff --git a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts index ce632add1..8427ee957 100644 --- a/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts +++ b/tests/api-resources/fine-tuning/checkpoints/permissions.test.ts @@ -51,11 +51,10 @@ describe('resource permissions', () => { ).rejects.toThrow(OpenAI.NotFoundError); }); - // OpenAPI spec is slightly incorrect - test.skip('delete', async () => { - const responsePromise = client.fineTuning.checkpoints.permissions.delete( - 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', - ); + 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', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -64,4 +63,10 @@ describe('resource permissions', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('delete: required and optional params', async () => { + const response = await 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/images.test.ts b/tests/api-resources/images.test.ts index 67b608d7e..844ff3768 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -53,6 +53,7 @@ describe('resource images', () => { mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1, + quality: 'high', response_format: 'url', size: '1024x1024', user: 'user-1234', @@ -73,9 +74,13 @@ describe('resource images', () => { test('generate: required and optional params', async () => { const response = await client.images.generate({ prompt: 'A cute baby sea otter', + background: 'transparent', model: 'string', + moderation: 'low', n: 1, - quality: 'standard', + output_compression: 100, + output_format: 'png', + quality: 'medium', response_format: 'url', size: '1024x1024', style: 'vivid', From e17a4f8e1fc3de02c953421debf39827ea72d52c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:55:24 +0000 Subject: [PATCH 374/509] chore(ci): run on more branches and use depot runners --- .github/workflows/ci.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 26440957d..2b482a121 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,18 +1,18 @@ name: CI on: push: - branches: - - main - pull_request: - branches: - - main - - next + branches-ignore: + - 'generated' + - 'codegen/**' + - 'integrated/**' + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: timeout-minutes: 10 name: lint - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -30,8 +30,7 @@ jobs: build: timeout-minutes: 5 name: build - runs-on: ubuntu-latest - + runs-on: depot-ubuntu-24.04 permissions: contents: read id-token: write @@ -66,7 +65,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ubuntu-latest + runs-on: depot-ubuntu-24.04 steps: - uses: actions/checkout@v4 From c59c3b5ead95b424b27c8c9f2120ad4283fb280e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 19:58:52 +0000 Subject: [PATCH 375/509] chore(ci): only use depot for staging repos --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b482a121..199f2419b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 @@ -30,7 +30,7 @@ jobs: build: timeout-minutes: 5 name: build - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} permissions: contents: read id-token: write @@ -65,7 +65,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: depot-ubuntu-24.04 + runs-on: ${{ github.repository == 'stainless-sdks/openai-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} steps: - uses: actions/checkout@v4 From e7fbfbce41c00aaa7d3b75a4bf001c7562b5b722 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 28 Apr 2025 22:15:33 +0000 Subject: [PATCH 376/509] chore(internal): refactor utils --- src/client.ts | 10 +++--- src/core/streaming.ts | 8 ++--- src/internal/decoders/line.ts | 67 ++++++----------------------------- src/internal/headers.ts | 5 +-- src/internal/utils/base64.ts | 9 ++--- src/internal/utils/bytes.ts | 32 +++++++++++++++++ 6 files changed, 59 insertions(+), 72 deletions(-) create mode 100644 src/internal/utils/bytes.ts diff --git a/src/client.ts b/src/client.ts index 0d3887384..12c28be1e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -652,12 +652,12 @@ export class OpenAI { fetchOptions.method = method.toUpperCase(); } - return ( + try { // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - this.fetch.call(undefined, url, fetchOptions).finally(() => { - clearTimeout(timeout); - }) - ); + return await this.fetch.call(undefined, url, fetchOptions); + } finally { + clearTimeout(timeout); + } } private shouldRetry(response: Response): boolean { diff --git a/src/core/streaming.ts b/src/core/streaming.ts index e47c088d2..813b85d63 100644 --- a/src/core/streaming.ts +++ b/src/core/streaming.ts @@ -4,6 +4,7 @@ import { makeReadableStream } from '../internal/shims'; import { findDoubleNewlineIndex, LineDecoder } from '../internal/decoders/line'; import { ReadableStreamToAsyncIterable } from '../internal/shims'; import { isAbortError } from '../internal/errors'; +import { encodeUTF8 } from '../internal/utils/bytes'; import { APIError } from './error'; @@ -176,9 +177,6 @@ export class Stream implements AsyncIterable { toReadableStream(): ReadableStream { const self = this; let iter: AsyncIterator; - const encoder: { - encode(str: string): Uint8Array; - } = new (globalThis as any).TextEncoder(); return makeReadableStream({ async start() { @@ -189,7 +187,7 @@ export class Stream implements AsyncIterable { const { value, done } = await iter.next(); if (done) return ctrl.close(); - const bytes = encoder.encode(JSON.stringify(value) + '\n'); + const bytes = encodeUTF8(JSON.stringify(value) + '\n'); ctrl.enqueue(bytes); } catch (err) { @@ -251,7 +249,7 @@ async function* iterSSEChunks(iterator: AsyncIterableIterator): AsyncGene const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) - : typeof chunk === 'string' ? new (globalThis as any).TextEncoder().encode(chunk) + : typeof chunk === 'string' ? encodeUTF8(chunk) : chunk; let newData = new Uint8Array(data.length + binaryChunk.length); diff --git a/src/internal/decoders/line.ts b/src/internal/decoders/line.ts index 1af727b34..b3bfa97cd 100644 --- a/src/internal/decoders/line.ts +++ b/src/internal/decoders/line.ts @@ -1,4 +1,4 @@ -import { OpenAIError } from '../../core/error'; +import { concatBytes, decodeUTF8, encodeUTF8 } from '../utils/bytes'; export type Bytes = string | ArrayBuffer | Uint8Array | null | undefined; @@ -13,16 +13,11 @@ export class LineDecoder { static NEWLINE_CHARS = new Set(['\n', '\r']); static NEWLINE_REGEXP = /\r\n|[\n\r]/g; - buffer: Uint8Array; + #buffer: Uint8Array; #carriageReturnIndex: number | null; - textDecoder: - | undefined - | { - decode(buffer: Uint8Array | ArrayBuffer): string; - }; constructor() { - this.buffer = new Uint8Array(); + this.#buffer = new Uint8Array(); this.#carriageReturnIndex = null; } @@ -33,17 +28,14 @@ export class LineDecoder { const binaryChunk = chunk instanceof ArrayBuffer ? new Uint8Array(chunk) - : typeof chunk === 'string' ? new TextEncoder().encode(chunk) + : typeof chunk === 'string' ? encodeUTF8(chunk) : chunk; - let newData = new Uint8Array(this.buffer.length + binaryChunk.length); - newData.set(this.buffer); - newData.set(binaryChunk, this.buffer.length); - this.buffer = newData; + this.#buffer = concatBytes([this.#buffer, binaryChunk]); const lines: string[] = []; let patternIndex; - while ((patternIndex = findNewlineIndex(this.buffer, this.#carriageReturnIndex)) != null) { + while ((patternIndex = findNewlineIndex(this.#buffer, this.#carriageReturnIndex)) != null) { if (patternIndex.carriage && this.#carriageReturnIndex == null) { // skip until we either get a corresponding `\n`, a new `\r` or nothing this.#carriageReturnIndex = patternIndex.index; @@ -55,8 +47,8 @@ export class LineDecoder { this.#carriageReturnIndex != null && (patternIndex.index !== this.#carriageReturnIndex + 1 || patternIndex.carriage) ) { - lines.push(this.decodeText(this.buffer.slice(0, this.#carriageReturnIndex - 1))); - this.buffer = this.buffer.slice(this.#carriageReturnIndex); + lines.push(decodeUTF8(this.#buffer.subarray(0, this.#carriageReturnIndex - 1))); + this.#buffer = this.#buffer.subarray(this.#carriageReturnIndex); this.#carriageReturnIndex = null; continue; } @@ -64,55 +56,18 @@ export class LineDecoder { const endIndex = this.#carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding; - const line = this.decodeText(this.buffer.slice(0, endIndex)); + const line = decodeUTF8(this.#buffer.subarray(0, endIndex)); lines.push(line); - this.buffer = this.buffer.slice(patternIndex.index); + this.#buffer = this.#buffer.subarray(patternIndex.index); this.#carriageReturnIndex = null; } return lines; } - decodeText(bytes: Bytes): string { - if (bytes == null) return ''; - if (typeof bytes === 'string') return bytes; - - // Node: - if (typeof (globalThis as any).Buffer !== 'undefined') { - if (bytes instanceof (globalThis as any).Buffer) { - return bytes.toString(); - } - if (bytes instanceof Uint8Array) { - return (globalThis as any).Buffer.from(bytes).toString(); - } - - throw new OpenAIError( - `Unexpected: received non-Uint8Array (${bytes.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`, - ); - } - - // Browser - if (typeof (globalThis as any).TextDecoder !== 'undefined') { - if (bytes instanceof Uint8Array || bytes instanceof ArrayBuffer) { - this.textDecoder ??= new (globalThis as any).TextDecoder('utf8'); - return this.textDecoder!.decode(bytes); - } - - throw new OpenAIError( - `Unexpected: received non-Uint8Array/ArrayBuffer (${ - (bytes as any).constructor.name - }) in a web platform. Please report this error.`, - ); - } - - throw new OpenAIError( - `Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.`, - ); - } - flush(): string[] { - if (!this.buffer.length) { + if (!this.#buffer.length) { return []; } return this.decode('\n'); diff --git a/src/internal/headers.ts b/src/internal/headers.ts index a110a1204..8659ddea8 100644 --- a/src/internal/headers.ts +++ b/src/internal/headers.ts @@ -3,7 +3,7 @@ type HeaderValue = string | undefined | null; export type HeadersLike = | Headers - | readonly [string, HeaderValue][] + | readonly HeaderValue[][] | Record | undefined | null @@ -40,7 +40,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator; + let iter: Iterable; if (headers instanceof Headers) { iter = headers.entries(); } else if (isArray(headers)) { @@ -51,6 +51,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator { if (!data) return ''; - if (typeof data === 'string') { - data = new (globalThis as any).TextEncoder().encode(data); - } - if (typeof (globalThis as any).Buffer !== 'undefined') { return (globalThis as any).Buffer.from(data).toString('base64'); } + if (typeof data === 'string') { + data = encodeUTF8(data); + } + if (typeof btoa !== 'undefined') { return btoa(String.fromCharCode.apply(null, data as any)); } diff --git a/src/internal/utils/bytes.ts b/src/internal/utils/bytes.ts new file mode 100644 index 000000000..8da627abe --- /dev/null +++ b/src/internal/utils/bytes.ts @@ -0,0 +1,32 @@ +export function concatBytes(buffers: Uint8Array[]): Uint8Array { + let length = 0; + for (const buffer of buffers) { + length += buffer.length; + } + const output = new Uint8Array(length); + let index = 0; + for (const buffer of buffers) { + output.set(buffer, index); + index += buffer.length; + } + + return output; +} + +let encodeUTF8_: (str: string) => Uint8Array; +export function encodeUTF8(str: string) { + let encoder; + return ( + encodeUTF8_ ?? + ((encoder = new (globalThis as any).TextEncoder()), (encodeUTF8_ = encoder.encode.bind(encoder))) + )(str); +} + +let decodeUTF8_: (bytes: Uint8Array) => string; +export function decodeUTF8(bytes: Uint8Array) { + let decoder; + return ( + decodeUTF8_ ?? + ((decoder = new (globalThis as any).TextDecoder()), (decodeUTF8_ = decoder.decode.bind(decoder))) + )(bytes); +} From c44ed98a3e7f497a656d612037667dd1f2e6816b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:45:47 +0000 Subject: [PATCH 377/509] docs(readme): fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93689e40d..cff8c07bc 100644 --- a/README.md +++ b/README.md @@ -352,7 +352,7 @@ async function main() { main(); ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | From 54955295ff5c7ab0fecb522b3aaadaaecb229d51 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:12:04 +0000 Subject: [PATCH 378/509] chore(docs): add missing deprecation warnings --- src/resources/chat/completions/completions.ts | 8 ++++---- src/resources/fine-tuning/jobs/jobs.ts | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 94b9108e5..2f16317a1 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1153,7 +1153,7 @@ export interface ChatCompletionCreateParamsBase { frequency_penalty?: number | null; /** - * Deprecated in favor of `tool_choice`. + * @deprecated Deprecated in favor of `tool_choice`. * * Controls which (if any) function is called by the model. * @@ -1171,7 +1171,7 @@ export interface ChatCompletionCreateParamsBase { function_call?: 'none' | 'auto' | ChatCompletionFunctionCallOption; /** - * Deprecated in favor of `tools`. + * @deprecated Deprecated in favor of `tools`. * * A list of functions the model may generate JSON inputs for. */ @@ -1204,8 +1204,8 @@ export interface ChatCompletionCreateParamsBase { max_completion_tokens?: number | null; /** - * The maximum number of [tokens](/tokenizer) that can be generated in the chat - * completion. This value can be used to control + * @deprecated The maximum number of [tokens](/tokenizer) that can be generated in + * the chat completion. This value can be used to control * [costs](https://openai.com/api/pricing/) for text generated via API. * * This value is now deprecated in favor of `max_completion_tokens`, and is not diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 79cfe6156..bef0de6e4 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -459,8 +459,9 @@ export interface JobCreateParams { training_file: string; /** - * The hyperparameters used for the fine-tuning job. This value is now deprecated - * in favor of `method`, and should be passed in under the `method` parameter. + * @deprecated The hyperparameters used for the fine-tuning job. This value is now + * deprecated in favor of `method`, and should be passed in under the `method` + * parameter. */ hyperparameters?: JobCreateParams.Hyperparameters; From 3e1ea4063327ac34f4f46536600a8923f96dbbb0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 14:36:51 +0000 Subject: [PATCH 379/509] chore(internal): fix format script --- .devcontainer/devcontainer.json | 4 +- MIGRATION.md | 175 ++++--- bin/cli | 21 +- bin/migration-config.json | 819 ++++++++++++++++++++++++++++++++ package.json | 5 +- scripts/build | 6 +- scripts/format | 4 + tsconfig.build.json | 2 +- 8 files changed, 943 insertions(+), 93 deletions(-) create mode 100644 bin/migration-config.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 763462fad..43fd5a73f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,9 +9,7 @@ "postCreateCommand": "yarn install", "customizations": { "vscode": { - "extensions": [ - "esbenp.prettier-vscode" - ] + "extensions": ["esbenp.prettier-vscode"] } } } diff --git a/MIGRATION.md b/MIGRATION.md index 2e63d6445..e95140a0f 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -4,95 +4,40 @@ This guide outlines the changes and steps needed to migrate your codebase to the The main changes are that the SDK now relies on the [builtin Web fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) instead of `node-fetch` and has zero dependencies. +## Migration CLI + +Most programs will only need minimal changes, but to assist there is a migration tool that will automatically update your code for the new version. +To use it, upgrade the `openai` package, then run `./node_modules/.bin/openai migrate ./your/src/folders` to update your code. +To preview the changes without writing them to disk, run the tool with `--dry`. + ## Environment requirements The minimum supported runtime and tooling versions are now: -- Node.js 18.x last LTS (Required for built-in fetch support) +- Node.js 18.x last LTS (Required for builtin fetch support) - This was previously documented as the minimum supported Node.js version but Node.js 16.x mostly worked at runtime; now it will not. - TypeScript 4.9 - Jest 28 -## Minimum types requirements - -### DOM - -`tsconfig.json` - -```jsonc -{ - "target": "ES2015", // note: we recommend ES2020 or higher - "lib": ["DOM", "DOM.Iterable", "ES2018"] -} -``` - -### Node.js - -`tsconfig.json` - -```jsonc -{ - "target": "ES2015" // note: we recommend ES2020 or higher -} -``` - -`package.json` - -```json -{ - "devDependencies": { - "@types/node": ">= 18.18.7" - } -} -``` - -### Cloudflare Workers - -`tsconfig.json` - -```jsonc -{ - "target": "ES2015", // note: we recommend ES2020 or higher - "lib": ["ES2020"], // <- needed by @cloudflare/workers-types - "types": ["@cloudflare/workers-types"] -} -``` - -`package.json` - -```json -{ - "devDependencies": { - "@cloudflare/workers-types": ">= 0.20221111.0" - } -} -``` - -### Bun +## Breaking changes -`tsconfig.json` +### Web types for `withResponse`, `asResponse`, and `APIError.headers` -```jsonc -{ - "target": "ES2015" // note: we recommend ES2020 or higher -} -``` - -`package.json` +Because we now use the builtin Web fetch API on all platforms, if you wrote code that used `withResponse` or `asResponse` and then accessed `node-fetch`-specific properties on the result, you will need to switch to standardized alternatives. +For example, `body` is now a [Web `ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream) rather than a [node `Readable`](https://nodejs.org/api/stream.html#readable-streams). -```json -{ - "devDependencies": { - "@types/bun": ">= 1.2.0" - } -} +```ts +// Before: +const res = await client.example.retrieve('string/with/slash').asResponse(); +res.body.pipe(process.stdout); + +// After: +import { Readable } from 'node:stream'; +const res = await client.example.retrieve('string/with/slash').asResponse(); +Readable.fromWeb(res.body).pipe(process.stdout); ``` -### Deno - -No config needed! - -## Breaking changes +Additionally, the `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously defined as `Record`. ### Named path parameters @@ -409,6 +354,80 @@ import OpenAI from 'openai/src'; import OpenAI from 'openai'; ``` -### Headers +## TypeScript troubleshooting + +When referencing the library after updating, you may encounter new type errors related to JS features like private properties or fetch classes like Request, Response, and Headers. +To resolve these issues, configure your tsconfig.json and install the appropriate `@types` packages for your runtime environment using the guidelines below: + +### Browsers + +`tsconfig.json` + +```jsonc +{ + "target": "ES2018", // note: we recommend ES2020 or higher + "lib": ["DOM", "DOM.Iterable", "ES2018"] +} +``` + +### Node.js -The `headers` property on `APIError` objects is now an instance of the Web [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) class. It was previously just `Record`. +`tsconfig.json` + +```jsonc +{ + "target": "ES2018" // note: we recommend ES2020 or higher +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@types/node": ">= 18.18.7" + } +} +``` + +### Cloudflare Workers + +`tsconfig.json` + +```jsonc +{ + "target": "ES2018", // note: we recommend ES2020 or higher + "lib": ["ES2020"], // <- needed by @cloudflare/workers-types + "types": ["@cloudflare/workers-types"] +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@cloudflare/workers-types": ">= 0.20221111.0" + } +} +``` + +### Bun + +`tsconfig.json` + +```jsonc +{ + "target": "ES2018" // note: we recommend ES2020 or higher +} +``` + +`package.json` + +```json +{ + "devDependencies": { + "@types/bun": ">= 1.2.0" + } +} +``` diff --git a/bin/cli b/bin/cli index 00275ace4..bda25277e 100755 --- a/bin/cli +++ b/bin/cli @@ -4,25 +4,28 @@ const { spawnSync } = require('child_process'); const commands = { migrate: { - description: 'Run migrations to update from openai v3 to v4', + description: 'Run migrations to update to the latest major SDK version', fn: () => { - console.log('This automatic code migration is provided by grit.io'); - console.log('Visit https://app.grit.io/studio?preset=openai_v4 for more details.') - const result = spawnSync( 'npx', - ['-y', '@getgrit/launcher', 'apply', 'openai_v4', ...process.argv.slice(3)], + [ + '-y', + 'https://github.com/stainless-api/migrate-ts/releases/download/0.0.2/stainless-api-migrate-0.0.2-6.tgz', + '--migrationConfig', + require.resolve('./migration-config.json'), + ...process.argv.slice(3), + ], { stdio: 'inherit' }, ); if (result.status !== 0) { process.exit(result.status); } - } - } -} + }, + }, +}; function exitWithHelp() { - console.log("Usage: $0 "); + console.log(`Usage: openai `); console.log(); console.log('Subcommands:'); diff --git a/bin/migration-config.json b/bin/migration-config.json new file mode 100644 index 000000000..9751f977c --- /dev/null +++ b/bin/migration-config.json @@ -0,0 +1,819 @@ +{ + "pkg": "openai", + "githubRepo": "https://github.com/stainless-sdks/openai-typescript", + "clientClass": "OpenAI", + "methods": [ + { + "base": "chat.completions", + "name": "delete", + "oldName": "del" + }, + { + "base": "files", + "name": "delete", + "oldName": "del" + }, + { + "base": "models", + "name": "delete", + "oldName": "del" + }, + { + "base": "fineTuning.checkpoints.permissions", + "name": "delete", + "params": [ + { + "type": "param", + "key": "permission_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldName": "del", + "oldParams": [ + { + "type": "param", + "key": "fine_tuned_model_checkpoint", + "location": "path" + }, + { + "type": "param", + "key": "permission_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores", + "name": "delete", + "oldName": "del" + }, + { + "base": "vectorStores.files", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.files", + "name": "update", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.files", + "name": "delete", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldName": "del", + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.files", + "name": "content", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.fileBatches", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.fileBatches", + "name": "cancel", + "params": [ + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "vectorStores.fileBatches", + "name": "listFiles", + "params": [ + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "vector_store_id", + "location": "path" + }, + { + "type": "param", + "key": "batch_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": true + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.assistants", + "name": "delete", + "oldName": "del" + }, + { + "base": "beta.threads", + "name": "delete", + "oldName": "del" + }, + { + "base": "beta.threads.runs", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.runs", + "name": "update", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.runs", + "name": "cancel", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.runs", + "name": "submitToolOutputs", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.runs.steps", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "step_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "param", + "key": "step_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": true + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.runs.steps", + "name": "list", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": true + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.messages", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.messages", + "name": "update", + "params": [ + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ] + }, + { + "base": "beta.threads.messages", + "name": "delete", + "params": [ + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldName": "del", + "oldParams": [ + { + "type": "param", + "key": "thread_id", + "location": "path" + }, + { + "type": "param", + "key": "message_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "responses", + "name": "delete", + "oldName": "del" + }, + { + "base": "evals", + "name": "delete", + "oldName": "del" + }, + { + "base": "evals.runs", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "eval_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "evals.runs", + "name": "delete", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldName": "del", + "oldParams": [ + { + "type": "param", + "key": "eval_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "evals.runs", + "name": "cancel", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "eval_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "evals.runs.outputItems", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "output_item_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "eval_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "param", + "key": "output_item_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "evals.runs.outputItems", + "name": "list", + "params": [ + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "eval_id", + "location": "path" + }, + { + "type": "param", + "key": "run_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": true + }, + { + "type": "options" + } + ] + } + ] +} diff --git a/package.json b/package.json index 2c8f80f06..f12114b08 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test": "./scripts/test", "build": "./scripts/build", "prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1", - "format": "prettier --write --cache --cache-strategy metadata . !dist", + "format": "./scripts/format", "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi", "tsn": "ts-node -r tsconfig-paths/register", "lint": "./scripts/lint", @@ -62,6 +62,9 @@ "openai": ".", "openai/*": "./src/*" }, + "bin": { + "openai": "bin/cli" + }, "exports": { ".": { "import": "./dist/index.mjs", diff --git a/scripts/build b/scripts/build index 5cec10804..d268d6627 100755 --- a/scripts/build +++ b/scripts/build @@ -19,9 +19,13 @@ for file in LICENSE CHANGELOG.md; do if [ -e "${file}" ]; then cp "${file}" dist; fi done if [ -e "bin/cli" ]; then - mkdir dist/bin + mkdir -p dist/bin cp -p "bin/cli" dist/bin/; fi +if [ -e "bin/migration-config.json" ]; then + mkdir -p dist/bin + cp -p "bin/migration-config.json" dist/bin/; +fi # this converts the export map paths for the dist directory # and does a few other minor things node scripts/utils/make-dist-package-json.cjs > dist/package.json diff --git a/scripts/format b/scripts/format index 903b1ef85..7a7564019 100755 --- a/scripts/format +++ b/scripts/format @@ -6,3 +6,7 @@ cd "$(dirname "$0")/.." echo "==> Running eslint --fix" ./node_modules/.bin/eslint --fix . + +echo "==> Running prettier --write" +# format things eslint didn't +./node_modules/.bin/prettier --write --cache --cache-strategy metadata . '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' diff --git a/tsconfig.build.json b/tsconfig.build.json index 664392bed..57578eb44 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -6,7 +6,7 @@ "rootDir": "./dist/src", "paths": { "openai/*": ["dist/src/*"], - "openai": ["dist/src/index.ts"], + "openai": ["dist/src/index.ts"] }, "noEmit": false, "declaration": true, From 247093374538f0e714178134c38813bc4fde9ecf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 18:37:03 +0000 Subject: [PATCH 380/509] chore(internal): share typescript helpers --- package.json | 10 ++-- tsc-multi.json | 4 +- yarn.lock | 128 ++++++++++++++++++++++++------------------------- 3 files changed, 71 insertions(+), 71 deletions(-) diff --git a/package.json b/package.json index f12114b08..b559238ee 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,9 @@ "@types/jest": "^29.4.0", "@types/ws": "^8.5.13", "@types/node": "^20.17.6", - "typescript-eslint": "^8.24.0", - "@typescript-eslint/eslint-plugin": "^8.24.0", - "@typescript-eslint/parser": "^8.24.0", + "typescript-eslint": "8.31.1", + "@typescript-eslint/eslint-plugin": "8.31.1", + "@typescript-eslint/parser": "8.31.1", "eslint": "^9.20.1", "eslint-plugin-prettier": "^5.2.3", "eslint-plugin-unused-imports": "^4.1.4", @@ -45,9 +45,9 @@ "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz", "tsconfig-paths": "^4.0.0", - "typescript": "^4.8.2", + "typescript": "5.8.3", "ws": "^8.18.0", "zod": "^3.23.8" }, diff --git a/tsc-multi.json b/tsc-multi.json index 4facad5ad..170bac7a4 100644 --- a/tsc-multi.json +++ b/tsc-multi.json @@ -1,7 +1,7 @@ { "targets": [ - { "extname": ".js", "module": "commonjs" }, - { "extname": ".mjs", "module": "esnext" } + { "extname": ".js", "module": "commonjs", "shareHelpers": "internal/tslib.js" }, + { "extname": ".mjs", "module": "esnext", "shareHelpers": "internal/tslib.mjs" } ], "projects": ["tsconfig.build.json"] } diff --git a/yarn.lock b/yarn.lock index b8808db07..c8dd560c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -968,62 +968,62 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@8.24.0", "@typescript-eslint/eslint-plugin@^8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.24.0.tgz#574a95d67660a1e4544ae131d672867a5b40abb3" - integrity sha512-aFcXEJJCI4gUdXgoo/j9udUYIHgF23MFkg09LFz2dzEmU0+1Plk4rQWv/IYKvPHAtlkkGoB3m5e6oUp+JPsNaQ== +"@typescript-eslint/eslint-plugin@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.1.tgz#62f1befe59647524994e89de4516d8dcba7a850a" + integrity sha512-oUlH4h1ABavI4F0Xnl8/fOtML/eu8nI2A1nYd+f+55XI0BLu+RIqKoCiZKNo6DtqZBEQm5aNKA20G3Z5w3R6GQ== dependencies: "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "8.24.0" - "@typescript-eslint/type-utils" "8.24.0" - "@typescript-eslint/utils" "8.24.0" - "@typescript-eslint/visitor-keys" "8.24.0" + "@typescript-eslint/scope-manager" "8.31.1" + "@typescript-eslint/type-utils" "8.31.1" + "@typescript-eslint/utils" "8.31.1" + "@typescript-eslint/visitor-keys" "8.31.1" graphemer "^1.4.0" ignore "^5.3.1" natural-compare "^1.4.0" ts-api-utils "^2.0.1" -"@typescript-eslint/parser@8.24.0", "@typescript-eslint/parser@^8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.24.0.tgz#bba837f9ee125b78f459ad947ff9b61be8139085" - integrity sha512-MFDaO9CYiard9j9VepMNa9MTcqVvSny2N4hkY6roquzj8pdCBRENhErrteaQuu7Yjn1ppk0v1/ZF9CG3KIlrTA== +"@typescript-eslint/parser@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-8.31.1.tgz#e9b0ccf30d37dde724ee4d15f4dbc195995cce1b" + integrity sha512-oU/OtYVydhXnumd0BobL9rkJg7wFJ9bFFPmSmB/bf/XWN85hlViji59ko6bSKBXyseT9V8l+CN1nwmlbiN0G7Q== dependencies: - "@typescript-eslint/scope-manager" "8.24.0" - "@typescript-eslint/types" "8.24.0" - "@typescript-eslint/typescript-estree" "8.24.0" - "@typescript-eslint/visitor-keys" "8.24.0" + "@typescript-eslint/scope-manager" "8.31.1" + "@typescript-eslint/types" "8.31.1" + "@typescript-eslint/typescript-estree" "8.31.1" + "@typescript-eslint/visitor-keys" "8.31.1" debug "^4.3.4" -"@typescript-eslint/scope-manager@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.24.0.tgz#2e34b3eb2ce768f2ffb109474174ced5417002b1" - integrity sha512-HZIX0UByphEtdVBKaQBgTDdn9z16l4aTUz8e8zPQnyxwHBtf5vtl1L+OhH+m1FGV9DrRmoDuYKqzVrvWDcDozw== +"@typescript-eslint/scope-manager@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-8.31.1.tgz#1eb52e76878f545e4add142e0d8e3e97e7aa443b" + integrity sha512-BMNLOElPxrtNQMIsFHE+3P0Yf1z0dJqV9zLdDxN/xLlWMlXK/ApEsVEKzpizg9oal8bAT5Sc7+ocal7AC1HCVw== dependencies: - "@typescript-eslint/types" "8.24.0" - "@typescript-eslint/visitor-keys" "8.24.0" + "@typescript-eslint/types" "8.31.1" + "@typescript-eslint/visitor-keys" "8.31.1" -"@typescript-eslint/type-utils@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.24.0.tgz#6ee3ec4db06f9e5e7b01ca6c2b5dd5843a9fd1e8" - integrity sha512-8fitJudrnY8aq0F1wMiPM1UUgiXQRJ5i8tFjq9kGfRajU+dbPyOuHbl0qRopLEidy0MwqgTHDt6CnSeXanNIwA== +"@typescript-eslint/type-utils@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-8.31.1.tgz#be0f438fb24b03568e282a0aed85f776409f970c" + integrity sha512-fNaT/m9n0+dpSp8G/iOQ05GoHYXbxw81x+yvr7TArTuZuCA6VVKbqWYVZrV5dVagpDTtj/O8k5HBEE/p/HM5LA== dependencies: - "@typescript-eslint/typescript-estree" "8.24.0" - "@typescript-eslint/utils" "8.24.0" + "@typescript-eslint/typescript-estree" "8.31.1" + "@typescript-eslint/utils" "8.31.1" debug "^4.3.4" ts-api-utils "^2.0.1" -"@typescript-eslint/types@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.24.0.tgz#694e7fb18d70506c317b816de9521300b0f72c8e" - integrity sha512-VacJCBTyje7HGAw7xp11q439A+zeGG0p0/p2zsZwpnMzjPB5WteaWqt4g2iysgGFafrqvyLWqq6ZPZAOCoefCw== +"@typescript-eslint/types@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-8.31.1.tgz#478ed6f7e8aee1be7b63a60212b6bffe1423b5d4" + integrity sha512-SfepaEFUDQYRoA70DD9GtytljBePSj17qPxFHA/h3eg6lPTqGJ5mWOtbXCk1YrVU1cTJRd14nhaXWFu0l2troQ== -"@typescript-eslint/typescript-estree@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.24.0.tgz#0487349be174097bb329a58273100a9629e03c6c" - integrity sha512-ITjYcP0+8kbsvT9bysygfIfb+hBj6koDsu37JZG7xrCiy3fPJyNmfVtaGsgTUSEuTzcvME5YI5uyL5LD1EV5ZQ== +"@typescript-eslint/typescript-estree@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-8.31.1.tgz#37792fe7ef4d3021c7580067c8f1ae66daabacdf" + integrity sha512-kaA0ueLe2v7KunYOyWYtlf/QhhZb7+qh4Yw6Ni5kgukMIG+iP773tjgBiLWIXYumWCwEq3nLW+TUywEp8uEeag== dependencies: - "@typescript-eslint/types" "8.24.0" - "@typescript-eslint/visitor-keys" "8.24.0" + "@typescript-eslint/types" "8.31.1" + "@typescript-eslint/visitor-keys" "8.31.1" debug "^4.3.4" fast-glob "^3.3.2" is-glob "^4.0.3" @@ -1031,22 +1031,22 @@ semver "^7.6.0" ts-api-utils "^2.0.1" -"@typescript-eslint/utils@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.24.0.tgz#21cb1195ae79230af825bfeed59574f5cb70a749" - integrity sha512-07rLuUBElvvEb1ICnafYWr4hk8/U7X9RDCOqd9JcAMtjh/9oRmcfN4yGzbPVirgMR0+HLVHehmu19CWeh7fsmQ== +"@typescript-eslint/utils@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-8.31.1.tgz#5628ea0393598a0b2f143d0fc6d019f0dee9dd14" + integrity sha512-2DSI4SNfF5T4oRveQ4nUrSjUqjMND0nLq9rEkz0gfGr3tg0S5KB6DhwR+WZPCjzkZl3cH+4x2ce3EsL50FubjQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" - "@typescript-eslint/scope-manager" "8.24.0" - "@typescript-eslint/types" "8.24.0" - "@typescript-eslint/typescript-estree" "8.24.0" + "@typescript-eslint/scope-manager" "8.31.1" + "@typescript-eslint/types" "8.31.1" + "@typescript-eslint/typescript-estree" "8.31.1" -"@typescript-eslint/visitor-keys@8.24.0": - version "8.24.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.24.0.tgz#36ecf0b9b1d819ad88a3bd4157ab7d594cb797c9" - integrity sha512-kArLq83QxGLbuHrTMoOEWO+l2MwsNS2TGISEdx8xgqpkbytB07XmlQyQdNDrCc1ecSqx0cnmhGvpX+VBwqqSkg== +"@typescript-eslint/visitor-keys@8.31.1": + version "8.31.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-8.31.1.tgz#6742b0e3ba1e0c1e35bdaf78c03e759eb8dd8e75" + integrity sha512-I+/rgqOVBn6f0o7NDTmAPWWC6NuqhV174lfYvAm9fUaWeiefLdux9/YI3/nLugEn9L8fcSi0XmpKi/r5u0nmpw== dependencies: - "@typescript-eslint/types" "8.24.0" + "@typescript-eslint/types" "8.31.1" eslint-visitor-keys "^4.2.0" acorn-jsx@^5.3.2: @@ -3303,9 +3303,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz": - version "1.1.3" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.3/tsc-multi.tgz#8fc21fc95b247b86721b95fabfb10c6a436134c3" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz": + version "1.1.4" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz#cbed459a9e902f5295ec3daaf1c7aa3b10427e55" dependencies: debug "^4.3.7" fast-glob "^3.3.2" @@ -3354,24 +3354,24 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typescript-eslint@^8.24.0: - version "8.24.0" - resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.24.0.tgz#cc655e71885ecb8280342b422ad839a2e2e46a96" - integrity sha512-/lmv4366en/qbB32Vz5+kCNZEMf6xYHwh1z48suBwZvAtnXKbP+YhGe8OLE2BqC67LMqKkCNLtjejdwsdW6uOQ== +typescript-eslint@8.31.1: + version "8.31.1" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-8.31.1.tgz#b77ab1e48ced2daab9225ff94bab54391a4af69b" + integrity sha512-j6DsEotD/fH39qKzXTQRwYYWlt7D+0HmfpOK+DVhwJOFLcdmn92hq3mBb7HlKJHbjjI/gTOqEcc9d6JfpFf/VA== dependencies: - "@typescript-eslint/eslint-plugin" "8.24.0" - "@typescript-eslint/parser" "8.24.0" - "@typescript-eslint/utils" "8.24.0" + "@typescript-eslint/eslint-plugin" "8.31.1" + "@typescript-eslint/parser" "8.31.1" + "@typescript-eslint/utils" "8.31.1" typescript@5.6.1-rc: version "5.6.1-rc" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.1-rc.tgz#d5e4d7d8170174fed607b74cc32aba3d77018e02" integrity sha512-E3b2+1zEFu84jB0YQi9BORDjz9+jGbwwy1Zi3G0LUNw7a7cePUrHMRNy8aPh53nXpkFGVHSxIZo5vKTfYaFiBQ== -typescript@^4.8.2: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@5.8.3: + version "5.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.8.3.tgz#92f8a3e5e3cf497356f4178c34cd65a7f5e8440e" + integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ== undici-types@~5.26.4: version "5.26.5" From 0c2502187f8895f029277a7be9825862f458e9aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 19:09:25 +0000 Subject: [PATCH 381/509] feat(api): add image sizes, reasoning encryption --- .stats.yml | 6 +-- src/resources/audio/speech.ts | 2 +- src/resources/images.ts | 24 +++++++-- src/resources/responses/responses.ts | 79 ++++++++++++++++++---------- tests/api-resources/images.test.ts | 1 + 5 files changed, 74 insertions(+), 38 deletions(-) diff --git a/.stats.yml b/.stats.yml index d92408173..0c8278866 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml -openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03 -config_hash: b597cd9a31e9e5ec709e2eefb4c54122 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml +openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6 +config_hash: d9b6b6e6bc85744663e300eebc482067 diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 451234e6b..350b944ae 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -67,7 +67,7 @@ export interface SpeechCreateParams { /** * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - * the default. + * the default. Does not work with `gpt-4o-mini-tts`. */ speed?: number; } diff --git a/src/resources/images.ts b/src/resources/images.ts index 20955d3ab..2039c0b17 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -168,10 +168,13 @@ export interface ImageCreateVariationParams { export interface ImageEditParams { /** - * The image(s) to edit. Must be a supported image file or an array of images. For - * `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than - * 25MB. For `dall-e-2`, you can only provide one image, and it should be a square - * `png` file less than 4MB. + * The image(s) to edit. Must be a supported image file or an array of images. + * + * For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than + * 25MB. You can provide up to 16 images. + * + * For `dall-e-2`, you can only provide one image, and it should be a square `png` + * file less than 4MB. */ image: Uploadable | Array; @@ -181,6 +184,17 @@ export interface ImageEditParams { */ prompt: string; + /** + * Allows to set transparency for the background of the generated image(s). This + * parameter is only supported for `gpt-image-1`. Must be one of `transparent`, + * `opaque` or `auto` (default value). When `auto` is used, the model will + * automatically determine the best background for the image. + * + * If `transparent`, the output format needs to support transparency, so it should + * be set to either `png` (default value) or `webp`. + */ + background?: 'transparent' | 'opaque' | 'auto' | null; + /** * An additional image whose fully transparent areas (e.g. where alpha is zero) * indicate where `image` should be edited. If there are multiple images provided, @@ -221,7 +235,7 @@ export interface ImageEditParams { * (landscape), `1024x1536` (portrait), or `auto` (default value) for * `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. */ - size?: '256x256' | '512x512' | '1024x1024' | null; + size?: '256x256' | '512x512' | '1024x1024' | '1536x1024' | '1024x1536' | 'auto' | null; /** * A unique identifier representing your end-user, which can help OpenAI to monitor diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index de9fa3547..cce22c2f2 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -88,7 +88,7 @@ export interface ComputerTool { /** * The type of computer environment to control. */ - environment: 'mac' | 'windows' | 'ubuntu' | 'browser'; + environment: 'windows' | 'mac' | 'linux' | 'ubuntu' | 'browser'; /** * The type of the computer use tool. Always `computer_use_preview`. @@ -139,9 +139,9 @@ export interface FileSearchTool { vector_store_ids: Array; /** - * A filter to apply based on file attributes. + * A filter to apply. */ - filters?: Shared.ComparisonFilter | Shared.CompoundFilter; + filters?: Shared.ComparisonFilter | Shared.CompoundFilter | null; /** * The maximum number of results to return. This number should be between 1 and 50 @@ -188,12 +188,12 @@ export interface FunctionTool { /** * A JSON schema object describing the parameters of the function. */ - parameters: Record; + parameters: Record | null; /** * Whether to enforce strict parameter validation. Default `true`. */ - strict: boolean; + strict: boolean | null; /** * The type of the function tool. Always `function`. @@ -1509,11 +1509,17 @@ export interface ResponseInProgressEvent { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ export type ResponseIncludable = | 'file_search_call.results' | 'message.input_image.image_url' - | 'computer_call_output.output.image_url'; + | 'computer_call_output.output.image_url' + | 'reasoning.encrypted_content'; /** * An event that is emitted when a response finishes as incomplete. @@ -1578,7 +1584,7 @@ export interface ResponseInputFile { /** * The ID of the file to be sent to the model. */ - file_id?: string; + file_id?: string | null; /** * The name of the file to be sent to the model. @@ -1595,7 +1601,7 @@ export interface ResponseInputImage { * The detail level of the image to be sent to the model. One of `high`, `low`, or * `auto`. Defaults to `auto`. */ - detail: 'high' | 'low' | 'auto'; + detail: 'low' | 'high' | 'auto'; /** * The type of the input item. Always `input_image`. @@ -1686,19 +1692,19 @@ export namespace ResponseInputItem { /** * The ID of the computer tool call output. */ - id?: string; + id?: string | null; /** * The safety checks reported by the API that have been acknowledged by the * developer. */ - acknowledged_safety_checks?: Array; + acknowledged_safety_checks?: Array | null; /** * The status of the message input. One of `in_progress`, `completed`, or * `incomplete`. Populated when input items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } export namespace ComputerCallOutput { @@ -1714,12 +1720,12 @@ export namespace ResponseInputItem { /** * The type of the pending safety check. */ - code: string; + code?: string | null; /** * Details about the pending safety check. */ - message: string; + message?: string | null; } } @@ -1746,13 +1752,13 @@ export namespace ResponseInputItem { * The unique ID of the function tool call output. Populated when this item is * returned via API. */ - id?: string; + id?: string | null; /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. */ - status?: 'in_progress' | 'completed' | 'incomplete'; + status?: 'in_progress' | 'completed' | 'incomplete' | null; } /** @@ -1767,7 +1773,7 @@ export namespace ResponseInputItem { /** * The type of item to reference. Always `item_reference`. */ - type: 'item_reference'; + type?: 'item_reference' | null; } } @@ -2047,7 +2053,9 @@ export namespace ResponseOutputText { /** * A description of the chain of thought used by a reasoning model while generating - * a response. + * a response. Be sure to include these items in your `input` to the Responses API + * for subsequent turns of a conversation if you are manually + * [managing context](https://platform.openai.com/docs/guides/conversation-state). */ export interface ResponseReasoningItem { /** @@ -2065,6 +2073,12 @@ export interface ResponseReasoningItem { */ type: 'reasoning'; + /** + * The encrypted content of the reasoning item - populated when a response is + * generated with `reasoning.encrypted_content` in the `include` parameter. + */ + encrypted_content?: string | null; + /** * The status of the item. One of `in_progress`, `completed`, or `incomplete`. * Populated when items are returned via API. @@ -2658,11 +2672,9 @@ export interface ResponseWebSearchCallSearchingEvent { } /** - * A tool that searches for relevant content from uploaded files. Learn more about - * the - * [file search tool](https://platform.openai.com/docs/guides/tools-file-search). + * A tool that can be used to generate a response. */ -export type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool; +export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool; /** * Use this option to force the model to call a specific function. @@ -2716,10 +2728,8 @@ export interface ToolChoiceTypes { */ export interface WebSearchTool { /** - * The type of the web search tool. One of: - * - * - `web_search_preview` - * - `web_search_preview_2025_03_11` + * The type of the web search tool. One of `web_search_preview` or + * `web_search_preview_2025_03_11`. */ type: 'web_search_preview' | 'web_search_preview_2025_03_11'; @@ -2729,10 +2739,16 @@ export interface WebSearchTool { */ search_context_size?: 'low' | 'medium' | 'high'; + /** + * The user's location. + */ user_location?: WebSearchTool.UserLocation | null; } export namespace WebSearchTool { + /** + * The user's location. + */ export interface UserLocation { /** * The type of location approximation. Always `approximate`. @@ -2742,24 +2758,24 @@ export namespace WebSearchTool { /** * Free text input for the city of the user, e.g. `San Francisco`. */ - city?: string; + city?: string | null; /** * The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of * the user, e.g. `US`. */ - country?: string; + country?: string | null; /** * Free text input for the region of the user, e.g. `California`. */ - region?: string; + region?: string | null; /** * The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the * user, e.g. `America/Los_Angeles`. */ - timezone?: string; + timezone?: string | null; } } @@ -2797,6 +2813,11 @@ export interface ResponseCreateParamsBase { * - `message.input_image.image_url`: Include image urls from the input message. * - `computer_call_output.output.image_url`: Include image urls from the computer * call output. + * - `reasoning.encrypted_content`: Includes an encrypted version of reasoning + * tokens in reasoning item outputs. This enables reasoning items to be used in + * multi-turn conversations when using the Responses API statelessly (like when + * the `store` parameter is set to `false`, or when an organization is enrolled + * in the zero data retention program). */ include?: Array | null; diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index 844ff3768..ba62d993c 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -50,6 +50,7 @@ describe('resource images', () => { const response = await client.images.edit({ image: await toFile(Buffer.from('# my file contents'), 'README.md'), prompt: 'A cute baby sea otter wearing a beret', + background: 'transparent', mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1, From 7e9ea85f63a0989b3446834d9e1a94c0d050cf87 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 18:08:35 +0000 Subject: [PATCH 382/509] feat(client): add withOptions helper --- src/client.ts | 19 +++++++++++++ tests/index.test.ts | 68 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/src/client.ts b/src/client.ts index 12c28be1e..bd09adc8f 100644 --- a/src/client.ts +++ b/src/client.ts @@ -341,6 +341,25 @@ export class OpenAI { this.project = project; } + /** + * Create a new client instance re-using the same options given to the current client with optional overriding. + */ + withOptions(options: Partial): this { + return new (this.constructor as any as new (props: ClientOptions) => typeof this)({ + ...this._options, + baseURL: this.baseURL, + maxRetries: this.maxRetries, + timeout: this.timeout, + logger: this.logger, + logLevel: this.logLevel, + fetchOptions: this.fetchOptions, + apiKey: this.apiKey, + organization: this.organization, + project: this.project, + ...options, + }); + } + protected defaultQuery(): Record | undefined { return this._options.defaultQuery; } diff --git a/tests/index.test.ts b/tests/index.test.ts index e1989722a..401cc5c6e 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -321,6 +321,74 @@ describe('instantiate client', () => { expect(client2.maxRetries).toEqual(2); }); + describe('withOptions', () => { + test('creates a new client with overridden options', () => { + const client = new OpenAI({ baseURL: 'http://localhost:5000/', maxRetries: 3, apiKey: 'My API Key' }); + + const newClient = client.withOptions({ + maxRetries: 5, + baseURL: 'http://localhost:5001/', + }); + + // Verify the new client has updated options + expect(newClient.maxRetries).toEqual(5); + expect(newClient.baseURL).toEqual('http://localhost:5001/'); + + // Verify the original client is unchanged + expect(client.maxRetries).toEqual(3); + expect(client.baseURL).toEqual('http://localhost:5000/'); + + // Verify it's a different instance + expect(newClient).not.toBe(client); + expect(newClient.constructor).toBe(client.constructor); + }); + + test('inherits options from the parent client', () => { + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + defaultHeaders: { 'X-Test-Header': 'test-value' }, + defaultQuery: { 'test-param': 'test-value' }, + apiKey: 'My API Key', + }); + + const newClient = client.withOptions({ + baseURL: 'http://localhost:5001/', + }); + + // Test inherited options remain the same + expect(newClient.buildURL('/foo', null)).toEqual('http://localhost:5001/foo?test-param=test-value'); + + const { req } = newClient.buildRequest({ path: '/foo', method: 'get' }); + expect(req.headers.get('x-test-header')).toEqual('test-value'); + }); + + test('respects runtime property changes when creating new client', () => { + const client = new OpenAI({ baseURL: 'http://localhost:5000/', timeout: 1000, apiKey: 'My API Key' }); + + // Modify the client properties directly after creation + client.baseURL = 'http://localhost:6000/'; + client.timeout = 2000; + + // Create a new client with withOptions + const newClient = client.withOptions({ + maxRetries: 10, + }); + + // Verify the new client uses the updated properties, not the original ones + expect(newClient.baseURL).toEqual('http://localhost:6000/'); + expect(newClient.timeout).toEqual(2000); + expect(newClient.maxRetries).toEqual(10); + + // Original client should still have its modified properties + expect(client.baseURL).toEqual('http://localhost:6000/'); + expect(client.timeout).toEqual(2000); + expect(client.maxRetries).not.toEqual(10); + + // Verify URL building uses the updated baseURL + expect(newClient.buildURL('/bar', null)).toEqual('http://localhost:6000/bar'); + }); + }); + test('with environment variable arguments', () => { // set options via env var process.env['OPENAI_API_KEY'] = 'My API Key'; From a326944e8a8822bc70f86d7046de3142f9dff530 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 19:19:16 +0000 Subject: [PATCH 383/509] chore(client): drop support for EOL node versions --- .github/workflows/ci.yml | 6 +- MIGRATION.md | 5 +- README.md | 2 +- package.json | 8 +-- src/internal/shims/crypto.ts | 18 ------ src/internal/shims/file.ts | 32 ----------- src/internal/shims/getBuiltinModule.ts | 66 ---------------------- src/internal/shims/nullGetBuiltinModule.ts | 1 - src/internal/to-file.ts | 6 +- src/internal/uploads.ts | 20 +++++-- src/internal/utils/uuid.ts | 4 +- 11 files changed, 30 insertions(+), 138 deletions(-) delete mode 100644 src/internal/shims/crypto.ts delete mode 100644 src/internal/shims/file.ts delete mode 100644 src/internal/shims/getBuiltinModule.ts delete mode 100644 src/internal/shims/nullGetBuiltinModule.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 199f2419b..34cc130cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: Bootstrap run: ./scripts/bootstrap @@ -40,7 +40,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: Bootstrap run: ./scripts/bootstrap @@ -72,7 +72,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: '18' + node-version: '20' - name: Bootstrap run: ./scripts/bootstrap diff --git a/MIGRATION.md b/MIGRATION.md index e95140a0f..4e138b42c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -14,8 +14,7 @@ To preview the changes without writing them to disk, run the tool with `--dry`. The minimum supported runtime and tooling versions are now: -- Node.js 18.x last LTS (Required for builtin fetch support) - - This was previously documented as the minimum supported Node.js version but Node.js 16.x mostly worked at runtime; now it will not. +- Node.js 20 LTS (Most recent non-EOL Node version) - TypeScript 4.9 - Jest 28 @@ -385,7 +384,7 @@ To resolve these issues, configure your tsconfig.json and install the appropriat ```json { "devDependencies": { - "@types/node": ">= 18.18.7" + "@types/node": ">= 20" } } ``` diff --git a/README.md b/README.md index cff8c07bc..7b8c8d696 100644 --- a/README.md +++ b/README.md @@ -725,7 +725,7 @@ TypeScript >= 4.9 is supported. The following runtimes are supported: -- Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. +- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. - Deno v1.28.0 or higher. - Bun 1.0 or later. - Cloudflare Workers. diff --git a/package.json b/package.json index b559238ee..ec332e255 100644 --- a/package.json +++ b/package.json @@ -54,10 +54,6 @@ "resolutions": { "synckit": "0.8.8" }, - "browser": { - "./internal/shims/getBuiltinModule.mjs": "./internal/shims/nullGetBuiltinModule.mjs", - "./internal/shims/getBuiltinModule.js": "./internal/shims/nullGetBuiltinModule.js" - }, "imports": { "openai": ".", "openai/*": "./src/*" @@ -81,7 +77,9 @@ "require": "./dist/*.js" } }, - "bin": "./bin/cli", + "engines": { + "node": ">= 20" + }, "peerDependencies": { "ws": "^8.18.0", "zod": "^3.23.8" diff --git a/src/internal/shims/crypto.ts b/src/internal/shims/crypto.ts deleted file mode 100644 index 905f81c6f..000000000 --- a/src/internal/shims/crypto.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { getBuiltinModule } from './getBuiltinModule'; - -type Crypto = { - /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ - getRandomValues(array: T): T; - /** - * Available only in secure contexts. - * - * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) - */ - randomUUID?: () => string; -}; -export let getCrypto: () => Crypto | undefined = function lazyGetCrypto() { - if (getCrypto !== lazyGetCrypto) return getCrypto(); - const crypto: Crypto = (globalThis as any).crypto || (getBuiltinModule?.('node:crypto') as any)?.webcrypto; - getCrypto = () => crypto; - return crypto; -}; diff --git a/src/internal/shims/file.ts b/src/internal/shims/file.ts deleted file mode 100644 index d5dc82091..000000000 --- a/src/internal/shims/file.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { getBuiltinModule } from './getBuiltinModule'; - -export let getFile = function lazyGetFile(): FileConstructor { - if (getFile !== lazyGetFile) return getFile(); - // We can drop getBuiltinModule once we no longer support Node < 20.0.0 - const File = (globalThis as any).File ?? (getBuiltinModule?.('node:buffer') as any)?.File; - if (!File) throw new Error('`File` is not defined as a global, which is required for file uploads.'); - getFile = () => File; - return File; -}; - -type FileConstructor = - typeof globalThis extends { File: infer fileConstructor } ? fileConstructor : typeof FallbackFile; -export type File = InstanceType; - -// The infer is to make TS show it as a nice union type, -// instead of literally `ConstructorParameters[0]` -type FallbackBlobSource = ConstructorParameters[0] extends infer T ? T : never; -/** - * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. - */ -declare class FallbackFile extends Blob { - constructor(sources: FallbackBlobSource, fileName: string, options?: any); - /** - * The name of the `File`. - */ - readonly name: string; - /** - * The last modified date of the `File`. - */ - readonly lastModified: number; -} diff --git a/src/internal/shims/getBuiltinModule.ts b/src/internal/shims/getBuiltinModule.ts deleted file mode 100644 index 64daa2ce0..000000000 --- a/src/internal/shims/getBuiltinModule.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Load a Node built-in module. ID may or may not be prefixed by `node:` and - * will be normalized. If we used static imports then our bundle size would be bloated by - * injected polyfills, and if we used dynamic require then in addition to bundlers logging warnings, - * our code would not work when bundled to ESM and run in Node 18. - * @param {string} id ID of the built-in to be loaded. - * @returns {object|undefined} exports of the built-in. Undefined if the built-in - * does not exist. - */ -export let getBuiltinModule: null | ((id: string) => object | undefined) = function getBuiltinModuleLazy( - id: string, -): object | undefined { - try { - if (getBuiltinModule !== getBuiltinModuleLazy) return getBuiltinModule!(id); - if ((process as any).getBuiltinModule) { - getBuiltinModule = (process as any).getBuiltinModule; - } else { - /* Fallback implementation for Node 18 */ - function createFallbackGetBuiltinModule(BuiltinModule: any) { - return function getBuiltinModule(id: string): object | undefined { - id = BuiltinModule.normalizeRequirableId(String(id)); - if (!BuiltinModule.canBeRequiredByUsers(id)) { - return; - } - const mod = BuiltinModule.map.get(id); - mod.compileForPublicLoader(); - return mod.exports; - }; - } - const magicKey = Math.random() + ''; - let module: { BuiltinModule: any } | undefined; - let ObjectPrototype: {} = Blob; - for (let next; (next = Reflect.getPrototypeOf(ObjectPrototype)); ObjectPrototype = next); - try { - const kClone = Object.getOwnPropertySymbols(Blob.prototype).find( - (e) => e.description?.includes('clone'), - )!; - Object.defineProperty(ObjectPrototype, magicKey, { - get() { - module = this; - throw null; - }, - configurable: true, - }); - structuredClone( - new (class extends Blob { - [kClone]() { - return { - deserializeInfo: 'internal/bootstrap/realm:' + magicKey, - }; - } - })([]), - ); - } catch {} - delete (ObjectPrototype as any)[magicKey]; - if (module) { - getBuiltinModule = createFallbackGetBuiltinModule(module.BuiltinModule); - } else { - getBuiltinModule = () => undefined; - } - } - return getBuiltinModule!(id); - } catch { - return undefined; - } -}; diff --git a/src/internal/shims/nullGetBuiltinModule.ts b/src/internal/shims/nullGetBuiltinModule.ts deleted file mode 100644 index 8bd2280d3..000000000 --- a/src/internal/shims/nullGetBuiltinModule.ts +++ /dev/null @@ -1 +0,0 @@ -export const getBuiltinModule = null; diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts index e92ac6944..245e84933 100644 --- a/src/internal/to-file.ts +++ b/src/internal/to-file.ts @@ -1,6 +1,6 @@ -import { type File, getFile } from './shims/file'; import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads'; import type { FilePropertyBag } from './builtin-types'; +import { checkFileSupport } from './uploads'; type BlobLikePart = string | ArrayBuffer | ArrayBufferView | BlobLike | DataView; @@ -85,12 +85,14 @@ export async function toFile( name?: string | null | undefined, options?: FilePropertyBag | undefined, ): Promise { + checkFileSupport(); + // If it's a promise, resolve it. value = await value; // If we've been given a `File` we don't need to do anything if (isFileLike(value)) { - if (value instanceof getFile()) { + if (value instanceof File) { return value; } return makeFile([await value.arrayBuffer()], value.name); diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index 116a5ab4e..b21555747 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -1,7 +1,6 @@ import { type RequestOptions } from './request-options'; import type { FilePropertyBag, Fetch } from './builtin-types'; import type { OpenAI } from '../client'; -import { type File, getFile } from './shims/file'; import { ReadableStreamFrom } from './shims'; export type BlobPart = string | ArrayBuffer | ArrayBufferView | Blob | DataView; @@ -12,6 +11,20 @@ interface BunFile extends Blob { readonly name?: string | undefined; } +export const checkFileSupport = () => { + if (typeof File === 'undefined') { + const { process } = globalThis as any; + const isOldNode = + typeof process?.versions?.node === 'string' && parseInt(process.versions.node.split('.')) < 20; + throw new Error( + '`File` is not defined as a global, which is required for file uploads.' + + (isOldNode ? + " Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`." + : ''), + ); + } +}; + /** * Typically, this is a native "File" class. * @@ -32,7 +45,7 @@ export function makeFile( fileName: string | undefined, options?: FilePropertyBag, ): File { - const File = getFile(); + checkFileSupport(); return new File(fileBits as any, fileName ?? 'unknown_file', options); } @@ -125,8 +138,7 @@ export const createForm = async >( // We check for Blob not File because Bun.File doesn't inherit from File, // but they both inherit from Blob and have a `name` property at runtime. -const isNamedBlob = (value: object) => - value instanceof getFile() || (value instanceof Blob && 'name' in value); +const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value; const isUploadable = (value: unknown) => typeof value === 'object' && diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts index 5a262c6d3..b0e53aaf7 100644 --- a/src/internal/utils/uuid.ts +++ b/src/internal/utils/uuid.ts @@ -1,12 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { getCrypto } from '../shims/crypto'; - /** * https://stackoverflow.com/a/2117523 */ export let uuid4 = function () { - const crypto = getCrypto(); + const { crypto } = globalThis as any; if (crypto?.randomUUID) { uuid4 = crypto.randomUUID.bind(crypto); return crypto.randomUUID(); From fa48353ffd03bfa2fb81ee16a9fb5fae0b0073c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 00:40:42 +0000 Subject: [PATCH 384/509] chore(internal): codegen related update --- src/resources/audio/speech.ts | 12 +++++ src/resources/audio/transcriptions.ts | 9 ++++ src/resources/audio/translations.ts | 8 +++ src/resources/beta/assistants.ts | 35 +++++++++++++ src/resources/beta/realtime/sessions.ts | 6 +++ .../beta/realtime/transcription-sessions.ts | 6 +++ src/resources/beta/threads/messages.ts | 42 +++++++++++++++ src/resources/beta/threads/runs/runs.ts | 51 +++++++++++++++++++ src/resources/beta/threads/runs/steps.ts | 20 ++++++++ src/resources/beta/threads/threads.ts | 33 ++++++++++++ src/resources/chat/completions/completions.ts | 38 ++++++++++++++ src/resources/chat/completions/messages.ts | 10 ++++ src/resources/completions.ts | 8 +++ src/resources/embeddings.ts | 9 ++++ .../fine-tuning/checkpoints/permissions.ts | 31 +++++++++++ src/resources/fine-tuning/jobs/checkpoints.ts | 10 ++++ src/resources/fine-tuning/jobs/jobs.ts | 40 +++++++++++++++ src/resources/images.ts | 22 ++++++++ src/resources/responses/input-items.ts | 10 ++++ src/resources/responses/responses.ts | 22 ++++++++ 20 files changed, 422 insertions(+) diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 350b944ae..41d890ccf 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -8,6 +8,18 @@ import { RequestOptions } from '../../internal/request-options'; export class Speech extends APIResource { /** * Generates audio from the input text. + * + * @example + * ```ts + * const speech = await client.audio.speech.create({ + * input: 'input', + * model: 'string', + * voice: 'ash', + * }); + * + * const content = await speech.blob(); + * console.log(content); + * ``` */ create(body: SpeechCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/audio/speech', { diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 675aa9409..fc99ab948 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -12,6 +12,15 @@ import { multipartFormRequestOptions } from '../../internal/uploads'; export class Transcriptions extends APIResource { /** * Transcribes audio into the input language. + * + * @example + * ```ts + * const transcription = + * await client.audio.transcriptions.create({ + * file: fs.createReadStream('speech.mp3'), + * model: 'gpt-4o-transcribe', + * }); + * ``` */ create( body: TranscriptionCreateParamsNonStreaming<'json' | undefined>, diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index 5f07a1ddb..2e8c8f4a4 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -11,6 +11,14 @@ import { multipartFormRequestOptions } from '../../internal/uploads'; export class Translations extends APIResource { /** * Translates audio into English. + * + * @example + * ```ts + * const translation = await client.audio.translations.create({ + * file: fs.createReadStream('speech.mp3'), + * model: 'whisper-1', + * }); + * ``` */ create( body: TranslationCreateParams<'json' | undefined>, diff --git a/src/resources/beta/assistants.ts b/src/resources/beta/assistants.ts index 40cc82384..dbda2d578 100644 --- a/src/resources/beta/assistants.ts +++ b/src/resources/beta/assistants.ts @@ -15,6 +15,13 @@ import { path } from '../../internal/utils/path'; export class Assistants extends APIResource { /** * Create an assistant with a model and instructions. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.create({ + * model: 'gpt-4o', + * }); + * ``` */ create(body: AssistantCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/assistants', { @@ -26,6 +33,13 @@ export class Assistants extends APIResource { /** * Retrieves an assistant. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.retrieve( + * 'assistant_id', + * ); + * ``` */ retrieve(assistantID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/assistants/${assistantID}`, { @@ -36,6 +50,13 @@ export class Assistants extends APIResource { /** * Modifies an assistant. + * + * @example + * ```ts + * const assistant = await client.beta.assistants.update( + * 'assistant_id', + * ); + * ``` */ update(assistantID: string, body: AssistantUpdateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/assistants/${assistantID}`, { @@ -47,6 +68,14 @@ export class Assistants extends APIResource { /** * Returns a list of assistants. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const assistant of client.beta.assistants.list()) { + * // ... + * } + * ``` */ list( query: AssistantListParams | null | undefined = {}, @@ -61,6 +90,12 @@ export class Assistants extends APIResource { /** * Delete an assistant. + * + * @example + * ```ts + * const assistantDeleted = + * await client.beta.assistants.delete('assistant_id'); + * ``` */ delete(assistantID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/assistants/${assistantID}`, { diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 324421197..04cf658d2 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -14,6 +14,12 @@ export class Sessions extends APIResource { * It responds with a session object, plus a `client_secret` key which contains a * usable ephemeral API token that can be used to authenticate browser clients for * the Realtime API. + * + * @example + * ```ts + * const session = + * await client.beta.realtime.sessions.create(); + * ``` */ create(body: SessionCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/realtime/sessions', { diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index 8040c5056..e30fbdbf5 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -14,6 +14,12 @@ export class TranscriptionSessions extends APIResource { * It responds with a session object, plus a `client_secret` key which contains a * usable ephemeral API token that can be used to authenticate browser clients for * the Realtime API. + * + * @example + * ```ts + * const transcriptionSession = + * await client.beta.realtime.transcriptionSessions.create(); + * ``` */ create(body: TranscriptionSessionCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/realtime/transcription_sessions', { diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index a4a7377c2..53ca21b11 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -12,6 +12,14 @@ import { path } from '../../../internal/utils/path'; export class Messages extends APIResource { /** * Create a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.create( + * 'thread_id', + * { content: 'string', role: 'user' }, + * ); + * ``` */ create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/threads/${threadID}/messages`, { @@ -23,6 +31,14 @@ export class Messages extends APIResource { /** * Retrieve a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.retrieve( + * 'message_id', + * { thread_id: 'thread_id' }, + * ); + * ``` */ retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -34,6 +50,14 @@ export class Messages extends APIResource { /** * Modifies a message. + * + * @example + * ```ts + * const message = await client.beta.threads.messages.update( + * 'message_id', + * { thread_id: 'thread_id' }, + * ); + * ``` */ update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; @@ -46,6 +70,16 @@ export class Messages extends APIResource { /** * Returns a list of messages for a given thread. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const message of client.beta.threads.messages.list( + * 'thread_id', + * )) { + * // ... + * } + * ``` */ list( threadID: string, @@ -61,6 +95,14 @@ export class Messages extends APIResource { /** * Deletes a message. + * + * @example + * ```ts + * const messageDeleted = + * await client.beta.threads.messages.delete('message_id', { + * thread_id: 'thread_id', + * }); + * ``` */ delete( messageID: string, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 0d786d759..2e28e4ef4 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -46,6 +46,14 @@ export class Runs extends APIResource { /** * Create a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.create( + * 'thread_id', + * { assistant_id: 'assistant_id' }, + * ); + * ``` */ create(threadID: string, params: RunCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( @@ -75,6 +83,14 @@ export class Runs extends APIResource { /** * Retrieves a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.retrieve( + * 'run_id', + * { thread_id: 'thread_id' }, + * ); + * ``` */ retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -86,6 +102,14 @@ export class Runs extends APIResource { /** * Modifies a run. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.update( + * 'run_id', + * { thread_id: 'thread_id' }, + * ); + * ``` */ update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; @@ -98,6 +122,16 @@ export class Runs extends APIResource { /** * Returns a list of runs belonging to a thread. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const run of client.beta.threads.runs.list( + * 'thread_id', + * )) { + * // ... + * } + * ``` */ list( threadID: string, @@ -113,6 +147,14 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. + * + * @example + * ```ts + * const run = await client.beta.threads.runs.cancel( + * 'run_id', + * { thread_id: 'thread_id' }, + * ); + * ``` */ cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -217,6 +259,15 @@ export class Runs extends APIResource { * `submit_tool_outputs`, this endpoint can be used to submit the outputs from the * tool calls once they're all completed. All outputs must be submitted in a single * request. + * + * @example + * ```ts + * const run = + * await client.beta.threads.runs.submitToolOutputs( + * 'run_id', + * { thread_id: 'thread_id', tool_outputs: [{}] }, + * ); + * ``` */ submitToolOutputs( runID: string, diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 68be569e5..90115f18b 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -12,6 +12,15 @@ import { path } from '../../../../internal/utils/path'; export class Steps extends APIResource { /** * Retrieves a run step. + * + * @example + * ```ts + * const runStep = + * await client.beta.threads.runs.steps.retrieve('step_id', { + * thread_id: 'thread_id', + * run_id: 'run_id', + * }); + * ``` */ retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id, run_id, ...query } = params; @@ -24,6 +33,17 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const runStep of client.beta.threads.runs.steps.list( + * 'run_id', + * { thread_id: 'thread_id' }, + * )) { + * // ... + * } + * ``` */ list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise { const { thread_id, ...query } = params; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index e03667ccd..7af258e85 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -78,6 +78,11 @@ export class Threads extends APIResource { /** * Create a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.create(); + * ``` */ create(body: ThreadCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.post('/threads', { @@ -89,6 +94,13 @@ export class Threads extends APIResource { /** * Retrieves a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.retrieve( + * 'thread_id', + * ); + * ``` */ retrieve(threadID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/threads/${threadID}`, { @@ -99,6 +111,13 @@ export class Threads extends APIResource { /** * Modifies a thread. + * + * @example + * ```ts + * const thread = await client.beta.threads.update( + * 'thread_id', + * ); + * ``` */ update(threadID: string, body: ThreadUpdateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/threads/${threadID}`, { @@ -110,6 +129,13 @@ export class Threads extends APIResource { /** * Delete a thread. + * + * @example + * ```ts + * const threadDeleted = await client.beta.threads.delete( + * 'thread_id', + * ); + * ``` */ delete(threadID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/threads/${threadID}`, { @@ -120,6 +146,13 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. + * + * @example + * ```ts + * const run = await client.beta.threads.createAndRun({ + * assistant_id: 'assistant_id', + * }); + * ``` */ createAndRun(body: ThreadCreateAndRunParamsNonStreaming, options?: RequestOptions): APIPromise; createAndRun( diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 2f16317a1..585febaa6 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -33,6 +33,16 @@ export class Completions extends APIResource { * supported for reasoning models are noted below. For the current state of * unsupported parameters in reasoning models, * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning). + * + * @example + * ```ts + * const chatCompletion = await client.chat.completions.create( + * { + * messages: [{ content: 'string', role: 'developer' }], + * model: 'gpt-4o', + * }, + * ); + * ``` */ create(body: ChatCompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( @@ -55,6 +65,12 @@ export class Completions extends APIResource { /** * Get a stored chat completion. Only Chat Completions that have been created with * the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * const chatCompletion = + * await client.chat.completions.retrieve('completion_id'); + * ``` */ retrieve(completionID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/chat/completions/${completionID}`, options); @@ -64,6 +80,14 @@ export class Completions extends APIResource { * Modify a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be modified. Currently, the only * supported modification is to update the `metadata` field. + * + * @example + * ```ts + * const chatCompletion = await client.chat.completions.update( + * 'completion_id', + * { metadata: { foo: 'string' } }, + * ); + * ``` */ update( completionID: string, @@ -76,6 +100,14 @@ export class Completions extends APIResource { /** * List stored Chat Completions. Only Chat Completions that have been stored with * the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const chatCompletion of client.chat.completions.list()) { + * // ... + * } + * ``` */ list( query: ChatCompletionListParams | null | undefined = {}, @@ -87,6 +119,12 @@ export class Completions extends APIResource { /** * Delete a stored chat completion. Only Chat Completions that have been created * with the `store` parameter set to `true` can be deleted. + * + * @example + * ```ts + * const chatCompletionDeleted = + * await client.chat.completions.delete('completion_id'); + * ``` */ delete(completionID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/chat/completions/${completionID}`, options); diff --git a/src/resources/chat/completions/messages.ts b/src/resources/chat/completions/messages.ts index 0ea05d2f7..ee16e3269 100644 --- a/src/resources/chat/completions/messages.ts +++ b/src/resources/chat/completions/messages.ts @@ -11,6 +11,16 @@ export class Messages extends APIResource { /** * Get the messages in a stored chat completion. Only Chat Completions that have * been created with the `store` parameter set to `true` will be returned. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const chatCompletionStoreMessage of client.chat.completions.messages.list( + * 'completion_id', + * )) { + * // ... + * } + * ``` */ list( completionID: string, diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 1930a0bc0..042e51693 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -10,6 +10,14 @@ import { RequestOptions } from '../internal/request-options'; export class Completions extends APIResource { /** * Creates a completion for the provided prompt and parameters. + * + * @example + * ```ts + * const completion = await client.completions.create({ + * model: 'string', + * prompt: 'This is a test.', + * }); + * ``` */ create(body: CompletionCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create(body: CompletionCreateParamsStreaming, options?: RequestOptions): APIPromise>; diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index b9c48efad..bb77cd78f 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -7,6 +7,15 @@ import { RequestOptions } from '../internal/request-options'; export class Embeddings extends APIResource { /** * Creates an embedding vector representing the input text. + * + * @example + * ```ts + * const createEmbeddingResponse = + * await client.embeddings.create({ + * input: 'The quick brown fox jumped over the lazy dog', + * model: 'text-embedding-3-small', + * }); + * ``` */ create(body: EmbeddingCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/embeddings', { body, ...options }); diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index 87a0743eb..9217f324c 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -12,6 +12,17 @@ export class Permissions extends APIResource { * * This enables organization owners to share fine-tuned models with other projects * in their organization. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create( + * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + * { project_ids: ['string'] }, + * )) { + * // ... + * } + * ``` */ create( fineTunedModelCheckpoint: string, @@ -30,6 +41,14 @@ 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', + * ); + * ``` */ retrieve( fineTunedModelCheckpoint: string, @@ -47,6 +66,18 @@ export class Permissions extends APIResource { * * Organization owners can use this endpoint to delete a permission for a * fine-tuned model checkpoint. + * + * @example + * ```ts + * const permission = + * await client.fineTuning.checkpoints.permissions.delete( + * 'cp_zc4Q7MP6XxulcVzj4MZdwsAB', + * { + * fine_tuned_model_checkpoint: + * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd', + * }, + * ); + * ``` */ delete( permissionID: string, diff --git a/src/resources/fine-tuning/jobs/checkpoints.ts b/src/resources/fine-tuning/jobs/checkpoints.ts index 1b014aa75..868713b6d 100644 --- a/src/resources/fine-tuning/jobs/checkpoints.ts +++ b/src/resources/fine-tuning/jobs/checkpoints.ts @@ -8,6 +8,16 @@ import { path } from '../../../internal/utils/path'; export class Checkpoints extends APIResource { /** * List checkpoints for a fine-tuning job. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJobCheckpoint of client.fineTuning.jobs.checkpoints.list( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } + * ``` */ list( fineTuningJobID: string, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index bef0de6e4..48cda2b2b 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -25,6 +25,14 @@ export class Jobs extends APIResource { * of the fine-tuned models once complete. * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.create({ + * model: 'gpt-4o-mini', + * training_file: 'file-abc123', + * }); + * ``` */ create(body: JobCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/fine_tuning/jobs', { body, ...options }); @@ -34,6 +42,13 @@ export class Jobs extends APIResource { * Get info about a fine-tuning job. * * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.retrieve( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` */ retrieve(fineTuningJobID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/fine_tuning/jobs/${fineTuningJobID}`, options); @@ -41,6 +56,14 @@ export class Jobs extends APIResource { /** * List your organization's fine-tuning jobs + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJob of client.fineTuning.jobs.list()) { + * // ... + * } + * ``` */ list( query: JobListParams | null | undefined = {}, @@ -51,6 +74,13 @@ export class Jobs extends APIResource { /** * Immediately cancel a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.cancel( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` */ cancel(fineTuningJobID: string, options?: RequestOptions): APIPromise { return this._client.post(path`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options); @@ -58,6 +88,16 @@ export class Jobs extends APIResource { /** * Get status updates for a fine-tuning job. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const fineTuningJobEvent of client.fineTuning.jobs.listEvents( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } + * ``` */ listEvents( fineTuningJobID: string, diff --git a/src/resources/images.ts b/src/resources/images.ts index 2039c0b17..9b7bacf87 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -9,6 +9,13 @@ import { multipartFormRequestOptions } from '../internal/uploads'; export class Images extends APIResource { /** * Creates a variation of a given image. This endpoint only supports `dall-e-2`. + * + * @example + * ```ts + * const imagesResponse = await client.images.createVariation({ + * image: fs.createReadStream('otter.png'), + * }); + * ``` */ createVariation(body: ImageCreateVariationParams, options?: RequestOptions): APIPromise { return this._client.post( @@ -20,6 +27,14 @@ export class Images extends APIResource { /** * Creates an edited or extended image given one or more source images and a * prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`. + * + * @example + * ```ts + * const imagesResponse = await client.images.edit({ + * image: fs.createReadStream('path/to/file'), + * prompt: 'A cute baby sea otter wearing a beret', + * }); + * ``` */ edit(body: ImageEditParams, options?: RequestOptions): APIPromise { return this._client.post( @@ -31,6 +46,13 @@ export class Images extends APIResource { /** * Creates an image given a prompt. * [Learn more](https://platform.openai.com/docs/guides/images). + * + * @example + * ```ts + * const imagesResponse = await client.images.generate({ + * prompt: 'A cute baby sea otter', + * }); + * ``` */ generate(body: ImageGenerateParams, options?: RequestOptions): APIPromise { return this._client.post('/images/generations', { body, ...options }); diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index c04fbe283..5ac6c2a74 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -10,6 +10,16 @@ import { path } from '../../internal/utils/path'; export class InputItems extends APIResource { /** * Returns a list of input items for a given response. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const responseItem of client.responses.inputItems.list( + * 'response_id', + * )) { + * // ... + * } + * ``` */ list( responseID: string, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index cce22c2f2..0805c3af0 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -27,6 +27,14 @@ export class Responses extends APIResource { * [web search](https://platform.openai.com/docs/guides/tools-web-search) or * [file search](https://platform.openai.com/docs/guides/tools-file-search) to use * your own data as input for the model's response. + * + * @example + * ```ts + * const response = await client.responses.create({ + * input: 'string', + * model: 'gpt-4o', + * }); + * ``` */ create(body: ResponseCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( @@ -48,6 +56,13 @@ export class Responses extends APIResource { /** * Retrieves a model response with the given ID. + * + * @example + * ```ts + * const response = await client.responses.retrieve( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` */ retrieve( responseID: string, @@ -59,6 +74,13 @@ export class Responses extends APIResource { /** * Deletes a model response with the given ID. + * + * @example + * ```ts + * await client.responses.delete( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` */ delete(responseID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/responses/${responseID}`, { From e6bbaf577aa6bdf3bcdaf25a5a7d4e8202831c7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 17:23:51 +0000 Subject: [PATCH 385/509] feat(api): Add reinforcement fine-tuning api support --- .stats.yml | 8 +- api.md | 43 +- src/client.ts | 11 +- src/resources/evals/evals.ts | 732 ++---------------- src/resources/evals/index.ts | 3 - src/resources/fine-tuning/alpha.ts | 3 + src/resources/fine-tuning/alpha/alpha.ts | 27 + src/resources/fine-tuning/alpha/graders.ts | 166 ++++ src/resources/fine-tuning/alpha/index.ts | 10 + src/resources/fine-tuning/fine-tuning.ts | 28 + src/resources/fine-tuning/index.ts | 10 + src/resources/fine-tuning/jobs/jobs.ts | 203 +---- src/resources/fine-tuning/methods.ts | 152 ++++ src/resources/graders.ts | 3 + src/resources/graders/grader-models.ts | 296 +++++++ src/resources/graders/graders.ts | 31 + src/resources/graders/index.ts | 12 + src/resources/index.ts | 4 +- .../fine-tuning/alpha/graders.test.ts | 52 ++ .../fine-tuning/jobs/jobs.test.ts | 42 +- 20 files changed, 1002 insertions(+), 834 deletions(-) create mode 100644 src/resources/fine-tuning/alpha.ts create mode 100644 src/resources/fine-tuning/alpha/alpha.ts create mode 100644 src/resources/fine-tuning/alpha/graders.ts create mode 100644 src/resources/fine-tuning/alpha/index.ts create mode 100644 src/resources/fine-tuning/methods.ts create mode 100644 src/resources/graders.ts create mode 100644 src/resources/graders/grader-models.ts create mode 100644 src/resources/graders/graders.ts create mode 100644 src/resources/graders/index.ts create mode 100644 tests/api-resources/fine-tuning/alpha/graders.test.ts diff --git a/.stats.yml b/.stats.yml index 0c8278866..5f1bee851 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 97 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml -openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6 -config_hash: d9b6b6e6bc85744663e300eebc482067 +configured_endpoints: 101 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-794a6ed3c3d3d77887564755168056af8a426b17cf1ec721e3a300503dc22a41.yml +openapi_spec_hash: 25a81c220713cd5b0bafc221d1dfa79a +config_hash: 0b768ed1b56c6d82816f0fa40dc4aaf5 diff --git a/api.md b/api.md index 3a27b52ef..248f7768c 100644 --- a/api.md +++ b/api.md @@ -205,6 +205,17 @@ Methods: # FineTuning +## Methods + +Types: + +- DpoHyperparameters +- DpoMethod +- ReinforcementHyperparameters +- ReinforcementMethod +- SupervisedHyperparameters +- SupervisedMethod + ## Jobs Types: @@ -222,6 +233,8 @@ Methods: - client.fineTuning.jobs.list({ ...params }) -> FineTuningJobsPage - client.fineTuning.jobs.cancel(fineTuningJobID) -> FineTuningJob - client.fineTuning.jobs.listEvents(fineTuningJobID, { ...params }) -> FineTuningJobEventsPage +- client.fineTuning.jobs.pause(fineTuningJobID) -> FineTuningJob +- client.fineTuning.jobs.resume(fineTuningJobID) -> FineTuningJob ### Checkpoints @@ -249,6 +262,33 @@ Methods: - client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse - client.fineTuning.checkpoints.permissions.delete(permissionID, { ...params }) -> PermissionDeleteResponse +## Alpha + +### Graders + +Types: + +- GraderRunResponse +- GraderValidateResponse + +Methods: + +- client.fineTuning.alpha.graders.run({ ...params }) -> GraderRunResponse +- client.fineTuning.alpha.graders.validate({ ...params }) -> GraderValidateResponse + +# Graders + +## GraderModels + +Types: + +- LabelModelGrader +- MultiGrader +- PythonGrader +- ScoreModelGrader +- StringCheckGrader +- TextSimilarityGrader + # VectorStores Types: @@ -668,10 +708,7 @@ Methods: Types: - EvalCustomDataSourceConfig -- EvalLabelModelGrader - EvalStoredCompletionsDataSourceConfig -- EvalStringCheckGrader -- EvalTextSimilarityGrader - EvalCreateResponse - EvalRetrieveResponse - EvalUpdateResponse diff --git a/src/client.ts b/src/client.ts index bd09adc8f..12fd53b59 100644 --- a/src/client.ts +++ b/src/client.ts @@ -90,19 +90,17 @@ import { EvalCreateResponse, EvalCustomDataSourceConfig, EvalDeleteResponse, - EvalLabelModelGrader, EvalListParams, EvalListResponse, EvalListResponsesPage, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, - EvalStringCheckGrader, - EvalTextSimilarityGrader, EvalUpdateParams, EvalUpdateResponse, Evals, } from './resources/evals/evals'; import { FineTuning } from './resources/fine-tuning/fine-tuning'; +import { Graders } from './resources/graders/graders'; import { Responses } from './resources/responses/responses'; import { Upload, @@ -887,6 +885,7 @@ export class OpenAI { moderations: API.Moderations = new API.Moderations(this); 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); beta: API.Beta = new API.Beta(this); batches: API.Batches = new API.Batches(this); @@ -903,6 +902,7 @@ OpenAI.Audio = Audio; OpenAI.Moderations = Moderations; OpenAI.Models = Models; OpenAI.FineTuning = FineTuning; +OpenAI.Graders = Graders; OpenAI.VectorStores = VectorStores; OpenAI.Beta = Beta; OpenAI.Batches = Batches; @@ -1019,6 +1019,8 @@ export declare namespace OpenAI { export { FineTuning as FineTuning }; + export { Graders as Graders }; + export { VectorStores as VectorStores, type AutoFileChunkingStrategyParam as AutoFileChunkingStrategyParam, @@ -1063,10 +1065,7 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLabelModelGrader as EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader as EvalStringCheckGrader, - type EvalTextSimilarityGrader as EvalTextSimilarityGrader, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, type EvalUpdateResponse as EvalUpdateResponse, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 172a1c47b..88369e461 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; +import * as GraderModelsAPI from '../graders/grader-models'; import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { @@ -95,83 +96,6 @@ export interface EvalCustomDataSourceConfig { type: 'custom'; } -/** - * A LabelModelGrader object which uses a model to assign labels to each item in - * the evaluation. - */ -export interface EvalLabelModelGrader { - input: Array; - - /** - * The labels to assign to each item in the evaluation. - */ - labels: Array; - - /** - * The model to use for the evaluation. Must support structured outputs. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The labels that indicate a passing result. Must be a subset of labels. - */ - passing_labels: Array; - - /** - * The object type, which is always `label_model`. - */ - type: 'label_model'; -} - -export namespace EvalLabelModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A StoredCompletionsDataSourceConfig which specifies the metadata property of * your stored completions query. This is usually metadata like `usecase=chatbot` @@ -202,83 +126,6 @@ export interface EvalStoredCompletionsDataSourceConfig { metadata?: Shared.Metadata | null; } -/** - * A StringCheckGrader object that performs a string comparison between input and - * reference using a specified operation. - */ -export interface EvalStringCheckGrader { - /** - * The input text. This may include template strings. - */ - input: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. - */ - operation: 'eq' | 'ne' | 'like' | 'ilike'; - - /** - * The reference text. This may include template strings. - */ - reference: string; - - /** - * The object type, which is always `string_check`. - */ - type: 'string_check'; -} - -/** - * A TextSimilarityGrader object which grades text based on similarity metrics. - */ -export interface EvalTextSimilarityGrader { - /** - * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, - * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. - */ - evaluation_metric: - | 'fuzzy_match' - | 'bleu' - | 'gleu' - | 'meteor' - | 'rouge_1' - | 'rouge_2' - | 'rouge_3' - | 'rouge_4' - | 'rouge_5' - | 'rouge_l'; - - /** - * The text being graded. - */ - input: string; - - /** - * A float score where a value greater than or equal indicates a passing grade. - */ - pass_threshold: number; - - /** - * The text being graded against. - */ - reference: string; - - /** - * The type of grader. - */ - type: 'text_similarity'; - - /** - * The name of the grader. - */ - name?: string; -} - /** * An Eval object with a data source config and testing criteria. An Eval * represents a task to be done for your LLM integration. Like: @@ -327,39 +174,29 @@ export interface EvalCreateResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalCreateResponse.Python - | EvalCreateResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalCreateResponse.EvalGraderTextSimilarity + | EvalCreateResponse.EvalGraderPython + | EvalCreateResponse.EvalGraderScoreModel >; } export namespace EvalCreateResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -369,85 +206,11 @@ export namespace EvalCreateResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -499,39 +262,29 @@ export interface EvalRetrieveResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalRetrieveResponse.Python - | EvalRetrieveResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalRetrieveResponse.EvalGraderTextSimilarity + | EvalRetrieveResponse.EvalGraderPython + | EvalRetrieveResponse.EvalGraderScoreModel >; } export namespace EvalRetrieveResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -541,85 +294,11 @@ export namespace EvalRetrieveResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -671,39 +350,29 @@ export interface EvalUpdateResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalUpdateResponse.Python - | EvalUpdateResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalUpdateResponse.EvalGraderTextSimilarity + | EvalUpdateResponse.EvalGraderPython + | EvalUpdateResponse.EvalGraderScoreModel >; } export namespace EvalUpdateResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -713,85 +382,11 @@ export namespace EvalUpdateResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -843,39 +438,29 @@ export interface EvalListResponse { * A list of testing criteria. */ testing_criteria: Array< - | EvalLabelModelGrader - | EvalStringCheckGrader - | EvalTextSimilarityGrader - | EvalListResponse.Python - | EvalListResponse.ScoreModel + | GraderModelsAPI.LabelModelGrader + | GraderModelsAPI.StringCheckGrader + | EvalListResponse.EvalGraderTextSimilarity + | EvalListResponse.EvalGraderPython + | EvalListResponse.EvalGraderScoreModel >; } export namespace EvalListResponse { /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { - /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - + export interface EvalGraderTextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface EvalGraderPython extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -885,85 +470,11 @@ export namespace EvalListResponse { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface EvalGraderScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -979,15 +490,15 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; /** * A list of graders for all eval runs in this group. */ testing_criteria: Array< | EvalCreateParams.LabelModel - | EvalStringCheckGrader - | EvalTextSimilarityGrader + | GraderModelsAPI.StringCheckGrader + | EvalCreateParams.TextSimilarity | EvalCreateParams.Python | EvalCreateParams.ScoreModel >; @@ -1040,14 +551,14 @@ export namespace EvalCreateParams { * completions query. This is usually metadata like `usecase=chatbot` or * `prompt-version=v2`, etc. */ - export interface Logs { + export interface StoredCompletions { /** - * The type of data source. Always `logs`. + * The type of data source. Always `stored_completions`. */ - type: 'logs'; + type: 'stored_completions'; /** - * Metadata filters for the logs data source. + * Metadata filters for the stored completions data source. */ metadata?: Record; } @@ -1146,29 +657,19 @@ export namespace EvalCreateParams { } /** - * A PythonGrader object that runs a python script on the input. + * A TextSimilarityGrader object which grades text based on similarity metrics. */ - export interface Python { + export interface TextSimilarity extends GraderModelsAPI.TextSimilarityGrader { /** - * The name of the grader. - */ - name: string; - - /** - * The source code of the python script. - */ - source: string; - - /** - * The object type, which is always `python`. - */ - type: 'python'; - - /** - * The image tag to use for the python script. + * The threshold for the score. */ - image_tag?: string; + pass_threshold: number; + } + /** + * A PythonGrader object that runs a python script on the input. + */ + export interface Python extends GraderModelsAPI.PythonGrader { /** * The threshold for the score. */ @@ -1178,85 +679,11 @@ export namespace EvalCreateParams { /** * A ScoreModelGrader object that uses a model to assign a score to the input. */ - export interface ScoreModel { - /** - * The input text. This may include template strings. - */ - input: Array; - - /** - * The model to use for the evaluation. - */ - model: string; - - /** - * The name of the grader. - */ - name: string; - - /** - * The object type, which is always `score_model`. - */ - type: 'score_model'; - + export interface ScoreModel extends GraderModelsAPI.ScoreModelGrader { /** * The threshold for the score. */ pass_threshold?: number; - - /** - * The range of the score. Defaults to `[0, 1]`. - */ - range?: Array; - - /** - * The sampling parameters for the model. - */ - sampling_params?: unknown; - } - - export namespace ScoreModel { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } } @@ -1296,10 +723,7 @@ Evals.Runs = Runs; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLabelModelGrader as EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader as EvalStringCheckGrader, - type EvalTextSimilarityGrader as EvalTextSimilarityGrader, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, type EvalUpdateResponse as EvalUpdateResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index 4d1e30a09..cd74e0edc 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -3,10 +3,7 @@ export { Evals, type EvalCustomDataSourceConfig, - type EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader, - type EvalTextSimilarityGrader, type EvalCreateResponse, type EvalRetrieveResponse, type EvalUpdateResponse, diff --git a/src/resources/fine-tuning/alpha.ts b/src/resources/fine-tuning/alpha.ts new file mode 100644 index 000000000..446b6431e --- /dev/null +++ b/src/resources/fine-tuning/alpha.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './alpha/index'; diff --git a/src/resources/fine-tuning/alpha/alpha.ts b/src/resources/fine-tuning/alpha/alpha.ts new file mode 100644 index 000000000..5a77065e8 --- /dev/null +++ b/src/resources/fine-tuning/alpha/alpha.ts @@ -0,0 +1,27 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as GradersAPI from './graders'; +import { + GraderRunParams, + GraderRunResponse, + GraderValidateParams, + GraderValidateResponse, + Graders, +} from './graders'; + +export class Alpha extends APIResource { + graders: GradersAPI.Graders = new GradersAPI.Graders(this._client); +} + +Alpha.Graders = Graders; + +export declare namespace Alpha { + export { + Graders as Graders, + type GraderRunResponse as GraderRunResponse, + type GraderValidateResponse as GraderValidateResponse, + type GraderRunParams as GraderRunParams, + type GraderValidateParams as GraderValidateParams, + }; +} diff --git a/src/resources/fine-tuning/alpha/graders.ts b/src/resources/fine-tuning/alpha/graders.ts new file mode 100644 index 000000000..043511703 --- /dev/null +++ b/src/resources/fine-tuning/alpha/graders.ts @@ -0,0 +1,166 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as GraderModelsAPI from '../../graders/grader-models'; +import { APIPromise } from '../../../core/api-promise'; +import { RequestOptions } from '../../../internal/request-options'; + +export class Graders extends APIResource { + /** + * Run a grader. + * + * @example + * ```ts + * const response = await client.fineTuning.alpha.graders.run({ + * grader: { + * input: 'input', + * name: 'name', + * operation: 'eq', + * reference: 'reference', + * type: 'string_check', + * }, + * model_sample: 'model_sample', + * reference_answer: 'string', + * }); + * ``` + */ + run(body: GraderRunParams, options?: RequestOptions): APIPromise { + return this._client.post('/fine_tuning/alpha/graders/run', { body, ...options }); + } + + /** + * Validate a grader. + * + * @example + * ```ts + * const response = + * await client.fineTuning.alpha.graders.validate({ + * grader: { + * input: 'input', + * name: 'name', + * operation: 'eq', + * reference: 'reference', + * type: 'string_check', + * }, + * }); + * ``` + */ + validate(body: GraderValidateParams, options?: RequestOptions): APIPromise { + return this._client.post('/fine_tuning/alpha/graders/validate', { body, ...options }); + } +} + +export interface GraderRunResponse { + metadata: GraderRunResponse.Metadata; + + model_grader_token_usage_per_model: Record; + + reward: number; + + sub_rewards: Record; +} + +export namespace GraderRunResponse { + export interface Metadata { + errors: Metadata.Errors; + + execution_time: number; + + name: string; + + sampled_model_name: string | null; + + scores: Record; + + token_usage: number | null; + + type: string; + } + + export namespace Metadata { + export interface Errors { + formula_parse_error: boolean; + + invalid_variable_error: boolean; + + model_grader_parse_error: boolean; + + model_grader_refusal_error: boolean; + + model_grader_server_error: boolean; + + model_grader_server_error_details: string | null; + + other_error: boolean; + + python_grader_runtime_error: boolean; + + python_grader_runtime_error_details: string | null; + + python_grader_server_error: boolean; + + python_grader_server_error_type: string | null; + + sample_parse_error: boolean; + + truncated_observation_error: boolean; + + unresponsive_reward_error: boolean; + } + } +} + +export interface GraderValidateResponse { + /** + * The grader used for the fine-tuning job. + */ + grader?: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; +} + +export interface GraderRunParams { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; + + /** + * The model sample to be evaluated. + */ + model_sample: string; + + /** + * The reference answer for the evaluation. + */ + reference_answer: string | unknown | Array | number; +} + +export interface GraderValidateParams { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; +} + +export declare namespace Graders { + export { + type GraderRunResponse as GraderRunResponse, + type GraderValidateResponse as GraderValidateResponse, + type GraderRunParams as GraderRunParams, + type GraderValidateParams as GraderValidateParams, + }; +} diff --git a/src/resources/fine-tuning/alpha/index.ts b/src/resources/fine-tuning/alpha/index.ts new file mode 100644 index 000000000..47b229bc3 --- /dev/null +++ b/src/resources/fine-tuning/alpha/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Alpha } from './alpha'; +export { + Graders, + type GraderRunResponse, + type GraderValidateResponse, + type GraderRunParams, + type GraderValidateParams, +} from './graders'; diff --git a/src/resources/fine-tuning/fine-tuning.ts b/src/resources/fine-tuning/fine-tuning.ts index 6836f2127..11d441754 100644 --- a/src/resources/fine-tuning/fine-tuning.ts +++ b/src/resources/fine-tuning/fine-tuning.ts @@ -1,6 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; +import * as MethodsAPI from './methods'; +import { + DpoHyperparameters, + DpoMethod, + Methods, + ReinforcementHyperparameters, + ReinforcementMethod, + SupervisedHyperparameters, + SupervisedMethod, +} from './methods'; +import * as AlphaAPI from './alpha/alpha'; +import { Alpha } from './alpha/alpha'; import * as CheckpointsAPI from './checkpoints/checkpoints'; import { Checkpoints } from './checkpoints/checkpoints'; import * as JobsAPI from './jobs/jobs'; @@ -19,14 +31,28 @@ import { } from './jobs/jobs'; export class FineTuning extends APIResource { + methods: MethodsAPI.Methods = new MethodsAPI.Methods(this._client); jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); checkpoints: CheckpointsAPI.Checkpoints = new CheckpointsAPI.Checkpoints(this._client); + alpha: AlphaAPI.Alpha = new AlphaAPI.Alpha(this._client); } +FineTuning.Methods = Methods; FineTuning.Jobs = Jobs; FineTuning.Checkpoints = Checkpoints; +FineTuning.Alpha = Alpha; export declare namespace FineTuning { + export { + Methods as Methods, + type DpoHyperparameters as DpoHyperparameters, + type DpoMethod as DpoMethod, + type ReinforcementHyperparameters as ReinforcementHyperparameters, + type ReinforcementMethod as ReinforcementMethod, + type SupervisedHyperparameters as SupervisedHyperparameters, + type SupervisedMethod as SupervisedMethod, + }; + export { Jobs as Jobs, type FineTuningJob as FineTuningJob, @@ -42,4 +68,6 @@ export declare namespace FineTuning { }; export { Checkpoints as Checkpoints }; + + export { Alpha as Alpha }; } diff --git a/src/resources/fine-tuning/index.ts b/src/resources/fine-tuning/index.ts index 29e57394a..8d4f240f2 100644 --- a/src/resources/fine-tuning/index.ts +++ b/src/resources/fine-tuning/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Alpha } from './alpha/index'; export { Checkpoints } from './checkpoints/index'; export { FineTuning } from './fine-tuning'; export { @@ -15,3 +16,12 @@ export { type FineTuningJobsPage, type FineTuningJobEventsPage, } from './jobs/index'; +export { + Methods, + type DpoHyperparameters, + type DpoMethod, + type ReinforcementHyperparameters, + type ReinforcementMethod, + type SupervisedHyperparameters, + type SupervisedMethod, +} from './methods'; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 48cda2b2b..d69663ff8 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -2,6 +2,7 @@ import { APIResource } from '../../../core/resource'; import * as Shared from '../../shared'; +import * as MethodsAPI from '../methods'; import * as CheckpointsAPI from './checkpoints'; import { CheckpointListParams, @@ -110,6 +111,34 @@ export class Jobs extends APIResource { { query, ...options }, ); } + + /** + * Pause a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.pause( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` + */ + pause(fineTuningJobID: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/fine_tuning/jobs/${fineTuningJobID}/pause`, options); + } + + /** + * Resume a fine-tune job. + * + * @example + * ```ts + * const fineTuningJob = await client.fineTuning.jobs.resume( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); + * ``` + */ + resume(fineTuningJobID: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/fine_tuning/jobs/${fineTuningJobID}/resume`, options); + } } export type FineTuningJobsPage = CursorPage; @@ -286,97 +315,24 @@ export namespace FineTuningJob { */ export interface Method { /** - * Configuration for the DPO fine-tuning method. - */ - dpo?: Method.Dpo; - - /** - * Configuration for the supervised fine-tuning method. + * The type of method. Is either `supervised`, `dpo`, or `reinforcement`. */ - supervised?: Method.Supervised; + type: 'supervised' | 'dpo' | 'reinforcement'; /** - * The type of method. Is either `supervised` or `dpo`. + * Configuration for the DPO fine-tuning method. */ - type?: 'supervised' | 'dpo'; - } + dpo?: MethodsAPI.DpoMethod; - export namespace Method { /** - * Configuration for the DPO fine-tuning method. + * Configuration for the reinforcement fine-tuning method. */ - export interface Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Dpo.Hyperparameters; - } - - export namespace Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * The beta value for the DPO method. A higher beta value will increase the weight - * of the penalty between the policy and reference model. - */ - beta?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + reinforcement?: MethodsAPI.ReinforcementMethod; /** * Configuration for the supervised fine-tuning method. */ - export interface Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Supervised.Hyperparameters; - } - - export namespace Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + supervised?: MethodsAPI.SupervisedMethod; } } @@ -640,97 +596,24 @@ export namespace JobCreateParams { */ export interface Method { /** - * Configuration for the DPO fine-tuning method. - */ - dpo?: Method.Dpo; - - /** - * Configuration for the supervised fine-tuning method. + * The type of method. Is either `supervised`, `dpo`, or `reinforcement`. */ - supervised?: Method.Supervised; + type: 'supervised' | 'dpo' | 'reinforcement'; /** - * The type of method. Is either `supervised` or `dpo`. + * Configuration for the DPO fine-tuning method. */ - type?: 'supervised' | 'dpo'; - } + dpo?: MethodsAPI.DpoMethod; - export namespace Method { /** - * Configuration for the DPO fine-tuning method. + * Configuration for the reinforcement fine-tuning method. */ - export interface Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Dpo.Hyperparameters; - } - - export namespace Dpo { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * The beta value for the DPO method. A higher beta value will increase the weight - * of the penalty between the policy and reference model. - */ - beta?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + reinforcement?: MethodsAPI.ReinforcementMethod; /** * Configuration for the supervised fine-tuning method. */ - export interface Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - hyperparameters?: Supervised.Hyperparameters; - } - - export namespace Supervised { - /** - * The hyperparameters used for the fine-tuning job. - */ - export interface Hyperparameters { - /** - * Number of examples in each batch. A larger batch size means that model - * parameters are updated less frequently, but with lower variance. - */ - batch_size?: 'auto' | number; - - /** - * Scaling factor for the learning rate. A smaller learning rate may be useful to - * avoid overfitting. - */ - learning_rate_multiplier?: 'auto' | number; - - /** - * The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. - */ - n_epochs?: 'auto' | number; - } - } + supervised?: MethodsAPI.SupervisedMethod; } } diff --git a/src/resources/fine-tuning/methods.ts b/src/resources/fine-tuning/methods.ts new file mode 100644 index 000000000..9c78d584b --- /dev/null +++ b/src/resources/fine-tuning/methods.ts @@ -0,0 +1,152 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as GraderModelsAPI from '../graders/grader-models'; + +export class Methods extends APIResource {} + +/** + * The hyperparameters used for the DPO fine-tuning job. + */ +export interface DpoHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * The beta value for the DPO method. A higher beta value will increase the weight + * of the penalty between the policy and reference model. + */ + beta?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; +} + +/** + * Configuration for the DPO fine-tuning method. + */ +export interface DpoMethod { + /** + * The hyperparameters used for the DPO fine-tuning job. + */ + hyperparameters?: DpoHyperparameters; +} + +/** + * The hyperparameters used for the reinforcement fine-tuning job. + */ +export interface ReinforcementHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Multiplier on amount of compute used for exploring search space during training. + */ + compute_multiplier?: 'auto' | number; + + /** + * The number of training steps between evaluation runs. + */ + eval_interval?: 'auto' | number; + + /** + * Number of evaluation samples to generate per training step. + */ + eval_samples?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; + + /** + * Level of reasoning effort. + */ + reasoning_effort?: 'default' | 'low' | 'medium' | 'high'; +} + +/** + * Configuration for the reinforcement fine-tuning method. + */ +export interface ReinforcementMethod { + /** + * The grader used for the fine-tuning job. + */ + grader: + | GraderModelsAPI.StringCheckGrader + | GraderModelsAPI.TextSimilarityGrader + | GraderModelsAPI.PythonGrader + | GraderModelsAPI.ScoreModelGrader + | GraderModelsAPI.MultiGrader; + + /** + * The hyperparameters used for the reinforcement fine-tuning job. + */ + hyperparameters?: ReinforcementHyperparameters; +} + +/** + * The hyperparameters used for the fine-tuning job. + */ +export interface SupervisedHyperparameters { + /** + * Number of examples in each batch. A larger batch size means that model + * parameters are updated less frequently, but with lower variance. + */ + batch_size?: 'auto' | number; + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to + * avoid overfitting. + */ + learning_rate_multiplier?: 'auto' | number; + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. + */ + n_epochs?: 'auto' | number; +} + +/** + * Configuration for the supervised fine-tuning method. + */ +export interface SupervisedMethod { + /** + * The hyperparameters used for the fine-tuning job. + */ + hyperparameters?: SupervisedHyperparameters; +} + +export declare namespace Methods { + export { + type DpoHyperparameters as DpoHyperparameters, + type DpoMethod as DpoMethod, + type ReinforcementHyperparameters as ReinforcementHyperparameters, + type ReinforcementMethod as ReinforcementMethod, + type SupervisedHyperparameters as SupervisedHyperparameters, + type SupervisedMethod as SupervisedMethod, + }; +} diff --git a/src/resources/graders.ts b/src/resources/graders.ts new file mode 100644 index 000000000..2ea9aa959 --- /dev/null +++ b/src/resources/graders.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './graders/index'; diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts new file mode 100644 index 000000000..6c43c7c03 --- /dev/null +++ b/src/resources/graders/grader-models.ts @@ -0,0 +1,296 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as ResponsesAPI from '../responses/responses'; + +export class GraderModels extends APIResource {} + +/** + * A LabelModelGrader object which uses a model to assign labels to each item in + * the evaluation. + */ +export interface LabelModelGrader { + input: Array; + + /** + * The labels to assign to each item in the evaluation. + */ + labels: Array; + + /** + * The model to use for the evaluation. Must support structured outputs. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The labels that indicate a passing result. Must be a subset of labels. + */ + passing_labels: Array; + + /** + * The object type, which is always `label_model`. + */ + type: 'label_model'; +} + +export namespace LabelModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A MultiGrader object combines the output of multiple graders to produce a single + * score. + */ +export interface MultiGrader { + /** + * A formula to calculate the output based on grader results. + */ + calculate_output: string; + + graders: Record< + string, + StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader + >; + + /** + * The name of the grader. + */ + name: string; + + /** + * The type of grader. + */ + type: 'multi'; +} + +/** + * A PythonGrader object that runs a python script on the input. + */ +export interface PythonGrader { + /** + * The name of the grader. + */ + name: string; + + /** + * The source code of the python script. + */ + source: string; + + /** + * The object type, which is always `python`. + */ + type: 'python'; + + /** + * The image tag to use for the python script. + */ + image_tag?: string; +} + +/** + * A ScoreModelGrader object that uses a model to assign a score to the input. + */ +export interface ScoreModelGrader { + /** + * The input text. This may include template strings. + */ + input: Array; + + /** + * The model to use for the evaluation. + */ + model: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The object type, which is always `score_model`. + */ + type: 'score_model'; + + /** + * The range of the score. Defaults to `[0, 1]`. + */ + range?: Array; + + /** + * The sampling parameters for the model. + */ + sampling_params?: unknown; +} + +export namespace ScoreModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + +/** + * A StringCheckGrader object that performs a string comparison between input and + * reference using a specified operation. + */ +export interface StringCheckGrader { + /** + * The input text. This may include template strings. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`. + */ + operation: 'eq' | 'ne' | 'like' | 'ilike'; + + /** + * The reference text. This may include template strings. + */ + reference: string; + + /** + * The object type, which is always `string_check`. + */ + type: 'string_check'; +} + +/** + * A TextSimilarityGrader object which grades text based on similarity metrics. + */ +export interface TextSimilarityGrader { + /** + * The evaluation metric to use. One of `fuzzy_match`, `bleu`, `gleu`, `meteor`, + * `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`, or `rouge_l`. + */ + evaluation_metric: + | 'fuzzy_match' + | 'bleu' + | 'gleu' + | 'meteor' + | 'rouge_1' + | 'rouge_2' + | 'rouge_3' + | 'rouge_4' + | 'rouge_5' + | 'rouge_l'; + + /** + * The text being graded. + */ + input: string; + + /** + * The name of the grader. + */ + name: string; + + /** + * The text being graded against. + */ + reference: string; + + /** + * The type of grader. + */ + type: 'text_similarity'; +} + +export declare namespace GraderModels { + export { + type LabelModelGrader as LabelModelGrader, + type MultiGrader as MultiGrader, + type PythonGrader as PythonGrader, + type ScoreModelGrader as ScoreModelGrader, + type StringCheckGrader as StringCheckGrader, + type TextSimilarityGrader as TextSimilarityGrader, + }; +} diff --git a/src/resources/graders/graders.ts b/src/resources/graders/graders.ts new file mode 100644 index 000000000..d337e02ae --- /dev/null +++ b/src/resources/graders/graders.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as GraderModelsAPI from './grader-models'; +import { + GraderModels, + LabelModelGrader, + MultiGrader, + PythonGrader, + ScoreModelGrader, + StringCheckGrader, + TextSimilarityGrader, +} from './grader-models'; + +export class Graders extends APIResource { + graderModels: GraderModelsAPI.GraderModels = new GraderModelsAPI.GraderModels(this._client); +} + +Graders.GraderModels = GraderModels; + +export declare namespace Graders { + export { + GraderModels as GraderModels, + type LabelModelGrader as LabelModelGrader, + type MultiGrader as MultiGrader, + type PythonGrader as PythonGrader, + type ScoreModelGrader as ScoreModelGrader, + type StringCheckGrader as StringCheckGrader, + type TextSimilarityGrader as TextSimilarityGrader, + }; +} diff --git a/src/resources/graders/index.ts b/src/resources/graders/index.ts new file mode 100644 index 000000000..82d557a6a --- /dev/null +++ b/src/resources/graders/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + GraderModels, + type LabelModelGrader, + type MultiGrader, + type PythonGrader, + type ScoreModelGrader, + type StringCheckGrader, + type TextSimilarityGrader, +} from './grader-models'; +export { Graders } from './graders'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 11b37eb14..eb244dfda 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -32,10 +32,7 @@ export { export { Evals, type EvalCustomDataSourceConfig, - type EvalLabelModelGrader, type EvalStoredCompletionsDataSourceConfig, - type EvalStringCheckGrader, - type EvalTextSimilarityGrader, type EvalCreateResponse, type EvalRetrieveResponse, type EvalUpdateResponse, @@ -57,6 +54,7 @@ export { type FileObjectsPage, } from './files'; export { FineTuning } from './fine-tuning/fine-tuning'; +export { Graders } from './graders/graders'; export { Images, type Image, diff --git a/tests/api-resources/fine-tuning/alpha/graders.test.ts b/tests/api-resources/fine-tuning/alpha/graders.test.ts new file mode 100644 index 000000000..a34373e85 --- /dev/null +++ b/tests/api-resources/fine-tuning/alpha/graders.test.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource graders', () => { + test('run: only required params', async () => { + const responsePromise = client.fineTuning.alpha.graders.run({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + model_sample: 'model_sample', + reference_answer: 'string', + }); + 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('run: required and optional params', async () => { + const response = await client.fineTuning.alpha.graders.run({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + model_sample: 'model_sample', + reference_answer: 'string', + }); + }); + + test('validate: only required params', async () => { + const responsePromise = client.fineTuning.alpha.graders.validate({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + }); + 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('validate: required and optional params', async () => { + const response = await client.fineTuning.alpha.graders.validate({ + grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, + }); + }); +}); diff --git a/tests/api-resources/fine-tuning/jobs/jobs.test.ts b/tests/api-resources/fine-tuning/jobs/jobs.test.ts index 0875598cf..8cd4088ab 100644 --- a/tests/api-resources/fine-tuning/jobs/jobs.test.ts +++ b/tests/api-resources/fine-tuning/jobs/jobs.test.ts @@ -35,6 +35,7 @@ describe('resource jobs', () => { ], metadata: { foo: 'string' }, method: { + type: 'supervised', dpo: { hyperparameters: { batch_size: 'auto', @@ -43,10 +44,27 @@ describe('resource jobs', () => { n_epochs: 'auto', }, }, + reinforcement: { + grader: { + input: 'input', + name: 'name', + operation: 'eq', + reference: 'reference', + type: 'string_check', + }, + hyperparameters: { + batch_size: 'auto', + compute_multiplier: 'auto', + eval_interval: 'auto', + eval_samples: 'auto', + learning_rate_multiplier: 'auto', + n_epochs: 'auto', + reasoning_effort: 'default', + }, + }, supervised: { hyperparameters: { batch_size: 'auto', learning_rate_multiplier: 'auto', n_epochs: 'auto' }, }, - type: 'supervised', }, seed: 42, suffix: 'x', @@ -118,4 +136,26 @@ describe('resource jobs', () => { ), ).rejects.toThrow(OpenAI.NotFoundError); }); + + test('pause', async () => { + const responsePromise = client.fineTuning.jobs.pause('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('resume', async () => { + const responsePromise = client.fineTuning.jobs.resume('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); + }); }); From a9c78216d88379bc1d5103b30970f041d22083b8 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Fri, 9 May 2025 18:25:36 +0100 Subject: [PATCH 386/509] fix(azure): use correct internal method --- src/azure.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/azure.ts b/src/azure.ts index 661f288af..eb642a778 100644 --- a/src/azure.ts +++ b/src/azure.ts @@ -3,7 +3,7 @@ import * as Errors from './error'; import { FinalRequestOptions } from './internal/request-options'; import { isObj, readEnv } from './internal/utils'; import { ClientOptions, OpenAI } from './client'; -import { buildHeaders } from './internal/headers'; +import { buildHeaders, NullableHeaders } from './internal/headers'; /** API Client for interfacing with the Azure OpenAI API. */ export interface AzureClientOptions extends ClientOptions { @@ -154,8 +154,8 @@ export class AzureOpenAI extends OpenAI { return undefined; } - protected override authHeaders(opts: FinalRequestOptions): Headers { - return new Headers(); + protected override authHeaders(opts: FinalRequestOptions): NullableHeaders | undefined { + return; } protected override async prepareOptions(opts: FinalRequestOptions): Promise { From ea1d56c979ad7136aa584a773904b0570ba14783 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:29:14 +0000 Subject: [PATCH 387/509] feat(api): responses x eval api --- .stats.yml | 6 +- api.md | 2 + src/index.ts | 2 + src/resources/audio/transcriptions.ts | 34 + src/resources/embeddings.ts | 7 +- src/resources/evals/evals.ts | 89 +- src/resources/evals/index.ts | 2 + src/resources/evals/runs/index.ts | 1 + src/resources/evals/runs/runs.ts | 1444 +++-------------- src/resources/fine-tuning/jobs/jobs.ts | 2 +- src/resources/index.ts | 1 + .../audio/transcriptions.test.ts | 1 + 12 files changed, 375 insertions(+), 1216 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5f1bee851..11ba2b010 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-794a6ed3c3d3d77887564755168056af8a426b17cf1ec721e3a300503dc22a41.yml -openapi_spec_hash: 25a81c220713cd5b0bafc221d1dfa79a -config_hash: 0b768ed1b56c6d82816f0fa40dc4aaf5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml +openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 +config_hash: 7da27f7260075e8813ddcea542fba1bf diff --git a/api.md b/api.md index cad696e7e..665dfaeed 100644 --- a/api.md +++ b/api.md @@ -709,6 +709,7 @@ Methods: Types: - EvalCustomDataSourceConfig +- EvalLogsDataSourceConfig - EvalStoredCompletionsDataSourceConfig - EvalCreateResponse - EvalRetrieveResponse @@ -730,6 +731,7 @@ Types: - CreateEvalCompletionsRunDataSource - CreateEvalJSONLRunDataSource +- CreateEvalResponsesRunDataSource - EvalAPIError - RunCreateResponse - RunRetrieveResponse diff --git a/src/index.ts b/src/index.ts index 537c18f43..b51da51c5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,6 +74,7 @@ import { EvalListParams, EvalListResponse, EvalListResponsesPage, + EvalLogsDataSourceConfig, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, EvalUpdateParams, @@ -533,6 +534,7 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 8d563e0ba..9e5310874 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -324,6 +324,14 @@ export interface TranscriptionCreateParamsBase< */ model: (string & {}) | AudioAPI.AudioModel; + /** + * Controls how the audio is cut into chunks. When set to `"auto"`, the server + * first normalizes loudness and then uses voice activity detection (VAD) to choose + * boundaries. `server_vad` object can be provided to tweak VAD detection + * parameters manually. If unset, the audio is transcribed as a single block. + */ + chunking_strategy?: 'auto' | TranscriptionCreateParams.VadConfig | null; + /** * Additional information to include in the transcription response. `logprobs` will * return the log probabilities of the tokens in the response to understand the @@ -387,6 +395,32 @@ export interface TranscriptionCreateParamsBase< } export namespace TranscriptionCreateParams { + export interface VadConfig { + /** + * Must be set to `server_vad` to enable manual chunking using server side VAD. + */ + type: 'server_vad'; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). With shorter values + * the model will respond more quickly, but may jump in on short pauses from the + * user. + */ + silence_duration_ms?: number; + + /** + * Sensitivity threshold (0.0 to 1.0) for voice activity detection. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + } + export type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming; export type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming; } diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index cc040abff..fb02a7654 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -130,11 +130,12 @@ export interface EmbeddingCreateParams { * Input text to embed, encoded as a string or array of tokens. To embed multiple * inputs in a single request, pass an array of strings or array of token arrays. * The input must not exceed the max input tokens for the model (8192 tokens for - * `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 + * all embedding models), cannot be an empty string, and any array must be 2048 * dimensions or less. * [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. Some models may also impose a limit on total number of - * tokens summed across inputs. + * for counting tokens. In addition to the per-input token limit, all embedding + * models enforce a maximum of 300,000 tokens summed across all inputs in a single + * request. */ input: string | Array | Array | Array>; diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 0f7166df4..396747af2 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -10,6 +10,7 @@ import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, + CreateEvalResponsesRunDataSource, EvalAPIError, RunCancelResponse, RunCreateParams, @@ -105,11 +106,37 @@ export interface EvalCustomDataSourceConfig { } /** - * A StoredCompletionsDataSourceConfig which specifies the metadata property of - * your stored completions query. This is usually metadata like `usecase=chatbot` - * or `prompt-version=v2`, etc. The schema returned by this data source config is - * used to defined what variables are available in your evals. `item` and `sample` - * are both defined when using this data source config. + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ +export interface EvalLogsDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; +} + +/** + * @deprecated Deprecated in favor of LogsDataSourceConfig. */ export interface EvalStoredCompletionsDataSourceConfig { /** @@ -119,9 +146,9 @@ export interface EvalStoredCompletionsDataSourceConfig { schema: Record; /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `stored-completions`. */ - type: 'stored_completions'; + type: 'stored-completions'; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -156,7 +183,10 @@ export interface EvalCreateResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -244,7 +274,10 @@ export interface EvalRetrieveResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -332,7 +365,10 @@ export interface EvalUpdateResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -420,7 +456,10 @@ export interface EvalListResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -498,7 +537,7 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs | EvalCreateParams.StoredCompletions; /** * A list of graders for all eval runs in this group. @@ -555,15 +594,29 @@ export namespace EvalCreateParams { } /** - * A data source config which specifies the metadata property of your stored - * completions query. This is usually metadata like `usecase=chatbot` or - * `prompt-version=v2`, etc. + * A data source config which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + */ + export interface Logs { + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * Metadata filters for the logs data source. + */ + metadata?: Record; + } + + /** + * Deprecated in favor of LogsDataSourceConfig. */ export interface StoredCompletions { /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `stored-completions`. */ - type: 'stored_completions'; + type: 'stored-completions'; /** * Metadata filters for the stored completions data source. @@ -733,6 +786,7 @@ Evals.RunListResponsesPage = RunListResponsesPage; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -749,6 +803,7 @@ export declare namespace Evals { Runs as Runs, type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index b2627fbf3..856a4088a 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -4,6 +4,7 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -19,6 +20,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource, type EvalAPIError, type RunCreateResponse, type RunRetrieveResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index d0e18bff4..2e5d1a884 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -12,6 +12,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource, type EvalAPIError, type RunCreateResponse, type RunRetrieveResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 50c07a514..9aec3a1c6 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -321,6 +321,242 @@ export namespace CreateEvalJSONLRunDataSource { } } +/** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ +export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; +} + +export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } +} + /** * An object representing an error response from the Eval API. */ @@ -356,7 +592,7 @@ export interface RunCreateResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCreateResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -419,241 +655,7 @@ export interface RunCreateResponse { status: string; } -export namespace RunCreateResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - +export namespace RunCreateResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -749,7 +751,7 @@ export interface RunRetrieveResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunRetrieveResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -813,240 +815,6 @@ export interface RunRetrieveResponse { } export namespace RunRetrieveResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1142,7 +910,7 @@ export interface RunListResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunListResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -1196,250 +964,16 @@ export interface RunListResponse { /** * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunListResponse.ResultCounts; - - /** - * The status of the evaluation run. - */ - status: string; -} - -export namespace RunListResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} +export namespace RunListResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1543,7 +1077,7 @@ export interface RunCancelResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCancelResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -1607,240 +1141,6 @@ export interface RunCancelResponse { } export namespace RunCancelResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1923,7 +1223,7 @@ export interface RunCreateParams { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCreateParams.CreateEvalResponsesRunDataSource; + | CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1941,247 +1241,6 @@ export interface RunCreateParams { name?: string; } -export namespace RunCreateParams { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: - | CreateEvalResponsesRunDataSource.FileContent - | CreateEvalResponsesRunDataSource.FileID - | CreateEvalResponsesRunDataSource.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: - | CreateEvalResponsesRunDataSource.Template - | CreateEvalResponsesRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; - } - - export namespace CreateEvalResponsesRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } -} - export interface RunListParams extends CursorPageParams { /** * Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for @@ -2204,6 +1263,7 @@ export declare namespace Runs { export { type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 08616cd4f..cc5f55e9a 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -302,7 +302,7 @@ export namespace FineTuningJob { * Number of examples in each batch. A larger batch size means that model * parameters are updated less frequently, but with lower variance. */ - batch_size?: 'auto' | number; + batch_size?: unknown | 'auto' | number | null; /** * Scaling factor for the learning rate. A smaller learning rate may be useful to diff --git a/src/resources/index.ts b/src/resources/index.ts index 9d827615c..74d585595 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -33,6 +33,7 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 2297677b4..ad76808d0 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -27,6 +27,7 @@ describe('resource transcriptions', () => { const response = await client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'gpt-4o-transcribe', + chunking_strategy: 'auto', include: ['logprobs'], language: 'language', prompt: 'prompt', From e83286b10b20d3e4c02903739b045af5cbf71cde Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 23:47:30 +0000 Subject: [PATCH 388/509] feat(api): manual updates --- .stats.yml | 2 +- api.md | 5 + src/index.ts | 3 + src/resources/beta/beta.ts | 2 + src/resources/beta/index.ts | 1 + src/resources/beta/threads/index.ts | 1 + src/resources/beta/threads/runs/runs.ts | 44 +--- src/resources/beta/threads/threads.ts | 43 ++-- src/resources/evals/evals.ts | 49 +--- src/resources/evals/index.ts | 2 + src/resources/evals/runs/index.ts | 2 + src/resources/evals/runs/runs.ts | 233 ++++--------------- src/resources/graders/grader-models.ts | 94 +------- src/resources/index.ts | 1 + src/resources/shared.ts | 44 ++++ src/resources/vector-stores/index.ts | 1 + src/resources/vector-stores/vector-stores.ts | 75 ++---- 17 files changed, 155 insertions(+), 447 deletions(-) diff --git a/.stats.yml b/.stats.yml index 11ba2b010..202b915dc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 -config_hash: 7da27f7260075e8813ddcea542fba1bf +config_hash: bdacc55eb995c15255ec82130eb8c3bb diff --git a/api.md b/api.md index 665dfaeed..c4170366f 100644 --- a/api.md +++ b/api.md @@ -7,6 +7,7 @@ Types: - ComparisonFilter - CompoundFilter - ErrorObject +- EvalItem - FunctionDefinition - FunctionParameters - Metadata @@ -304,6 +305,7 @@ Types: - StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted +- VectorStoreExpirationAfter - VectorStoreSearchResponse Methods: @@ -463,6 +465,7 @@ Types: - AssistantToolChoiceOption - Thread - ThreadDeleted +- TruncationObject Methods: @@ -733,6 +736,8 @@ Types: - CreateEvalJSONLRunDataSource - CreateEvalResponsesRunDataSource - EvalAPIError +- EvalJSONLFileContentSource +- EvalJSONLFileIDSource - RunCreateResponse - RunRetrieveResponse - RunListResponse diff --git a/src/index.ts b/src/index.ts index b51da51c5..c1612964a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -101,6 +101,7 @@ import { VectorStore, VectorStoreCreateParams, VectorStoreDeleted, + VectorStoreExpirationAfter, VectorStoreListParams, VectorStoreSearchParams, VectorStoreSearchResponse, @@ -501,6 +502,7 @@ export declare namespace OpenAI { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, @@ -552,6 +554,7 @@ export declare namespace OpenAI { export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; + export type EvalItem = API.EvalItem; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 6282d4593..c32159776 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -90,6 +90,7 @@ import { ThreadDeleted, ThreadUpdateParams, Threads, + TruncationObject, } from './threads/threads'; import { Chat } from './chat/chat'; @@ -188,6 +189,7 @@ export declare namespace Beta { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, + type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index b9cef17cb..296fdba75 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -29,6 +29,7 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, + type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index f67a1edde..89d00dcf6 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -63,6 +63,7 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, + type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 25356df3c..608ef6481 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -564,7 +564,7 @@ export interface Run { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy: Run.TruncationStrategy | null; + truncation_strategy: ThreadsAPI.TruncationObject | null; /** * Usage statistics related to the run. This value will be `null` if the run is not @@ -639,26 +639,6 @@ export namespace Run { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - /** * Usage statistics related to the run. This value will be `null` if the run is not * in a terminal state (i.e. `in_progress`, `queued`, etc.). @@ -862,7 +842,7 @@ export interface RunCreateParamsBase { * Body param: Controls for how a thread will be truncated prior to the run. Use * this to control the intial context window of the run. */ - truncation_strategy?: RunCreateParams.TruncationStrategy | null; + truncation_strategy?: ThreadsAPI.TruncationObject | null; } export namespace RunCreateParams { @@ -921,26 +901,6 @@ export namespace RunCreateParams { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - export type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; export type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index c0c6bc8e4..8b0332fb8 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -346,6 +346,26 @@ export interface ThreadDeleted { object: 'thread.deleted'; } +/** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ +export interface TruncationObject { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; +} + export interface ThreadCreateParams { /** * A list of [messages](https://platform.openai.com/docs/api-reference/messages) to @@ -734,7 +754,7 @@ export interface ThreadCreateAndRunParamsBase { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null; + truncation_strategy?: TruncationObject | null; } export namespace ThreadCreateAndRunParams { @@ -965,26 +985,6 @@ export namespace ThreadCreateAndRunParams { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - export type ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; export type ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; } @@ -1684,6 +1684,7 @@ export declare namespace Threads { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, + type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 396747af2..5370c51b9 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -5,13 +5,14 @@ import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; import * as GraderModelsAPI from '../graders/grader-models'; -import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, CreateEvalResponsesRunDataSource, EvalAPIError, + EvalJSONLFileContentSource, + EvalJSONLFileIDSource, RunCancelResponse, RunCreateParams, RunCreateResponse, @@ -633,7 +634,7 @@ export namespace EvalCreateParams { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - input: Array; + input: Array; /** * The labels to classify to each item in the evaluation. @@ -673,48 +674,6 @@ export namespace EvalCreateParams { */ role: string; } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } /** @@ -805,6 +764,8 @@ export declare namespace Evals { type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, + type EvalJSONLFileContentSource as EvalJSONLFileContentSource, + type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index 856a4088a..084fc9ad6 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -22,6 +22,8 @@ export { type CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource, type EvalAPIError, + type EvalJSONLFileContentSource, + type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index 2e5d1a884..8e13e67df 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -14,6 +14,8 @@ export { type CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource, type EvalAPIError, + type EvalJSONLFileContentSource, + type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 9aec3a1c6..dec4dcb51 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -88,8 +88,8 @@ export interface CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ source: - | CreateEvalCompletionsRunDataSource.FileContent - | CreateEvalCompletionsRunDataSource.FileID + | EvalJSONLFileContentSource + | EvalJSONLFileIDSource | CreateEvalCompletionsRunDataSource.StoredCompletions; /** @@ -110,38 +110,6 @@ export interface CreateEvalCompletionsRunDataSource { } export namespace CreateEvalCompletionsRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -187,7 +155,7 @@ export namespace CreateEvalCompletionsRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -195,50 +163,6 @@ export namespace CreateEvalCompletionsRunDataSource { type: 'template'; } - export namespace Template { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Message { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Message.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Message { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - export interface ItemReference { /** * A reference to a variable in the "item" namespace. Ie, "item.name" @@ -279,7 +203,7 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { - source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; + source: EvalJSONLFileContentSource | EvalJSONLFileIDSource; /** * The type of data source. Always `jsonl`. @@ -287,40 +211,6 @@ export interface CreateEvalJSONLRunDataSource { type: 'jsonl'; } -export namespace CreateEvalJSONLRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } -} - /** * A ResponsesRunDataSource object describing a model sampling configuration. */ @@ -328,10 +218,7 @@ export interface CreateEvalResponsesRunDataSource { /** * A EvalResponsesSource object describing a run data source configuration. */ - source: - | CreateEvalResponsesRunDataSource.FileContent - | CreateEvalResponsesRunDataSource.FileID - | CreateEvalResponsesRunDataSource.Responses; + source: EvalJSONLFileContentSource | EvalJSONLFileIDSource | CreateEvalResponsesRunDataSource.Responses; /** * The type of run data source. Always `responses`. @@ -349,38 +236,6 @@ export interface CreateEvalResponsesRunDataSource { } export namespace CreateEvalResponsesRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - /** * A EvalResponsesSource object describing a run data source configuration. */ @@ -458,7 +313,7 @@ export namespace CreateEvalResponsesRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -478,48 +333,6 @@ export namespace CreateEvalResponsesRunDataSource { */ role: string; } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } export interface ItemReference { @@ -572,6 +385,38 @@ export interface EvalAPIError { message: string; } +export interface EvalJSONLFileContentSource { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; +} + +export namespace EvalJSONLFileContentSource { + export interface Content { + item: Record; + + sample?: Record; + } +} + +export interface EvalJSONLFileIDSource { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; +} + /** * A schema representing an evaluation run. */ @@ -1265,6 +1110,8 @@ export declare namespace Runs { type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, + type EvalJSONLFileContentSource as EvalJSONLFileContentSource, + type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts index 9ee08f75f..8a1a0eddd 100644 --- a/src/resources/graders/grader-models.ts +++ b/src/resources/graders/grader-models.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as ResponsesAPI from '../responses/responses'; +import * as Shared from '../shared'; export class GraderModels extends APIResource {} @@ -10,7 +10,7 @@ export class GraderModels extends APIResource {} * the evaluation. */ export interface LabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -38,50 +38,6 @@ export interface LabelModelGrader { type: 'label_model'; } -export namespace LabelModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A MultiGrader object combines the output of multiple graders to produce a single * score. @@ -140,7 +96,7 @@ export interface ScoreModelGrader { /** * The input text. This may include template strings. */ - input: Array; + input: Array; /** * The model to use for the evaluation. @@ -168,50 +124,6 @@ export interface ScoreModelGrader { sampling_params?: unknown; } -export namespace ScoreModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A StringCheckGrader object that performs a string comparison between input and * reference using a specified operation. diff --git a/src/resources/index.ts b/src/resources/index.ts index 74d585595..0f21e596c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -91,6 +91,7 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 1c0006b18..d0c2aaa49 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import * as ResponsesAPI from './responses/responses'; + export type AllModels = | (string & {}) | ChatModel @@ -118,6 +120,48 @@ export interface ErrorObject { type: string; } +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; +} + +export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } +} + export interface FunctionDefinition { /** * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain diff --git a/src/resources/vector-stores/index.ts b/src/resources/vector-stores/index.ts index 9cbcbc0b2..c3c042387 100644 --- a/src/resources/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -30,6 +30,7 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index 7d61e7fd6..66438be02 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -249,7 +249,7 @@ export interface VectorStore { /** * The expiration policy for a vector store. */ - expires_after?: VectorStore.ExpiresAfter; + expires_after?: VectorStoreExpirationAfter; /** * The Unix timestamp (in seconds) for when the vector store will expire. @@ -284,22 +284,6 @@ export namespace VectorStore { */ total: number; } - - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } } export interface VectorStoreDeleted { @@ -310,6 +294,22 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } +/** + * The expiration policy for a vector store. + */ +export interface VectorStoreExpirationAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; +} + export interface VectorStoreSearchResponse { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -365,7 +365,7 @@ export interface VectorStoreCreateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreCreateParams.ExpiresAfter; + expires_after?: VectorStoreExpirationAfter; /** * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that @@ -390,29 +390,11 @@ export interface VectorStoreCreateParams { name?: string; } -export namespace VectorStoreCreateParams { - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } -} - export interface VectorStoreUpdateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreUpdateParams.ExpiresAfter | null; + expires_after?: VectorStoreExpirationAfter | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -430,24 +412,6 @@ export interface VectorStoreUpdateParams { name?: string | null; } -export namespace VectorStoreUpdateParams { - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } -} - export interface VectorStoreListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -521,6 +485,7 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, From 8cc63d351057678d474fe1a16e3077370c83fddb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 17:11:15 +0000 Subject: [PATCH 389/509] feat(api): Updating Assistants and Evals API schemas --- .stats.yml | 6 +- api.md | 7 - src/index.ts | 5 - src/resources/beta/beta.ts | 2 - src/resources/beta/index.ts | 1 - src/resources/beta/threads/index.ts | 1 - src/resources/beta/threads/runs/runs.ts | 44 +- src/resources/beta/threads/threads.ts | 43 +- src/resources/evals/evals.ts | 210 ++- src/resources/evals/index.ts | 4 - src/resources/evals/runs/index.ts | 3 - src/resources/evals/runs/runs.ts | 1511 +++++++++++++++--- src/resources/graders/grader-models.ts | 96 +- src/resources/index.ts | 2 - src/resources/shared.ts | 45 +- src/resources/vector-stores/index.ts | 1 - src/resources/vector-stores/vector-stores.ts | 75 +- 17 files changed, 1680 insertions(+), 376 deletions(-) diff --git a/.stats.yml b/.stats.yml index 202b915dc..a3c5d081d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml -openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 -config_hash: bdacc55eb995c15255ec82130eb8c3bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5fa16b9a02985ae06e41be14946a9c325dc672fb014b3c19abca65880c6990e6.yml +openapi_spec_hash: da3e669f65130043b1170048c0727890 +config_hash: d8d5fda350f6db77c784f35429741a2e diff --git a/api.md b/api.md index c4170366f..cad696e7e 100644 --- a/api.md +++ b/api.md @@ -7,7 +7,6 @@ Types: - ComparisonFilter - CompoundFilter - ErrorObject -- EvalItem - FunctionDefinition - FunctionParameters - Metadata @@ -305,7 +304,6 @@ Types: - StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted -- VectorStoreExpirationAfter - VectorStoreSearchResponse Methods: @@ -465,7 +463,6 @@ Types: - AssistantToolChoiceOption - Thread - ThreadDeleted -- TruncationObject Methods: @@ -712,7 +709,6 @@ Methods: Types: - EvalCustomDataSourceConfig -- EvalLogsDataSourceConfig - EvalStoredCompletionsDataSourceConfig - EvalCreateResponse - EvalRetrieveResponse @@ -734,10 +730,7 @@ Types: - CreateEvalCompletionsRunDataSource - CreateEvalJSONLRunDataSource -- CreateEvalResponsesRunDataSource - EvalAPIError -- EvalJSONLFileContentSource -- EvalJSONLFileIDSource - RunCreateResponse - RunRetrieveResponse - RunListResponse diff --git a/src/index.ts b/src/index.ts index c1612964a..537c18f43 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,7 +74,6 @@ import { EvalListParams, EvalListResponse, EvalListResponsesPage, - EvalLogsDataSourceConfig, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, EvalUpdateParams, @@ -101,7 +100,6 @@ import { VectorStore, VectorStoreCreateParams, VectorStoreDeleted, - VectorStoreExpirationAfter, VectorStoreListParams, VectorStoreSearchParams, VectorStoreSearchResponse, @@ -502,7 +500,6 @@ export declare namespace OpenAI { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, @@ -536,7 +533,6 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -554,7 +550,6 @@ export declare namespace OpenAI { export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; - export type EvalItem = API.EvalItem; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index c32159776..6282d4593 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -90,7 +90,6 @@ import { ThreadDeleted, ThreadUpdateParams, Threads, - TruncationObject, } from './threads/threads'; import { Chat } from './chat/chat'; @@ -189,7 +188,6 @@ export declare namespace Beta { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, - type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 296fdba75..b9cef17cb 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -29,7 +29,6 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, - type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index 89d00dcf6..f67a1edde 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -63,7 +63,6 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, - type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 608ef6481..25356df3c 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -564,7 +564,7 @@ export interface Run { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy: ThreadsAPI.TruncationObject | null; + truncation_strategy: Run.TruncationStrategy | null; /** * Usage statistics related to the run. This value will be `null` if the run is not @@ -639,6 +639,26 @@ export namespace Run { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + /** * Usage statistics related to the run. This value will be `null` if the run is not * in a terminal state (i.e. `in_progress`, `queued`, etc.). @@ -842,7 +862,7 @@ export interface RunCreateParamsBase { * Body param: Controls for how a thread will be truncated prior to the run. Use * this to control the intial context window of the run. */ - truncation_strategy?: ThreadsAPI.TruncationObject | null; + truncation_strategy?: RunCreateParams.TruncationStrategy | null; } export namespace RunCreateParams { @@ -901,6 +921,26 @@ export namespace RunCreateParams { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + export type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; export type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 8b0332fb8..c0c6bc8e4 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -346,26 +346,6 @@ export interface ThreadDeleted { object: 'thread.deleted'; } -/** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ -export interface TruncationObject { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; -} - export interface ThreadCreateParams { /** * A list of [messages](https://platform.openai.com/docs/api-reference/messages) to @@ -754,7 +734,7 @@ export interface ThreadCreateAndRunParamsBase { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy?: TruncationObject | null; + truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null; } export namespace ThreadCreateAndRunParams { @@ -985,6 +965,26 @@ export namespace ThreadCreateAndRunParams { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + export type ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; export type ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; } @@ -1684,7 +1684,6 @@ export declare namespace Threads { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, - type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 5370c51b9..08c898ace 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -5,14 +5,12 @@ import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as Shared from '../shared'; import * as GraderModelsAPI from '../graders/grader-models'; +import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, - CreateEvalResponsesRunDataSource, EvalAPIError, - EvalJSONLFileContentSource, - EvalJSONLFileIDSource, RunCancelResponse, RunCreateParams, RunCreateResponse, @@ -106,36 +104,6 @@ export interface EvalCustomDataSourceConfig { type: 'custom'; } -/** - * A LogsDataSourceConfig which specifies the metadata property of your logs query. - * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The - * schema returned by this data source config is used to defined what variables are - * available in your evals. `item` and `sample` are both defined when using this - * data source config. - */ -export interface EvalLogsDataSourceConfig { - /** - * The json schema for the run data source items. Learn how to build JSON schemas - * [here](https://json-schema.org/). - */ - schema: Record; - - /** - * The type of data source. Always `logs`. - */ - type: 'logs'; - - /** - * 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; -} - /** * @deprecated Deprecated in favor of LogsDataSourceConfig. */ @@ -186,7 +154,7 @@ export interface EvalCreateResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalCreateResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -222,6 +190,36 @@ export interface EvalCreateResponse { } export namespace EvalCreateResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -277,7 +275,7 @@ export interface EvalRetrieveResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalRetrieveResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -313,6 +311,36 @@ export interface EvalRetrieveResponse { } export namespace EvalRetrieveResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -368,7 +396,7 @@ export interface EvalUpdateResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalUpdateResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -404,6 +432,36 @@ export interface EvalUpdateResponse { } export namespace EvalUpdateResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -459,7 +517,7 @@ export interface EvalListResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalListResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -495,6 +553,36 @@ export interface EvalListResponse { } export namespace EvalListResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -634,7 +722,7 @@ export namespace EvalCreateParams { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - input: Array; + input: Array; /** * The labels to classify to each item in the evaluation. @@ -674,6 +762,48 @@ export namespace EvalCreateParams { */ role: string; } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } } /** @@ -745,7 +875,6 @@ Evals.RunListResponsesPage = RunListResponsesPage; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -762,10 +891,7 @@ export declare namespace Evals { Runs as Runs, type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, - type EvalJSONLFileContentSource as EvalJSONLFileContentSource, - type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index 084fc9ad6..b2627fbf3 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -4,7 +4,6 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -20,10 +19,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource, type EvalAPIError, - type EvalJSONLFileContentSource, - type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index 8e13e67df..d0e18bff4 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -12,10 +12,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource, type EvalAPIError, - type EvalJSONLFileContentSource, - type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index dec4dcb51..31883e6b5 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -88,8 +88,8 @@ export interface CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ source: - | EvalJSONLFileContentSource - | EvalJSONLFileIDSource + | CreateEvalCompletionsRunDataSource.FileContent + | CreateEvalCompletionsRunDataSource.FileID | CreateEvalCompletionsRunDataSource.StoredCompletions; /** @@ -110,6 +110,38 @@ export interface CreateEvalCompletionsRunDataSource { } export namespace CreateEvalCompletionsRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -155,7 +187,7 @@ export namespace CreateEvalCompletionsRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -163,6 +195,50 @@ export namespace CreateEvalCompletionsRunDataSource { type: 'template'; } + export namespace Template { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Message { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Message.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Message { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + export interface ItemReference { /** * A reference to a variable in the "item" namespace. Ie, "item.name" @@ -203,7 +279,7 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { - source: EvalJSONLFileContentSource | EvalJSONLFileIDSource; + source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; /** * The type of data source. Always `jsonl`. @@ -211,162 +287,37 @@ export interface CreateEvalJSONLRunDataSource { type: 'jsonl'; } -/** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ -export interface CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: EvalJSONLFileContentSource | EvalJSONLFileIDSource | CreateEvalResponsesRunDataSource.Responses; - - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - input_messages?: CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; -} - -export namespace CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional string to search the 'instructions' field. This is a query parameter - * used to select responses. - */ - instructions_search?: string | null; - +export namespace CreateEvalJSONLRunDataSource { + export interface FileContent { /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. + * The content of the jsonl file. */ - metadata?: unknown | null; + content: Array; /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. + * The type of jsonl source. Always `file_content`. */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * List of tool names. This is a query parameter used to select responses. - */ - tools?: Array | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; + type: 'file_content'; } - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; + export namespace FileContent { + export interface Content { + item: Record; - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; + sample?: Record; } } - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - + export interface FileID { /** - * A higher temperature increases randomness in the outputs. + * The identifier of the file. */ - temperature?: number; + id: string; /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + * The type of jsonl source. Always `file_id`. */ - top_p?: number; + type: 'file_id'; } } @@ -385,38 +336,6 @@ export interface EvalAPIError { message: string; } -export interface EvalJSONLFileContentSource { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; -} - -export namespace EvalJSONLFileContentSource { - export interface Content { - item: Record; - - sample?: Record; - } -} - -export interface EvalJSONLFileIDSource { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; -} - /** * A schema representing an evaluation run. */ @@ -437,7 +356,7 @@ export interface RunCreateResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCreateResponse.Responses; /** * An object representing an error response from the Eval API. @@ -501,6 +420,239 @@ export interface RunCreateResponse { } export namespace RunCreateResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -596,7 +748,7 @@ export interface RunRetrieveResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunRetrieveResponse.Responses; /** * An object representing an error response from the Eval API. @@ -660,6 +812,239 @@ export interface RunRetrieveResponse { } export namespace RunRetrieveResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -752,10 +1137,7 @@ export interface RunListResponse { /** * Information about the run's data source. */ - data_source: - | CreateEvalJSONLRunDataSource - | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource | RunListResponse.Responses; /** * An object representing an error response from the Eval API. @@ -787,38 +1169,271 @@ export interface RunListResponse { */ name: string; - /** - * The type of the object. Always "eval.run". - */ - object: 'eval.run'; + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunListResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; - /** - * Usage statistics for each model during the evaluation run. - */ - per_model_usage: Array; + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } - /** - * Results per testing criteria applied during the evaluation run. - */ - per_testing_criteria_results: Array; + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; - /** - * The URL to the rendered evaluation run report on the UI dashboard. - */ - report_url: string; + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunListResponse.ResultCounts; + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; - /** - * The status of the evaluation run. - */ - status: string; -} + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } -export namespace RunListResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -922,7 +1537,7 @@ export interface RunCancelResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCancelResponse.Responses; /** * An object representing an error response from the Eval API. @@ -986,6 +1601,239 @@ export interface RunCancelResponse { } export namespace RunCancelResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1068,7 +1916,7 @@ export interface RunCreateParams { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCreateParams.CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1086,6 +1934,246 @@ export interface RunCreateParams { name?: string; } +export namespace RunCreateParams { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: + | CreateEvalResponsesRunDataSource.Template + | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; + } + + export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } +} + export interface RunListParams extends CursorPageParams { /** * Sort order for runs by timestamp. Use `asc` for ascending order or `desc` for @@ -1108,10 +2196,7 @@ export declare namespace Runs { export { type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, - type EvalJSONLFileContentSource as EvalJSONLFileContentSource, - type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts index 8a1a0eddd..d2c335300 100644 --- a/src/resources/graders/grader-models.ts +++ b/src/resources/graders/grader-models.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Shared from '../shared'; +import * as ResponsesAPI from '../responses/responses'; export class GraderModels extends APIResource {} @@ -10,7 +10,7 @@ export class GraderModels extends APIResource {} * the evaluation. */ export interface LabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -38,6 +38,50 @@ export interface LabelModelGrader { type: 'label_model'; } +export namespace LabelModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + /** * A MultiGrader object combines the output of multiple graders to produce a single * score. @@ -59,7 +103,7 @@ export interface MultiGrader { name: string; /** - * The type of grader. + * The object type, which is always `multi`. */ type: 'multi'; } @@ -96,7 +140,7 @@ export interface ScoreModelGrader { /** * The input text. This may include template strings. */ - input: Array; + input: Array; /** * The model to use for the evaluation. @@ -124,6 +168,50 @@ export interface ScoreModelGrader { sampling_params?: unknown; } +export namespace ScoreModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + /** * A StringCheckGrader object that performs a string comparison between input and * reference using a specified operation. diff --git a/src/resources/index.ts b/src/resources/index.ts index 0f21e596c..9d827615c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -33,7 +33,6 @@ export { EvalListResponsesPage, Evals, type EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -91,7 +90,6 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, - type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index d0c2aaa49..adea184fd 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as ResponsesAPI from './responses/responses'; - export type AllModels = | (string & {}) | ChatModel @@ -43,6 +41,7 @@ export type ChatModel = | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview-2025-03-11' | 'chatgpt-4o-latest' + | 'codex-mini-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' @@ -120,48 +119,6 @@ export interface ErrorObject { type: string; } -/** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ -export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; -} - -export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } -} - export interface FunctionDefinition { /** * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain diff --git a/src/resources/vector-stores/index.ts b/src/resources/vector-stores/index.ts index c3c042387..9cbcbc0b2 100644 --- a/src/resources/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -30,7 +30,6 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, - type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index 66438be02..7d61e7fd6 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -249,7 +249,7 @@ export interface VectorStore { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter; + expires_after?: VectorStore.ExpiresAfter; /** * The Unix timestamp (in seconds) for when the vector store will expire. @@ -284,6 +284,22 @@ export namespace VectorStore { */ total: number; } + + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } } export interface VectorStoreDeleted { @@ -294,22 +310,6 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } -/** - * The expiration policy for a vector store. - */ -export interface VectorStoreExpirationAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; -} - export interface VectorStoreSearchResponse { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -365,7 +365,7 @@ export interface VectorStoreCreateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter; + expires_after?: VectorStoreCreateParams.ExpiresAfter; /** * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that @@ -390,11 +390,29 @@ export interface VectorStoreCreateParams { name?: string; } +export namespace VectorStoreCreateParams { + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } +} + export interface VectorStoreUpdateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter | null; + expires_after?: VectorStoreUpdateParams.ExpiresAfter | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -412,6 +430,24 @@ export interface VectorStoreUpdateParams { name?: string | null; } +export namespace VectorStoreUpdateParams { + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } +} + export interface VectorStoreListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -485,7 +521,6 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, VectorStoresPage as VectorStoresPage, VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, From 416c89bc773e6a79a238123467b4431da39c072d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 17:11:44 +0000 Subject: [PATCH 390/509] release: 4.99.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 10 ++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a279d9124..a65cc01f9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.98.0" + ".": "4.99.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f1a39177..2a552b8ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 4.99.0 (2025-05-16) + +Full Changelog: [v4.98.0...v4.99.0](https://github.com/openai/openai-node/compare/v4.98.0...v4.99.0) + +### Features + +* **api:** manual updates ([75eb804](https://github.com/openai/openai-node/commit/75eb804edd6ad653eaa22d47f8c6d09ee845ebf4)) +* **api:** responses x eval api ([5029f1a](https://github.com/openai/openai-node/commit/5029f1a05eb1e8601ada06e0a5ba49f4c2b83c02)) +* **api:** Updating Assistants and Evals API schemas ([27fd517](https://github.com/openai/openai-node/commit/27fd5173b20f75debe96024ae8f1ce58a8254d26)) + ## 4.98.0 (2025-05-08) Full Changelog: [v4.97.0...v4.98.0](https://github.com/openai/openai-node/compare/v4.97.0...v4.98.0) diff --git a/jsr.json b/jsr.json index 25bbc9ac2..2f29927c6 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.98.0", + "version": "4.99.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index d34efceb0..0d756ef85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.98.0", + "version": "4.99.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index f64cc03ff..c7ee5a162 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.98.0'; // x-release-please-version +export const VERSION = '4.99.0'; // x-release-please-version From 5123fe08a56f3d0040b1cc67129382f3eacc3cca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 19:35:22 +0000 Subject: [PATCH 391/509] chore(internal): version bump From 3f6f248191b45015924be76fd5154d149c4ed8a0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 19:41:32 +0000 Subject: [PATCH 392/509] feat(api): further updates for evals API --- .stats.yml | 4 +- src/resources/beta/realtime/realtime.ts | 2 +- .../beta/realtime/transcription-sessions.ts | 2 +- src/resources/evals/evals.ts | 31 ++--- src/resources/evals/runs/runs.ts | 109 ++++++++++-------- 5 files changed, 82 insertions(+), 66 deletions(-) diff --git a/.stats.yml b/.stats.yml index a3c5d081d..afa33d93b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5fa16b9a02985ae06e41be14946a9c325dc672fb014b3c19abca65880c6990e6.yml -openapi_spec_hash: da3e669f65130043b1170048c0727890 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-262e171d0a8150ea1192474d16ba3afdf9a054b399f1a49a9c9b697a3073c136.yml +openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b config_hash: d8d5fda350f6db77c784f35429741a2e diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5012b1edd..26fba883e 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2571,7 +2571,7 @@ export interface TranscriptionSessionUpdatedEvent { * A new Realtime transcription session configuration. * * When a session is created on the server via REST API, the session object also - * contains an ephemeral key. Default TTL for keys is one minute. This property is + * contains an ephemeral key. Default TTL for keys is 10 minutes. This property is * not present when a session is updated via the WebSocket API. */ session: TranscriptionSessionsAPI.TranscriptionSession; diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index 61e58a8e8..83e8c47ad 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -35,7 +35,7 @@ export class TranscriptionSessions extends APIResource { * A new Realtime transcription session configuration. * * When a session is created on the server via REST API, the session object also - * contains an ephemeral key. Default TTL for keys is one minute. This property is + * contains an ephemeral key. Default TTL for keys is 10 minutes. This property is * not present when a session is updated via the WebSocket API. */ export interface TranscriptionSession { diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 08c898ace..05a656619 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -28,7 +28,8 @@ export class Evals extends APIResource { /** * Create the structure of an evaluation that can be used to test a model's - * performance. An evaluation is a set of testing criteria and a datasource. After + * performance. An evaluation is a set of testing criteria and the config for a + * data source, which dictates the schema of the data used in the evaluation. After * creating an evaluation, you can run it on different models and model parameters. * We support several types of graders and datasources. For more information, see * the [Evals guide](https://platform.openai.com/docs/guides/evals). @@ -115,9 +116,9 @@ export interface EvalStoredCompletionsDataSourceConfig { schema: Record; /** - * The type of data source. Always `stored-completions`. + * The type of data source. Always `stored_completions`. */ - type: 'stored-completions'; + type: 'stored_completions'; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -136,7 +137,7 @@ export interface EvalStoredCompletionsDataSourceConfig { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalCreateResponse { /** @@ -257,7 +258,7 @@ export namespace EvalCreateResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalRetrieveResponse { /** @@ -378,7 +379,7 @@ export namespace EvalRetrieveResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalUpdateResponse { /** @@ -499,7 +500,7 @@ export namespace EvalUpdateResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalListResponse { /** @@ -624,12 +625,16 @@ export interface EvalDeleteResponse { export interface EvalCreateParams { /** - * The configuration for the data source used for the evaluation runs. + * The configuration for the data source used for the evaluation runs. Dictates the + * schema of the data used in the evaluation. */ data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs | EvalCreateParams.StoredCompletions; /** - * A list of graders for all eval runs in this group. + * A list of graders for all eval runs in this group. Graders can reference + * variables in the data source using double curly braces notation, like + * `{{item.variable_name}}`. To reference the model's output, use the `sample` + * namespace (ie, `{{sample.output_text}}`). */ testing_criteria: Array< | EvalCreateParams.LabelModel @@ -699,13 +704,13 @@ export namespace EvalCreateParams { } /** - * Deprecated in favor of LogsDataSourceConfig. + * @deprecated Deprecated in favor of LogsDataSourceConfig. */ export interface StoredCompletions { /** - * The type of data source. Always `stored-completions`. + * The type of data source. Always `stored_completions`. */ - type: 'stored-completions'; + type: 'stored_completions'; /** * Metadata filters for the stored completions data source. @@ -720,7 +725,7 @@ export namespace EvalCreateParams { export interface LabelModel { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ input: Array; diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 31883e6b5..e761e2160 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -19,7 +19,9 @@ export class Runs extends APIResource { outputItems: OutputItemsAPI.OutputItems = new OutputItemsAPI.OutputItems(this._client); /** - * Create a new evaluation run. This is the endpoint that will kick off grading. + * Kicks off a new run for a given evaluation, specifying the data source, and what + * model configuration to use to test. The datasource will be validated against the + * schema specified in the config of the evaluation. */ create( evalId: string, @@ -85,7 +87,7 @@ export class RunListResponsesPage extends CursorPage {} */ export interface CreateEvalCompletionsRunDataSource { /** - * A StoredCompletionsRunDataSource configuration describing a set of filters + * Determines what populates the `item` namespace in this run's data source. */ source: | CreateEvalCompletionsRunDataSource.FileContent @@ -97,6 +99,12 @@ export interface CreateEvalCompletionsRunDataSource { */ type: 'completions'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: | CreateEvalCompletionsRunDataSource.Template | CreateEvalCompletionsRunDataSource.ItemReference; @@ -185,7 +193,7 @@ export namespace CreateEvalCompletionsRunDataSource { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -241,7 +249,7 @@ export namespace CreateEvalCompletionsRunDataSource { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" */ item_reference: string; @@ -279,6 +287,9 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { + /** + * Determines what populates the `item` namespace in the data source. + */ source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; /** @@ -425,7 +436,7 @@ export namespace RunCreateResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -434,6 +445,12 @@ export namespace RunCreateResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -498,12 +515,6 @@ export namespace RunCreateResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -552,7 +563,7 @@ export namespace RunCreateResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -620,7 +631,7 @@ export namespace RunCreateResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -817,7 +828,7 @@ export namespace RunRetrieveResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -826,6 +837,12 @@ export namespace RunRetrieveResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -890,12 +907,6 @@ export namespace RunRetrieveResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -944,7 +955,7 @@ export namespace RunRetrieveResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1012,7 +1023,7 @@ export namespace RunRetrieveResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1206,7 +1217,7 @@ export namespace RunListResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -1215,6 +1226,12 @@ export namespace RunListResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -1279,12 +1296,6 @@ export namespace RunListResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -1333,7 +1344,7 @@ export namespace RunListResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1401,7 +1412,7 @@ export namespace RunListResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1606,7 +1617,7 @@ export namespace RunCancelResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -1615,6 +1626,12 @@ export namespace RunCancelResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -1679,12 +1696,6 @@ export namespace RunCancelResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -1733,7 +1744,7 @@ export namespace RunCancelResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1801,7 +1812,7 @@ export namespace RunCancelResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1940,7 +1951,7 @@ export namespace RunCreateParams { */ export interface CreateEvalResponsesRunDataSource { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: | CreateEvalResponsesRunDataSource.FileContent @@ -1952,6 +1963,12 @@ export namespace RunCreateParams { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: | CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; @@ -2018,12 +2035,6 @@ export namespace RunCreateParams { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -2072,7 +2083,7 @@ export namespace RunCreateParams { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -2140,7 +2151,7 @@ export namespace RunCreateParams { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; From 29e608f24af8880fcdc0d45cc64321e4856e47ba Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 19:42:24 +0000 Subject: [PATCH 393/509] release: 4.100.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a65cc01f9..989bed91e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.99.0" + ".": "4.100.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a552b8ed..adda41e52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 4.100.0 (2025-05-16) + +Full Changelog: [v4.99.0...v4.100.0](https://github.com/openai/openai-node/compare/v4.99.0...v4.100.0) + +### Features + +* **api:** further updates for evals API ([3f6f248](https://github.com/openai/openai-node/commit/3f6f248191b45015924be76fd5154d149c4ed8a0)) + + +### Chores + +* **internal:** version bump ([5123fe0](https://github.com/openai/openai-node/commit/5123fe08a56f3d0040b1cc67129382f3eacc3cca)) + ## 4.99.0 (2025-05-16) Full Changelog: [v4.98.0...v4.99.0](https://github.com/openai/openai-node/compare/v4.98.0...v4.99.0) diff --git a/jsr.json b/jsr.json index 2f29927c6..3c2d41b0f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.99.0", + "version": "4.100.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 0d756ef85..23205e569 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.99.0", + "version": "4.100.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index c7ee5a162..62b43ffce 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.99.0'; // x-release-please-version +export const VERSION = '4.100.0'; // x-release-please-version From b40e8302ec11683b6a360a050236ad1284afc760 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 20:54:00 +0000 Subject: [PATCH 394/509] chore(internal): version bump From 45b1448777c502c0fce0c8410e49c357b4201524 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 13:13:07 +0000 Subject: [PATCH 395/509] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index afa33d93b..7a20222a3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-262e171d0a8150ea1192474d16ba3afdf9a054b399f1a49a9c9b697a3073c136.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d51538ac955164de98b0c94a0a4718d96623fe39bf31a1d168be06c93c94e645.yml openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b -config_hash: d8d5fda350f6db77c784f35429741a2e +config_hash: c42d37618b8628ce7e1c76437db5dd8f From 7761cfb0a8a56d056a73c046a6a613f66ada4abe Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 15:11:03 +0000 Subject: [PATCH 396/509] chore(docs): grammar improvements --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 3b3bd8a66..4adb0c54f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,13 +16,13 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by OpenAI please follow the respective company's security reporting guidelines. +or products provided by OpenAI, please follow the respective company's security reporting guidelines. ### OpenAI Terms and Policies Our Security Policy can be found at [Security Policy URL](https://openai.com/policies/coordinated-vulnerability-disclosure-policy). -Please contact disclosure@openai.com for any questions or concerns regarding security of our services. +Please contact disclosure@openai.com for any questions or concerns regarding the security of our services. --- From fb4014ffac7b220d37bd03c94fa745386b010bf0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 16:20:21 +0000 Subject: [PATCH 397/509] feat(api): new API tools --- .stats.yml | 6 +- api.md | 18 + src/resources/responses/responses.ts | 1539 ++++++++++++++++- .../api-resources/responses/responses.test.ts | 11 +- 4 files changed, 1539 insertions(+), 35 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7a20222a3..4b4f19c91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d51538ac955164de98b0c94a0a4718d96623fe39bf31a1d168be06c93c94e645.yml -openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b -config_hash: c42d37618b8628ce7e1c76437db5dd8f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml +openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd +config_hash: bb657c3fed232a56930035de3aaed936 diff --git a/api.md b/api.md index cad696e7e..f7fb47e3e 100644 --- a/api.md +++ b/api.md @@ -645,6 +645,10 @@ Types: - ResponseFunctionToolCallItem - ResponseFunctionToolCallOutputItem - ResponseFunctionWebSearch +- ResponseImageGenCallCompletedEvent +- ResponseImageGenCallGeneratingEvent +- ResponseImageGenCallInProgressEvent +- ResponseImageGenCallPartialImageEvent - ResponseInProgressEvent - ResponseIncludable - ResponseIncompleteEvent @@ -658,6 +662,14 @@ Types: - ResponseInputMessageItem - ResponseInputText - ResponseItem +- ResponseMcpCallArgumentsDeltaEvent +- ResponseMcpCallArgumentsDoneEvent +- ResponseMcpCallCompletedEvent +- ResponseMcpCallFailedEvent +- ResponseMcpCallInProgressEvent +- ResponseMcpListToolsCompletedEvent +- ResponseMcpListToolsFailedEvent +- ResponseMcpListToolsInProgressEvent - ResponseOutputAudio - ResponseOutputItem - ResponseOutputItemAddedEvent @@ -665,7 +677,13 @@ Types: - ResponseOutputMessage - ResponseOutputRefusal - ResponseOutputText +- ResponseOutputTextAnnotationAddedEvent +- ResponseQueuedEvent +- ResponseReasoningDeltaEvent +- ResponseReasoningDoneEvent - ResponseReasoningItem +- ResponseReasoningSummaryDeltaEvent +- ResponseReasoningSummaryDoneEvent - ResponseReasoningSummaryPartAddedEvent - ResponseReasoningSummaryPartDoneEvent - ResponseReasoningSummaryTextDeltaEvent diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 1440e865e..fdf51f224 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -37,7 +37,13 @@ export type ParsedResponseOutputItem = | ResponseFileSearchToolCall | ResponseFunctionWebSearch | ResponseComputerToolCall - | ResponseReasoningItem; + | ResponseReasoningItem + | ResponseOutputItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseOutputItem.LocalShellCall + | ResponseOutputItem.McpCall + | ResponseOutputItem.McpListTools + | ResponseOutputItem.McpApprovalRequest; export interface ParsedResponse extends Response { output: Array>; @@ -414,6 +420,12 @@ export interface Response { */ top_p: number | null; + /** + * Whether to run the model response in the background. + * [Learn more](https://platform.openai.com/docs/guides/background). + */ + background?: boolean | null; + /** * An upper bound for the number of tokens that can be generated for a response, * including visible output tokens and @@ -459,7 +471,7 @@ export interface Response { /** * The status of the response generation. One of `completed`, `failed`, - * `in_progress`, or `incomplete`. + * `in_progress`, `cancelled`, `queued`, or `incomplete`. */ status?: ResponseStatus; @@ -687,6 +699,11 @@ export interface ResponseCodeInterpreterToolCall { * The type of the code interpreter tool call. Always `code_interpreter_call`. */ type: 'code_interpreter_call'; + + /** + * The ID of the container used to run the code. + */ + container_id?: string; } export namespace ResponseCodeInterpreterToolCall { @@ -1579,6 +1596,114 @@ export interface ResponseFunctionWebSearch { type: 'web_search_call'; } +/** + * Emitted when an image generation tool call has completed and the final image is + * available. + */ +export interface ResponseImageGenCallCompletedEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.image_generation_call.completed'. + */ + type: 'response.image_generation_call.completed'; +} + +/** + * Emitted when an image generation tool call is actively generating an image + * (intermediate state). + */ +export interface ResponseImageGenCallGeneratingEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.image_generation_call.generating'. + */ + type: 'response.image_generation_call.generating'; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number?: number; +} + +/** + * Emitted when an image generation tool call is in progress. + */ +export interface ResponseImageGenCallInProgressEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number: number; + + /** + * The type of the event. Always 'response.image_generation_call.in_progress'. + */ + type: 'response.image_generation_call.in_progress'; +} + +/** + * Emitted when a partial image is available during image generation streaming. + */ +export interface ResponseImageGenCallPartialImageEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * Base64-encoded partial image data, suitable for rendering as an image. + */ + partial_image_b64: string; + + /** + * 0-based index for the partial image (backend is 1-based, but this is 0-based for + * the user). + */ + partial_image_index: number; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number: number; + + /** + * The type of the event. Always 'response.image_generation_call.partial_image'. + */ + type: 'response.image_generation_call.partial_image'; +} + /** * Emitted when the response is in progress. */ @@ -1732,6 +1857,14 @@ export type ResponseInputItem = | ResponseFunctionToolCall | ResponseInputItem.FunctionCallOutput | ResponseReasoningItem + | ResponseInputItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseInputItem.LocalShellCall + | ResponseInputItem.LocalShellCallOutput + | ResponseInputItem.McpListTools + | ResponseInputItem.McpApprovalRequest + | ResponseInputItem.McpApprovalResponse + | ResponseInputItem.McpCall | ResponseInputItem.ItemReference; export namespace ResponseInputItem { @@ -1855,6 +1988,280 @@ export namespace ResponseInputItem { status?: 'in_progress' | 'completed' | 'incomplete' | null; } + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * The output of a local shell tool call. + */ + export interface LocalShellCallOutput { + /** + * The unique ID of the local shell tool call generated by the model. + */ + id: string; + + /** + * A JSON string of the output of the local shell tool call. + */ + output: string; + + /** + * The type of the local shell tool call output. Always `local_shell_call_output`. + */ + type: 'local_shell_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } + + /** + * A response to an MCP approval request. + */ + export interface McpApprovalResponse { + /** + * The ID of the approval request being answered. + */ + approval_request_id: string; + + /** + * Whether the request was approved. + */ + approve: boolean; + + /** + * The type of the item. Always `mcp_approval_response`. + */ + type: 'mcp_approval_response'; + + /** + * The unique ID of the approval response + */ + id?: string | null; + + /** + * Optional reason for the decision. + */ + reason?: string | null; + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } + /** * An internal identifier for an item to reference. */ @@ -1932,11 +2339,417 @@ export type ResponseItem = | ResponseComputerToolCallOutputItem | ResponseFunctionWebSearch | ResponseFunctionToolCallItem - | ResponseFunctionToolCallOutputItem; + | ResponseFunctionToolCallOutputItem + | ResponseItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseItem.LocalShellCall + | ResponseItem.LocalShellCallOutput + | ResponseItem.McpListTools + | ResponseItem.McpApprovalRequest + | ResponseItem.McpApprovalResponse + | ResponseItem.McpCall; -/** - * An audio output from the model. - */ +export namespace ResponseItem { + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * The output of a local shell tool call. + */ + export interface LocalShellCallOutput { + /** + * The unique ID of the local shell tool call generated by the model. + */ + id: string; + + /** + * A JSON string of the output of the local shell tool call. + */ + output: string; + + /** + * The type of the local shell tool call output. Always `local_shell_call_output`. + */ + type: 'local_shell_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } + + /** + * A response to an MCP approval request. + */ + export interface McpApprovalResponse { + /** + * The unique ID of the approval response + */ + id: string; + + /** + * The ID of the approval request being answered. + */ + approval_request_id: string; + + /** + * Whether the request was approved. + */ + approve: boolean; + + /** + * The type of the item. Always `mcp_approval_response`. + */ + type: 'mcp_approval_response'; + + /** + * Optional reason for the decision. + */ + reason?: string | null; + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } +} + +/** + * Emitted when there is a delta (partial update) to the arguments of an MCP tool + * call. + */ +export interface ResponseMcpCallArgumentsDeltaEvent { + /** + * The partial update to the arguments for the MCP tool call. + */ + delta: unknown; + + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.arguments_delta'. + */ + type: 'response.mcp_call.arguments_delta'; +} + +/** + * Emitted when the arguments for an MCP tool call are finalized. + */ +export interface ResponseMcpCallArgumentsDoneEvent { + /** + * The finalized arguments for the MCP tool call. + */ + arguments: unknown; + + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.arguments_done'. + */ + type: 'response.mcp_call.arguments_done'; +} + +/** + * Emitted when an MCP tool call has completed successfully. + */ +export interface ResponseMcpCallCompletedEvent { + /** + * The type of the event. Always 'response.mcp_call.completed'. + */ + type: 'response.mcp_call.completed'; +} + +/** + * Emitted when an MCP tool call has failed. + */ +export interface ResponseMcpCallFailedEvent { + /** + * The type of the event. Always 'response.mcp_call.failed'. + */ + type: 'response.mcp_call.failed'; +} + +/** + * Emitted when an MCP tool call is in progress. + */ +export interface ResponseMcpCallInProgressEvent { + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.in_progress'. + */ + type: 'response.mcp_call.in_progress'; +} + +/** + * Emitted when the list of available MCP tools has been successfully retrieved. + */ +export interface ResponseMcpListToolsCompletedEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.completed'. + */ + type: 'response.mcp_list_tools.completed'; +} + +/** + * Emitted when the attempt to list available MCP tools has failed. + */ +export interface ResponseMcpListToolsFailedEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.failed'. + */ + type: 'response.mcp_list_tools.failed'; +} + +/** + * Emitted when the system is in the process of retrieving the list of available + * MCP tools. + */ +export interface ResponseMcpListToolsInProgressEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.in_progress'. + */ + type: 'response.mcp_list_tools.in_progress'; +} + +/** + * An audio output from the model. + */ export interface ResponseOutputAudio { /** * Base64-encoded audio data from the model. @@ -1948,23 +2761,250 @@ export interface ResponseOutputAudio { */ transcript: string; - /** - * The type of the output audio. Always `output_audio`. - */ - type: 'output_audio'; + /** + * The type of the output audio. Always `output_audio`. + */ + type: 'output_audio'; +} + +/** + * An output message from the model. + */ +export type ResponseOutputItem = + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseFunctionToolCall + | ResponseFunctionWebSearch + | ResponseComputerToolCall + | ResponseReasoningItem + | ResponseOutputItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseOutputItem.LocalShellCall + | ResponseOutputItem.McpCall + | ResponseOutputItem.McpListTools + | ResponseOutputItem.McpApprovalRequest; + +export namespace ResponseOutputItem { + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } } -/** - * An output message from the model. - */ -export type ResponseOutputItem = - | ResponseOutputMessage - | ResponseFileSearchToolCall - | ResponseFunctionToolCall - | ResponseFunctionWebSearch - | ResponseComputerToolCall - | ResponseReasoningItem; - /** * Emitted when a new output item is added. */ @@ -2145,6 +3185,116 @@ export namespace ResponseOutputText { } } +/** + * Emitted when an annotation is added to output text content. + */ +export interface ResponseOutputTextAnnotationAddedEvent { + /** + * The annotation object being added. (See annotation schema for details.) + */ + annotation: unknown; + + /** + * The index of the annotation within the content part. + */ + annotation_index: number; + + /** + * The index of the content part within the output item. + */ + content_index: number; + + /** + * The unique identifier of the item to which the annotation is being added. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.output_text_annotation.added'. + */ + type: 'response.output_text_annotation.added'; +} + +/** + * Emitted when a response is queued and waiting to be processed. + */ +export interface ResponseQueuedEvent { + /** + * The full response object that is queued. + */ + response: Response; + + /** + * The type of the event. Always 'response.queued'. + */ + type: 'response.queued'; +} + +/** + * Emitted when there is a delta (partial update) to the reasoning content. + */ +export interface ResponseReasoningDeltaEvent { + /** + * The index of the reasoning content part within the output item. + */ + content_index: number; + + /** + * The partial update to the reasoning content. + */ + delta: unknown; + + /** + * The unique identifier of the item for which reasoning is being updated. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.reasoning.delta'. + */ + type: 'response.reasoning.delta'; +} + +/** + * Emitted when the reasoning content is finalized for an item. + */ +export interface ResponseReasoningDoneEvent { + /** + * The index of the reasoning content part within the output item. + */ + content_index: number; + + /** + * The unique identifier of the item for which reasoning is finalized. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The finalized reasoning text. + */ + text: string; + + /** + * The type of the event. Always 'response.reasoning.done'. + */ + type: 'response.reasoning.done'; +} + /** * A description of the chain of thought used by a reasoning model while generating * a response. Be sure to include these items in your `input` to the Responses API @@ -2194,6 +3344,67 @@ export namespace ResponseReasoningItem { } } +/** + * Emitted when there is a delta (partial update) to the reasoning summary content. + */ +export interface ResponseReasoningSummaryDeltaEvent { + /** + * The partial update to the reasoning summary content. + */ + delta: unknown; + + /** + * The unique identifier of the item for which the reasoning summary is being + * updated. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The index of the summary part within the output item. + */ + summary_index: number; + + /** + * The type of the event. Always 'response.reasoning_summary.delta'. + */ + type: 'response.reasoning_summary.delta'; +} + +/** + * Emitted when the reasoning summary content is finalized for an item. + */ +export interface ResponseReasoningSummaryDoneEvent { + /** + * The unique identifier of the item for which the reasoning summary is finalized. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The index of the summary part within the output item. + */ + summary_index: number; + + /** + * The finalized reasoning summary text. + */ + text: string; + + /** + * The type of the event. Always 'response.reasoning_summary.done'. + */ + type: 'response.reasoning_summary.done'; +} + /** * Emitted when a new reasoning summary part is added. */ @@ -2410,9 +3621,9 @@ export interface ResponseRefusalDoneEvent { /** * The status of the response generation. One of `completed`, `failed`, - * `in_progress`, or `incomplete`. + * `in_progress`, `cancelled`, `queued`, or `incomplete`. */ -export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete'; +export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete'; /** * Emitted when there is a partial audio response. @@ -2453,7 +3664,25 @@ export type ResponseStreamEvent = | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent | ResponseWebSearchCallInProgressEvent - | ResponseWebSearchCallSearchingEvent; + | ResponseWebSearchCallSearchingEvent + | ResponseImageGenCallCompletedEvent + | ResponseImageGenCallGeneratingEvent + | ResponseImageGenCallInProgressEvent + | ResponseImageGenCallPartialImageEvent + | ResponseMcpCallArgumentsDeltaEvent + | ResponseMcpCallArgumentsDoneEvent + | ResponseMcpCallCompletedEvent + | ResponseMcpCallFailedEvent + | ResponseMcpCallInProgressEvent + | ResponseMcpListToolsCompletedEvent + | ResponseMcpListToolsFailedEvent + | ResponseMcpListToolsInProgressEvent + | ResponseOutputTextAnnotationAddedEvent + | ResponseQueuedEvent + | ResponseReasoningDeltaEvent + | ResponseReasoningDoneEvent + | ResponseReasoningSummaryDeltaEvent + | ResponseReasoningSummaryDoneEvent; /** * Emitted when a text annotation is added. @@ -2768,7 +3997,229 @@ export interface ResponseWebSearchCallSearchingEvent { /** * A tool that can be used to generate a response. */ -export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool; +export type Tool = + | FunctionTool + | FileSearchTool + | WebSearchTool + | ComputerTool + | Tool.Mcp + | Tool.CodeInterpreter + | Tool.ImageGeneration + | Tool.LocalShell; + +export namespace Tool { + /** + * Give the model access to additional tools via remote Model Context Protocol + * (MCP) servers. + * [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). + */ + export interface Mcp { + /** + * A label for this MCP server, used to identify it in tool calls. + */ + server_label: string; + + /** + * The URL for the MCP server. + */ + server_url: string; + + /** + * The type of the MCP tool. Always `mcp`. + */ + type: 'mcp'; + + /** + * List of allowed tool names or a filter object. + */ + allowed_tools?: Array | Mcp.McpAllowedToolsFilter | null; + + /** + * Optional HTTP headers to send to the MCP server. Use for authentication or other + * purposes. + */ + headers?: Record | null; + + /** + * Specify which of the MCP server's tools require approval. + */ + require_approval?: Mcp.McpToolApprovalFilter | 'always' | 'never' | null; + } + + export namespace Mcp { + /** + * A filter object to specify which tools are allowed. + */ + export interface McpAllowedToolsFilter { + /** + * List of allowed tool names. + */ + tool_names?: Array; + } + + export interface McpToolApprovalFilter { + /** + * A list of tools that always require approval. + */ + always?: McpToolApprovalFilter.Always; + + /** + * A list of tools that never require approval. + */ + never?: McpToolApprovalFilter.Never; + + /** + * List of allowed tool names. + */ + tool_names?: Array; + } + + export namespace McpToolApprovalFilter { + /** + * A list of tools that always require approval. + */ + export interface Always { + /** + * List of tools that require approval. + */ + tool_names?: Array; + } + + /** + * A list of tools that never require approval. + */ + export interface Never { + /** + * List of tools that do not require approval. + */ + tool_names?: Array; + } + } + } + + /** + * A tool that runs Python code to help generate a response to a prompt. + */ + export interface CodeInterpreter { + /** + * The code interpreter container. Can be a container ID or an object that + * specifies uploaded file IDs to make available to your code. + */ + container: string | CodeInterpreter.CodeInterpreterToolAuto; + + /** + * The type of the code interpreter tool. Always `code_interpreter`. + */ + type: 'code_interpreter'; + } + + export namespace CodeInterpreter { + /** + * Configuration for a code interpreter container. Optionally specify the IDs of + * the files to run the code on. + */ + export interface CodeInterpreterToolAuto { + /** + * Always `auto`. + */ + type: 'auto'; + + /** + * An optional list of uploaded files to make available to your code. + */ + file_ids?: Array; + } + } + + /** + * A tool that generates images using a model like `gpt-image-1`. + */ + export interface ImageGeneration { + /** + * The type of the image generation tool. Always `image_generation`. + */ + type: 'image_generation'; + + /** + * Background type for the generated image. One of `transparent`, `opaque`, or + * `auto`. Default: `auto`. + */ + background?: 'transparent' | 'opaque' | 'auto'; + + /** + * Optional mask for inpainting. Contains `image_url` (string, optional) and + * `file_id` (string, optional). + */ + input_image_mask?: ImageGeneration.InputImageMask; + + /** + * The image generation model to use. Default: `gpt-image-1`. + */ + model?: 'gpt-image-1'; + + /** + * Moderation level for the generated image. Default: `auto`. + */ + moderation?: 'auto' | 'low'; + + /** + * Compression level for the output image. Default: 100. + */ + output_compression?: number; + + /** + * The output format of the generated image. One of `png`, `webp`, or `jpeg`. + * Default: `png`. + */ + output_format?: 'png' | 'webp' | 'jpeg'; + + /** + * Number of partial images to generate in streaming mode, from 0 (default value) + * to 3. + */ + partial_images?: number; + + /** + * The quality of the generated image. One of `low`, `medium`, `high`, or `auto`. + * Default: `auto`. + */ + quality?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, + * or `auto`. Default: `auto`. + */ + size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto'; + } + + export namespace ImageGeneration { + /** + * Optional mask for inpainting. Contains `image_url` (string, optional) and + * `file_id` (string, optional). + */ + export interface InputImageMask { + /** + * File ID for the mask image. + */ + file_id?: string; + + /** + * Base64-encoded mask image. + */ + image_url?: string; + } + } + + /** + * A tool that allows the model to execute shell commands in a local environment. + */ + export interface LocalShell { + /** + * The type of the local shell tool. Always `local_shell`. + */ + type: 'local_shell'; + } +} /** * Use this option to force the model to call a specific function. @@ -2811,8 +4262,18 @@ export interface ToolChoiceTypes { * - `file_search` * - `web_search_preview` * - `computer_use_preview` - */ - type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11'; + * - `code_interpreter` + * - `mcp` + * - `image_generation` + */ + type: + | 'file_search' + | 'web_search_preview' + | 'computer_use_preview' + | 'web_search_preview_2025_03_11' + | 'image_generation' + | 'code_interpreter' + | 'mcp'; } /** @@ -2898,6 +4359,12 @@ export interface ResponseCreateParamsBase { */ model: Shared.ResponsesModel; + /** + * Whether to run the model response in the background. + * [Learn more](https://platform.openai.com/docs/guides/background). + */ + background?: boolean | null; + /** * Specify additional output data to include in the model response. Currently * supported values are: @@ -3147,6 +4614,10 @@ export declare namespace Responses { type ResponseFunctionToolCallItem as ResponseFunctionToolCallItem, type ResponseFunctionToolCallOutputItem as ResponseFunctionToolCallOutputItem, type ResponseFunctionWebSearch as ResponseFunctionWebSearch, + type ResponseImageGenCallCompletedEvent as ResponseImageGenCallCompletedEvent, + type ResponseImageGenCallGeneratingEvent as ResponseImageGenCallGeneratingEvent, + type ResponseImageGenCallInProgressEvent as ResponseImageGenCallInProgressEvent, + type ResponseImageGenCallPartialImageEvent as ResponseImageGenCallPartialImageEvent, type ResponseInProgressEvent as ResponseInProgressEvent, type ResponseIncludable as ResponseIncludable, type ResponseIncompleteEvent as ResponseIncompleteEvent, @@ -3160,6 +4631,14 @@ export declare namespace Responses { type ResponseInputMessageItem as ResponseInputMessageItem, type ResponseInputText as ResponseInputText, type ResponseItem as ResponseItem, + type ResponseMcpCallArgumentsDeltaEvent as ResponseMcpCallArgumentsDeltaEvent, + type ResponseMcpCallArgumentsDoneEvent as ResponseMcpCallArgumentsDoneEvent, + type ResponseMcpCallCompletedEvent as ResponseMcpCallCompletedEvent, + type ResponseMcpCallFailedEvent as ResponseMcpCallFailedEvent, + type ResponseMcpCallInProgressEvent as ResponseMcpCallInProgressEvent, + type ResponseMcpListToolsCompletedEvent as ResponseMcpListToolsCompletedEvent, + type ResponseMcpListToolsFailedEvent as ResponseMcpListToolsFailedEvent, + type ResponseMcpListToolsInProgressEvent as ResponseMcpListToolsInProgressEvent, type ResponseOutputAudio as ResponseOutputAudio, type ResponseOutputItem as ResponseOutputItem, type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, @@ -3167,7 +4646,13 @@ export declare namespace Responses { type ResponseOutputMessage as ResponseOutputMessage, type ResponseOutputRefusal as ResponseOutputRefusal, type ResponseOutputText as ResponseOutputText, + type ResponseOutputTextAnnotationAddedEvent as ResponseOutputTextAnnotationAddedEvent, + type ResponseQueuedEvent as ResponseQueuedEvent, + type ResponseReasoningDeltaEvent as ResponseReasoningDeltaEvent, + type ResponseReasoningDoneEvent as ResponseReasoningDoneEvent, type ResponseReasoningItem as ResponseReasoningItem, + type ResponseReasoningSummaryDeltaEvent as ResponseReasoningSummaryDeltaEvent, + type ResponseReasoningSummaryDoneEvent as ResponseReasoningSummaryDoneEvent, type ResponseReasoningSummaryPartAddedEvent as ResponseReasoningSummaryPartAddedEvent, type ResponseReasoningSummaryPartDoneEvent as ResponseReasoningSummaryPartDoneEvent, type ResponseReasoningSummaryTextDeltaEvent as ResponseReasoningSummaryTextDeltaEvent, diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index cf7e9cf3c..1b2cf7fc4 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -24,6 +24,7 @@ describe('resource responses', () => { const response = await client.responses.create({ input: 'string', model: 'gpt-4o', + background: true, include: ['file_search_call.results'], instructions: 'instructions', max_output_tokens: 0, @@ -39,11 +40,11 @@ describe('resource responses', () => { tool_choice: 'none', tools: [ { - type: 'file_search', - vector_store_ids: ['string'], - filters: { key: 'key', type: 'eq', value: 'string' }, - max_num_results: 0, - ranking_options: { ranker: 'auto', score_threshold: 0 }, + name: 'name', + parameters: { foo: 'bar' }, + strict: true, + type: 'function', + description: 'description', }, ], top_p: 1, From 16a8cd0ef78de965322862e2ca4a5f3dc801b74d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 16:21:19 +0000 Subject: [PATCH 398/509] release: 4.101.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 989bed91e..514215a1e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.100.0" + ".": "4.101.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index adda41e52..1e427d912 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 4.101.0 (2025-05-21) + +Full Changelog: [v4.100.0...v4.101.0](https://github.com/openai/openai-node/compare/v4.100.0...v4.101.0) + +### Features + +* **api:** new API tools ([fb4014f](https://github.com/openai/openai-node/commit/fb4014ffac7b220d37bd03c94fa745386b010bf0)) + + +### Chores + +* **docs:** grammar improvements ([7761cfb](https://github.com/openai/openai-node/commit/7761cfb0a8a56d056a73c046a6a613f66ada4abe)) +* **internal:** version bump ([b40e830](https://github.com/openai/openai-node/commit/b40e8302ec11683b6a360a050236ad1284afc760)) + ## 4.100.0 (2025-05-16) Full Changelog: [v4.99.0...v4.100.0](https://github.com/openai/openai-node/compare/v4.99.0...v4.100.0) diff --git a/jsr.json b/jsr.json index 3c2d41b0f..42bf0a235 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.100.0", + "version": "4.101.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 23205e569..e8cd7277c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.100.0", + "version": "4.101.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 62b43ffce..ff06c96c3 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.100.0'; // x-release-please-version +export const VERSION = '4.101.0'; // x-release-please-version From e9734764625275c50ef612ff934804be8cb2adff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 18:37:18 +0000 Subject: [PATCH 399/509] feat(api): add container endpoint --- .stats.yml | 8 +- api.md | 37 +++ src/index.ts | 22 ++ src/resources/containers.ts | 3 + src/resources/containers/containers.ts | 291 ++++++++++++++++++ src/resources/containers/files.ts | 3 + src/resources/containers/files/content.ts | 16 + src/resources/containers/files/files.ts | 222 +++++++++++++ src/resources/containers/files/index.ts | 12 + src/resources/containers/index.ts | 20 ++ src/resources/index.ts | 9 + src/resources/responses/responses.ts | 269 +++++++++++++++- .../containers/containers.test.ts | 94 ++++++ .../containers/files/content.test.ts | 31 ++ .../containers/files/files.test.ts | 87 ++++++ .../api-resources/responses/responses.test.ts | 18 ++ 16 files changed, 1134 insertions(+), 8 deletions(-) create mode 100644 src/resources/containers.ts create mode 100644 src/resources/containers/containers.ts create mode 100644 src/resources/containers/files.ts create mode 100644 src/resources/containers/files/content.ts create mode 100644 src/resources/containers/files/files.ts create mode 100644 src/resources/containers/files/index.ts create mode 100644 src/resources/containers/index.ts create mode 100644 tests/api-resources/containers/containers.test.ts create mode 100644 tests/api-resources/containers/files/content.test.ts create mode 100644 tests/api-resources/containers/files/files.test.ts diff --git a/.stats.yml b/.stats.yml index 4b4f19c91..41319e5e5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml -openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd -config_hash: bb657c3fed232a56930035de3aaed936 +configured_endpoints: 111 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6af14840a810139bf407013167ce1c8fb21b6ef8eb0cc3db58b51af7d52c4b5a.yml +openapi_spec_hash: 3241bde6b273cfec0035e522bd07985d +config_hash: 7367b68a4e7db36885c1a886f57b17f6 diff --git a/api.md b/api.md index f7fb47e3e..4e8187d0f 100644 --- a/api.md +++ b/api.md @@ -711,6 +711,7 @@ Methods: - client.responses.create({ ...params }) -> Response - client.responses.retrieve(responseId, { ...params }) -> Response - client.responses.del(responseId) -> void +- client.responses.cancel(responseId) -> void ## InputItems @@ -774,3 +775,39 @@ Methods: - client.evals.runs.outputItems.retrieve(evalId, runId, outputItemId) -> OutputItemRetrieveResponse - client.evals.runs.outputItems.list(evalId, runId, { ...params }) -> OutputItemListResponsesPage + +# Containers + +Types: + +- ContainerCreateResponse +- ContainerRetrieveResponse +- ContainerListResponse + +Methods: + +- client.containers.create({ ...params }) -> ContainerCreateResponse +- client.containers.retrieve(containerId) -> ContainerRetrieveResponse +- client.containers.list({ ...params }) -> ContainerListResponsesPage +- client.containers.del(containerId) -> void + +## Files + +Types: + +- FileCreateResponse +- FileRetrieveResponse +- FileListResponse + +Methods: + +- client.containers.files.create(containerId, { ...params }) -> FileCreateResponse +- client.containers.files.retrieve(containerId, fileId) -> FileRetrieveResponse +- client.containers.files.list(containerId, { ...params }) -> FileListResponsesPage +- client.containers.files.del(containerId, fileId) -> void + +### Content + +Methods: + +- client.containers.files.content.retrieve(containerId, fileId) -> void diff --git a/src/index.ts b/src/index.ts index 537c18f43..3b4b9a574 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,6 +66,15 @@ import { import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; +import { + ContainerCreateParams, + ContainerCreateResponse, + ContainerListParams, + ContainerListResponse, + ContainerListResponsesPage, + ContainerRetrieveResponse, + Containers, +} from './resources/containers/containers'; import { EvalCreateParams, EvalCreateResponse, @@ -310,6 +319,7 @@ export class OpenAI extends Core.APIClient { uploads: API.Uploads = new API.Uploads(this); responses: API.Responses = new API.Responses(this); evals: API.Evals = new API.Evals(this); + containers: API.Containers = new API.Containers(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -376,6 +386,8 @@ OpenAI.Uploads = UploadsAPIUploads; OpenAI.Responses = Responses; OpenAI.Evals = Evals; OpenAI.EvalListResponsesPage = EvalListResponsesPage; +OpenAI.Containers = Containers; +OpenAI.ContainerListResponsesPage = ContainerListResponsesPage; export declare namespace OpenAI { export type RequestOptions = Core.RequestOptions; @@ -545,6 +557,16 @@ export declare namespace OpenAI { type EvalListParams as EvalListParams, }; + export { + Containers as Containers, + type ContainerCreateResponse as ContainerCreateResponse, + type ContainerRetrieveResponse as ContainerRetrieveResponse, + type ContainerListResponse as ContainerListResponse, + ContainerListResponsesPage as ContainerListResponsesPage, + type ContainerCreateParams as ContainerCreateParams, + type ContainerListParams as ContainerListParams, + }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; diff --git a/src/resources/containers.ts b/src/resources/containers.ts new file mode 100644 index 000000000..c8f3a6456 --- /dev/null +++ b/src/resources/containers.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './containers/index'; diff --git a/src/resources/containers/containers.ts b/src/resources/containers/containers.ts new file mode 100644 index 000000000..66303dc61 --- /dev/null +++ b/src/resources/containers/containers.ts @@ -0,0 +1,291 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; +import * as FilesAPI from './files/files'; +import { + FileCreateParams, + FileCreateResponse, + FileListParams, + FileListResponse, + FileListResponsesPage, + FileRetrieveResponse, + Files, +} from './files/files'; +import { CursorPage, type CursorPageParams } from '../../pagination'; + +export class Containers extends APIResource { + files: FilesAPI.Files = new FilesAPI.Files(this._client); + + /** + * Create Container + */ + create( + body: ContainerCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post('/containers', { body, ...options }); + } + + /** + * Retrieve Container + */ + retrieve(containerId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/containers/${containerId}`, options); + } + + /** + * List Containers + */ + list( + query?: ContainerListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; + list( + query: ContainerListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return this._client.getAPIList('/containers', ContainerListResponsesPage, { query, ...options }); + } + + /** + * Delete Container + */ + del(containerId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/containers/${containerId}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } +} + +export class ContainerListResponsesPage extends CursorPage {} + +export interface ContainerCreateResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerCreateResponse.ExpiresAfter; +} + +export namespace ContainerCreateResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerRetrieveResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerRetrieveResponse.ExpiresAfter; +} + +export namespace ContainerRetrieveResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerListResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerListResponse.ExpiresAfter; +} + +export namespace ContainerListResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerCreateParams { + /** + * Name of the container to create. + */ + name: string; + + /** + * Container expiration time in seconds relative to the 'anchor' time. + */ + expires_after?: ContainerCreateParams.ExpiresAfter; + + /** + * IDs of files to copy to the container. + */ + file_ids?: Array; +} + +export namespace ContainerCreateParams { + /** + * Container expiration time in seconds relative to the 'anchor' time. + */ + export interface ExpiresAfter { + /** + * Time anchor for the expiration time. Currently only 'last_active_at' is + * supported. + */ + anchor: 'last_active_at'; + + minutes: number; + } +} + +export interface ContainerListParams extends CursorPageParams { + /** + * Sort order by the `created_at` timestamp of the objects. `asc` for ascending + * order and `desc` for descending order. + */ + order?: 'asc' | 'desc'; +} + +Containers.ContainerListResponsesPage = ContainerListResponsesPage; +Containers.Files = Files; +Containers.FileListResponsesPage = FileListResponsesPage; + +export declare namespace Containers { + export { + type ContainerCreateResponse as ContainerCreateResponse, + type ContainerRetrieveResponse as ContainerRetrieveResponse, + type ContainerListResponse as ContainerListResponse, + ContainerListResponsesPage as ContainerListResponsesPage, + type ContainerCreateParams as ContainerCreateParams, + type ContainerListParams as ContainerListParams, + }; + + export { + Files as Files, + type FileCreateResponse as FileCreateResponse, + type FileRetrieveResponse as FileRetrieveResponse, + type FileListResponse as FileListResponse, + FileListResponsesPage as FileListResponsesPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; +} diff --git a/src/resources/containers/files.ts b/src/resources/containers/files.ts new file mode 100644 index 000000000..46a5299c1 --- /dev/null +++ b/src/resources/containers/files.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './files/index'; diff --git a/src/resources/containers/files/content.ts b/src/resources/containers/files/content.ts new file mode 100644 index 000000000..efb33a87f --- /dev/null +++ b/src/resources/containers/files/content.ts @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Content extends APIResource { + /** + * Retrieve Container File Content + */ + retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.get(`/containers/${containerId}/files/${fileId}/content`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } +} diff --git a/src/resources/containers/files/files.ts b/src/resources/containers/files/files.ts new file mode 100644 index 000000000..0c249df0f --- /dev/null +++ b/src/resources/containers/files/files.ts @@ -0,0 +1,222 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import * as ContentAPI from './content'; +import { Content } from './content'; +import { CursorPage, type CursorPageParams } from '../../../pagination'; + +export class Files extends APIResource { + content: ContentAPI.Content = new ContentAPI.Content(this._client); + + /** + * Create a Container File + * + * You can send either a multipart/form-data request with the raw file content, or + * a JSON request with a file ID. + */ + create( + containerId: string, + body: FileCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.post(`/containers/${containerId}/files`, { body, ...options }); + } + + /** + * Retrieve Container File + */ + retrieve( + containerId: string, + fileId: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.get(`/containers/${containerId}/files/${fileId}`, options); + } + + /** + * List Container files + */ + list( + containerId: string, + query?: FileListParams, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + containerId: string, + options?: Core.RequestOptions, + ): Core.PagePromise; + list( + containerId: string, + query: FileListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.PagePromise { + if (isRequestOptions(query)) { + return this.list(containerId, {}, query); + } + return this._client.getAPIList(`/containers/${containerId}/files`, FileListResponsesPage, { + query, + ...options, + }); + } + + /** + * Delete Container File + */ + del(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.delete(`/containers/${containerId}/files/${fileId}`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } +} + +export class FileListResponsesPage extends CursorPage {} + +export interface FileCreateResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileRetrieveResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileListResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileCreateParams { + /** + * The File object (not file name) to be uploaded. + */ + file?: Core.Uploadable; + + /** + * Name of the file to create. + */ + file_id?: string; +} + +export interface FileListParams extends CursorPageParams { + /** + * Sort order by the `created_at` timestamp of the objects. `asc` for ascending + * order and `desc` for descending order. + */ + order?: 'asc' | 'desc'; +} + +Files.FileListResponsesPage = FileListResponsesPage; +Files.Content = Content; + +export declare namespace Files { + export { + type FileCreateResponse as FileCreateResponse, + type FileRetrieveResponse as FileRetrieveResponse, + type FileListResponse as FileListResponse, + FileListResponsesPage as FileListResponsesPage, + type FileCreateParams as FileCreateParams, + type FileListParams as FileListParams, + }; + + export { Content as Content }; +} diff --git a/src/resources/containers/files/index.ts b/src/resources/containers/files/index.ts new file mode 100644 index 000000000..7305ab706 --- /dev/null +++ b/src/resources/containers/files/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Content } from './content'; +export { + FileListResponsesPage, + Files, + type FileCreateResponse, + type FileRetrieveResponse, + type FileListResponse, + type FileCreateParams, + type FileListParams, +} from './files'; diff --git a/src/resources/containers/index.ts b/src/resources/containers/index.ts new file mode 100644 index 000000000..91145bbe0 --- /dev/null +++ b/src/resources/containers/index.ts @@ -0,0 +1,20 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ContainerListResponsesPage, + Containers, + type ContainerCreateResponse, + type ContainerRetrieveResponse, + type ContainerListResponse, + type ContainerCreateParams, + type ContainerListParams, +} from './containers'; +export { + FileListResponsesPage, + Files, + type FileCreateResponse, + type FileRetrieveResponse, + type FileListResponse, + type FileCreateParams, + type FileListParams, +} from './files/index'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 9d827615c..d1f816a84 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -22,6 +22,15 @@ export { type CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming, } from './completions'; +export { + ContainerListResponsesPage, + Containers, + type ContainerCreateResponse, + type ContainerRetrieveResponse, + type ContainerListResponse, + type ContainerCreateParams, + type ContainerListParams, +} from './containers/containers'; export { Embeddings, type CreateEmbeddingResponse, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index fdf51f224..40dd9a6fb 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -158,12 +158,33 @@ export class Responses extends APIResource { /** * Creates a model response stream */ + stream>( body: Params, options?: Core.RequestOptions, ): ResponseStream { return ResponseStream.createResponse(this._client, body, options); } + + /** + * Cancels a model response with the given ID. Only responses created with the + * `background` parameter set to `true` can be cancelled. + * [Learn more](https://platform.openai.com/docs/guides/background). + * + * @example + * ```ts + * await client.responses.cancel( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` + */ + + cancel(responseId: string, options?: Core.RequestOptions): Core.APIPromise { + return this._client.post(`/responses/${responseId}/cancel`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } } export class ResponseItemsPage extends CursorPage {} @@ -530,6 +551,11 @@ export interface ResponseAudioDeltaEvent { */ delta: string; + /** + * A sequence number for this chunk of the stream response. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.delta`. */ @@ -540,6 +566,11 @@ export interface ResponseAudioDeltaEvent { * Emitted when the audio response is complete. */ export interface ResponseAudioDoneEvent { + /** + * The sequence number of the delta. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.done`. */ @@ -555,6 +586,11 @@ export interface ResponseAudioTranscriptDeltaEvent { */ delta: string; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.transcript.delta`. */ @@ -565,6 +601,11 @@ export interface ResponseAudioTranscriptDeltaEvent { * Emitted when the full audio transcript is completed. */ export interface ResponseAudioTranscriptDoneEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.transcript.done`. */ @@ -585,6 +626,11 @@ export interface ResponseCodeInterpreterCallCodeDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.code.delta`. */ @@ -605,6 +651,11 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.code.done`. */ @@ -625,6 +676,11 @@ export interface ResponseCodeInterpreterCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.completed`. */ @@ -645,6 +701,11 @@ export interface ResponseCodeInterpreterCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.in_progress`. */ @@ -665,6 +726,11 @@ export interface ResponseCodeInterpreterCallInterpretingEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.interpreting`. */ @@ -758,6 +824,11 @@ export interface ResponseCompletedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.completed`. */ @@ -1140,6 +1211,11 @@ export interface ResponseContentPartAddedEvent { */ part: ResponseOutputText | ResponseOutputRefusal; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.content_part.added`. */ @@ -1170,6 +1246,11 @@ export interface ResponseContentPartDoneEvent { */ part: ResponseOutputText | ResponseOutputRefusal; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.content_part.done`. */ @@ -1185,6 +1266,11 @@ export interface ResponseCreatedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.created`. */ @@ -1243,6 +1329,11 @@ export interface ResponseErrorEvent { */ param: string | null; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `error`. */ @@ -1258,6 +1349,11 @@ export interface ResponseFailedEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.failed`. */ @@ -1278,6 +1374,11 @@ export interface ResponseFileSearchCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.completed`. */ @@ -1298,6 +1399,11 @@ export interface ResponseFileSearchCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.in_progress`. */ @@ -1318,6 +1424,11 @@ export interface ResponseFileSearchCallSearchingEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.searching`. */ @@ -1468,6 +1579,11 @@ export interface ResponseFunctionCallArgumentsDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.function_call_arguments.delta`. */ @@ -1493,6 +1609,11 @@ export interface ResponseFunctionCallArgumentsDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + type: 'response.function_call_arguments.done'; } @@ -1611,6 +1732,11 @@ export interface ResponseImageGenCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.image_generation_call.completed'. */ @@ -1633,14 +1759,14 @@ export interface ResponseImageGenCallGeneratingEvent { output_index: number; /** - * The type of the event. Always 'response.image_generation_call.generating'. + * The sequence number of the image generation item being processed. */ - type: 'response.image_generation_call.generating'; + sequence_number: number; /** - * The sequence number of the image generation item being processed. + * The type of the event. Always 'response.image_generation_call.generating'. */ - sequence_number?: number; + type: 'response.image_generation_call.generating'; } /** @@ -1713,6 +1839,11 @@ export interface ResponseInProgressEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.in_progress`. */ @@ -1749,6 +1880,11 @@ export interface ResponseIncompleteEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.incomplete`. */ @@ -2645,6 +2781,11 @@ export interface ResponseMcpCallArgumentsDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.arguments_delta'. */ @@ -2670,6 +2811,11 @@ export interface ResponseMcpCallArgumentsDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.arguments_done'. */ @@ -2680,6 +2826,11 @@ export interface ResponseMcpCallArgumentsDoneEvent { * Emitted when an MCP tool call has completed successfully. */ export interface ResponseMcpCallCompletedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.completed'. */ @@ -2690,6 +2841,11 @@ export interface ResponseMcpCallCompletedEvent { * Emitted when an MCP tool call has failed. */ export interface ResponseMcpCallFailedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.failed'. */ @@ -2710,6 +2866,11 @@ export interface ResponseMcpCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.in_progress'. */ @@ -2720,6 +2881,11 @@ export interface ResponseMcpCallInProgressEvent { * Emitted when the list of available MCP tools has been successfully retrieved. */ export interface ResponseMcpListToolsCompletedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.completed'. */ @@ -2730,6 +2896,11 @@ export interface ResponseMcpListToolsCompletedEvent { * Emitted when the attempt to list available MCP tools has failed. */ export interface ResponseMcpListToolsFailedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.failed'. */ @@ -2741,6 +2912,11 @@ export interface ResponseMcpListToolsFailedEvent { * MCP tools. */ export interface ResponseMcpListToolsInProgressEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.in_progress'. */ @@ -3019,6 +3195,11 @@ export interface ResponseOutputItemAddedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_item.added`. */ @@ -3039,6 +3220,11 @@ export interface ResponseOutputItemDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_item.done`. */ @@ -3214,6 +3400,11 @@ export interface ResponseOutputTextAnnotationAddedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.output_text_annotation.added'. */ @@ -3229,6 +3420,11 @@ export interface ResponseQueuedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.queued'. */ @@ -3259,6 +3455,11 @@ export interface ResponseReasoningDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.reasoning.delta'. */ @@ -3284,6 +3485,11 @@ export interface ResponseReasoningDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The finalized reasoning text. */ @@ -3364,6 +3570,11 @@ export interface ResponseReasoningSummaryDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the output item. */ @@ -3389,6 +3600,11 @@ export interface ResponseReasoningSummaryDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the output item. */ @@ -3424,6 +3640,11 @@ export interface ResponseReasoningSummaryPartAddedEvent { */ part: ResponseReasoningSummaryPartAddedEvent.Part; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3471,6 +3692,11 @@ export interface ResponseReasoningSummaryPartDoneEvent { */ part: ResponseReasoningSummaryPartDoneEvent.Part; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3518,6 +3744,11 @@ export interface ResponseReasoningSummaryTextDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3543,6 +3774,11 @@ export interface ResponseReasoningSummaryTextDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3583,6 +3819,11 @@ export interface ResponseRefusalDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.refusal.delta`. */ @@ -3613,6 +3854,11 @@ export interface ResponseRefusalDoneEvent { */ refusal: string; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.refusal.done`. */ @@ -3716,6 +3962,11 @@ export interface ResponseTextAnnotationDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_text.annotation.added`. */ @@ -3844,6 +4095,11 @@ export interface ResponseTextDeltaEvent { */ output_index: number; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_text.delta`. */ @@ -3869,6 +4125,11 @@ export interface ResponseTextDoneEvent { */ output_index: number; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The text content that is finalized. */ diff --git a/tests/api-resources/containers/containers.test.ts b/tests/api-resources/containers/containers.test.ts new file mode 100644 index 000000000..11c6f166c --- /dev/null +++ b/tests/api-resources/containers/containers.test.ts @@ -0,0 +1,94 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource containers', () => { + test('create: only required params', async () => { + const responsePromise = client.containers.create({ name: 'name' }); + 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('create: required and optional params', async () => { + const response = await client.containers.create({ + name: 'name', + expires_after: { anchor: 'last_active_at', minutes: 0 }, + file_ids: ['string'], + }); + }); + + test('retrieve', async () => { + const responsePromise = client.containers.retrieve('container_id'); + 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('retrieve: request options instead of 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.containers.retrieve('container_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('list', async () => { + const responsePromise = client.containers.list(); + 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 instead of 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.containers.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); + + 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.containers.list( + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.containers.del('container_id'); + 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('del: request options instead of 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.containers.del('container_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( + OpenAI.NotFoundError, + ); + }); +}); diff --git a/tests/api-resources/containers/files/content.test.ts b/tests/api-resources/containers/files/content.test.ts new file mode 100644 index 000000000..9215c001a --- /dev/null +++ b/tests/api-resources/containers/files/content.test.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource content', () => { + test('retrieve', async () => { + const responsePromise = client.containers.files.content.retrieve('container_id', 'file_id'); + 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('retrieve: request options instead of 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.containers.files.content.retrieve('container_id', 'file_id', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/containers/files/files.test.ts b/tests/api-resources/containers/files/files.test.ts new file mode 100644 index 000000000..79f47e9ad --- /dev/null +++ b/tests/api-resources/containers/files/files.test.ts @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; +import { Response } from 'node-fetch'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource files', () => { + test('create', async () => { + const responsePromise = client.containers.files.create('container_id', {}); + 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('retrieve', async () => { + const responsePromise = client.containers.files.retrieve('container_id', 'file_id'); + 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('retrieve: request options instead of 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.containers.files.retrieve('container_id', 'file_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('list', async () => { + const responsePromise = client.containers.files.list('container_id'); + 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 instead of 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.containers.files.list('container_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + 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.containers.files.list( + 'container_id', + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('del', async () => { + const responsePromise = client.containers.files.del('container_id', 'file_id'); + 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('del: request options instead of 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.containers.files.del('container_id', 'file_id', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); +}); diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 1b2cf7fc4..f8e653c52 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -101,4 +101,22 @@ describe('resource responses', () => { client.responses.del('resp_677efb5139a88190b512bc3fef8e535d', { path: '/_stainless_unknown_path' }), ).rejects.toThrow(OpenAI.NotFoundError); }); + + test('cancel', async () => { + const responsePromise = client.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d'); + 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('cancel: request options instead of 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.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d', { path: '/_stainless_unknown_path' }), + ).rejects.toThrow(OpenAI.NotFoundError); + }); }); From 63839dc3d9af0105cb711345b5e7d105b31a9df3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 18:37:47 +0000 Subject: [PATCH 400/509] release: 4.102.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 514215a1e..a39d68281 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.101.0" + ".": "4.102.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e427d912..b6254488a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.102.0 (2025-05-21) + +Full Changelog: [v4.101.0...v4.102.0](https://github.com/openai/openai-node/compare/v4.101.0...v4.102.0) + +### Features + +* **api:** add container endpoint ([e973476](https://github.com/openai/openai-node/commit/e9734764625275c50ef612ff934804be8cb2adff)) + ## 4.101.0 (2025-05-21) Full Changelog: [v4.100.0...v4.101.0](https://github.com/openai/openai-node/compare/v4.100.0...v4.101.0) diff --git a/jsr.json b/jsr.json index 42bf0a235..a48e4e9ca 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.101.0", + "version": "4.102.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index e8cd7277c..c1886271b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.101.0", + "version": "4.102.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index ff06c96c3..180cea6da 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.101.0'; // x-release-please-version +export const VERSION = '4.102.0'; // x-release-please-version From f83a733b74304e1218f01a46babf25b61cf34765 Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Wed, 21 May 2025 18:12:50 -0700 Subject: [PATCH 401/509] Support streaming background responses --- examples/responses/stream_background.ts | 42 + package-lock.json | 6653 +++++++++++++++++++++++ src/lib/ResponsesParser.ts | 5 +- src/lib/responses/ResponseStream.ts | 67 +- src/resources/responses/responses.ts | 63 +- yarn.lock | 1113 ++-- 6 files changed, 7316 insertions(+), 627 deletions(-) create mode 100755 examples/responses/stream_background.ts create mode 100644 package-lock.json diff --git a/examples/responses/stream_background.ts b/examples/responses/stream_background.ts new file mode 100755 index 000000000..7a7847b1b --- /dev/null +++ b/examples/responses/stream_background.ts @@ -0,0 +1,42 @@ +#!/usr/bin/env -S npm run tsn -T + +import OpenAI from 'openai'; + +const openai = new OpenAI(); + +async function main() { + const runner = openai.responses.stream({ + model: 'gpt-4o-2024-08-06', + input: 'solve 8x + 31 = 2', + background: true, + }); + + var id: string | null = null; + + for await (const event of runner) { + if (event.type == 'response.created') { + id = event.response.id; + } + + console.log('event', event); + if (event.sequence_number == 10) { + break; + } + } + + console.log('Interrupted. Continuing...'); + + const runner2 = openai.responses.stream({ + response_id: id!, + starting_after: 10, + }); + + for await (const event of runner2) { + console.log('event', event); + } + + const result = await runner2.finalResponse(); + console.log(result); +} + +main(); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..f51a43ff8 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6653 @@ +{ + "name": "openai", + "version": "4.102.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "openai", + "version": "4.102.0", + "license": "Apache-2.0", + "dependencies": { + "@types/node": "^18.11.18", + "@types/node-fetch": "^2.6.4", + "abort-controller": "^3.0.0", + "agentkeepalive": "^4.2.1", + "form-data-encoder": "1.7.2", + "formdata-node": "^4.3.2", + "node-fetch": "^2.6.7" + }, + "bin": { + "openai": "bin/cli" + }, + "devDependencies": { + "@swc/core": "^1.3.102", + "@swc/jest": "^0.2.29", + "@types/jest": "^29.4.0", + "@types/ws": "^8.5.13", + "@typescript-eslint/eslint-plugin": "^6.7.0", + "@typescript-eslint/parser": "^6.7.0", + "eslint": "^8.49.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-unused-imports": "^3.0.0", + "fast-check": "^3.22.0", + "iconv-lite": "^0.6.3", + "jest": "^29.4.0", + "prettier": "^3.0.0", + "prettier-2": "npm:prettier@^2", + "ts-jest": "^29.1.0", + "ts-node": "^10.5.0", + "tsc-multi": "^1.1.0", + "tsconfig-paths": "^4.0.0", + "typescript": "^4.8.2", + "ws": "^8.18.0", + "zod": "^3.23.8" + }, + "peerDependencies": { + "ws": "^8.18.0", + "zod": "^3.23.8" + }, + "peerDependenciesMeta": { + "ws": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", + "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz", + "integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.6", + "@babel/parser": "^7.23.6", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.6", + "@babel/types": "^7.23.6", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz", + "integrity": "sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.6", + "@babel/types": "^7.23.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", + "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", + "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", + "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/types": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.11.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", + "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", + "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", + "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/console/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/core/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jest/create-cache-key-function": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz", + "integrity": "sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/environment/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/reporters/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@pkgr/utils": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", + "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "fast-glob": "^3.3.0", + "is-glob": "^4.0.3", + "open": "^9.1.0", + "picocolors": "^1.0.0", + "tslib": "^2.6.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@swc/core": { + "version": "1.4.16", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.16.tgz", + "integrity": "sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/counter": "^0.1.2", + "@swc/types": "^0.1.5" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-darwin-arm64": "1.4.16", + "@swc/core-darwin-x64": "1.4.16", + "@swc/core-linux-arm-gnueabihf": "1.4.16", + "@swc/core-linux-arm64-gnu": "1.4.16", + "@swc/core-linux-arm64-musl": "1.4.16", + "@swc/core-linux-x64-gnu": "1.4.16", + "@swc/core-linux-x64-musl": "1.4.16", + "@swc/core-win32-arm64-msvc": "1.4.16", + "@swc/core-win32-ia32-msvc": "1.4.16", + "@swc/core-win32-x64-msvc": "1.4.16" + }, + "peerDependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.4.16", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz", + "integrity": "sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@swc/jest": { + "version": "0.2.36", + "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz", + "integrity": "sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/create-cache-key-function": "^29.7.0", + "@swc/counter": "^0.1.3", + "jsonc-parser": "^3.2.0" + }, + "engines": { + "npm": ">= 7.0.0" + }, + "peerDependencies": { + "@swc/core": "*" + } + }, + "node_modules/@swc/types": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz", + "integrity": "sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/counter": "^0.1.3" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", + "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.4", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", + "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/graceful-fs/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.11", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", + "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "license": "MIT" + }, + "node_modules/@types/node-fetch": { + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", + "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/node-fetch/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ws": { + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/ws/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", + "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/type-utils": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", + "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", + "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", + "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "6.21.0", + "@typescript-eslint/utils": "6.21.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", + "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", + "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/visitor-keys": "6.21.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "9.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", + "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.21.0", + "@typescript-eslint/types": "6.21.0", + "@typescript-eslint/typescript-estree": "6.21.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", + "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "6.21.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agentkeepalive": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", + "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "depd": "^1.1.2", + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "license": "MIT" + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/big-integer": { + "version": "1.6.52", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", + "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", + "dev": true, + "license": "Unlicense", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/bplist-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", + "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "big-integer": "^1.6.44" + }, + "engines": { + "node": ">= 5.10.0" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/bundle-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", + "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001570", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", + "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "license": "MIT" + }, + "node_modules/dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-browser": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", + "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^3.0.0", + "default-browser-id": "^3.0.0", + "execa": "^7.1.1", + "titleize": "^3.0.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", + "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bplist-parser": "^0.2.0", + "untildify": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/execa": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", + "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.1", + "human-signals": "^4.3.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^3.0.7", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": "^14.18.0 || ^16.14.0 || >=18.0.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/default-browser/node_modules/human-signals": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", + "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=14.18.0" + } + }, + "node_modules/default-browser/node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser/node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.614", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz", + "integrity": "sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.50.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", + "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.2", + "@eslint/js": "8.50.0", + "@humanwhocodes/config-array": "^0.11.11", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-prettier": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", + "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.8.5" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-unused-imports": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz", + "integrity": "sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-rule-composer": "^0.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^6.0.0", + "eslint": "^8.0.0" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + } + } + }, + "node_modules/eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", + "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-check": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.22.0.tgz", + "integrity": "sha512-8HKz3qXqnHYp/VCNn2qfjHdAdcI8zcSqOyX64GOMukp7SL2bfzfeDKjSd+UyECtejccaZv3LcvZTm9YDD22iCQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^6.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data-encoder": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", + "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", + "license": "MIT" + }, + "node_modules/formdata-node": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.3.tgz", + "integrity": "sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA==", + "license": "MIT", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.1" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "13.20.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", + "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-core-module": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-inside-container/node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz", + "integrity": "sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-config/node_modules/@types/node": { + "version": "20.10.5", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-haste-map/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-runtime/node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-util/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-watcher/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/@types/node": { + "version": "20.10.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", + "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", + "dev": true, + "license": "MIT" + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "license": "MIT", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.6.11", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", + "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", + "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^4.0.0", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", + "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-all": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-all/-/p-all-3.0.0.tgz", + "integrity": "sha512-qUZbvbBFVXm6uJ7U/WDiO0fv6waBMbjlCm4E66oZdRR+egswICarIdHyVSZZHudH8T5SF8x/JG0q0duFzPnlBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-map": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-2": { + "name": "prettier", + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-applescript": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", + "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-to-stream": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/string-to-stream/-/string-to-stream-3.0.1.tgz", + "integrity": "sha512-Hl092MV3USJuUCC6mfl9sPzGloA3K5VwdIeJjYIkXY/8K+mUvaeEabWJgArp+xXrsWxCajeT2pc4axbVhIZJyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^3.4.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/superstruct": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/synckit": { + "version": "0.8.6", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.6.tgz", + "integrity": "sha512-laHF2savN6sMeHCjLRkheIU4wo3Zg9Ln5YOjOo7sZ5dVQW8yF5pPE5SIw1dsPhq3TRp1jisKRCdPhfs/1WMqDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/utils": "^2.4.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true, + "license": "MIT" + }, + "node_modules/titleize": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", + "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "license": "MIT" + }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-jest": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", + "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-node": { + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", + "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tsc-multi": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tsc-multi/-/tsc-multi-1.1.0.tgz", + "integrity": "sha512-THE6X+sse7EZ2qMhqXvBhd2HMTvXyWwYnx+2T/ijqdp/6Rf7rUc2uPRzPdrrljZCNcYDeL0qP2P7tqm2IwayTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "fast-glob": "^3.2.12", + "get-stdin": "^8.0.0", + "p-all": "^3.0.0", + "picocolors": "^1.0.0", + "signal-exit": "^3.0.7", + "string-to-stream": "^3.0.1", + "superstruct": "^1.0.3", + "tslib": "^2.5.0", + "yargs": "^17.7.1" + }, + "bin": { + "tsc-multi": "bin/tsc-multi.js" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "typescript": ">=4.3.0" + } + }, + "node_modules/tsc-multi/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/tsconfig-paths": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", + "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", + "dev": true, + "license": "MIT", + "dependencies": { + "json5": "^2.2.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true, + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "license": "MIT" + }, + "node_modules/untildify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", + "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", + "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/ws": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "3.23.8", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/src/lib/ResponsesParser.ts b/src/lib/ResponsesParser.ts index c64c6ffa0..50a078ee9 100644 --- a/src/lib/ResponsesParser.ts +++ b/src/lib/ResponsesParser.ts @@ -1,6 +1,7 @@ import { OpenAIError } from '../error'; import type { ChatCompletionTool } from '../resources/chat/completions'; import { + ResponseTextConfig, type FunctionTool, type ParsedContent, type ParsedResponse, @@ -20,7 +21,9 @@ export type ResponseCreateParamsWithTools = ResponseCreateParamsBase & { tools?: ParseableToolsParams; }; -export type ExtractParsedContentFromParams = +type TextConfigParams = { text?: ResponseTextConfig }; + +export type ExtractParsedContentFromParams = NonNullable['format'] extends AutoParseableTextFormat ? P : null; export function maybeParseResponse< diff --git a/src/lib/responses/ResponseStream.ts b/src/lib/responses/ResponseStream.ts index d2ee80a75..b4c9e13f2 100644 --- a/src/lib/responses/ResponseStream.ts +++ b/src/lib/responses/ResponseStream.ts @@ -1,4 +1,5 @@ import { + ResponseTextConfig, type ParsedResponse, type Response, type ResponseCreateParamsBase, @@ -10,12 +11,29 @@ import { APIUserAbortError, OpenAIError } from '../../error'; import OpenAI from '../../index'; import { type BaseEvents, EventStream } from '../EventStream'; import { type ResponseFunctionCallArgumentsDeltaEvent, type ResponseTextDeltaEvent } from './EventTypes'; -import { maybeParseResponse } from '../ResponsesParser'; +import { maybeParseResponse, ParseableToolsParams } from '../ResponsesParser'; +import { Stream } from 'openai/streaming'; -export type ResponseStreamParams = Omit & { +export type ResponseStreamParams = ResponseCreateAndStreamParams | ResponseStreamByIdParams; + +export type ResponseCreateAndStreamParams = Omit & { stream?: true; }; +export type ResponseStreamByIdParams = { + response_id: string; + starting_after?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: ResponseTextConfig; + tools?: ParseableToolsParams; +}; + type ResponseEvents = BaseEvents & Omit< { @@ -52,7 +70,7 @@ export class ResponseStream ): ResponseStream { const runner = new ResponseStream(params as ResponseCreateParamsStreaming); runner._run(() => - runner._createResponse(client, params, { + runner._createOrRetrieveResponse(client, params, { ...options, headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'stream' }, }), @@ -65,11 +83,17 @@ export class ResponseStream this.#currentResponseSnapshot = undefined; } - #addEvent(this: ResponseStream, event: ResponseStreamEvent) { + #addEvent(this: ResponseStream, event: ResponseStreamEvent, starting_after: number | null) { if (this.ended) return; + const maybeEmit = (name: string, event: ResponseStreamEvent & { snapshot?: string }) => { + if (starting_after == null || event.sequence_number > starting_after) { + this._emit(name as any, event); + } + }; + const response = this.#accumulateResponse(event); - this._emit('event', event); + maybeEmit('event', event); switch (event.type) { case 'response.output_text.delta': { @@ -86,7 +110,7 @@ export class ResponseStream throw new OpenAIError(`expected content to be 'output_text', got ${content.type}`); } - this._emit('response.output_text.delta', { + maybeEmit('response.output_text.delta', { ...event, snapshot: content.text, }); @@ -99,7 +123,7 @@ export class ResponseStream throw new OpenAIError(`missing output at index ${event.output_index}`); } if (output.type === 'function_call') { - this._emit('response.function_call_arguments.delta', { + maybeEmit('response.function_call_arguments.delta', { ...event, snapshot: output.arguments, }); @@ -107,8 +131,7 @@ export class ResponseStream break; } default: - // @ts-ignore - this._emit(event.type, event); + maybeEmit(event.type, event); break; } } @@ -128,9 +151,9 @@ export class ResponseStream return parsedResponse; } - protected async _createResponse( + protected async _createOrRetrieveResponse( client: OpenAI, - params: ResponseStreamingParams, + params: ResponseStreamParams, options?: Core.RequestOptions, ): Promise> { const signal = options?.signal; @@ -140,13 +163,25 @@ export class ResponseStream } this.#beginRequest(); - const stream = await client.responses.create( - { ...params, stream: true }, - { ...options, signal: this.controller.signal }, - ); + var stream: Stream | undefined; + var starting_after: number | null = null; + if ('response_id' in params) { + stream = await client.responses.retrieve( + params.response_id, + { stream: true }, + { ...options, signal: this.controller.signal, stream: true }, + ); + starting_after = params.starting_after ?? null; + } else { + stream = await client.responses.create( + { ...params, stream: true }, + { ...options, signal: this.controller.signal }, + ); + } + this._connected(); for await (const event of stream) { - this.#addEvent(event); + this.#addEvent(event, starting_after); } if (stream.controller.signal?.aborted) { throw new APIUserAbortError(); diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 40dd9a6fb..586a6af0c 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -112,21 +112,44 @@ export class Responses extends APIResource { * ); * ``` */ + retrieve( responseId: string, - query?: ResponseRetrieveParams, + query?: ResponseRetrieveParamsNonStreaming, options?: Core.RequestOptions, ): Core.APIPromise; + retrieve( + responseId: string, + query?: ResponseRetrieveParamsStreaming, + options?: Core.RequestOptions, + ): Core.APIPromise>; retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise; + retrieve( + responseId: string, + query: ResponseRetrieveParams | Core.RequestOptions, + options?: Core.RequestOptions, + ): Core.APIPromise | Core.APIPromise>; retrieve( responseId: string, query: ResponseRetrieveParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { + ): Core.APIPromise | Core.APIPromise> { + if (isRequestOptions(query) && options === undefined) { return this.retrieve(responseId, {}, query); } - return this._client.get(`/responses/${responseId}`, { query, ...options }); + return ( + this._client.get(`/responses/${responseId}`, { + query, + ...options, + stream: query.stream ?? false, + }) as APIPromise | APIPromise> + )._thenUnwrap((rsp) => { + if ('object' in rsp && rsp.object === 'response') { + addOutputText(rsp as Response); + } + + return rsp; + }) as APIPromise | APIPromise>; } /** @@ -4204,6 +4227,11 @@ export interface ResponseWebSearchCallCompletedEvent { */ item_id: string; + /** + * A sequence number for this chunk of the stream response. + */ + sequence_number: number; + /** * The index of the output item that the web search call is associated with. */ @@ -4224,6 +4252,11 @@ export interface ResponseWebSearchCallInProgressEvent { */ item_id: string; + /** + * A sequence number for this chunk of the stream response. + */ + sequence_number: number; + /** * The index of the output item that the web search call is associated with. */ @@ -4244,6 +4277,11 @@ export interface ResponseWebSearchCallSearchingEvent { */ item_id: string; + /** + * A sequence number for this chunk of the stream response. + */ + sequence_number: number; + /** * The index of the output item that the web search call is associated with. */ @@ -4825,14 +4863,29 @@ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase stream: true; } -export interface ResponseRetrieveParams { +export type ResponseRetrieveParams = ResponseRetrieveParamsStreaming | ResponseRetrieveParamsNonStreaming; +export interface ResponseRetrieveParamsBase { /** * Additional fields to include in the response. See the `include` parameter for * Response creation above for more information. */ include?: Array; + + starting_after?: number | null; + stream?: boolean | null; } +export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { + stream: true; +} +export interface ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase { + stream?: false | null; +} + +export namespace ResponseRetrieveParams { + export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; + export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; +} Responses.InputItems = InputItems; export declare namespace Responses { diff --git a/yarn.lock b/yarn.lock index ad5fb7630..2fc0a3520 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4,12 +4,12 @@ "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6" - resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + resolved "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== "@ampproject/remapping@^2.2.0": version "2.2.1" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" + resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz" integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== dependencies: "@jridgewell/gen-mapping" "^0.3.0" @@ -17,7 +17,7 @@ "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz" integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== dependencies: "@babel/highlight" "^7.23.4" @@ -25,12 +25,12 @@ "@babel/compat-data@^7.23.5": version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" + resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@^7.11.6", "@babel/core@^7.12.3": +"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0", "@babel/core@>=7.0.0-beta.0 <8": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.6.tgz#8be77cd77c55baadcc1eae1c33df90ab6d2151d4" + resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz" integrity sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw== dependencies: "@ampproject/remapping" "^2.2.0" @@ -51,7 +51,7 @@ "@babel/generator@^7.23.6", "@babel/generator@^7.7.2": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" + resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz" integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== dependencies: "@babel/types" "^7.23.6" @@ -61,7 +61,7 @@ "@babel/helper-compilation-targets@^7.23.6": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" + resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz" integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== dependencies: "@babel/compat-data" "^7.23.5" @@ -72,12 +72,12 @@ "@babel/helper-environment-visitor@^7.22.20": version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" + resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz" integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== "@babel/helper-function-name@^7.23.0": version "7.23.0" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" + resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz" integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: "@babel/template" "^7.22.15" @@ -85,21 +85,21 @@ "@babel/helper-hoist-variables@^7.22.5": version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" + resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz" integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== dependencies: "@babel/types" "^7.22.5" "@babel/helper-module-imports@^7.22.15": version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" + resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz" integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== dependencies: "@babel/types" "^7.22.15" "@babel/helper-module-transforms@^7.23.3": version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" + resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz" integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== dependencies: "@babel/helper-environment-visitor" "^7.22.20" @@ -110,41 +110,41 @@ "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0": version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" + resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz" integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== "@babel/helper-simple-access@^7.22.5": version "7.22.5" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" + resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz" integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== dependencies: "@babel/types" "^7.22.5" "@babel/helper-split-export-declaration@^7.22.6": version "7.22.6" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz" integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== dependencies: "@babel/types" "^7.22.5" "@babel/helper-string-parser@^7.23.4": version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" + resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz" integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== "@babel/helper-validator-identifier@^7.22.20": version "7.22.20" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz" integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== "@babel/helper-validator-option@^7.23.5": version "7.23.5" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" + resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz" integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== "@babel/helpers@^7.23.6": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.6.tgz#d03af2ee5fb34691eec0cda90f5ecbb4d4da145a" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz" integrity sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA== dependencies: "@babel/template" "^7.22.15" @@ -153,7 +153,7 @@ "@babel/highlight@^7.23.4": version "7.23.4" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz" integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== dependencies: "@babel/helper-validator-identifier" "^7.22.20" @@ -162,110 +162,110 @@ "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.23.6": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" + resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz" integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-bigint@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz" integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-class-properties@^7.8.3": version "7.12.13" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: "@babel/helper-plugin-utils" "^7.12.13" "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz" integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz" integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-numeric-separator@^7.8.3": version "7.10.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-chaining@^7.8.3": version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-top-level-await@^7.8.3": version "7.14.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== dependencies: "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": version "7.23.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz#24f460c85dbbc983cd2b9c4994178bcc01df958f" + resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz" integrity sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/template@^7.22.15", "@babel/template@^7.3.3": version "7.22.15" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" + resolved "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz" integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: "@babel/code-frame" "^7.22.13" @@ -274,7 +274,7 @@ "@babel/traverse@^7.23.6": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.6.tgz#b53526a2367a0dd6edc423637f3d2d0f2521abc5" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz" integrity sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ== dependencies: "@babel/code-frame" "^7.23.5" @@ -290,7 +290,7 @@ "@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.3.3": version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.6.tgz#be33fdb151e1f5a56877d704492c240fc71c7ccd" + resolved "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz" integrity sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg== dependencies: "@babel/helper-string-parser" "^7.23.4" @@ -299,41 +299,36 @@ "@bcoe/v8-coverage@^0.2.3": version "0.2.3" - resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" + resolved "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz" integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== "@cspotcode/source-map-support@0.7.0": version "0.7.0" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" + resolved "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz" integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== dependencies: "@cspotcode/source-map-consumer" "0.8.0" "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.5.1": +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": version "4.11.1" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" + resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz" integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== -"@eslint-community/regexpp@^4.6.1": - version "4.6.2" - resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" - integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== - "@eslint/eslintrc@^2.1.2": version "2.1.2" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" + resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz" integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== dependencies: ajv "^6.12.4" @@ -348,12 +343,12 @@ "@eslint/js@8.50.0": version "8.50.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" + resolved "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz" integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== "@humanwhocodes/config-array@^0.11.11": version "0.11.11" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" + resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz" integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== dependencies: "@humanwhocodes/object-schema" "^1.2.1" @@ -362,17 +357,17 @@ "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^1.2.1": version "1.2.1" - resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" + resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== dependencies: camelcase "^5.3.1" @@ -383,12 +378,12 @@ "@istanbuljs/schema@^0.1.2": version "0.1.3" - resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" + resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== "@jest/console@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" + resolved "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz" integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: "@jest/types" "^29.6.3" @@ -400,7 +395,7 @@ "@jest/core@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + resolved "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz" integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: "@jest/console" "^29.7.0" @@ -434,14 +429,14 @@ "@jest/create-cache-key-function@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0" + resolved "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz" integrity sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA== dependencies: "@jest/types" "^29.6.3" "@jest/environment@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" + resolved "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz" integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: "@jest/fake-timers" "^29.7.0" @@ -451,14 +446,14 @@ "@jest/expect-utils@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" + resolved "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz" integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== dependencies: jest-get-type "^29.6.3" "@jest/expect@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" + resolved "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz" integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== dependencies: expect "^29.7.0" @@ -466,7 +461,7 @@ "@jest/fake-timers@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" + resolved "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz" integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== dependencies: "@jest/types" "^29.6.3" @@ -478,7 +473,7 @@ "@jest/globals@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" + resolved "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz" integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: "@jest/environment" "^29.7.0" @@ -488,7 +483,7 @@ "@jest/reporters@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" + resolved "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz" integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" @@ -518,14 +513,14 @@ "@jest/schemas@^29.6.3": version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" + resolved "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz" integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== dependencies: "@sinclair/typebox" "^0.27.8" "@jest/source-map@^29.6.3": version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" + resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz" integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== dependencies: "@jridgewell/trace-mapping" "^0.3.18" @@ -534,7 +529,7 @@ "@jest/test-result@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" + resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz" integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: "@jest/console" "^29.7.0" @@ -544,7 +539,7 @@ "@jest/test-sequencer@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" + resolved "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz" integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: "@jest/test-result" "^29.7.0" @@ -554,7 +549,7 @@ "@jest/transform@^29.7.0": version "29.7.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" + resolved "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz" integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: "@babel/core" "^7.11.6" @@ -573,9 +568,9 @@ slash "^3.0.0" write-file-atomic "^4.0.2" -"@jest/types@^29.6.3": +"@jest/types@^29.0.0", "@jest/types@^29.6.3": version "29.6.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" + resolved "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz" integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: "@jest/schemas" "^29.6.3" @@ -587,7 +582,7 @@ "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.3" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" + resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz" integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== dependencies: "@jridgewell/set-array" "^1.0.1" @@ -596,22 +591,22 @@ "@jridgewell/resolve-uri@^3.1.0": version "3.1.1" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== "@jridgewell/set-array@^1.0.1": version "1.1.2" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.9": version "0.3.20" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz" integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== dependencies: "@jridgewell/resolve-uri" "^3.1.0" @@ -619,20 +614,20 @@ "@nodelib/fs.scandir@2.1.5": version "2.1.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": +"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": version "2.0.5" - resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== "@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" - resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: "@nodelib/fs.scandir" "2.1.5" @@ -640,7 +635,7 @@ "@pkgr/utils@^2.4.2": version "2.4.2" - resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" + resolved "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz" integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw== dependencies: cross-spawn "^7.0.3" @@ -652,76 +647,31 @@ "@sinclair/typebox@^0.27.8": version "0.27.8" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" + resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== "@sinonjs/commons@^3.0.0": version "3.0.0" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" + resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz" integrity sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA== dependencies: type-detect "4.0.8" "@sinonjs/fake-timers@^10.0.2": version "10.3.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" + resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz" integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: "@sinonjs/commons" "^3.0.0" -"@swc/core-darwin-arm64@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.16.tgz#2cd45d709ce76d448d96bf8d0006849541436611" - integrity sha512-UOCcH1GvjRnnM/LWT6VCGpIk0OhHRq6v1U6QXuPt5wVsgXnXQwnf5k3sG5Cm56hQHDvhRPY6HCsHi/p0oek8oQ== - "@swc/core-darwin-x64@1.4.16": version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz#a5bc7d8b1dd850adb0bb95c6b5c742b92201fd01" + resolved "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz" integrity sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA== -"@swc/core-linux-arm-gnueabihf@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.16.tgz#961744908ee5cbb79bc009dcf58cc8b831111f38" - integrity sha512-DvHuwvEF86YvSd0lwnzVcjOTZ0jcxewIbsN0vc/0fqm9qBdMMjr9ox6VCam1n3yYeRtj4VFgrjeNFksqbUejdQ== - -"@swc/core-linux-arm64-gnu@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.16.tgz#43713be3f26757d82d2745dc25f8b63400e0a3d0" - integrity sha512-9Uu5YlPbyCvbidjKtYEsPpyZlu16roOZ5c2tP1vHfnU9bgf5Tz5q5VovSduNxPHx+ed2iC1b1URODHvDzbbDuQ== - -"@swc/core-linux-arm64-musl@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.16.tgz#394a7d030f3a61902bd3947bb9d70d26d42f3c81" - integrity sha512-/YZq/qB1CHpeoL0eMzyqK5/tYZn/rzKoCYDviFU4uduSUIJsDJQuQA/skdqUzqbheOXKAd4mnJ1hT04RbJ8FPQ== - -"@swc/core-linux-x64-gnu@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.16.tgz#71eb108b784f9d551ee8a35ebcdaed972f567981" - integrity sha512-UUjaW5VTngZYDcA8yQlrFmqs1tLi1TxbKlnaJwoNhel9zRQ0yG1YEVGrzTvv4YApSuIiDK18t+Ip927bwucuVQ== - -"@swc/core-linux-x64-musl@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.16.tgz#10dbaedb4e3dfc7268e3a9a66ad3431471ef035b" - integrity sha512-aFhxPifevDTwEDKPi4eRYWzC0p/WYJeiFkkpNU5Uc7a7M5iMWPAbPFUbHesdlb9Jfqs5c07oyz86u+/HySBNPQ== - -"@swc/core-win32-arm64-msvc@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.16.tgz#80247adff6c245ff32b44d773c1a148858cd655f" - integrity sha512-bTD43MbhIHL2s5QgCwyleaGwl96Gk/scF2TaVKdUe4QlJCDV/YK9h5oIBAp63ckHtE8GHlH4c8dZNBiAXn4Org== - -"@swc/core-win32-ia32-msvc@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.16.tgz#e540afc3ccf3224267b4ddfb408f9d9737984686" - integrity sha512-/lmZeAN/qV5XbK2SEvi8e2RkIg8FQNYiSA8y2/Zb4gTUMKVO5JMLH0BSWMiIKMstKDPDSxMWgwJaQHF8UMyPmQ== - -"@swc/core-win32-x64-msvc@1.4.16": - version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.16.tgz#f880939fca32c181adfe7e3abd2b6b7857bd3489" - integrity sha512-BPAfFfODWXtUu6SwaTTftDHvcbDyWBSI/oanUeRbQR5vVWkXoQ3cxLTsDluc3H74IqXS5z1Uyoe0vNo2hB1opA== - -"@swc/core@^1.3.102": +"@swc/core@*", "@swc/core@^1.3.102", "@swc/core@>=1.2.50": version "1.4.16" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.4.16.tgz#d175bae2acfecd53bcbd4293f1fba5ec316634a0" + resolved "https://registry.npmjs.org/@swc/core/-/core-1.4.16.tgz" integrity sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA== dependencies: "@swc/counter" "^0.1.2" @@ -740,12 +690,12 @@ "@swc/counter@^0.1.2", "@swc/counter@^0.1.3": version "0.1.3" - resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" + resolved "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz" integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== "@swc/jest@^0.2.29": version "0.2.36" - resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.36.tgz#2797450a30d28b471997a17e901ccad946fe693e" + resolved "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz" integrity sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw== dependencies: "@jest/create-cache-key-function" "^29.7.0" @@ -754,34 +704,34 @@ "@swc/types@^0.1.5": version "0.1.6" - resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.6.tgz#2f13f748995b247d146de2784d3eb7195410faba" + resolved "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz" integrity sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg== dependencies: "@swc/counter" "^0.1.3" "@tsconfig/node10@^1.0.7": version "1.0.8" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" + resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz" integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== "@tsconfig/node12@^1.0.7": version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" + resolved "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz" integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== "@tsconfig/node14@^1.0.0": version "1.0.1" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" + resolved "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz" integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== "@tsconfig/node16@^1.0.2": version "1.0.2" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" + resolved "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz" integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== "@types/babel__core@^7.1.14": version "7.20.5" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" + resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== dependencies: "@babel/parser" "^7.20.7" @@ -792,14 +742,14 @@ "@types/babel__generator@*": version "7.6.8" - resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" + resolved "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz" integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": version "7.4.4" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" + resolved "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz" integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== dependencies: "@babel/parser" "^7.1.0" @@ -807,40 +757,40 @@ "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": version "7.20.4" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.4.tgz#ec2c06fed6549df8bc0eb4615b683749a4a92e1b" + resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz" integrity sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA== dependencies: "@babel/types" "^7.20.7" "@types/graceful-fs@^4.1.3": version "4.1.9" - resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" + resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz" integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== dependencies: "@types/node" "*" "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" + resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== "@types/istanbul-lib-report@*": version "3.0.3" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" + resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz" integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": version "3.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" + resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz" integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: "@types/istanbul-lib-report" "*" "@types/jest@^29.4.0": version "29.5.11" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.11.tgz#0c13aa0da7d0929f078ab080ae5d4ced80fa2f2c" + resolved "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz" integrity sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ== dependencies: expect "^29.0.0" @@ -848,61 +798,54 @@ "@types/json-schema@^7.0.12": version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node-fetch@^2.6.4": version "2.6.4" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660" + resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz" integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg== dependencies: "@types/node" "*" form-data "^3.0.0" -"@types/node@*": - version "20.10.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" - integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== - dependencies: - undici-types "~5.26.4" - -"@types/node@^18.11.18": +"@types/node@*", "@types/node@^18.11.18": version "18.11.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" + resolved "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz" integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== "@types/semver@^7.5.0": version "7.5.8" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz" integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/stack-utils@^2.0.0": version "2.0.3" - resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" + resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== "@types/ws@^8.5.13": version "8.5.13" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.13.tgz#6414c280875e2691d0d1e080b05addbf5cb91e20" + resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz" integrity sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA== dependencies: "@types/node" "*" "@types/yargs-parser@*": version "21.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" + resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== "@types/yargs@^17.0.8": version "17.0.32" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" + resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz" integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^6.7.0": +"@typescript-eslint/eslint-plugin@^6.0.0", "@typescript-eslint/eslint-plugin@^6.7.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" + resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz" integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: "@eslint-community/regexpp" "^4.5.1" @@ -917,9 +860,9 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/parser@^6.7.0": +"@typescript-eslint/parser@^6.0.0 || ^6.0.0-alpha", "@typescript-eslint/parser@^6.7.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" + resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz" integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== dependencies: "@typescript-eslint/scope-manager" "6.21.0" @@ -930,7 +873,7 @@ "@typescript-eslint/scope-manager@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" + resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz" integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: "@typescript-eslint/types" "6.21.0" @@ -938,7 +881,7 @@ "@typescript-eslint/type-utils@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" + resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz" integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: "@typescript-eslint/typescript-estree" "6.21.0" @@ -948,12 +891,12 @@ "@typescript-eslint/types@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" + resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz" integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== "@typescript-eslint/typescript-estree@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" + resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz" integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: "@typescript-eslint/types" "6.21.0" @@ -967,7 +910,7 @@ "@typescript-eslint/utils@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" + resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz" integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" @@ -980,7 +923,7 @@ "@typescript-eslint/visitor-keys@6.21.0": version "6.21.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" + resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz" integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: "@typescript-eslint/types" "6.21.0" @@ -988,34 +931,29 @@ abort-controller@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + resolved "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== dependencies: event-target-shim "^5.0.0" acorn-jsx@^5.3.2: version "5.3.2" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^8.1.1: version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -acorn@^8.4.1: - version "8.7.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" - integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== - -acorn@^8.9.0: +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.4.1, acorn@^8.9.0: version "8.10.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== agentkeepalive@^4.2.1: version "4.2.1" - resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" + resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz" integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA== dependencies: debug "^4.1.0" @@ -1024,7 +962,7 @@ agentkeepalive@^4.2.1: aggregate-error@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" + resolved "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz" integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== dependencies: clean-stack "^2.0.0" @@ -1032,7 +970,7 @@ aggregate-error@^3.0.0: ajv@^6.12.4: version "6.12.6" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" @@ -1042,38 +980,38 @@ ajv@^6.12.4: ansi-escapes@^4.2.1: version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" + resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: type-fest "^0.21.3" ansi-regex@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" ansi-styles@^5.0.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== anymatch@^3.0.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" @@ -1081,34 +1019,34 @@ anymatch@^3.0.3: arg@^4.1.0: version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + resolved "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== argparse@^1.0.7: version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" argparse@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== array-union@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== asynckit@^0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -babel-jest@^29.7.0: +babel-jest@^29.0.0, babel-jest@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" + resolved "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz" integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== dependencies: "@jest/transform" "^29.7.0" @@ -1121,7 +1059,7 @@ babel-jest@^29.7.0: babel-plugin-istanbul@^6.1.1: version "6.1.1" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" + resolved "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -1132,7 +1070,7 @@ babel-plugin-istanbul@^6.1.1: babel-plugin-jest-hoist@^29.6.3: version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" + resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz" integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== dependencies: "@babel/template" "^7.3.3" @@ -1142,7 +1080,7 @@ babel-plugin-jest-hoist@^29.6.3: babel-preset-current-node-syntax@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" + resolved "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz" integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" @@ -1160,7 +1098,7 @@ babel-preset-current-node-syntax@^1.0.0: babel-preset-jest@^29.6.3: version "29.6.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" + resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz" integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== dependencies: babel-plugin-jest-hoist "^29.6.3" @@ -1168,24 +1106,24 @@ babel-preset-jest@^29.6.3: balanced-match@^1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== big-integer@^1.6.44: version "1.6.52" - resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" + resolved "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== bplist-parser@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" + resolved "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz" integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== dependencies: big-integer "^1.6.44" brace-expansion@^1.1.7: version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" @@ -1193,21 +1131,21 @@ brace-expansion@^1.1.7: brace-expansion@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz" integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== dependencies: balanced-match "^1.0.0" braces@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: fill-range "^7.1.1" -browserslist@^4.22.2: +browserslist@^4.22.2, "browserslist@>= 4.21.0": version "4.22.2" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b" + resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz" integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A== dependencies: caniuse-lite "^1.0.30001565" @@ -1217,53 +1155,53 @@ browserslist@^4.22.2: bs-logger@0.x: version "0.2.6" - resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" + resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz" integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== dependencies: fast-json-stable-stringify "2.x" bser@2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" + resolved "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz" integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: node-int64 "^0.4.0" buffer-from@^1.0.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" + resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== bundle-name@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" + resolved "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz" integrity sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw== dependencies: run-applescript "^5.0.0" callsites@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase@^5.3.1: version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== camelcase@^6.2.0: version "6.3.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001565: version "1.0.30001570" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz#b4e5c1fa786f733ab78fc70f592df6b3f23244ca" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz" integrity sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw== chalk@^2.4.2: version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" @@ -1272,7 +1210,7 @@ chalk@^2.4.2: chalk@^4.0.0: version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" @@ -1280,27 +1218,27 @@ chalk@^4.0.0: char-regex@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" + resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== ci-info@^3.2.0: version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" + resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: version "1.2.3" - resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" + resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz" integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== clean-stack@^2.0.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" + resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== cliui@^8.0.1: version "8.0.1" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + resolved "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz" integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: string-width "^4.2.0" @@ -1309,58 +1247,58 @@ cliui@^8.0.1: co@^4.6.0: version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== collect-v8-coverage@^1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" + resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz" integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== color-convert@^1.9.0: version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + combined-stream@^1.0.8: version "1.0.8" - resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" concat-map@0.0.1: version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== convert-source-map@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== create-jest@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + resolved "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz" integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== dependencies: "@jest/types" "^29.6.3" @@ -1373,12 +1311,12 @@ create-jest@^29.7.0: create-require@^1.1.0: version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.6" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" @@ -1387,36 +1325,36 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: version "4.3.4" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" debug@^4.3.4: version "4.3.7" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + resolved "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz" integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: ms "^2.1.3" dedent@^1.0.0: version "1.5.1" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" + resolved "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz" integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== deep-is@^0.1.3: version "0.1.4" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.3.1" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" + resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== default-browser-id@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" + resolved "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz" integrity sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA== dependencies: bplist-parser "^0.2.0" @@ -1424,7 +1362,7 @@ default-browser-id@^3.0.0: default-browser@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-4.0.0.tgz#53c9894f8810bf86696de117a6ce9085a3cbc7da" + resolved "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz" integrity sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA== dependencies: bundle-name "^3.0.0" @@ -1434,93 +1372,93 @@ default-browser@^4.0.0: define-lazy-prop@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" + resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz" integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== delayed-stream@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= depd@^1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" + resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= detect-newline@^3.0.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== diff-sequences@^29.6.3: version "29.6.3" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" + resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== diff@^4.0.1: version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== dir-glob@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== dependencies: path-type "^4.0.0" doctrine@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" electron-to-chromium@^1.4.601: version "1.4.614" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz#2fe789d61fa09cb875569f37c309d0c2701f91c0" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz" integrity sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ== emittery@^0.13.1: version "0.13.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + resolved "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== error-ex@^1.3.1: version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" escalade@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== escape-string-regexp@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== escape-string-regexp@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== escape-string-regexp@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== eslint-plugin-prettier@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz#a3b399f04378f79f066379f544e42d6b73f11515" + resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz" integrity sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg== dependencies: prettier-linter-helpers "^1.0.0" @@ -1528,19 +1466,19 @@ eslint-plugin-prettier@^5.0.1: eslint-plugin-unused-imports@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz#d25175b0072ff16a91892c3aa72a09ca3a9e69e7" + resolved "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz" integrity sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw== dependencies: eslint-rule-composer "^0.3.0" eslint-rule-composer@^0.3.0: version "0.3.0" - resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" + resolved "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz" integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== eslint-scope@^7.2.2: version "7.2.2" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz" integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" @@ -1548,12 +1486,12 @@ eslint-scope@^7.2.2: eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@^8.49.0: +"eslint@^6.0.0 || ^7.0.0 || >=8.0.0", "eslint@^7.0.0 || ^8.0.0", eslint@^8.0.0, eslint@^8.49.0, eslint@>=8.0.0: version "8.50.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" + resolved "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz" integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" @@ -1596,7 +1534,7 @@ eslint@^8.49.0: espree@^9.6.0, espree@^9.6.1: version "9.6.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + resolved "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz" integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: acorn "^8.9.0" @@ -1605,41 +1543,41 @@ espree@^9.6.0, espree@^9.6.1: esprima@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.2: version "1.5.0" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + resolved "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" esrecurse@^4.3.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: estraverse "^5.2.0" estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== esutils@^2.0.2: version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== event-target-shim@^5.0.0: version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== execa@^5.0.0: version "5.1.1" - resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== dependencies: cross-spawn "^7.0.3" @@ -1654,7 +1592,7 @@ execa@^5.0.0: execa@^7.1.1: version "7.2.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" + resolved "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz" integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== dependencies: cross-spawn "^7.0.3" @@ -1669,12 +1607,12 @@ execa@^7.1.1: exit@^0.1.2: version "0.1.2" - resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" + resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== expect@^29.0.0, expect@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" + resolved "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== dependencies: "@jest/expect-utils" "^29.7.0" @@ -1685,35 +1623,24 @@ expect@^29.0.0, expect@^29.7.0: fast-check@^3.22.0: version "3.22.0" - resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-3.22.0.tgz#1a8153e9d6fbdcc60b818f447cbb9cac1fdd8fb6" + resolved "https://registry.npmjs.org/fast-check/-/fast-check-3.22.0.tgz" integrity sha512-8HKz3qXqnHYp/VCNn2qfjHdAdcI8zcSqOyX64GOMukp7SL2bfzfeDKjSd+UyECtejccaZv3LcvZTm9YDD22iCQ== dependencies: pure-rand "^6.1.0" fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" - resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-diff@^1.1.2: version "1.3.0" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.12: - version "3.2.12" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" - integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== - dependencies: - "@nodelib/fs.stat" "^2.0.2" - "@nodelib/fs.walk" "^1.2.3" - glob-parent "^5.1.2" - merge2 "^1.3.0" - micromatch "^4.0.4" - -fast-glob@^3.2.9, fast-glob@^3.3.0: +fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.2" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== dependencies: "@nodelib/fs.stat" "^2.0.2" @@ -1722,47 +1649,47 @@ fast-glob@^3.2.9, fast-glob@^3.3.0: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: +fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0, fast-json-stable-stringify@2.x: version "2.1.0" - resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6: version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: version "1.17.1" - resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + resolved "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz" integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" fb-watchman@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" + resolved "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz" integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== dependencies: bser "2.1.1" file-entry-cache@^6.0.1: version "6.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" fill-range@^7.1.1: version "7.1.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== dependencies: locate-path "^5.0.0" @@ -1770,7 +1697,7 @@ find-up@^4.0.0, find-up@^4.1.0: find-up@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: locate-path "^6.0.0" @@ -1778,7 +1705,7 @@ find-up@^5.0.0: flat-cache@^3.0.4: version "3.0.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: flatted "^3.1.0" @@ -1786,17 +1713,17 @@ flat-cache@^3.0.4: flatted@^3.1.0: version "3.2.7" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== form-data-encoder@1.7.2: version "1.7.2" - resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" + resolved "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz" integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== form-data@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" + resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz" integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== dependencies: asynckit "^0.4.0" @@ -1805,7 +1732,7 @@ form-data@^3.0.0: formdata-node@^4.3.2: version "4.3.3" - resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.3.3.tgz#21415225be66e2c87a917bfc0fedab30a119c23c" + resolved "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.3.tgz" integrity sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA== dependencies: node-domexception "1.0.0" @@ -1813,61 +1740,61 @@ formdata-node@^4.3.2: fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@^2.3.2: version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.2: version "1.1.2" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== gensync@^1.0.0-beta.2: version "1.0.0-beta.2" - resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" + resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-package-type@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" + resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== get-stdin@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" + resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz" integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== glob-parent@^5.1.2: version "5.1.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob-parent@^6.0.2: version "6.0.2" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: is-glob "^4.0.3" glob@^7.1.3, glob@^7.1.4: version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" @@ -1879,19 +1806,19 @@ glob@^7.1.3, glob@^7.1.4: globals@^11.1.0: version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" + resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.19.0: version "13.20.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" + resolved "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz" integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== dependencies: type-fest "^0.20.2" globby@^11.1.0: version "11.1.0" - resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: array-union "^2.1.0" @@ -1903,68 +1830,68 @@ globby@^11.1.0: graceful-fs@^4.2.9: version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== graphemer@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== has-flag@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== hasown@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz" integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== dependencies: function-bind "^1.1.2" html-escaper@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" + resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== human-signals@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== human-signals@^4.3.0: version "4.3.1" - resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" + resolved "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== humanize-ms@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" + resolved "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz" integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= dependencies: ms "^2.0.0" iconv-lite@^0.6.3: version "0.6.3" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz" integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" ignore@^5.2.0, ignore@^5.2.4: version "5.3.2" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" + resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== import-fresh@^3.2.1: version "3.3.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" @@ -1972,7 +1899,7 @@ import-fresh@^3.2.1: import-local@^3.0.2: version "3.1.0" - resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" + resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz" integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== dependencies: pkg-dir "^4.2.0" @@ -1980,118 +1907,118 @@ import-local@^3.0.2: imurmurhash@^0.1.4: version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== indent-string@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" + resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3: +inherits@^2.0.3, inherits@2: version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== is-arrayish@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-core-module@^2.13.0: version "2.13.1" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz" integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== dependencies: hasown "^2.0.0" is-docker@^2.0.0: version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + resolved "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== is-docker@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" + resolved "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz" integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-fullwidth-code-point@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-generator-fn@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" + resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" is-inside-container@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" + resolved "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz" integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== dependencies: is-docker "^3.0.0" is-number@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-path-inside@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== is-stream@^2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== is-stream@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz" integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== is-wsl@^2.2.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== dependencies: is-docker "^2.0.0" isexe@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" + resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== istanbul-lib-instrument@^5.0.4: version "5.2.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz" integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== dependencies: "@babel/core" "^7.12.3" @@ -2102,7 +2029,7 @@ istanbul-lib-instrument@^5.0.4: istanbul-lib-instrument@^6.0.0: version "6.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz#71e87707e8041428732518c6fb5211761753fbdf" + resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz" integrity sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA== dependencies: "@babel/core" "^7.12.3" @@ -2113,7 +2040,7 @@ istanbul-lib-instrument@^6.0.0: istanbul-lib-report@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" + resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz" integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== dependencies: istanbul-lib-coverage "^3.0.0" @@ -2122,7 +2049,7 @@ istanbul-lib-report@^3.0.0: istanbul-lib-source-maps@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" + resolved "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz" integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== dependencies: debug "^4.1.1" @@ -2131,7 +2058,7 @@ istanbul-lib-source-maps@^4.0.0: istanbul-reports@^3.1.3: version "3.1.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" + resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz" integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== dependencies: html-escaper "^2.0.0" @@ -2139,7 +2066,7 @@ istanbul-reports@^3.1.3: jest-changed-files@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz" integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: execa "^5.0.0" @@ -2148,7 +2075,7 @@ jest-changed-files@^29.7.0: jest-circus@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" + resolved "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz" integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== dependencies: "@jest/environment" "^29.7.0" @@ -2174,7 +2101,7 @@ jest-circus@^29.7.0: jest-cli@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + resolved "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz" integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: "@jest/core" "^29.7.0" @@ -2191,7 +2118,7 @@ jest-cli@^29.7.0: jest-config@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" + resolved "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz" integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== dependencies: "@babel/core" "^7.11.6" @@ -2219,7 +2146,7 @@ jest-config@^29.7.0: jest-diff@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" + resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz" integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== dependencies: chalk "^4.0.0" @@ -2229,14 +2156,14 @@ jest-diff@^29.7.0: jest-docblock@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" + resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz" integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== dependencies: detect-newline "^3.0.0" jest-each@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" + resolved "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz" integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== dependencies: "@jest/types" "^29.6.3" @@ -2247,7 +2174,7 @@ jest-each@^29.7.0: jest-environment-node@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" + resolved "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz" integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== dependencies: "@jest/environment" "^29.7.0" @@ -2259,12 +2186,12 @@ jest-environment-node@^29.7.0: jest-get-type@^29.6.3: version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" + resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz" integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== jest-haste-map@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" + resolved "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz" integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== dependencies: "@jest/types" "^29.6.3" @@ -2283,7 +2210,7 @@ jest-haste-map@^29.7.0: jest-leak-detector@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" + resolved "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz" integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== dependencies: jest-get-type "^29.6.3" @@ -2291,7 +2218,7 @@ jest-leak-detector@^29.7.0: jest-matcher-utils@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" + resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz" integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== dependencies: chalk "^4.0.0" @@ -2301,7 +2228,7 @@ jest-matcher-utils@^29.7.0: jest-message-util@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" + resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz" integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== dependencies: "@babel/code-frame" "^7.12.13" @@ -2316,7 +2243,7 @@ jest-message-util@^29.7.0: jest-mock@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" + resolved "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz" integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== dependencies: "@jest/types" "^29.6.3" @@ -2325,25 +2252,25 @@ jest-mock@^29.7.0: jest-pnp-resolver@^1.2.2: version "1.2.3" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" + resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== jest-regex-util@^29.6.3: version "29.6.3" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" + resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz" integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== jest-resolve-dependencies@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + resolved "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz" integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: jest-regex-util "^29.6.3" jest-snapshot "^29.7.0" -jest-resolve@^29.7.0: +jest-resolve@*, jest-resolve@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" + resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz" integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== dependencies: chalk "^4.0.0" @@ -2358,7 +2285,7 @@ jest-resolve@^29.7.0: jest-runner@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" + resolved "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz" integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== dependencies: "@jest/console" "^29.7.0" @@ -2385,7 +2312,7 @@ jest-runner@^29.7.0: jest-runtime@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" + resolved "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz" integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== dependencies: "@jest/environment" "^29.7.0" @@ -2413,7 +2340,7 @@ jest-runtime@^29.7.0: jest-snapshot@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" + resolved "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz" integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== dependencies: "@babel/core" "^7.11.6" @@ -2439,7 +2366,7 @@ jest-snapshot@^29.7.0: jest-util@^29.0.0, jest-util@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" + resolved "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz" integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== dependencies: "@jest/types" "^29.6.3" @@ -2451,7 +2378,7 @@ jest-util@^29.0.0, jest-util@^29.7.0: jest-validate@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" + resolved "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz" integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: "@jest/types" "^29.6.3" @@ -2463,7 +2390,7 @@ jest-validate@^29.7.0: jest-watcher@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" + resolved "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz" integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== dependencies: "@jest/test-result" "^29.7.0" @@ -2477,7 +2404,7 @@ jest-watcher@^29.7.0: jest-worker@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" + resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz" integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== dependencies: "@types/node" "*" @@ -2485,9 +2412,9 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.4.0: +jest@^29.0.0, jest@^29.4.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + resolved "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: "@jest/core" "^29.7.0" @@ -2497,12 +2424,12 @@ jest@^29.4.0: js-tokens@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: version "3.14.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" @@ -2510,54 +2437,54 @@ js-yaml@^3.13.1: js-yaml@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" jsesc@^2.5.1: version "2.5.2" - resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" + resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== json-parse-even-better-errors@^2.3.0: version "2.3.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + resolved "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== json5@^2.2.2, json5@^2.2.3: version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonc-parser@^3.2.0: version "3.2.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" + resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz" integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== kleur@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" + resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== leven@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" + resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.4.1: version "0.4.1" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" @@ -2565,79 +2492,72 @@ levn@^0.4.1: lines-and-columns@^1.1.6: version "1.2.4" - resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== locate-path@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz" integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== dependencies: p-locate "^4.1.0" locate-path@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: p-locate "^5.0.0" lodash.memoize@4.x: version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== lodash.merge@^4.6.2: version "4.6.2" - resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== lru-cache@^5.1.1: version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== dependencies: yallist "^3.0.2" -lru-cache@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" - integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== - dependencies: - yallist "^4.0.0" - make-dir@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" + resolved "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz" integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== dependencies: semver "^7.5.3" -make-error@1.x, make-error@^1.1.1: +make-error@^1.1.1, make-error@1.x: version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== makeerror@1.0.12: version "1.0.12" - resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" + resolved "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz" integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== dependencies: tmpl "1.0.5" merge-stream@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" - resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== micromatch@^4.0.4: version "4.0.8" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: braces "^3.0.3" @@ -2645,125 +2565,125 @@ micromatch@^4.0.4: mime-db@1.51.0: version "1.51.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" + resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz" integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== mime-types@^2.1.12: version "2.1.34" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" + resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz" integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== dependencies: mime-db "1.51.0" mimic-fn@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== mimic-fn@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== -minimatch@9.0.3: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== - dependencies: - brace-expansion "^2.0.1" - minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimist@^1.2.6: version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - ms@^2.0.0, ms@^2.1.3: version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== +ms@2.1.2: + version "2.1.2" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + natural-compare@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== node-domexception@1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== node-fetch@^2.6.7: version "2.6.11" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz" integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== dependencies: whatwg-url "^5.0.0" node-int64@^0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" + resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.14: version "2.0.14" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" + resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== normalize-path@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== npm-run-path@^4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== dependencies: path-key "^3.0.0" npm-run-path@^5.1.0: version "5.1.0" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz" integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== dependencies: path-key "^4.0.0" once@^1.3.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" onetime@^5.1.2: version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== dependencies: mimic-fn "^2.1.0" onetime@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + resolved "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz" integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== dependencies: mimic-fn "^4.0.0" open@^9.1.0: version "9.1.0" - resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6" + resolved "https://registry.npmjs.org/open/-/open-9.1.0.tgz" integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg== dependencies: default-browser "^4.0.0" @@ -2773,7 +2693,7 @@ open@^9.1.0: optionator@^0.9.3: version "0.9.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz" integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: "@aashutoshrathi/word-wrap" "^1.2.3" @@ -2785,61 +2705,61 @@ optionator@^0.9.3: p-all@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/p-all/-/p-all-3.0.0.tgz#077c023c37e75e760193badab2bad3ccd5782bfb" + resolved "https://registry.npmjs.org/p-all/-/p-all-3.0.0.tgz" integrity sha512-qUZbvbBFVXm6uJ7U/WDiO0fv6waBMbjlCm4E66oZdRR+egswICarIdHyVSZZHudH8T5SF8x/JG0q0duFzPnlBw== dependencies: p-map "^4.0.0" p-limit@^2.2.0: version "2.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: yocto-queue "^0.1.0" p-locate@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz" integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== dependencies: p-limit "^2.2.0" p-locate@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== dependencies: p-limit "^3.0.2" p-map@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" + resolved "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz" integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== dependencies: aggregate-error "^3.0.0" p-try@^2.0.0: version "2.2.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" + resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== parent-module@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parse-json@^5.2.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + resolved "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz" integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== dependencies: "@babel/code-frame" "^7.0.0" @@ -2849,81 +2769,81 @@ parse-json@^5.2.0: path-exists@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-key@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + resolved "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz" integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== path-parse@^1.0.7: version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-type@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== picocolors@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pirates@^4.0.4: version "4.0.6" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz" integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== pkg-dir@^4.2.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: find-up "^4.0.0" prelude-ls@^1.2.1: version "1.2.1" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== "prettier-2@npm:prettier@^2": version "2.8.8" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== prettier-linter-helpers@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz" integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== dependencies: fast-diff "^1.1.2" -prettier@^3.0.0: +prettier@^3.0.0, prettier@>=3.0.0: version "3.1.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848" + resolved "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz" integrity sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" + resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: "@jest/schemas" "^29.6.3" @@ -2932,7 +2852,7 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: prompts@^2.0.1: version "2.4.2" - resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" + resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== dependencies: kleur "^3.0.3" @@ -2940,32 +2860,27 @@ prompts@^2.0.1: punycode@^2.1.0: version "2.3.0" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== -pure-rand@^6.0.0: - version "6.0.4" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7" - integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA== - -pure-rand@^6.1.0: +pure-rand@^6.0.0, pure-rand@^6.1.0: version "6.1.0" - resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" + resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== queue-microtask@^1.2.2: version "1.2.3" - resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== react-is@^18.0.0: version "18.2.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== readable-stream@^3.4.0: version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" @@ -2974,34 +2889,34 @@ readable-stream@^3.4.0: require-directory@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== resolve-cwd@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== dependencies: resolve-from "^5.0.0" resolve-from@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-from@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== resolve.exports@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.20.0: version "1.22.8" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: is-core-module "^2.13.0" @@ -3010,87 +2925,85 @@ resolve@^1.20.0: reusify@^1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== rimraf@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" run-applescript@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-5.0.0.tgz#e11e1c932e055d5c6b40d98374e0268d9b11899c" + resolved "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz" integrity sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg== dependencies: execa "^5.0.0" run-parallel@^1.1.9: version "1.2.0" - resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" safe-buffer@~5.2.0: version "5.2.1" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver@^6.3.0, semver@^6.3.1: +semver@^6.3.0: version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.3: - version "7.5.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" - integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== - dependencies: - lru-cache "^6.0.0" +semver@^6.3.1: + version "6.3.1" + resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.4: +semver@^7.5.3, semver@^7.5.4: version "7.6.3" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" + resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== shebang-command@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== sisteransi@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" + resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== slash@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== source-map-support@0.5.13: version "0.5.13" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz" integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" @@ -3098,24 +3011,31 @@ source-map-support@0.5.13: source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== sprintf-js@~1.0.2: version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== stack-utils@^2.0.3: version "2.0.6" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" + resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: escape-string-regexp "^2.0.0" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + string-length@^4.0.1: version "4.0.2" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" + resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== dependencies: char-regex "^1.0.2" @@ -3123,93 +3043,86 @@ string-length@^4.0.1: string-to-stream@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/string-to-stream/-/string-to-stream-3.0.1.tgz#480e6fb4d5476d31cb2221f75307a5dcb6638a42" + resolved "https://registry.npmjs.org/string-to-stream/-/string-to-stream-3.0.1.tgz" integrity sha512-Hl092MV3USJuUCC6mfl9sPzGloA3K5VwdIeJjYIkXY/8K+mUvaeEabWJgArp+xXrsWxCajeT2pc4axbVhIZJyg== dependencies: readable-stream "^3.4.0" string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" strip-bom@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== strip-bom@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== strip-final-newline@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== strip-final-newline@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz" integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== strip-json-comments@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== superstruct@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" + resolved "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz" integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== supports-color@^5.3.0: version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" supports-color@^7.1.0: version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" supports-color@^8.0.0: version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== synckit@^0.8.5: version "0.8.6" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.6.tgz#b69b7fbce3917c2673cbdc0d87fb324db4a5b409" + resolved "https://registry.npmjs.org/synckit/-/synckit-0.8.6.tgz" integrity sha512-laHF2savN6sMeHCjLRkheIU4wo3Zg9Ln5YOjOo7sZ5dVQW8yF5pPE5SIw1dsPhq3TRp1jisKRCdPhfs/1WMqDA== dependencies: "@pkgr/utils" "^2.4.2" @@ -3217,7 +3130,7 @@ synckit@^0.8.5: test-exclude@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== dependencies: "@istanbuljs/schema" "^0.1.2" @@ -3226,44 +3139,44 @@ test-exclude@^6.0.0: text-table@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== titleize@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" + resolved "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz" integrity sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ== tmpl@1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz" integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-fast-properties@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== to-regex-range@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" tr46@~0.0.3: version "0.0.3" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= ts-api-utils@^1.0.1: version "1.3.0" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + resolved "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== ts-jest@^29.1.0: version "29.1.1" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" + resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz" integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== dependencies: bs-logger "0.x" @@ -3275,9 +3188,9 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" -ts-node@^10.5.0: +ts-node@^10.5.0, ts-node@>=9.0.0: version "10.7.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz" integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== dependencies: "@cspotcode/source-map-support" "0.7.0" @@ -3296,7 +3209,7 @@ ts-node@^10.5.0: tsc-multi@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/tsc-multi/-/tsc-multi-1.1.0.tgz#0e2b03c0ed0ac58ecb556f11709441102d202680" + resolved "https://registry.npmjs.org/tsc-multi/-/tsc-multi-1.1.0.tgz" integrity sha512-THE6X+sse7EZ2qMhqXvBhd2HMTvXyWwYnx+2T/ijqdp/6Rf7rUc2uPRzPdrrljZCNcYDeL0qP2P7tqm2IwayTg== dependencies: debug "^4.3.4" @@ -3312,63 +3225,58 @@ tsc-multi@^1.1.0: tsconfig-paths@^4.0.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c" + resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz" integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg== dependencies: json5 "^2.2.2" minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.5.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" - integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== - -tslib@^2.6.0, tslib@^2.6.2: +tslib@^2.5.0, tslib@^2.6.0, tslib@^2.6.2: version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" type-detect@4.0.8: version "4.0.8" - resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" + resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== type-fest@^0.20.2: version "0.20.2" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== type-fest@^0.21.3: version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typescript@^4.8.2: +typescript@^4.8.2, typescript@>=2.7, typescript@>=4.2.0, "typescript@>=4.3 <6", typescript@>=4.3.0: version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== undici-types@~5.26.4: version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== untildify@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" + resolved "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz" integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== update-browserslist-db@^1.0.13: version "1.0.13" - resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" + resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz" integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== dependencies: escalade "^3.1.1" @@ -3376,24 +3284,24 @@ update-browserslist-db@^1.0.13: uri-js@^4.2.2: version "4.4.1" - resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" util-deprecate@^1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== v8-compile-cache-lib@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" + resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz" integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== v8-to-istanbul@^9.0.1: version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" + resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz" integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== dependencies: "@jridgewell/trace-mapping" "^0.3.12" @@ -3402,24 +3310,24 @@ v8-to-istanbul@^9.0.1: walker@^1.0.8: version "1.0.8" - resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" + resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== dependencies: makeerror "1.0.12" web-streams-polyfill@4.0.0-beta.1: version "4.0.0-beta.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz#3b19b9817374b7cee06d374ba7eeb3aeb80e8c95" + resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz" integrity sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ== webidl-conversions@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= whatwg-url@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= dependencies: tr46 "~0.0.3" @@ -3427,14 +3335,14 @@ whatwg-url@^5.0.0: which@^2.0.1: version "2.0.2" - resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" wrap-ansi@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" @@ -3443,12 +3351,12 @@ wrap-ansi@^7.0.0: wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== write-file-atomic@^4.0.2: version "4.0.2" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" + resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz" integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" @@ -3456,32 +3364,27 @@ write-file-atomic@^4.0.2: ws@^8.18.0: version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" + resolved "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== y18n@^5.0.5: version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^3.0.2: version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yallist@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" - integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== - yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== yargs@^17.3.1, yargs@^17.7.1: version "17.7.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" + resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== dependencies: cliui "^8.0.1" @@ -3494,15 +3397,15 @@ yargs@^17.3.1, yargs@^17.7.1: yn@3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz" integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== yocto-queue@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" + resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== zod@^3.23.8: version "3.23.8" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" + resolved "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz" integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== From 68ec86ea0b53bad89e8067e02cfe98426af50fa2 Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Thu, 22 May 2025 07:21:05 -0700 Subject: [PATCH 402/509] LLM: package-lock.json: remove lockfile from repository --- package-lock.json | 6653 --------------------------------------------- 1 file changed, 6653 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index f51a43ff8..000000000 --- a/package-lock.json +++ /dev/null @@ -1,6653 +0,0 @@ -{ - "name": "openai", - "version": "4.102.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "openai", - "version": "4.102.0", - "license": "Apache-2.0", - "dependencies": { - "@types/node": "^18.11.18", - "@types/node-fetch": "^2.6.4", - "abort-controller": "^3.0.0", - "agentkeepalive": "^4.2.1", - "form-data-encoder": "1.7.2", - "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7" - }, - "bin": { - "openai": "bin/cli" - }, - "devDependencies": { - "@swc/core": "^1.3.102", - "@swc/jest": "^0.2.29", - "@types/jest": "^29.4.0", - "@types/ws": "^8.5.13", - "@typescript-eslint/eslint-plugin": "^6.7.0", - "@typescript-eslint/parser": "^6.7.0", - "eslint": "^8.49.0", - "eslint-plugin-prettier": "^5.0.1", - "eslint-plugin-unused-imports": "^3.0.0", - "fast-check": "^3.22.0", - "iconv-lite": "^0.6.3", - "jest": "^29.4.0", - "prettier": "^3.0.0", - "prettier-2": "npm:prettier@^2", - "ts-jest": "^29.1.0", - "ts-node": "^10.5.0", - "tsc-multi": "^1.1.0", - "tsconfig-paths": "^4.0.0", - "typescript": "^4.8.2", - "ws": "^8.18.0", - "zod": "^3.23.8" - }, - "peerDependencies": { - "ws": "^8.18.0", - "zod": "^3.23.8" - }, - "peerDependenciesMeta": { - "ws": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, - "node_modules/@aashutoshrathi/word-wrap": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", - "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", - "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", - "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/highlight": "^7.23.4", - "chalk": "^2.4.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/code-frame/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/code-frame/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/code-frame/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/code-frame/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", - "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz", - "integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", - "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.6", - "@babel/parser": "^7.23.6", - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.6", - "@babel/types": "^7.23.6", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/core/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/generator": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", - "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.23.6", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", - "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.23.5", - "@babel/helper-validator-option": "^7.23.5", - "browserslist": "^4.22.2", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", - "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", - "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-simple-access": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.20" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", - "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", - "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", - "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.23.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", - "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz", - "integrity": "sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.22.15", - "@babel/traverse": "^7.23.6", - "@babel/types": "^7.23.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", - "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.22.20", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/parser": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", - "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", - "dev": true, - "license": "MIT", - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", - "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.23.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", - "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", - "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.23.5", - "@babel/generator": "^7.23.6", - "@babel/helper-environment-visitor": "^7.22.20", - "@babel/helper-function-name": "^7.23.0", - "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.6", - "@babel/types": "^7.23.6", - "debug": "^4.3.1", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse/node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/types": { - "version": "7.23.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", - "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.23.4", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 12" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz", - "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", - "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^9.6.0", - "globals": "^13.19.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/js": { - "version": "8.50.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz", - "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.11.11", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", - "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", - "debug": "^4.1.1", - "minimatch": "^3.0.5" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", - "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/console/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jest/core": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", - "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/reporters": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.7.0", - "jest-config": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-resolve-dependencies": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "jest-watcher": "^29.7.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/core/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jest/create-cache-key-function": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz", - "integrity": "sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/environment": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", - "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-mock": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/environment/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jest/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "expect": "^29.7.0", - "jest-snapshot": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", - "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^29.6.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", - "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jest/globals": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", - "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/types": "^29.6.3", - "jest-mock": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/reporters": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", - "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^6.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/reporters/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@sinclair/typebox": "^0.27.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/source-map": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", - "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.18", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-result": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", - "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", - "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", - "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/types": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", - "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/types/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@pkgr/utils": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz", - "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "fast-glob": "^3.3.0", - "is-glob": "^4.0.3", - "open": "^9.1.0", - "picocolors": "^1.0.0", - "tslib": "^2.6.0" - }, - "engines": { - "node": "^12.20.0 || ^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, - "node_modules/@sinclair/typebox": { - "version": "0.27.8", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", - "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@sinonjs/commons": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", - "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", - "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^3.0.0" - } - }, - "node_modules/@swc/core": { - "version": "1.4.16", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.4.16.tgz", - "integrity": "sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA==", - "dev": true, - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "@swc/counter": "^0.1.2", - "@swc/types": "^0.1.5" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/swc" - }, - "optionalDependencies": { - "@swc/core-darwin-arm64": "1.4.16", - "@swc/core-darwin-x64": "1.4.16", - "@swc/core-linux-arm-gnueabihf": "1.4.16", - "@swc/core-linux-arm64-gnu": "1.4.16", - "@swc/core-linux-arm64-musl": "1.4.16", - "@swc/core-linux-x64-gnu": "1.4.16", - "@swc/core-linux-x64-musl": "1.4.16", - "@swc/core-win32-arm64-msvc": "1.4.16", - "@swc/core-win32-ia32-msvc": "1.4.16", - "@swc/core-win32-x64-msvc": "1.4.16" - }, - "peerDependencies": { - "@swc/helpers": "^0.5.0" - }, - "peerDependenciesMeta": { - "@swc/helpers": { - "optional": true - } - } - }, - "node_modules/@swc/core-darwin-x64": { - "version": "1.4.16", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz", - "integrity": "sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "Apache-2.0 AND MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/counter": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", - "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/@swc/jest": { - "version": "0.2.36", - "resolved": "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz", - "integrity": "sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/create-cache-key-function": "^29.7.0", - "@swc/counter": "^0.1.3", - "jsonc-parser": "^3.2.0" - }, - "engines": { - "npm": ">= 7.0.0" - }, - "peerDependencies": { - "@swc/core": "*" - } - }, - "node_modules/@swc/types": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz", - "integrity": "sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@swc/counter": "^0.1.3" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.8", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz", - "integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.20.4", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", - "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.20.7" - } - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.9", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", - "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/graceful-fs/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", - "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", - "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", - "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/jest": { - "version": "29.5.11", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", - "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "expect": "^29.0.0", - "pretty-format": "^29.0.0" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", - "license": "MIT" - }, - "node_modules/@types/node-fetch": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz", - "integrity": "sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==", - "license": "MIT", - "dependencies": { - "@types/node": "*", - "form-data": "^3.0.0" - } - }, - "node_modules/@types/node-fetch/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/semver": { - "version": "7.5.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", - "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/stack-utils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", - "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/ws": { - "version": "8.5.13", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", - "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/ws/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/yargs": { - "version": "17.0.32", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", - "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "21.0.3", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", - "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", - "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/type-utils": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4", - "graphemer": "^1.4.0", - "ignore": "^5.2.4", - "natural-compare": "^1.4.0", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", - "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/parser/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", - "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", - "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/typescript-estree": "6.21.0", - "@typescript-eslint/utils": "6.21.0", - "debug": "^4.3.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/type-utils/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", - "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", - "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/visitor-keys": "6.21.0", - "debug": "^4.3.4", - "globby": "^11.1.0", - "is-glob": "^4.0.3", - "minimatch": "9.0.3", - "semver": "^7.5.4", - "ts-api-utils": "^1.0.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", - "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", - "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.4.0", - "@types/json-schema": "^7.0.12", - "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.21.0", - "@typescript-eslint/types": "6.21.0", - "@typescript-eslint/typescript-estree": "6.21.0", - "semver": "^7.5.4" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", - "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "6.21.0", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^16.0.0 || >=18.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/agentkeepalive": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz", - "integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==", - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/aggregate-error": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", - "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "clean-stack": "^2.0.0", - "indent-string": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "license": "MIT" - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "license": "MIT" - }, - "node_modules/babel-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", - "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/transform": "^29.7.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.6.3", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.8.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-istanbul/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", - "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", - "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-preset-jest": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", - "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", - "dev": true, - "license": "MIT", - "dependencies": { - "babel-plugin-jest-hoist": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/big-integer": { - "version": "1.6.52", - "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", - "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", - "dev": true, - "license": "Unlicense", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/bplist-parser": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz", - "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==", - "dev": true, - "license": "MIT", - "dependencies": { - "big-integer": "^1.6.44" - }, - "engines": { - "node": ">= 5.10.0" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.22.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", - "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "caniuse-lite": "^1.0.30001565", - "electron-to-chromium": "^1.4.601", - "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/bs-logger": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", - "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-json-stable-stringify": "2.x" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/bundle-name": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz", - "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "run-applescript": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001570", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", - "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/cjs-module-lexer": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", - "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/clean-stack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", - "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", - "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/create-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", - "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "prompts": "^2.0.1" - }, - "bin": { - "create-jest": "bin/create-jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "license": "MIT" - }, - "node_modules/dedent": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", - "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "babel-plugin-macros": "^3.1.0" - }, - "peerDependenciesMeta": { - "babel-plugin-macros": { - "optional": true - } - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-browser": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz", - "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==", - "dev": true, - "license": "MIT", - "dependencies": { - "bundle-name": "^3.0.0", - "default-browser-id": "^3.0.0", - "execa": "^7.1.1", - "titleize": "^3.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser-id": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz", - "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==", - "dev": true, - "license": "MIT", - "dependencies": { - "bplist-parser": "^0.2.0", - "untildify": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/execa": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz", - "integrity": "sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.1", - "human-signals": "^4.3.0", - "is-stream": "^3.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^5.1.0", - "onetime": "^6.0.0", - "signal-exit": "^3.0.7", - "strip-final-newline": "^3.0.0" - }, - "engines": { - "node": "^14.18.0 || ^16.14.0 || >=18.0.0" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/default-browser/node_modules/human-signals": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz", - "integrity": "sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=14.18.0" - } - }, - "node_modules/default-browser/node_modules/is-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", - "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/mimic-fn": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", - "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/npm-run-path": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", - "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/onetime": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", - "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/path-key": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", - "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/default-browser/node_modules/strip-final-newline": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", - "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", - "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.4.614", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz", - "integrity": "sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/emittery": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", - "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "8.50.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz", - "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.6.1", - "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.50.0", - "@humanwhocodes/config-array": "^0.11.11", - "@humanwhocodes/module-importer": "^1.0.1", - "@nodelib/fs.walk": "^1.2.8", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.3.2", - "doctrine": "^3.0.0", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.2.2", - "eslint-visitor-keys": "^3.4.3", - "espree": "^9.6.1", - "esquery": "^1.4.2", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "globals": "^13.19.0", - "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "is-path-inside": "^3.0.3", - "js-yaml": "^4.1.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "strip-ansi": "^6.0.1", - "text-table": "^0.2.0" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-plugin-prettier": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", - "integrity": "sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg==", - "dev": true, - "license": "MIT", - "dependencies": { - "prettier-linter-helpers": "^1.0.0", - "synckit": "^0.8.5" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/prettier" - }, - "peerDependencies": { - "@types/eslint": ">=8.0.0", - "eslint": ">=8.0.0", - "prettier": ">=3.0.0" - }, - "peerDependenciesMeta": { - "@types/eslint": { - "optional": true - }, - "eslint-config-prettier": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-unused-imports": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz", - "integrity": "sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-rule-composer": "^0.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^6.0.0", - "eslint": "^8.0.0" - }, - "peerDependenciesMeta": { - "@typescript-eslint/eslint-plugin": { - "optional": true - } - } - }, - "node_modules/eslint-rule-composer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", - "integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/eslint/node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/espree": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", - "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.9.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^3.4.1" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/fast-check": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.22.0.tgz", - "integrity": "sha512-8HKz3qXqnHYp/VCNn2qfjHdAdcI8zcSqOyX64GOMukp7SL2bfzfeDKjSd+UyECtejccaZv3LcvZTm9YDD22iCQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "license": "MIT", - "dependencies": { - "pure-rand": "^6.1.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-diff": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", - "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/fast-glob": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", - "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", - "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", - "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flatted": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", - "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/form-data": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", - "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", - "license": "MIT" - }, - "node_modules/formdata-node": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.3.tgz", - "integrity": "sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA==", - "license": "MIT", - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.1" - }, - "engines": { - "node": ">= 12.20" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "license": "ISC" - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stdin": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", - "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/globals": { - "version": "13.20.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", - "integrity": "sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true, - "license": "MIT" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "license": "MIT" - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "license": "MIT", - "dependencies": { - "ms": "^2.0.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/import-local": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", - "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/indent-string": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", - "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true, - "license": "MIT" - }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-docker": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", - "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", - "dev": true, - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-docker": "^3.0.0" - }, - "bin": { - "is-inside-container": "cli.js" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-inside-container/node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", - "dev": true, - "license": "MIT", - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-wsl": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", - "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz", - "integrity": "sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", - "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", - "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^29.7.0", - "@jest/types": "^29.6.3", - "import-local": "^3.0.2", - "jest-cli": "^29.7.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-changed-files": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", - "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", - "dev": true, - "license": "MIT", - "dependencies": { - "execa": "^5.0.0", - "jest-util": "^29.7.0", - "p-limit": "^3.1.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", - "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^1.0.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.7.0", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.7.0", - "pure-rand": "^6.0.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-cli": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", - "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "create-jest": "^29.7.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "yargs": "^17.3.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-config": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-jest": "^29.7.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-config/node_modules/@types/node": { - "version": "20.10.5", - "dev": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-docblock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", - "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-newline": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "jest-util": "^29.7.0", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-node": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", - "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-node/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-haste-map": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", - "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/jest-haste-map/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-leak-detector": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", - "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-matcher-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", - "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-message-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", - "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.6.3", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-mock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", - "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-mock/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", - "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", - "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", - "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", - "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-regex-util": "^29.6.3", - "jest-snapshot": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", - "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/environment": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-leak-detector": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-resolve": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-util": "^29.7.0", - "jest-watcher": "^29.7.0", - "jest-worker": "^29.7.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-runtime": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", - "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/globals": "^29.7.0", - "@jest/source-map": "^29.6.3", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runtime/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-runtime/node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-snapshot": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", - "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.7.0", - "semver": "^7.5.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-util/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-validate": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", - "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "leven": "^3.1.0", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-watcher": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", - "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "jest-util": "^29.7.0", - "string-length": "^4.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-watcher/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-worker": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", - "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "jest-util": "^29.7.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker/node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true, - "license": "MIT" - }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true, - "license": "MIT" - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash.memoize": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", - "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "license": "ISC" - }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "license": "MIT" - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", - "license": "MIT", - "dependencies": { - "mime-db": "1.51.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", - "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "license": "MIT", - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.14", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", - "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", - "dev": true, - "license": "MIT" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/open": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz", - "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==", - "dev": true, - "license": "MIT", - "dependencies": { - "default-browser": "^4.0.0", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^2.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/optionator": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", - "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@aashutoshrathi/word-wrap": "^1.2.3", - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-all": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-all/-/p-all-3.0.0.tgz", - "integrity": "sha512-qUZbvbBFVXm6uJ7U/WDiO0fv6waBMbjlCm4E66oZdRR+egswICarIdHyVSZZHudH8T5SF8x/JG0q0duFzPnlBw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-map": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-map": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", - "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "aggregate-error": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "license": "MIT" - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", - "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prettier": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", - "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-2": { - "name": "prettier", - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", - "dev": true, - "license": "MIT", - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" - } - }, - "node_modules/prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-diff": "^1.1.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/pure-rand": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", - "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "license": "MIT" - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", - "dev": true, - "license": "MIT" - }, - "node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve.exports": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", - "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/run-applescript": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz", - "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "execa": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "license": "MIT" - }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true, - "license": "MIT" - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-to-stream": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/string-to-stream/-/string-to-stream-3.0.1.tgz", - "integrity": "sha512-Hl092MV3USJuUCC6mfl9sPzGloA3K5VwdIeJjYIkXY/8K+mUvaeEabWJgArp+xXrsWxCajeT2pc4axbVhIZJyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^3.4.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/superstruct": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", - "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/synckit": { - "version": "0.8.6", - "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.6.tgz", - "integrity": "sha512-laHF2savN6sMeHCjLRkheIU4wo3Zg9Ln5YOjOo7sZ5dVQW8yF5pPE5SIw1dsPhq3TRp1jisKRCdPhfs/1WMqDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@pkgr/utils": "^2.4.2", - "tslib": "^2.6.2" - }, - "engines": { - "node": "^14.18.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/unts" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, - "node_modules/titleize": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz", - "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "license": "MIT" - }, - "node_modules/ts-api-utils": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", - "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16" - }, - "peerDependencies": { - "typescript": ">=4.2.0" - } - }, - "node_modules/ts-jest": { - "version": "29.1.1", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", - "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", - "dev": true, - "license": "MIT", - "dependencies": { - "bs-logger": "0.x", - "fast-json-stable-stringify": "2.x", - "jest-util": "^29.0.0", - "json5": "^2.2.3", - "lodash.memoize": "4.x", - "make-error": "1.x", - "semver": "^7.5.3", - "yargs-parser": "^21.0.1" - }, - "bin": { - "ts-jest": "cli.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": ">=7.0.0-beta.0 <8", - "@jest/types": "^29.0.0", - "babel-jest": "^29.0.0", - "jest": "^29.0.0", - "typescript": ">=4.3 <6" - }, - "peerDependenciesMeta": { - "@babel/core": { - "optional": true - }, - "@jest/types": { - "optional": true - }, - "babel-jest": { - "optional": true - }, - "esbuild": { - "optional": true - } - } - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/tsc-multi": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/tsc-multi/-/tsc-multi-1.1.0.tgz", - "integrity": "sha512-THE6X+sse7EZ2qMhqXvBhd2HMTvXyWwYnx+2T/ijqdp/6Rf7rUc2uPRzPdrrljZCNcYDeL0qP2P7tqm2IwayTg==", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.3.4", - "fast-glob": "^3.2.12", - "get-stdin": "^8.0.0", - "p-all": "^3.0.0", - "picocolors": "^1.0.0", - "signal-exit": "^3.0.7", - "string-to-stream": "^3.0.1", - "superstruct": "^1.0.3", - "tslib": "^2.5.0", - "yargs": "^17.7.1" - }, - "bin": { - "tsc-multi": "bin/tsc-multi.js" - }, - "engines": { - "node": ">=14" - }, - "peerDependencies": { - "typescript": ">=4.3.0" - } - }, - "node_modules/tsc-multi/node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/tsconfig-paths": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz", - "integrity": "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==", - "dev": true, - "license": "MIT", - "dependencies": { - "json5": "^2.2.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true, - "license": "0BSD" - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "license": "MIT" - }, - "node_modules/untildify": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", - "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", - "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-to-istanbul": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", - "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", - "dev": true, - "license": "ISC", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.1", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz", - "integrity": "sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ==", - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - } - } -} From 3a08c588f7e9ea13e7fd1da9ef349ac0cf300a35 Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Thu, 22 May 2025 07:22:40 -0700 Subject: [PATCH 403/509] LLM: docs(ResponseStream): add detailed comments to ResponseStreamByIdParams fields --- src/lib/responses/ResponseStream.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib/responses/ResponseStream.ts b/src/lib/responses/ResponseStream.ts index b4c9e13f2..79f61bd35 100644 --- a/src/lib/responses/ResponseStream.ts +++ b/src/lib/responses/ResponseStream.ts @@ -21,7 +21,13 @@ export type ResponseCreateAndStreamParams = Omit Date: Thu, 22 May 2025 07:49:49 -0700 Subject: [PATCH 404/509] LLM: update yarn.lock: use registry.yarnpkg.com, add swc platform packages, and update several dependencies --- yarn.lock | 1113 +++++++++++++++++++++++++++++------------------------ 1 file changed, 605 insertions(+), 508 deletions(-) diff --git a/yarn.lock b/yarn.lock index 2fc0a3520..ad5fb7630 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4,12 +4,12 @@ "@aashutoshrathi/word-wrap@^1.2.3": version "1.2.6" - resolved "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== "@ampproject/remapping@^2.2.0": version "2.2.1" - resolved "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz" + resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630" integrity sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg== dependencies: "@jridgewell/gen-mapping" "^0.3.0" @@ -17,7 +17,7 @@ "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.22.13", "@babel/code-frame@^7.23.5": version "7.23.5" - resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.23.5.tgz#9009b69a8c602293476ad598ff53e4562e15c244" integrity sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA== dependencies: "@babel/highlight" "^7.23.4" @@ -25,12 +25,12 @@ "@babel/compat-data@^7.23.5": version "7.23.5" - resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.23.5.tgz#ffb878728bb6bdcb6f4510aa51b1be9afb8cfd98" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0", "@babel/core@>=7.0.0-beta.0 <8": +"@babel/core@^7.11.6", "@babel/core@^7.12.3": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.23.6.tgz#8be77cd77c55baadcc1eae1c33df90ab6d2151d4" integrity sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw== dependencies: "@ampproject/remapping" "^2.2.0" @@ -51,7 +51,7 @@ "@babel/generator@^7.23.6", "@babel/generator@^7.7.2": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.23.6.tgz#9e1fca4811c77a10580d17d26b57b036133f3c2e" integrity sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw== dependencies: "@babel/types" "^7.23.6" @@ -61,7 +61,7 @@ "@babel/helper-compilation-targets@^7.23.6": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz#4d79069b16cbcf1461289eccfbbd81501ae39991" integrity sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ== dependencies: "@babel/compat-data" "^7.23.5" @@ -72,12 +72,12 @@ "@babel/helper-environment-visitor@^7.22.20": version "7.22.20" - resolved "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz#96159db61d34a29dba454c959f5ae4a649ba9167" integrity sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA== "@babel/helper-function-name@^7.23.0": version "7.23.0" - resolved "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz#1f9a3cdbd5b2698a670c30d2735f9af95ed52759" integrity sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw== dependencies: "@babel/template" "^7.22.15" @@ -85,21 +85,21 @@ "@babel/helper-hoist-variables@^7.22.5": version "7.22.5" - resolved "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz#c01a007dac05c085914e8fb652b339db50d823bb" integrity sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw== dependencies: "@babel/types" "^7.22.5" "@babel/helper-module-imports@^7.22.15": version "7.22.15" - resolved "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz#16146307acdc40cc00c3b2c647713076464bdbf0" integrity sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w== dependencies: "@babel/types" "^7.22.15" "@babel/helper-module-transforms@^7.23.3": version "7.23.3" - resolved "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz#d7d12c3c5d30af5b3c0fcab2a6d5217773e2d0f1" integrity sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ== dependencies: "@babel/helper-environment-visitor" "^7.22.20" @@ -110,41 +110,41 @@ "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.22.5", "@babel/helper-plugin-utils@^7.8.0": version "7.22.5" - resolved "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== "@babel/helper-simple-access@^7.22.5": version "7.22.5" - resolved "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de" integrity sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w== dependencies: "@babel/types" "^7.22.5" "@babel/helper-split-export-declaration@^7.22.6": version "7.22.6" - resolved "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== dependencies: "@babel/types" "^7.22.5" "@babel/helper-string-parser@^7.23.4": version "7.23.4" - resolved "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz#9478c707febcbbe1ddb38a3d91a2e054ae622d83" integrity sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ== "@babel/helper-validator-identifier@^7.22.20": version "7.22.20" - resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== "@babel/helper-validator-option@^7.23.5": version "7.23.5" - resolved "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz#907a3fbd4523426285365d1206c423c4c5520307" integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== "@babel/helpers@^7.23.6": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.23.6.tgz#d03af2ee5fb34691eec0cda90f5ecbb4d4da145a" integrity sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA== dependencies: "@babel/template" "^7.22.15" @@ -153,7 +153,7 @@ "@babel/highlight@^7.23.4": version "7.23.4" - resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.23.4.tgz#edaadf4d8232e1a961432db785091207ead0621b" integrity sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A== dependencies: "@babel/helper-validator-identifier" "^7.22.20" @@ -162,110 +162,110 @@ "@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.22.15", "@babel/parser@^7.23.6": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-bigint@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-class-properties@^7.8.3": version "7.12.13" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== dependencies: "@babel/helper-plugin-utils" "^7.12.13" "@babel/plugin-syntax-import-meta@^7.8.3": version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-jsx@^7.7.2": version "7.23.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz#8f2e4f8a9b5f9aa16067e142c1ac9cd9f810f473" integrity sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-numeric-separator@^7.8.3": version "7.10.4" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== dependencies: "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-catch-binding@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-optional-chaining@^7.8.3": version "7.8.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-top-level-await@^7.8.3": version "7.14.5" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== dependencies: "@babel/helper-plugin-utils" "^7.14.5" "@babel/plugin-syntax-typescript@^7.7.2": version "7.23.3" - resolved "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz#24f460c85dbbc983cd2b9c4994178bcc01df958f" integrity sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ== dependencies: "@babel/helper-plugin-utils" "^7.22.5" "@babel/template@^7.22.15", "@babel/template@^7.3.3": version "7.22.15" - resolved "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.22.15.tgz#09576efc3830f0430f4548ef971dde1350ef2f38" integrity sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w== dependencies: "@babel/code-frame" "^7.22.13" @@ -274,7 +274,7 @@ "@babel/traverse@^7.23.6": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.6.tgz#b53526a2367a0dd6edc423637f3d2d0f2521abc5" integrity sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ== dependencies: "@babel/code-frame" "^7.23.5" @@ -290,7 +290,7 @@ "@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.22.15", "@babel/types@^7.22.5", "@babel/types@^7.23.0", "@babel/types@^7.23.6", "@babel/types@^7.3.3": version "7.23.6" - resolved "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.23.6.tgz#be33fdb151e1f5a56877d704492c240fc71c7ccd" integrity sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg== dependencies: "@babel/helper-string-parser" "^7.23.4" @@ -299,36 +299,41 @@ "@bcoe/v8-coverage@^0.2.3": version "0.2.3" - resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" - resolved "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== "@cspotcode/source-map-support@0.7.0": version "0.7.0" - resolved "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== dependencies: "@cspotcode/source-map-consumer" "0.8.0" "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" - resolved "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.5.1": version "4.11.1" - resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.1.tgz" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.11.1.tgz#a547badfc719eb3e5f4b556325e542fbe9d7a18f" integrity sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q== +"@eslint-community/regexpp@^4.6.1": + version "4.6.2" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8" + integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw== + "@eslint/eslintrc@^2.1.2": version "2.1.2" - resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== dependencies: ajv "^6.12.4" @@ -343,12 +348,12 @@ "@eslint/js@8.50.0": version "8.50.0" - resolved "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.50.0.tgz#9e93b850f0f3fa35f5fa59adfd03adae8488e484" integrity sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ== "@humanwhocodes/config-array@^0.11.11": version "0.11.11" - resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.11.tgz#88a04c570dbbc7dd943e4712429c3df09bc32844" integrity sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA== dependencies: "@humanwhocodes/object-schema" "^1.2.1" @@ -357,17 +362,17 @@ "@humanwhocodes/module-importer@^1.0.1": version "1.0.1" - resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== "@humanwhocodes/object-schema@^1.2.1": version "1.2.1" - resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" - resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" integrity sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ== dependencies: camelcase "^5.3.1" @@ -378,12 +383,12 @@ "@istanbuljs/schema@^0.1.2": version "0.1.3" - resolved "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== "@jest/console@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" integrity sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg== dependencies: "@jest/types" "^29.6.3" @@ -395,7 +400,7 @@ "@jest/core@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: "@jest/console" "^29.7.0" @@ -429,14 +434,14 @@ "@jest/create-cache-key-function@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0" integrity sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA== dependencies: "@jest/types" "^29.6.3" "@jest/environment@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" integrity sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw== dependencies: "@jest/fake-timers" "^29.7.0" @@ -446,14 +451,14 @@ "@jest/expect-utils@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.7.0.tgz#023efe5d26a8a70f21677d0a1afc0f0a44e3a1c6" integrity sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA== dependencies: jest-get-type "^29.6.3" "@jest/expect@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.7.0.tgz#76a3edb0cb753b70dfbfe23283510d3d45432bf2" integrity sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ== dependencies: expect "^29.7.0" @@ -461,7 +466,7 @@ "@jest/fake-timers@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" integrity sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ== dependencies: "@jest/types" "^29.6.3" @@ -473,7 +478,7 @@ "@jest/globals@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" integrity sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ== dependencies: "@jest/environment" "^29.7.0" @@ -483,7 +488,7 @@ "@jest/reporters@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== dependencies: "@bcoe/v8-coverage" "^0.2.3" @@ -513,14 +518,14 @@ "@jest/schemas@^29.6.3": version "29.6.3" - resolved "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.6.3.tgz#430b5ce8a4e0044a7e3819663305a7b3091c8e03" integrity sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA== dependencies: "@sinclair/typebox" "^0.27.8" "@jest/source-map@^29.6.3": version "29.6.3" - resolved "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" integrity sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw== dependencies: "@jridgewell/trace-mapping" "^0.3.18" @@ -529,7 +534,7 @@ "@jest/test-result@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" integrity sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA== dependencies: "@jest/console" "^29.7.0" @@ -539,7 +544,7 @@ "@jest/test-sequencer@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" integrity sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw== dependencies: "@jest/test-result" "^29.7.0" @@ -549,7 +554,7 @@ "@jest/transform@^29.7.0": version "29.7.0" - resolved "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.7.0.tgz#df2dd9c346c7d7768b8a06639994640c642e284c" integrity sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw== dependencies: "@babel/core" "^7.11.6" @@ -568,9 +573,9 @@ slash "^3.0.0" write-file-atomic "^4.0.2" -"@jest/types@^29.0.0", "@jest/types@^29.6.3": +"@jest/types@^29.6.3": version "29.6.3" - resolved "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.6.3.tgz#1131f8cf634e7e84c5e77bab12f052af585fba59" integrity sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw== dependencies: "@jest/schemas" "^29.6.3" @@ -582,7 +587,7 @@ "@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2": version "0.3.3" - resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098" integrity sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ== dependencies: "@jridgewell/set-array" "^1.0.1" @@ -591,22 +596,22 @@ "@jridgewell/resolve-uri@^3.1.0": version "3.1.1" - resolved "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== "@jridgewell/set-array@^1.0.1": version "1.1.2" - resolved "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== "@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" - resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.9": version "0.3.20" - resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz#72e45707cf240fa6b081d0366f8265b0cd10197f" integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== dependencies: "@jridgewell/resolve-uri" "^3.1.0" @@ -614,20 +619,20 @@ "@nodelib/fs.scandir@2.1.5": version "2.1.5" - resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== dependencies: "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": version "2.0.5" - resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== "@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": version "1.2.8" - resolved "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== dependencies: "@nodelib/fs.scandir" "2.1.5" @@ -635,7 +640,7 @@ "@pkgr/utils@^2.4.2": version "2.4.2" - resolved "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz" + resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw== dependencies: cross-spawn "^7.0.3" @@ -647,31 +652,76 @@ "@sinclair/typebox@^0.27.8": version "0.27.8" - resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== "@sinonjs/commons@^3.0.0": version "3.0.0" - resolved "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" integrity sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA== dependencies: type-detect "4.0.8" "@sinonjs/fake-timers@^10.0.2": version "10.3.0" - resolved "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz#55fdff1ecab9f354019129daf4df0dd4d923ea66" integrity sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA== dependencies: "@sinonjs/commons" "^3.0.0" +"@swc/core-darwin-arm64@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.4.16.tgz#2cd45d709ce76d448d96bf8d0006849541436611" + integrity sha512-UOCcH1GvjRnnM/LWT6VCGpIk0OhHRq6v1U6QXuPt5wVsgXnXQwnf5k3sG5Cm56hQHDvhRPY6HCsHi/p0oek8oQ== + "@swc/core-darwin-x64@1.4.16": version "1.4.16" - resolved "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.4.16.tgz#a5bc7d8b1dd850adb0bb95c6b5c742b92201fd01" integrity sha512-t3bgqFoYLWvyVtVL6KkFNCINEoOrIlyggT/kJRgi1y0aXSr0oVgcrQ4ezJpdeahZZ4N+Q6vT3ffM30yIunELNA== -"@swc/core@*", "@swc/core@^1.3.102", "@swc/core@>=1.2.50": +"@swc/core-linux-arm-gnueabihf@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.4.16.tgz#961744908ee5cbb79bc009dcf58cc8b831111f38" + integrity sha512-DvHuwvEF86YvSd0lwnzVcjOTZ0jcxewIbsN0vc/0fqm9qBdMMjr9ox6VCam1n3yYeRtj4VFgrjeNFksqbUejdQ== + +"@swc/core-linux-arm64-gnu@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.4.16.tgz#43713be3f26757d82d2745dc25f8b63400e0a3d0" + integrity sha512-9Uu5YlPbyCvbidjKtYEsPpyZlu16roOZ5c2tP1vHfnU9bgf5Tz5q5VovSduNxPHx+ed2iC1b1URODHvDzbbDuQ== + +"@swc/core-linux-arm64-musl@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.4.16.tgz#394a7d030f3a61902bd3947bb9d70d26d42f3c81" + integrity sha512-/YZq/qB1CHpeoL0eMzyqK5/tYZn/rzKoCYDviFU4uduSUIJsDJQuQA/skdqUzqbheOXKAd4mnJ1hT04RbJ8FPQ== + +"@swc/core-linux-x64-gnu@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.4.16.tgz#71eb108b784f9d551ee8a35ebcdaed972f567981" + integrity sha512-UUjaW5VTngZYDcA8yQlrFmqs1tLi1TxbKlnaJwoNhel9zRQ0yG1YEVGrzTvv4YApSuIiDK18t+Ip927bwucuVQ== + +"@swc/core-linux-x64-musl@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.4.16.tgz#10dbaedb4e3dfc7268e3a9a66ad3431471ef035b" + integrity sha512-aFhxPifevDTwEDKPi4eRYWzC0p/WYJeiFkkpNU5Uc7a7M5iMWPAbPFUbHesdlb9Jfqs5c07oyz86u+/HySBNPQ== + +"@swc/core-win32-arm64-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.4.16.tgz#80247adff6c245ff32b44d773c1a148858cd655f" + integrity sha512-bTD43MbhIHL2s5QgCwyleaGwl96Gk/scF2TaVKdUe4QlJCDV/YK9h5oIBAp63ckHtE8GHlH4c8dZNBiAXn4Org== + +"@swc/core-win32-ia32-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.4.16.tgz#e540afc3ccf3224267b4ddfb408f9d9737984686" + integrity sha512-/lmZeAN/qV5XbK2SEvi8e2RkIg8FQNYiSA8y2/Zb4gTUMKVO5JMLH0BSWMiIKMstKDPDSxMWgwJaQHF8UMyPmQ== + +"@swc/core-win32-x64-msvc@1.4.16": + version "1.4.16" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.4.16.tgz#f880939fca32c181adfe7e3abd2b6b7857bd3489" + integrity sha512-BPAfFfODWXtUu6SwaTTftDHvcbDyWBSI/oanUeRbQR5vVWkXoQ3cxLTsDluc3H74IqXS5z1Uyoe0vNo2hB1opA== + +"@swc/core@^1.3.102": version "1.4.16" - resolved "https://registry.npmjs.org/@swc/core/-/core-1.4.16.tgz" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.4.16.tgz#d175bae2acfecd53bcbd4293f1fba5ec316634a0" integrity sha512-Xaf+UBvW6JNuV131uvSNyMXHn+bh6LyKN4tbv7tOUFQpXyz/t9YWRE04emtlUW9Y0qrm/GKFCbY8n3z6BpZbTA== dependencies: "@swc/counter" "^0.1.2" @@ -690,12 +740,12 @@ "@swc/counter@^0.1.2", "@swc/counter@^0.1.3": version "0.1.3" - resolved "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz" + resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== "@swc/jest@^0.2.29": version "0.2.36" - resolved "https://registry.npmjs.org/@swc/jest/-/jest-0.2.36.tgz" + resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.36.tgz#2797450a30d28b471997a17e901ccad946fe693e" integrity sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw== dependencies: "@jest/create-cache-key-function" "^29.7.0" @@ -704,34 +754,34 @@ "@swc/types@^0.1.5": version "0.1.6" - resolved "https://registry.npmjs.org/@swc/types/-/types-0.1.6.tgz" + resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.6.tgz#2f13f748995b247d146de2784d3eb7195410faba" integrity sha512-/JLo/l2JsT/LRd80C3HfbmVpxOAJ11FO2RCEslFrgzLltoP9j8XIbsyDcfCt2WWyX+CM96rBoNM+IToAkFOugg== dependencies: "@swc/counter" "^0.1.3" "@tsconfig/node10@^1.0.7": version "1.0.8" - resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" integrity sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg== "@tsconfig/node12@^1.0.7": version "1.0.9" - resolved "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.9.tgz#62c1f6dee2ebd9aead80dc3afa56810e58e1a04c" integrity sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw== "@tsconfig/node14@^1.0.0": version "1.0.1" - resolved "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.1.tgz#95f2d167ffb9b8d2068b0b235302fafd4df711f2" integrity sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg== "@tsconfig/node16@^1.0.2": version "1.0.2" - resolved "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.2.tgz#423c77877d0569db20e1fc80885ac4118314010e" integrity sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA== "@types/babel__core@^7.1.14": version "7.20.5" - resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" integrity sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA== dependencies: "@babel/parser" "^7.20.7" @@ -742,14 +792,14 @@ "@types/babel__generator@*": version "7.6.8" - resolved "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz" + resolved "https://registry.yarnpkg.com/@types/babel__generator/-/babel__generator-7.6.8.tgz#f836c61f48b1346e7d2b0d93c6dacc5b9535d3ab" integrity sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw== dependencies: "@babel/types" "^7.0.0" "@types/babel__template@*": version "7.4.4" - resolved "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.4.tgz#5672513701c1b2199bc6dad636a9d7491586766f" integrity sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A== dependencies: "@babel/parser" "^7.1.0" @@ -757,40 +807,40 @@ "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": version "7.20.4" - resolved "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.4.tgz#ec2c06fed6549df8bc0eb4615b683749a4a92e1b" integrity sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA== dependencies: "@babel/types" "^7.20.7" "@types/graceful-fs@^4.1.3": version "4.1.9" - resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz" + resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4" integrity sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ== dependencies: "@types/node" "*" "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.6" - resolved "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" integrity sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w== "@types/istanbul-lib-report@*": version "3.0.3" - resolved "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz" + resolved "https://registry.yarnpkg.com/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz#53047614ae72e19fc0401d872de3ae2b4ce350bf" integrity sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA== dependencies: "@types/istanbul-lib-coverage" "*" "@types/istanbul-reports@^3.0.0": version "3.0.4" - resolved "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz" + resolved "https://registry.yarnpkg.com/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz#0f03e3d2f670fbdac586e34b433783070cc16f54" integrity sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ== dependencies: "@types/istanbul-lib-report" "*" "@types/jest@^29.4.0": version "29.5.11" - resolved "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.11.tgz#0c13aa0da7d0929f078ab080ae5d4ced80fa2f2c" integrity sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ== dependencies: expect "^29.0.0" @@ -798,54 +848,61 @@ "@types/json-schema@^7.0.12": version "7.0.15" - resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node-fetch@^2.6.4": version "2.6.4" - resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.4.tgz" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.4.tgz#1bc3a26de814f6bf466b25aeb1473fa1afe6a660" integrity sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg== dependencies: "@types/node" "*" form-data "^3.0.0" -"@types/node@*", "@types/node@^18.11.18": +"@types/node@*": + version "20.10.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" + integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== + dependencies: + undici-types "~5.26.4" + +"@types/node@^18.11.18": version "18.11.18" - resolved "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== "@types/semver@^7.5.0": version "7.5.8" - resolved "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== "@types/stack-utils@^2.0.0": version "2.0.3" - resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz" + resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== "@types/ws@^8.5.13": version "8.5.13" - resolved "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.13.tgz#6414c280875e2691d0d1e080b05addbf5cb91e20" integrity sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA== dependencies: "@types/node" "*" "@types/yargs-parser@*": version "21.0.3" - resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz" + resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.3.tgz#815e30b786d2e8f0dcd85fd5bcf5e1a04d008f15" integrity sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ== "@types/yargs@^17.0.8": version "17.0.32" - resolved "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-17.0.32.tgz#030774723a2f7faafebf645f4e5a48371dca6229" integrity sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog== dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^6.0.0", "@typescript-eslint/eslint-plugin@^6.7.0": +"@typescript-eslint/eslint-plugin@^6.7.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz#30830c1ca81fd5f3c2714e524c4303e0194f9cd3" integrity sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA== dependencies: "@eslint-community/regexpp" "^4.5.1" @@ -860,9 +917,9 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/parser@^6.0.0 || ^6.0.0-alpha", "@typescript-eslint/parser@^6.7.0": +"@typescript-eslint/parser@^6.7.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.21.0.tgz#af8fcf66feee2edc86bc5d1cf45e33b0630bf35b" integrity sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ== dependencies: "@typescript-eslint/scope-manager" "6.21.0" @@ -873,7 +930,7 @@ "@typescript-eslint/scope-manager@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz#ea8a9bfc8f1504a6ac5d59a6df308d3a0630a2b1" integrity sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg== dependencies: "@typescript-eslint/types" "6.21.0" @@ -881,7 +938,7 @@ "@typescript-eslint/type-utils@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz#6473281cfed4dacabe8004e8521cee0bd9d4c01e" integrity sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag== dependencies: "@typescript-eslint/typescript-estree" "6.21.0" @@ -891,12 +948,12 @@ "@typescript-eslint/types@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.21.0.tgz#205724c5123a8fef7ecd195075fa6e85bac3436d" integrity sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg== "@typescript-eslint/typescript-estree@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz#c47ae7901db3b8bddc3ecd73daff2d0895688c46" integrity sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ== dependencies: "@typescript-eslint/types" "6.21.0" @@ -910,7 +967,7 @@ "@typescript-eslint/utils@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.21.0.tgz#4714e7a6b39e773c1c8e97ec587f520840cd8134" integrity sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ== dependencies: "@eslint-community/eslint-utils" "^4.4.0" @@ -923,7 +980,7 @@ "@typescript-eslint/visitor-keys@6.21.0": version "6.21.0" - resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz#87a99d077aa507e20e238b11d56cc26ade45fe47" integrity sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A== dependencies: "@typescript-eslint/types" "6.21.0" @@ -931,29 +988,34 @@ abort-controller@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== dependencies: event-target-shim "^5.0.0" acorn-jsx@^5.3.2: version "5.3.2" - resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== acorn-walk@^8.1.1: version "8.2.0" - resolved "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== -"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.4.1, acorn@^8.9.0: +acorn@^8.4.1: + version "8.7.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.7.0.tgz#90951fde0f8f09df93549481e5fc141445b791cf" + integrity sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ== + +acorn@^8.9.0: version "8.10.0" - resolved "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== agentkeepalive@^4.2.1: version "4.2.1" - resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz" + resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717" integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA== dependencies: debug "^4.1.0" @@ -962,7 +1024,7 @@ agentkeepalive@^4.2.1: aggregate-error@^3.0.0: version "3.1.0" - resolved "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/aggregate-error/-/aggregate-error-3.1.0.tgz#92670ff50f5359bdb7a3e0d40d0ec30c5737687a" integrity sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA== dependencies: clean-stack "^2.0.0" @@ -970,7 +1032,7 @@ aggregate-error@^3.0.0: ajv@^6.12.4: version "6.12.6" - resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== dependencies: fast-deep-equal "^3.1.1" @@ -980,38 +1042,38 @@ ajv@^6.12.4: ansi-escapes@^4.2.1: version "4.3.2" - resolved "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== dependencies: type-fest "^0.21.3" ansi-regex@^5.0.1: version "5.0.1" - resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" ansi-styles@^4.0.0, ansi-styles@^4.1.0: version "4.3.0" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" ansi-styles@^5.0.0: version "5.2.0" - resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== anymatch@^3.0.3: version "3.1.3" - resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" @@ -1019,34 +1081,34 @@ anymatch@^3.0.3: arg@^4.1.0: version "4.1.3" - resolved "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== argparse@^1.0.7: version "1.0.10" - resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== dependencies: sprintf-js "~1.0.2" argparse@^2.0.1: version "2.0.1" - resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== array-union@^2.1.0: version "2.1.0" - resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== asynckit@^0.4.0: version "0.4.0" - resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" + resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha1-x57Zf380y48robyXkLzDZkdLS3k= -babel-jest@^29.0.0, babel-jest@^29.7.0: +babel-jest@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.7.0.tgz#f4369919225b684c56085998ac63dbd05be020d5" integrity sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg== dependencies: "@jest/transform" "^29.7.0" @@ -1059,7 +1121,7 @@ babel-jest@^29.0.0, babel-jest@^29.7.0: babel-plugin-istanbul@^6.1.1: version "6.1.1" - resolved "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz#fa88ec59232fd9b4e36dbbc540a8ec9a9b47da73" integrity sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" @@ -1070,7 +1132,7 @@ babel-plugin-istanbul@^6.1.1: babel-plugin-jest-hoist@^29.6.3: version "29.6.3" - resolved "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz#aadbe943464182a8922c3c927c3067ff40d24626" integrity sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg== dependencies: "@babel/template" "^7.3.3" @@ -1080,7 +1142,7 @@ babel-plugin-jest-hoist@^29.6.3: babel-preset-current-node-syntax@^1.0.0: version "1.0.1" - resolved "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" integrity sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" @@ -1098,7 +1160,7 @@ babel-preset-current-node-syntax@^1.0.0: babel-preset-jest@^29.6.3: version "29.6.3" - resolved "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz#fa05fa510e7d493896d7b0dd2033601c840f171c" integrity sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA== dependencies: babel-plugin-jest-hoist "^29.6.3" @@ -1106,24 +1168,24 @@ babel-preset-jest@^29.6.3: balanced-match@^1.0.0: version "1.0.2" - resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== big-integer@^1.6.44: version "1.6.52" - resolved "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.52.tgz#60a887f3047614a8e1bffe5d7173490a97dc8c85" integrity sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg== bplist-parser@^0.2.0: version "0.2.0" - resolved "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz" + resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== dependencies: big-integer "^1.6.44" brace-expansion@^1.1.7: version "1.1.11" - resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" @@ -1131,21 +1193,21 @@ brace-expansion@^1.1.7: brace-expansion@^2.0.1: version "2.0.1" - resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== dependencies: balanced-match "^1.0.0" braces@^3.0.3: version "3.0.3" - resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: fill-range "^7.1.1" -browserslist@^4.22.2, "browserslist@>= 4.21.0": +browserslist@^4.22.2: version "4.22.2" - resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.22.2.tgz#704c4943072bd81ea18997f3bd2180e89c77874b" integrity sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A== dependencies: caniuse-lite "^1.0.30001565" @@ -1155,53 +1217,53 @@ browserslist@^4.22.2, "browserslist@>= 4.21.0": bs-logger@0.x: version "0.2.6" - resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz" + resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== dependencies: fast-json-stable-stringify "2.x" bser@2.1.1: version "2.1.1" - resolved "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz" + resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" integrity sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ== dependencies: node-int64 "^0.4.0" buffer-from@^1.0.0: version "1.1.2" - resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== bundle-name@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" integrity sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw== dependencies: run-applescript "^5.0.0" callsites@^3.0.0: version "3.1.0" - resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase@^5.3.1: version "5.3.1" - resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== camelcase@^6.2.0: version "6.3.0" - resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001565: version "1.0.30001570" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz#b4e5c1fa786f733ab78fc70f592df6b3f23244ca" integrity sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw== chalk@^2.4.2: version "2.4.2" - resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" @@ -1210,7 +1272,7 @@ chalk@^2.4.2: chalk@^4.0.0: version "4.1.2" - resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== dependencies: ansi-styles "^4.1.0" @@ -1218,27 +1280,27 @@ chalk@^4.0.0: char-regex@^1.0.2: version "1.0.2" - resolved "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/char-regex/-/char-regex-1.0.2.tgz#d744358226217f981ed58f479b1d6bcc29545dcf" integrity sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw== ci-info@^3.2.0: version "3.9.0" - resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== cjs-module-lexer@^1.0.0: version "1.2.3" - resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz" + resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz#6c370ab19f8a3394e318fe682686ec0ac684d107" integrity sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ== clean-stack@^2.0.0: version "2.2.0" - resolved "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz" + resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== cliui@^8.0.1: version "8.0.1" - resolved "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== dependencies: string-width "^4.2.0" @@ -1247,58 +1309,58 @@ cliui@^8.0.1: co@^4.6.0: version "4.6.0" - resolved "https://registry.npmjs.org/co/-/co-4.6.0.tgz" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ== collect-v8-coverage@^1.0.0: version "1.0.2" - resolved "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz#c0b29bcd33bcd0779a1344c2136051e6afd3d9e9" integrity sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q== color-convert@^1.9.0: version "1.9.3" - resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - color-name@1.1.3: version "1.1.3" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + combined-stream@^1.0.8: version "1.0.8" - resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz" + resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== dependencies: delayed-stream "~1.0.0" concat-map@0.0.1: version "0.0.1" - resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== convert-source-map@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== create-jest@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== dependencies: "@jest/types" "^29.6.3" @@ -1311,12 +1373,12 @@ create-jest@^29.7.0: create-require@^1.1.0: version "1.1.1" - resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.6" - resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== dependencies: path-key "^3.1.0" @@ -1325,36 +1387,36 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2: version "4.3.4" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" debug@^4.3.4: version "4.3.7" - resolved "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== dependencies: ms "^2.1.3" dedent@^1.0.0: version "1.5.1" - resolved "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.5.1.tgz#4f3fc94c8b711e9bb2800d185cd6ad20f2a90aff" integrity sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg== deep-is@^0.1.3: version "0.1.4" - resolved "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== deepmerge@^4.2.2: version "4.3.1" - resolved "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A== default-browser-id@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" integrity sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA== dependencies: bplist-parser "^0.2.0" @@ -1362,7 +1424,7 @@ default-browser-id@^3.0.0: default-browser@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-4.0.0.tgz#53c9894f8810bf86696de117a6ce9085a3cbc7da" integrity sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA== dependencies: bundle-name "^3.0.0" @@ -1372,93 +1434,93 @@ default-browser@^4.0.0: define-lazy-prop@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== delayed-stream@~1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= depd@^1.1.2: version "1.1.2" - resolved "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz" + resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak= detect-newline@^3.0.0: version "3.1.0" - resolved "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== diff-sequences@^29.6.3: version "29.6.3" - resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== diff@^4.0.1: version "4.0.2" - resolved "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== dir-glob@^3.0.1: version "3.0.1" - resolved "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== dependencies: path-type "^4.0.0" doctrine@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== dependencies: esutils "^2.0.2" electron-to-chromium@^1.4.601: version "1.4.614" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.614.tgz#2fe789d61fa09cb875569f37c309d0c2701f91c0" integrity sha512-X4ze/9Sc3QWs6h92yerwqv7aB/uU8vCjZcrMjA8N9R1pjMFRe44dLsck5FzLilOYvcXuDn93B+bpGYyufc70gQ== emittery@^0.13.1: version "0.13.1" - resolved "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" - resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== error-ex@^1.3.1: version "1.3.2" - resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== dependencies: is-arrayish "^0.2.1" escalade@^3.1.1: version "3.1.1" - resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== escape-string-regexp@^1.0.5: version "1.0.5" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== escape-string-regexp@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== escape-string-regexp@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== eslint-plugin-prettier@^5.0.1: version "5.0.1" - resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz#a3b399f04378f79f066379f544e42d6b73f11515" integrity sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg== dependencies: prettier-linter-helpers "^1.0.0" @@ -1466,19 +1528,19 @@ eslint-plugin-prettier@^5.0.1: eslint-plugin-unused-imports@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-3.0.0.tgz#d25175b0072ff16a91892c3aa72a09ca3a9e69e7" integrity sha512-sduiswLJfZHeeBJ+MQaG+xYzSWdRXoSw61DpU13mzWumCkR0ufD0HmO4kdNokjrkluMHpj/7PJeN35pgbhW3kw== dependencies: eslint-rule-composer "^0.3.0" eslint-rule-composer@^0.3.0: version "0.3.0" - resolved "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz" + resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== eslint-scope@^7.2.2: version "7.2.2" - resolved "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== dependencies: esrecurse "^4.3.0" @@ -1486,12 +1548,12 @@ eslint-scope@^7.2.2: eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: version "3.4.3" - resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -"eslint@^6.0.0 || ^7.0.0 || >=8.0.0", "eslint@^7.0.0 || ^8.0.0", eslint@^8.0.0, eslint@^8.49.0, eslint@>=8.0.0: +eslint@^8.49.0: version "8.50.0" - resolved "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.50.0.tgz#2ae6015fee0240fcd3f83e1e25df0287f487d6b2" integrity sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg== dependencies: "@eslint-community/eslint-utils" "^4.2.0" @@ -1534,7 +1596,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 espree@^9.6.0, espree@^9.6.1: version "9.6.1" - resolved "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== dependencies: acorn "^8.9.0" @@ -1543,41 +1605,41 @@ espree@^9.6.0, espree@^9.6.1: esprima@^4.0.0: version "4.0.1" - resolved "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== esquery@^1.4.2: version "1.5.0" - resolved "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== dependencies: estraverse "^5.1.0" esrecurse@^4.3.0: version "4.3.0" - resolved "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== dependencies: estraverse "^5.2.0" estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" - resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== esutils@^2.0.2: version "2.0.3" - resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== event-target-shim@^5.0.0: version "5.0.1" - resolved "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== execa@^5.0.0: version "5.1.1" - resolved "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== dependencies: cross-spawn "^7.0.3" @@ -1592,7 +1654,7 @@ execa@^5.0.0: execa@^7.1.1: version "7.2.0" - resolved "https://registry.npmjs.org/execa/-/execa-7.2.0.tgz" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== dependencies: cross-spawn "^7.0.3" @@ -1607,12 +1669,12 @@ execa@^7.1.1: exit@^0.1.2: version "0.1.2" - resolved "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz" + resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== expect@^29.0.0, expect@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== dependencies: "@jest/expect-utils" "^29.7.0" @@ -1623,24 +1685,35 @@ expect@^29.0.0, expect@^29.7.0: fast-check@^3.22.0: version "3.22.0" - resolved "https://registry.npmjs.org/fast-check/-/fast-check-3.22.0.tgz" + resolved "https://registry.yarnpkg.com/fast-check/-/fast-check-3.22.0.tgz#1a8153e9d6fbdcc60b818f447cbb9cac1fdd8fb6" integrity sha512-8HKz3qXqnHYp/VCNn2qfjHdAdcI8zcSqOyX64GOMukp7SL2bfzfeDKjSd+UyECtejccaZv3LcvZTm9YDD22iCQ== dependencies: pure-rand "^6.1.0" fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" - resolved "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== fast-diff@^1.1.2: version "1.3.0" - resolved "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== -fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: +fast-glob@^3.2.12: + version "3.2.12" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" + integrity sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-glob@^3.2.9, fast-glob@^3.3.0: version "3.3.2" - resolved "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== dependencies: "@nodelib/fs.stat" "^2.0.2" @@ -1649,47 +1722,47 @@ fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0, fast-json-stable-stringify@2.x: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" - resolved "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-levenshtein@^2.0.6: version "2.0.6" - resolved "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== fastq@^1.6.0: version "1.17.1" - resolved "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== dependencies: reusify "^1.0.4" fb-watchman@^2.0.0: version "2.0.2" - resolved "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz" + resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" integrity sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA== dependencies: bser "2.1.1" file-entry-cache@^6.0.1: version "6.0.1" - resolved "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: flat-cache "^3.0.4" fill-range@^7.1.1: version "7.1.1" - resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== dependencies: locate-path "^5.0.0" @@ -1697,7 +1770,7 @@ find-up@^4.0.0, find-up@^4.1.0: find-up@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== dependencies: locate-path "^6.0.0" @@ -1705,7 +1778,7 @@ find-up@^5.0.0: flat-cache@^3.0.4: version "3.0.4" - resolved "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: flatted "^3.1.0" @@ -1713,17 +1786,17 @@ flat-cache@^3.0.4: flatted@^3.1.0: version "3.2.7" - resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== form-data-encoder@1.7.2: version "1.7.2" - resolved "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== form-data@^3.0.0: version "3.0.1" - resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== dependencies: asynckit "^0.4.0" @@ -1732,7 +1805,7 @@ form-data@^3.0.0: formdata-node@^4.3.2: version "4.3.3" - resolved "https://registry.npmjs.org/formdata-node/-/formdata-node-4.3.3.tgz" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.3.3.tgz#21415225be66e2c87a917bfc0fedab30a119c23c" integrity sha512-coTew7WODO2vF+XhpUdmYz4UBvlsiTMSNaFYZlrXIqYbFd4W7bMwnoALNLE6uvNgzTg2j1JDF0ZImEfF06VPAA== dependencies: node-domexception "1.0.0" @@ -1740,61 +1813,61 @@ formdata-node@^4.3.2: fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@^2.3.2: version "2.3.3" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.2: version "1.1.2" - resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== gensync@^1.0.0-beta.2: version "1.0.0-beta.2" - resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" + resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-package-type@^0.1.0: version "0.1.0" - resolved "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz" + resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== get-stdin@^8.0.0: version "8.0.0" - resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53" integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg== get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" - resolved "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== glob-parent@^5.1.2: version "5.1.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" glob-parent@^6.0.2: version "6.0.2" - resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== dependencies: is-glob "^4.0.3" glob@^7.1.3, glob@^7.1.4: version "7.2.3" - resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" @@ -1806,19 +1879,19 @@ glob@^7.1.3, glob@^7.1.4: globals@^11.1.0: version "11.12.0" - resolved "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== globals@^13.19.0: version "13.20.0" - resolved "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82" integrity sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ== dependencies: type-fest "^0.20.2" globby@^11.1.0: version "11.1.0" - resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== dependencies: array-union "^2.1.0" @@ -1830,68 +1903,68 @@ globby@^11.1.0: graceful-fs@^4.2.9: version "4.2.11" - resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== graphemer@^1.4.0: version "1.4.0" - resolved "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== has-flag@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== has-flag@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== hasown@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== dependencies: function-bind "^1.1.2" html-escaper@^2.0.0: version "2.0.2" - resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== human-signals@^2.1.0: version "2.1.0" - resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== human-signals@^4.3.0: version "4.3.1" - resolved "https://registry.npmjs.org/human-signals/-/human-signals-4.3.1.tgz" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== humanize-ms@^1.2.1: version "1.2.1" - resolved "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz" + resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" integrity sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0= dependencies: ms "^2.0.0" iconv-lite@^0.6.3: version "0.6.3" - resolved "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== dependencies: safer-buffer ">= 2.1.2 < 3.0.0" ignore@^5.2.0, ignore@^5.2.4: version "5.3.2" - resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5" integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g== import-fresh@^3.2.1: version "3.3.0" - resolved "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" @@ -1899,7 +1972,7 @@ import-fresh@^3.2.1: import-local@^3.0.2: version "3.1.0" - resolved "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" integrity sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg== dependencies: pkg-dir "^4.2.0" @@ -1907,118 +1980,118 @@ import-local@^3.0.2: imurmurhash@^0.1.4: version "0.1.4" - resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== indent-string@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-4.0.0.tgz#624f8f4497d619b2d9768531d58f4122854d7251" integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== inflight@^1.0.4: version "1.0.6" - resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== dependencies: once "^1.3.0" wrappy "1" -inherits@^2.0.3, inherits@2: +inherits@2, inherits@^2.0.3: version "2.0.4" - resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== is-arrayish@^0.2.1: version "0.2.1" - resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== is-core-module@^2.13.0: version "2.13.1" - resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== dependencies: hasown "^2.0.0" is-docker@^2.0.0: version "2.2.1" - resolved "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== is-docker@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== is-extglob@^2.1.1: version "2.1.1" - resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== is-fullwidth-code-point@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-generator-fn@^2.0.0: version "2.1.0" - resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" + resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" - resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== dependencies: is-extglob "^2.1.1" is-inside-container@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== dependencies: is-docker "^3.0.0" is-number@^7.0.0: version "7.0.0" - resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== is-path-inside@^3.0.3: version "3.0.3" - resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== is-stream@^2.0.0: version "2.0.1" - resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== is-stream@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== is-wsl@^2.2.0: version "2.2.0" - resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== dependencies: is-docker "^2.0.0" isexe@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.2" - resolved "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== istanbul-lib-instrument@^5.0.4: version "5.2.1" - resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== dependencies: "@babel/core" "^7.12.3" @@ -2029,7 +2102,7 @@ istanbul-lib-instrument@^5.0.4: istanbul-lib-instrument@^6.0.0: version "6.0.1" - resolved "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz#71e87707e8041428732518c6fb5211761753fbdf" integrity sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA== dependencies: "@babel/core" "^7.12.3" @@ -2040,7 +2113,7 @@ istanbul-lib-instrument@^6.0.0: istanbul-lib-report@^3.0.0: version "3.0.1" - resolved "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz#908305bac9a5bd175ac6a74489eafd0fc2445a7d" integrity sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw== dependencies: istanbul-lib-coverage "^3.0.0" @@ -2049,7 +2122,7 @@ istanbul-lib-report@^3.0.0: istanbul-lib-source-maps@^4.0.0: version "4.0.1" - resolved "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz#895f3a709fcfba34c6de5a42939022f3e4358551" integrity sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw== dependencies: debug "^4.1.1" @@ -2058,7 +2131,7 @@ istanbul-lib-source-maps@^4.0.0: istanbul-reports@^3.1.3: version "3.1.6" - resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.6.tgz#2544bcab4768154281a2f0870471902704ccaa1a" integrity sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg== dependencies: html-escaper "^2.0.0" @@ -2066,7 +2139,7 @@ istanbul-reports@^3.1.3: jest-changed-files@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: execa "^5.0.0" @@ -2075,7 +2148,7 @@ jest-changed-files@^29.7.0: jest-circus@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.7.0.tgz#b6817a45fcc835d8b16d5962d0c026473ee3668a" integrity sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw== dependencies: "@jest/environment" "^29.7.0" @@ -2101,7 +2174,7 @@ jest-circus@^29.7.0: jest-cli@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: "@jest/core" "^29.7.0" @@ -2118,7 +2191,7 @@ jest-cli@^29.7.0: jest-config@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== dependencies: "@babel/core" "^7.11.6" @@ -2146,7 +2219,7 @@ jest-config@^29.7.0: jest-diff@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" integrity sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw== dependencies: chalk "^4.0.0" @@ -2156,14 +2229,14 @@ jest-diff@^29.7.0: jest-docblock@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" integrity sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g== dependencies: detect-newline "^3.0.0" jest-each@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" integrity sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ== dependencies: "@jest/types" "^29.6.3" @@ -2174,7 +2247,7 @@ jest-each@^29.7.0: jest-environment-node@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw== dependencies: "@jest/environment" "^29.7.0" @@ -2186,12 +2259,12 @@ jest-environment-node@^29.7.0: jest-get-type@^29.6.3: version "29.6.3" - resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" integrity sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw== jest-haste-map@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.7.0.tgz#3c2396524482f5a0506376e6c858c3bbcc17b104" integrity sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA== dependencies: "@jest/types" "^29.6.3" @@ -2210,7 +2283,7 @@ jest-haste-map@^29.7.0: jest-leak-detector@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" integrity sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw== dependencies: jest-get-type "^29.6.3" @@ -2218,7 +2291,7 @@ jest-leak-detector@^29.7.0: jest-matcher-utils@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" integrity sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g== dependencies: chalk "^4.0.0" @@ -2228,7 +2301,7 @@ jest-matcher-utils@^29.7.0: jest-message-util@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" integrity sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w== dependencies: "@babel/code-frame" "^7.12.13" @@ -2243,7 +2316,7 @@ jest-message-util@^29.7.0: jest-mock@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" integrity sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw== dependencies: "@jest/types" "^29.6.3" @@ -2252,25 +2325,25 @@ jest-mock@^29.7.0: jest-pnp-resolver@^1.2.2: version "1.2.3" - resolved "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz#930b1546164d4ad5937d5540e711d4d38d4cad2e" integrity sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w== jest-regex-util@^29.6.3: version "29.6.3" - resolved "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== jest-resolve-dependencies@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: jest-regex-util "^29.6.3" jest-snapshot "^29.7.0" -jest-resolve@*, jest-resolve@^29.7.0: +jest-resolve@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.7.0.tgz#64d6a8992dd26f635ab0c01e5eef4399c6bcbc30" integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== dependencies: chalk "^4.0.0" @@ -2285,7 +2358,7 @@ jest-resolve@*, jest-resolve@^29.7.0: jest-runner@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" integrity sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ== dependencies: "@jest/console" "^29.7.0" @@ -2312,7 +2385,7 @@ jest-runner@^29.7.0: jest-runtime@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" integrity sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ== dependencies: "@jest/environment" "^29.7.0" @@ -2340,7 +2413,7 @@ jest-runtime@^29.7.0: jest-snapshot@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" integrity sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw== dependencies: "@babel/core" "^7.11.6" @@ -2366,7 +2439,7 @@ jest-snapshot@^29.7.0: jest-util@^29.0.0, jest-util@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.7.0.tgz#23c2b62bfb22be82b44de98055802ff3710fc0bc" integrity sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA== dependencies: "@jest/types" "^29.6.3" @@ -2378,7 +2451,7 @@ jest-util@^29.0.0, jest-util@^29.7.0: jest-validate@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" integrity sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw== dependencies: "@jest/types" "^29.6.3" @@ -2390,7 +2463,7 @@ jest-validate@^29.7.0: jest-watcher@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" integrity sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g== dependencies: "@jest/test-result" "^29.7.0" @@ -2404,7 +2477,7 @@ jest-watcher@^29.7.0: jest-worker@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.7.0.tgz#acad073acbbaeb7262bd5389e1bcf43e10058d4a" integrity sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw== dependencies: "@types/node" "*" @@ -2412,9 +2485,9 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.0.0, jest@^29.4.0: +jest@^29.4.0: version "29.7.0" - resolved "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: "@jest/core" "^29.7.0" @@ -2424,12 +2497,12 @@ jest@^29.0.0, jest@^29.4.0: js-tokens@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== js-yaml@^3.13.1: version "3.14.1" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.1.tgz#dae812fdb3825fa306609a8717383c50c36a0537" integrity sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g== dependencies: argparse "^1.0.7" @@ -2437,54 +2510,54 @@ js-yaml@^3.13.1: js-yaml@^4.1.0: version "4.1.0" - resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" jsesc@^2.5.1: version "2.5.2" - resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== json-parse-even-better-errors@^2.3.0: version "2.3.1" - resolved "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== json-schema-traverse@^0.4.1: version "0.4.1" - resolved "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== json5@^2.2.2, json5@^2.2.3: version "2.2.3" - resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== jsonc-parser@^3.2.0: version "3.2.1" - resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== kleur@^3.0.3: version "3.0.3" - resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" + resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== leven@^3.1.0: version "3.1.0" - resolved "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== levn@^0.4.1: version "0.4.1" - resolved "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== dependencies: prelude-ls "^1.2.1" @@ -2492,72 +2565,79 @@ levn@^0.4.1: lines-and-columns@^1.1.6: version "1.2.4" - resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== locate-path@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== dependencies: p-locate "^4.1.0" locate-path@^6.0.0: version "6.0.0" - resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== dependencies: p-locate "^5.0.0" lodash.memoize@4.x: version "4.1.2" - resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" + resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== lodash.merge@^4.6.2: version "4.6.2" - resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== lru-cache@^5.1.1: version "5.1.1" - resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== dependencies: yallist "^3.0.2" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + make-dir@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-4.0.0.tgz#c3c2307a771277cd9638305f915c29ae741b614e" integrity sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw== dependencies: semver "^7.5.3" -make-error@^1.1.1, make-error@1.x: +make-error@1.x, make-error@^1.1.1: version "1.3.6" - resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== makeerror@1.0.12: version "1.0.12" - resolved "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz" + resolved "https://registry.yarnpkg.com/makeerror/-/makeerror-1.0.12.tgz#3e5dd2079a82e812e983cc6610c4a2cb0eaa801a" integrity sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg== dependencies: tmpl "1.0.5" merge-stream@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== merge2@^1.3.0, merge2@^1.4.1: version "1.4.1" - resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== micromatch@^4.0.4: version "4.0.8" - resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202" integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA== dependencies: braces "^3.0.3" @@ -2565,125 +2645,125 @@ micromatch@^4.0.4: mime-db@1.51.0: version "1.51.0" - resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c" integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g== mime-types@^2.1.12: version "2.1.34" - resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24" integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A== dependencies: mime-db "1.51.0" mimic-fn@^2.1.0: version "2.1.0" - resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== mimic-fn@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - minimatch@9.0.3: version "9.0.3" - resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== dependencies: brace-expansion "^2.0.1" +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimist@^1.2.6: version "1.2.6" - resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== -ms@^2.0.0, ms@^2.1.3: - version "2.1.3" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - ms@2.1.2: version "2.1.2" - resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@^2.0.0, ms@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + natural-compare@^1.4.0: version "1.4.0" - resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== node-domexception@1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== node-fetch@^2.6.7: version "2.6.11" - resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" integrity sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w== dependencies: whatwg-url "^5.0.0" node-int64@^0.4.0: version "0.4.0" - resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz" + resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.14: version "2.0.14" - resolved "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.14.tgz#2ffb053bceb8b2be8495ece1ab6ce600c4461b0b" integrity sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw== normalize-path@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== npm-run-path@^4.0.1: version "4.0.1" - resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== dependencies: path-key "^3.0.0" npm-run-path@^5.1.0: version "5.1.0" - resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== dependencies: path-key "^4.0.0" once@^1.3.0: version "1.4.0" - resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" onetime@^5.1.2: version "5.1.2" - resolved "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== dependencies: mimic-fn "^2.1.0" onetime@^6.0.0: version "6.0.0" - resolved "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== dependencies: mimic-fn "^4.0.0" open@^9.1.0: version "9.1.0" - resolved "https://registry.npmjs.org/open/-/open-9.1.0.tgz" + resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6" integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg== dependencies: default-browser "^4.0.0" @@ -2693,7 +2773,7 @@ open@^9.1.0: optionator@^0.9.3: version "0.9.3" - resolved "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== dependencies: "@aashutoshrathi/word-wrap" "^1.2.3" @@ -2705,61 +2785,61 @@ optionator@^0.9.3: p-all@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/p-all/-/p-all-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/p-all/-/p-all-3.0.0.tgz#077c023c37e75e760193badab2bad3ccd5782bfb" integrity sha512-qUZbvbBFVXm6uJ7U/WDiO0fv6waBMbjlCm4E66oZdRR+egswICarIdHyVSZZHudH8T5SF8x/JG0q0duFzPnlBw== dependencies: p-map "^4.0.0" p-limit@^2.2.0: version "2.3.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== dependencies: p-try "^2.0.0" p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" - resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== dependencies: yocto-queue "^0.1.0" p-locate@^4.1.0: version "4.1.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== dependencies: p-limit "^2.2.0" p-locate@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== dependencies: p-limit "^3.0.2" p-map@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b" integrity sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ== dependencies: aggregate-error "^3.0.0" p-try@^2.0.0: version "2.2.0" - resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== parent-module@^1.0.0: version "1.0.1" - resolved "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== dependencies: callsites "^3.0.0" parse-json@^5.2.0: version "5.2.0" - resolved "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== dependencies: "@babel/code-frame" "^7.0.0" @@ -2769,81 +2849,81 @@ parse-json@^5.2.0: path-exists@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== path-key@^3.0.0, path-key@^3.1.0: version "3.1.1" - resolved "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== path-key@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== path-parse@^1.0.7: version "1.0.7" - resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== path-type@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== picocolors@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" - resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== pirates@^4.0.4: version "4.0.6" - resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== pkg-dir@^4.2.0: version "4.2.0" - resolved "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== dependencies: find-up "^4.0.0" prelude-ls@^1.2.1: version "1.2.1" - resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== "prettier-2@npm:prettier@^2": version "2.8.8" - resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== prettier-linter-helpers@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== dependencies: fast-diff "^1.1.2" -prettier@^3.0.0, prettier@>=3.0.0: +prettier@^3.0.0: version "3.1.1" - resolved "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.1.tgz#6ba9f23165d690b6cbdaa88cb0807278f7019848" integrity sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" - resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== dependencies: "@jest/schemas" "^29.6.3" @@ -2852,7 +2932,7 @@ pretty-format@^29.0.0, pretty-format@^29.7.0: prompts@^2.0.1: version "2.4.2" - resolved "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz" + resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" integrity sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q== dependencies: kleur "^3.0.3" @@ -2860,27 +2940,32 @@ prompts@^2.0.1: punycode@^2.1.0: version "2.3.0" - resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== -pure-rand@^6.0.0, pure-rand@^6.1.0: +pure-rand@^6.0.0: + version "6.0.4" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.4.tgz#50b737f6a925468679bff00ad20eade53f37d5c7" + integrity sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA== + +pure-rand@^6.1.0: version "6.1.0" - resolved "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== queue-microtask@^1.2.2: version "1.2.3" - resolved "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== react-is@^18.0.0: version "18.2.0" - resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== readable-stream@^3.4.0: version "3.6.2" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" @@ -2889,34 +2974,34 @@ readable-stream@^3.4.0: require-directory@^2.1.1: version "2.1.1" - resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" + resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== resolve-cwd@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== dependencies: resolve-from "^5.0.0" resolve-from@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== resolve-from@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== resolve.exports@^2.0.0: version "2.0.2" - resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.20.0: version "1.22.8" - resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: is-core-module "^2.13.0" @@ -2925,85 +3010,87 @@ resolve@^1.20.0: reusify@^1.0.4: version "1.0.4" - resolved "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== rimraf@^3.0.2: version "3.0.2" - resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" run-applescript@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-5.0.0.tgz#e11e1c932e055d5c6b40d98374e0268d9b11899c" integrity sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg== dependencies: execa "^5.0.0" run-parallel@^1.1.9: version "1.2.0" - resolved "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== dependencies: queue-microtask "^1.2.2" safe-buffer@~5.2.0: version "5.2.1" - resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" - resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -semver@^6.3.0: +semver@^6.3.0, semver@^6.3.1: version "6.3.1" - resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^6.3.1: - version "6.3.1" - resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" -semver@^7.5.3, semver@^7.5.4: +semver@^7.5.4: version "7.6.3" - resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.3.tgz#980f7b5550bc175fb4dc09403085627f9eb33143" integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== shebang-command@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== dependencies: shebang-regex "^3.0.0" shebang-regex@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" - resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== sisteransi@^1.0.5: version "1.0.5" - resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz" + resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== slash@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== source-map-support@0.5.13: version "0.5.13" - resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== dependencies: buffer-from "^1.0.0" @@ -3011,31 +3098,24 @@ source-map-support@0.5.13: source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" - resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== sprintf-js@~1.0.2: version "1.0.3" - resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== stack-utils@^2.0.3: version "2.0.6" - resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" + resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.6.tgz#aaf0748169c02fc33c8232abccf933f54a1cc34f" integrity sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ== dependencies: escape-string-regexp "^2.0.0" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - string-length@^4.0.1: version "4.0.2" - resolved "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" integrity sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ== dependencies: char-regex "^1.0.2" @@ -3043,86 +3123,93 @@ string-length@^4.0.1: string-to-stream@^3.0.1: version "3.0.1" - resolved "https://registry.npmjs.org/string-to-stream/-/string-to-stream-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/string-to-stream/-/string-to-stream-3.0.1.tgz#480e6fb4d5476d31cb2221f75307a5dcb6638a42" integrity sha512-Hl092MV3USJuUCC6mfl9sPzGloA3K5VwdIeJjYIkXY/8K+mUvaeEabWJgArp+xXrsWxCajeT2pc4axbVhIZJyg== dependencies: readable-stream "^3.4.0" string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: emoji-regex "^8.0.0" is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" - resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== dependencies: ansi-regex "^5.0.1" strip-bom@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== strip-bom@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== strip-final-newline@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== strip-final-newline@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== strip-json-comments@^3.1.1: version "3.1.1" - resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== superstruct@^1.0.3: version "1.0.3" - resolved "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz" + resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-1.0.3.tgz#de626a5b49c6641ff4d37da3c7598e7a87697046" integrity sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg== supports-color@^5.3.0: version "5.5.0" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" supports-color@^7.1.0: version "7.2.0" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== dependencies: has-flag "^4.0.0" supports-color@^8.0.0: version "8.1.1" - resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== dependencies: has-flag "^4.0.0" supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" - resolved "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== synckit@^0.8.5: version "0.8.6" - resolved "https://registry.npmjs.org/synckit/-/synckit-0.8.6.tgz" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.6.tgz#b69b7fbce3917c2673cbdc0d87fb324db4a5b409" integrity sha512-laHF2savN6sMeHCjLRkheIU4wo3Zg9Ln5YOjOo7sZ5dVQW8yF5pPE5SIw1dsPhq3TRp1jisKRCdPhfs/1WMqDA== dependencies: "@pkgr/utils" "^2.4.2" @@ -3130,7 +3217,7 @@ synckit@^0.8.5: test-exclude@^6.0.0: version "6.0.0" - resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== dependencies: "@istanbuljs/schema" "^0.1.2" @@ -3139,44 +3226,44 @@ test-exclude@^6.0.0: text-table@^0.2.0: version "0.2.0" - resolved "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== titleize@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" integrity sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ== tmpl@1.0.5: version "1.0.5" - resolved "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-fast-properties@^2.0.0: version "2.0.0" - resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" integrity sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog== to-regex-range@^5.0.1: version "5.0.1" - resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== dependencies: is-number "^7.0.0" tr46@~0.0.3: version "0.0.3" - resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= ts-api-utils@^1.0.1: version "1.3.0" - resolved "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== ts-jest@^29.1.0: version "29.1.1" - resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== dependencies: bs-logger "0.x" @@ -3188,9 +3275,9 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" -ts-node@^10.5.0, ts-node@>=9.0.0: +ts-node@^10.5.0: version "10.7.0" - resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== dependencies: "@cspotcode/source-map-support" "0.7.0" @@ -3209,7 +3296,7 @@ ts-node@^10.5.0, ts-node@>=9.0.0: tsc-multi@^1.1.0: version "1.1.0" - resolved "https://registry.npmjs.org/tsc-multi/-/tsc-multi-1.1.0.tgz" + resolved "https://registry.yarnpkg.com/tsc-multi/-/tsc-multi-1.1.0.tgz#0e2b03c0ed0ac58ecb556f11709441102d202680" integrity sha512-THE6X+sse7EZ2qMhqXvBhd2HMTvXyWwYnx+2T/ijqdp/6Rf7rUc2uPRzPdrrljZCNcYDeL0qP2P7tqm2IwayTg== dependencies: debug "^4.3.4" @@ -3225,58 +3312,63 @@ tsc-multi@^1.1.0: tsconfig-paths@^4.0.0: version "4.2.0" - resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-4.2.0.tgz#ef78e19039133446d244beac0fd6a1632e2d107c" integrity sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg== dependencies: json5 "^2.2.2" minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.5.0, tslib@^2.6.0, tslib@^2.6.2: +tslib@^2.5.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3" + integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== + +tslib@^2.6.0, tslib@^2.6.2: version "2.6.2" - resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" - resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== dependencies: prelude-ls "^1.2.1" type-detect@4.0.8: version "4.0.8" - resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" + resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== type-fest@^0.20.2: version "0.20.2" - resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== type-fest@^0.21.3: version "0.21.3" - resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typescript@^4.8.2, typescript@>=2.7, typescript@>=4.2.0, "typescript@>=4.3 <6", typescript@>=4.3.0: +typescript@^4.8.2: version "4.9.5" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== undici-types@~5.26.4: version "5.26.5" - resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== untildify@^4.0.0: version "4.0.0" - resolved "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== update-browserslist-db@^1.0.13: version "1.0.13" - resolved "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4" integrity sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg== dependencies: escalade "^3.1.1" @@ -3284,24 +3376,24 @@ update-browserslist-db@^1.0.13: uri-js@^4.2.2: version "4.4.1" - resolved "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== dependencies: punycode "^2.1.0" util-deprecate@^1.0.1: version "1.0.2" - resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== v8-compile-cache-lib@^3.0.0: version "3.0.0" - resolved "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== v8-to-istanbul@^9.0.1: version "9.2.0" - resolved "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== dependencies: "@jridgewell/trace-mapping" "^0.3.12" @@ -3310,24 +3402,24 @@ v8-to-istanbul@^9.0.1: walker@^1.0.8: version "1.0.8" - resolved "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz" + resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" integrity sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ== dependencies: makeerror "1.0.12" web-streams-polyfill@4.0.0-beta.1: version "4.0.0-beta.1" - resolved "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.1.tgz#3b19b9817374b7cee06d374ba7eeb3aeb80e8c95" integrity sha512-3ux37gEX670UUphBF9AMCq8XM6iQ8Ac6A+DSRRjDoRBm1ufCkaCDdNVbaqq60PsEkdNlLKrGtv/YBP4EJXqNtQ== webidl-conversions@^3.0.0: version "3.0.1" - resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= whatwg-url@^5.0.0: version "5.0.0" - resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= dependencies: tr46 "~0.0.3" @@ -3335,14 +3427,14 @@ whatwg-url@^5.0.0: which@^2.0.1: version "2.0.2" - resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== dependencies: isexe "^2.0.0" wrap-ansi@^7.0.0: version "7.0.0" - resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" @@ -3351,12 +3443,12 @@ wrap-ansi@^7.0.0: wrappy@1: version "1.0.2" - resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== write-file-atomic@^4.0.2: version "4.0.2" - resolved "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== dependencies: imurmurhash "^0.1.4" @@ -3364,27 +3456,32 @@ write-file-atomic@^4.0.2: ws@^8.18.0: version "8.18.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== y18n@^5.0.5: version "5.0.8" - resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" + resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^3.0.2: version "3.1.1" - resolved "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== + yargs-parser@^21.0.1, yargs-parser@^21.1.1: version "21.1.1" - resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== yargs@^17.3.1, yargs@^17.7.1: version "17.7.2" - resolved "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== dependencies: cliui "^8.0.1" @@ -3397,15 +3494,15 @@ yargs@^17.3.1, yargs@^17.7.1: yn@3.1.1: version "3.1.1" - resolved "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== yocto-queue@^0.1.0: version "0.1.0" - resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" + resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== zod@^3.23.8: version "3.23.8" - resolved "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g== From f8ed654ebb6b044ebf0f324a725533e5c58282ee Mon Sep 17 00:00:00 2001 From: pakrym-oai Date: Thu, 22 May 2025 09:27:00 -0700 Subject: [PATCH 405/509] let --- examples/responses/stream_background.ts | 2 +- src/lib/responses/ResponseStream.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/responses/stream_background.ts b/examples/responses/stream_background.ts index 7a7847b1b..d3ecb7e6c 100755 --- a/examples/responses/stream_background.ts +++ b/examples/responses/stream_background.ts @@ -11,7 +11,7 @@ async function main() { background: true, }); - var id: string | null = null; + let id: string | null = null; for await (const event of runner) { if (event.type == 'response.created') { diff --git a/src/lib/responses/ResponseStream.ts b/src/lib/responses/ResponseStream.ts index 79f61bd35..e8fe0cb3a 100644 --- a/src/lib/responses/ResponseStream.ts +++ b/src/lib/responses/ResponseStream.ts @@ -174,8 +174,8 @@ export class ResponseStream } this.#beginRequest(); - var stream: Stream | undefined; - var starting_after: number | null = null; + let stream: Stream | undefined; + let starting_after: number | null = null; if ('response_id' in params) { stream = await client.responses.retrieve( params.response_id, From 1ddd6ff182b09d696954fda4bde50fb82f1d6585 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 19:58:07 +0000 Subject: [PATCH 406/509] feat(api): new streaming helpers for background responses --- .stats.yml | 6 +- api.md | 1 - src/lib/responses/EventTypes.ts | 2 - src/resources/beta/realtime/realtime.ts | 8 +- src/resources/chat/completions/completions.ts | 4 +- src/resources/containers/files/files.ts | 5 +- src/resources/responses/input-items.ts | 2 +- src/resources/responses/responses.ts | 154 ++---------------- 8 files changed, 30 insertions(+), 152 deletions(-) diff --git a/.stats.yml b/.stats.yml index 41319e5e5..017aa58a1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6af14840a810139bf407013167ce1c8fb21b6ef8eb0cc3db58b51af7d52c4b5a.yml -openapi_spec_hash: 3241bde6b273cfec0035e522bd07985d -config_hash: 7367b68a4e7db36885c1a886f57b17f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml +openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c +config_hash: c497f6b750cc89c0bf2eefc0bc839c70 diff --git a/api.md b/api.md index 4e8187d0f..fde6fa2a3 100644 --- a/api.md +++ b/api.md @@ -692,7 +692,6 @@ Types: - ResponseRefusalDoneEvent - ResponseStatus - ResponseStreamEvent -- ResponseTextAnnotationDeltaEvent - ResponseTextConfig - ResponseTextDeltaEvent - ResponseTextDoneEvent diff --git a/src/lib/responses/EventTypes.ts b/src/lib/responses/EventTypes.ts index fc1620988..8fc419fc6 100644 --- a/src/lib/responses/EventTypes.ts +++ b/src/lib/responses/EventTypes.ts @@ -24,7 +24,6 @@ import { ResponseOutputItemDoneEvent, ResponseRefusalDeltaEvent, ResponseRefusalDoneEvent, - ResponseTextAnnotationDeltaEvent, ResponseTextDeltaEvent as RawResponseTextDeltaEvent, ResponseTextDoneEvent, ResponseIncompleteEvent, @@ -68,7 +67,6 @@ export type ParsedResponseStreamEvent = | ResponseOutputItemDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent - | ResponseTextAnnotationDeltaEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 26fba883e..5ced1574f 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -928,7 +928,7 @@ export namespace RealtimeClientEvent { * the server to stop generating audio and emit a `output_audio_buffer.cleared` * event. This event should be preceded by a `response.cancel` client event to stop * the generation of the current response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferClear { /** @@ -1227,7 +1227,7 @@ export namespace RealtimeServerEvent { * **WebRTC Only:** Emitted when the server begins streaming audio to the client. * This event is emitted after an audio content part has been added * (`response.content_part.added`) to the response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferStarted { /** @@ -1250,7 +1250,7 @@ export namespace RealtimeServerEvent { * **WebRTC Only:** Emitted when the output audio buffer has been completely * drained on the server, and no more audio is forthcoming. This event is emitted * after the full response data has been sent to the client (`response.done`). - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferStopped { /** @@ -1275,7 +1275,7 @@ export namespace RealtimeServerEvent { * (`input_audio_buffer.speech_started`), or when the client has emitted the * `output_audio_buffer.clear` event to manually cut off the current audio * response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferCleared { /** diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 6481f8e0f..06bb0b495 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1453,8 +1453,8 @@ export interface ChatCompletionCreateParamsBase { top_p?: number | null; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; diff --git a/src/resources/containers/files/files.ts b/src/resources/containers/files/files.ts index 0c249df0f..eb4159a5c 100644 --- a/src/resources/containers/files/files.ts +++ b/src/resources/containers/files/files.ts @@ -21,7 +21,10 @@ export class Files extends APIResource { body: FileCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.post(`/containers/${containerId}/files`, { body, ...options }); + return this._client.post( + `/containers/${containerId}/files`, + Core.multipartFormRequestOptions({ body, ...options }), + ); } /** diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 74707f184..211b6a7b6 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -88,7 +88,7 @@ export interface InputItemListParams extends CursorPageParams { include?: Array; /** - * The order to return the input items in. Default is `asc`. + * The order to return the input items in. Default is `desc`. * * - `asc`: Return the input items in ascending order. * - `desc`: Return the input items in descending order. diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 586a6af0c..a0839e432 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -546,8 +546,8 @@ export interface Response { usage?: ResponseUsage; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; @@ -3928,7 +3928,6 @@ export type ResponseStreamEvent = | ResponseReasoningSummaryTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent - | ResponseTextAnnotationDeltaEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent @@ -3953,121 +3952,6 @@ export type ResponseStreamEvent = | ResponseReasoningSummaryDeltaEvent | ResponseReasoningSummaryDoneEvent; -/** - * Emitted when a text annotation is added. - */ -export interface ResponseTextAnnotationDeltaEvent { - /** - * A citation to a file. - */ - annotation: - | ResponseTextAnnotationDeltaEvent.FileCitation - | ResponseTextAnnotationDeltaEvent.URLCitation - | ResponseTextAnnotationDeltaEvent.FilePath; - - /** - * The index of the annotation that was added. - */ - annotation_index: number; - - /** - * The index of the content part that the text annotation was added to. - */ - content_index: number; - - /** - * The ID of the output item that the text annotation was added to. - */ - item_id: string; - - /** - * The index of the output item that the text annotation was added to. - */ - output_index: number; - - /** - * The sequence number of this event. - */ - sequence_number: number; - - /** - * The type of the event. Always `response.output_text.annotation.added`. - */ - type: 'response.output_text.annotation.added'; -} - -export namespace ResponseTextAnnotationDeltaEvent { - /** - * A citation to a file. - */ - export interface FileCitation { - /** - * The ID of the file. - */ - file_id: string; - - /** - * The index of the file in the list of files. - */ - index: number; - - /** - * The type of the file citation. Always `file_citation`. - */ - type: 'file_citation'; - } - - /** - * A citation for a web resource used to generate a model response. - */ - export interface URLCitation { - /** - * The index of the last character of the URL citation in the message. - */ - end_index: number; - - /** - * The index of the first character of the URL citation in the message. - */ - start_index: number; - - /** - * The title of the web resource. - */ - title: string; - - /** - * The type of the URL citation. Always `url_citation`. - */ - type: 'url_citation'; - - /** - * The URL of the web resource. - */ - url: string; - } - - /** - * A path to a file. - */ - export interface FilePath { - /** - * The ID of the file. - */ - file_id: string; - - /** - * The index of the file in the list of files. - */ - index: number; - - /** - * The type of the file path. Always `file_path`. - */ - type: 'file_path'; - } -} - /** * Configuration options for a text response from the model. Can be plain text or * structured JSON data. Learn more: @@ -4228,14 +4112,14 @@ export interface ResponseWebSearchCallCompletedEvent { item_id: string; /** - * A sequence number for this chunk of the stream response. + * The index of the output item that the web search call is associated with. */ - sequence_number: number; + output_index: number; /** - * The index of the output item that the web search call is associated with. + * The sequence number of the web search call being processed. */ - output_index: number; + sequence_number: number; /** * The type of the event. Always `response.web_search_call.completed`. @@ -4253,14 +4137,14 @@ export interface ResponseWebSearchCallInProgressEvent { item_id: string; /** - * A sequence number for this chunk of the stream response. + * The index of the output item that the web search call is associated with. */ - sequence_number: number; + output_index: number; /** - * The index of the output item that the web search call is associated with. + * The sequence number of the web search call being processed. */ - output_index: number; + sequence_number: number; /** * The type of the event. Always `response.web_search_call.in_progress`. @@ -4278,14 +4162,14 @@ export interface ResponseWebSearchCallSearchingEvent { item_id: string; /** - * A sequence number for this chunk of the stream response. + * The index of the output item that the web search call is associated with. */ - sequence_number: number; + output_index: number; /** - * The index of the output item that the web search call is associated with. + * The sequence number of the web search call being processed. */ - output_index: number; + sequence_number: number; /** * The type of the event. Always `response.web_search_call.searching`. @@ -4366,11 +4250,6 @@ export namespace Tool { * A list of tools that never require approval. */ never?: McpToolApprovalFilter.Never; - - /** - * List of allowed tool names. - */ - tool_names?: Array; } export namespace McpToolApprovalFilter { @@ -4827,8 +4706,8 @@ export interface ResponseCreateParamsBase { truncation?: 'auto' | 'disabled' | null; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; @@ -4975,7 +4854,6 @@ export declare namespace Responses { type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, type ResponseStatus as ResponseStatus, type ResponseStreamEvent as ResponseStreamEvent, - type ResponseTextAnnotationDeltaEvent as ResponseTextAnnotationDeltaEvent, type ResponseTextConfig as ResponseTextConfig, type ResponseTextDeltaEvent as ResponseTextDeltaEvent, type ResponseTextDoneEvent as ResponseTextDoneEvent, From 00b63f4d706e6f9694a4588dc723ac6cf9db240c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 19:58:37 +0000 Subject: [PATCH 407/509] release: 4.103.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a39d68281..7bd02ca78 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.102.0" + ".": "4.103.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b6254488a..6e9589bc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 4.103.0 (2025-05-22) + +Full Changelog: [v4.102.0...v4.103.0](https://github.com/openai/openai-node/compare/v4.102.0...v4.103.0) + +### Features + +* **api:** new streaming helpers for background responses ([1ddd6ff](https://github.com/openai/openai-node/commit/1ddd6ff182b09d696954fda4bde50fb82f1d6585)) + ## 4.102.0 (2025-05-21) Full Changelog: [v4.101.0...v4.102.0](https://github.com/openai/openai-node/compare/v4.101.0...v4.102.0) diff --git a/jsr.json b/jsr.json index a48e4e9ca..b35a86451 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.102.0", + "version": "4.103.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index c1886271b..ba999c878 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.102.0", + "version": "4.103.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 180cea6da..81be9e239 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.102.0'; // x-release-please-version +export const VERSION = '4.103.0'; // x-release-please-version From a9d9511615e48ab0edd297a9692b4ae9a3d442ad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:06:17 +0000 Subject: [PATCH 408/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 017aa58a1..d761f22d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: c497f6b750cc89c0bf2eefc0bc839c70 +config_hash: 535b6e5f26a295d609b259c8cb8f656c From 353349de9ee10d32d3243cb5c60a8ae982c49d37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:30:52 +0000 Subject: [PATCH 409/509] chore(internal): fix release workflows --- bin/check-release-environment | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/check-release-environment b/bin/check-release-environment index e51564b7d..dbfd546bf 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${STAINLESS_API_KEY}" ]; then + errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") +fi + if [ -z "${NPM_TOKEN}" ]; then errors+=("The OPENAI_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi From c160550761eed22b038ac8a5b477729fe298834c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 19:54:15 +0000 Subject: [PATCH 410/509] fix(client): always overwrite when merging headers --- src/internal/headers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/headers.ts b/src/internal/headers.ts index 8659ddea8..5cc03ce32 100644 --- a/src/internal/headers.ts +++ b/src/internal/headers.ts @@ -71,8 +71,8 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator { const targetHeaders = new Headers(); const nullHeaders = new Set(); - const seenHeaders = new Set(); for (const headers of newHeaders) { + const seenHeaders = new Set(); for (const [name, value] of iterateHeaders(headers)) { const lowerName = name.toLowerCase(); if (!seenHeaders.has(lowerName)) { From 500a82f45d46697be14987e12d896acb2b109d32 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 22:00:26 +0000 Subject: [PATCH 411/509] chore(package): remove engines --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index ec332e255..837fd2e14 100644 --- a/package.json +++ b/package.json @@ -77,9 +77,6 @@ "require": "./dist/*.js" } }, - "engines": { - "node": ">= 20" - }, "peerDependencies": { "ws": "^8.18.0", "zod": "^3.23.8" From b349adeff0df0b6c56d937da082900e7331d1ab6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 21:29:14 +0000 Subject: [PATCH 412/509] feat(api): responses x eval api --- .stats.yml | 6 +- api.md | 2 + src/client.ts | 2 + src/resources/audio/transcriptions.ts | 34 + src/resources/embeddings.ts | 7 +- src/resources/evals/evals.ts | 89 +- src/resources/evals/index.ts | 2 + src/resources/evals/runs/index.ts | 1 + src/resources/evals/runs/runs.ts | 1444 +++-------------- src/resources/fine-tuning/jobs/jobs.ts | 2 +- src/resources/index.ts | 1 + .../audio/transcriptions.test.ts | 1 + 12 files changed, 375 insertions(+), 1216 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5f1bee851..11ba2b010 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-794a6ed3c3d3d77887564755168056af8a426b17cf1ec721e3a300503dc22a41.yml -openapi_spec_hash: 25a81c220713cd5b0bafc221d1dfa79a -config_hash: 0b768ed1b56c6d82816f0fa40dc4aaf5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml +openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 +config_hash: 7da27f7260075e8813ddcea542fba1bf diff --git a/api.md b/api.md index 248f7768c..f12fc7f0d 100644 --- a/api.md +++ b/api.md @@ -708,6 +708,7 @@ Methods: Types: - EvalCustomDataSourceConfig +- EvalLogsDataSourceConfig - EvalStoredCompletionsDataSourceConfig - EvalCreateResponse - EvalRetrieveResponse @@ -729,6 +730,7 @@ Types: - CreateEvalCompletionsRunDataSource - CreateEvalJSONLRunDataSource +- CreateEvalResponsesRunDataSource - EvalAPIError - RunCreateResponse - RunRetrieveResponse diff --git a/src/client.ts b/src/client.ts index 12fd53b59..c7819209b 100644 --- a/src/client.ts +++ b/src/client.ts @@ -93,6 +93,7 @@ import { EvalListParams, EvalListResponse, EvalListResponsesPage, + EvalLogsDataSourceConfig, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, EvalUpdateParams, @@ -1065,6 +1066,7 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index fc99ab948..3b9d34222 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -327,6 +327,14 @@ export interface TranscriptionCreateParamsBase< */ model: (string & {}) | AudioAPI.AudioModel; + /** + * Controls how the audio is cut into chunks. When set to `"auto"`, the server + * first normalizes loudness and then uses voice activity detection (VAD) to choose + * boundaries. `server_vad` object can be provided to tweak VAD detection + * parameters manually. If unset, the audio is transcribed as a single block. + */ + chunking_strategy?: 'auto' | TranscriptionCreateParams.VadConfig | null; + /** * Additional information to include in the transcription response. `logprobs` will * return the log probabilities of the tokens in the response to understand the @@ -390,6 +398,32 @@ export interface TranscriptionCreateParamsBase< } export namespace TranscriptionCreateParams { + export interface VadConfig { + /** + * Must be set to `server_vad` to enable manual chunking using server side VAD. + */ + type: 'server_vad'; + + /** + * Amount of audio to include before the VAD detected speech (in milliseconds). + */ + prefix_padding_ms?: number; + + /** + * Duration of silence to detect speech stop (in milliseconds). With shorter values + * the model will respond more quickly, but may jump in on short pauses from the + * user. + */ + silence_duration_ms?: number; + + /** + * Sensitivity threshold (0.0 to 1.0) for voice activity detection. A higher + * threshold will require louder audio to activate the model, and thus might + * perform better in noisy environments. + */ + threshold?: number; + } + export type TranscriptionCreateParamsNonStreaming = TranscriptionsAPI.TranscriptionCreateParamsNonStreaming; export type TranscriptionCreateParamsStreaming = TranscriptionsAPI.TranscriptionCreateParamsStreaming; } diff --git a/src/resources/embeddings.ts b/src/resources/embeddings.ts index bb77cd78f..d57fa0d01 100644 --- a/src/resources/embeddings.ts +++ b/src/resources/embeddings.ts @@ -90,11 +90,12 @@ export interface EmbeddingCreateParams { * Input text to embed, encoded as a string or array of tokens. To embed multiple * inputs in a single request, pass an array of strings or array of token arrays. * The input must not exceed the max input tokens for the model (8192 tokens for - * `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 + * all embedding models), cannot be an empty string, and any array must be 2048 * dimensions or less. * [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) - * for counting tokens. Some models may also impose a limit on total number of - * tokens summed across inputs. + * for counting tokens. In addition to the per-input token limit, all embedding + * models enforce a maximum of 300,000 tokens summed across all inputs in a single + * request. */ input: string | Array | Array | Array>; diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 88369e461..fea459353 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -8,6 +8,7 @@ import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, + CreateEvalResponsesRunDataSource, EvalAPIError, RunCancelParams, RunCancelResponse, @@ -97,11 +98,37 @@ export interface EvalCustomDataSourceConfig { } /** - * A StoredCompletionsDataSourceConfig which specifies the metadata property of - * your stored completions query. This is usually metadata like `usecase=chatbot` - * or `prompt-version=v2`, etc. The schema returned by this data source config is - * used to defined what variables are available in your evals. `item` and `sample` - * are both defined when using this data source config. + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ +export interface EvalLogsDataSourceConfig { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; +} + +/** + * @deprecated Deprecated in favor of LogsDataSourceConfig. */ export interface EvalStoredCompletionsDataSourceConfig { /** @@ -111,9 +138,9 @@ export interface EvalStoredCompletionsDataSourceConfig { schema: Record; /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `stored-completions`. */ - type: 'stored_completions'; + type: 'stored-completions'; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -148,7 +175,10 @@ export interface EvalCreateResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -236,7 +266,10 @@ export interface EvalRetrieveResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -324,7 +357,10 @@ export interface EvalUpdateResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -412,7 +448,10 @@ export interface EvalListResponse { /** * Configuration of data sources used in runs of the evaluation. */ - data_source_config: EvalCustomDataSourceConfig | EvalStoredCompletionsDataSourceConfig; + data_source_config: + | EvalCustomDataSourceConfig + | EvalLogsDataSourceConfig + | EvalStoredCompletionsDataSourceConfig; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -490,7 +529,7 @@ export interface EvalCreateParams { /** * The configuration for the data source used for the evaluation runs. */ - data_source_config: EvalCreateParams.Custom | EvalCreateParams.StoredCompletions; + data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs | EvalCreateParams.StoredCompletions; /** * A list of graders for all eval runs in this group. @@ -547,15 +586,29 @@ export namespace EvalCreateParams { } /** - * A data source config which specifies the metadata property of your stored - * completions query. This is usually metadata like `usecase=chatbot` or - * `prompt-version=v2`, etc. + * A data source config which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. + */ + export interface Logs { + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * Metadata filters for the logs data source. + */ + metadata?: Record; + } + + /** + * Deprecated in favor of LogsDataSourceConfig. */ export interface StoredCompletions { /** - * The type of data source. Always `stored_completions`. + * The type of data source. Always `stored-completions`. */ - type: 'stored_completions'; + type: 'stored-completions'; /** * Metadata filters for the stored completions data source. @@ -723,6 +776,7 @@ Evals.Runs = Runs; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -739,6 +793,7 @@ export declare namespace Evals { Runs as Runs, type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index cd74e0edc..d59ba7b72 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -3,6 +3,7 @@ export { Evals, type EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -18,6 +19,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource, type EvalAPIError, type RunCreateResponse, type RunRetrieveResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index e51e04c11..b684cb165 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -12,6 +12,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource, type EvalAPIError, type RunCreateResponse, type RunRetrieveResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 4f12435e4..6f23dc2d9 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -313,6 +313,242 @@ export namespace CreateEvalJSONLRunDataSource { } } +/** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ +export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; +} + +export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } +} + /** * An object representing an error response from the Eval API. */ @@ -348,7 +584,7 @@ export interface RunCreateResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCreateResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -411,241 +647,7 @@ export interface RunCreateResponse { status: string; } -export namespace RunCreateResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - +export namespace RunCreateResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -741,7 +743,7 @@ export interface RunRetrieveResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunRetrieveResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -805,240 +807,6 @@ export interface RunRetrieveResponse { } export namespace RunRetrieveResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1134,7 +902,7 @@ export interface RunListResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunListResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -1188,250 +956,16 @@ export interface RunListResponse { /** * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunListResponse.ResultCounts; - - /** - * The status of the evaluation run. - */ - status: string; -} - -export namespace RunListResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} +export namespace RunListResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1535,7 +1069,7 @@ export interface RunCancelResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCancelResponse.Completions; + | CreateEvalResponsesRunDataSource; /** * An object representing an error response from the Eval API. @@ -1599,240 +1133,6 @@ export interface RunCancelResponse { } export namespace RunCancelResponse { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface Completions { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: Completions.FileContent | Completions.FileID | Completions.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: Completions.Template | Completions.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: Completions.SamplingParams; - } - - export namespace Completions { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } - export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1915,7 +1215,7 @@ export interface RunCreateParams { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | RunCreateParams.CreateEvalResponsesRunDataSource; + | CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1933,247 +1233,6 @@ export interface RunCreateParams { name?: string; } -export namespace RunCreateParams { - /** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ - export interface CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: - | CreateEvalResponsesRunDataSource.FileContent - | CreateEvalResponsesRunDataSource.FileID - | CreateEvalResponsesRunDataSource.Responses; - - /** - * The type of run data source. Always `completions`. - */ - type: 'completions'; - - input_messages?: - | CreateEvalResponsesRunDataSource.Template - | CreateEvalResponsesRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; - } - - export namespace CreateEvalResponsesRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Whether to allow parallel tool calls. This is a query parameter used to select - * responses. - */ - allow_parallel_tool_calls?: boolean | null; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional search string for instructions. This is a query parameter used to - * select responses. - */ - instructions_search?: string | null; - - /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. - */ - metadata?: unknown | null; - - /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. - */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; - } - - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; - - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; - } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - - /** - * A higher temperature increases randomness in the outputs. - */ - temperature?: number; - - /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. - */ - top_p?: number; - } - } -} - export interface RunRetrieveParams { /** * The ID of the evaluation to retrieve runs for. @@ -2215,6 +1274,7 @@ export declare namespace Runs { export { type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, + type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index d69663ff8..c1ed972c2 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -295,7 +295,7 @@ export namespace FineTuningJob { * Number of examples in each batch. A larger batch size means that model * parameters are updated less frequently, but with lower variance. */ - batch_size?: 'auto' | number; + batch_size?: unknown | 'auto' | number | null; /** * Scaling factor for the learning rate. A smaller learning rate may be useful to diff --git a/src/resources/index.ts b/src/resources/index.ts index eb244dfda..5244fb74a 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -32,6 +32,7 @@ export { export { Evals, type EvalCustomDataSourceConfig, + type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, diff --git a/tests/api-resources/audio/transcriptions.test.ts b/tests/api-resources/audio/transcriptions.test.ts index 62d478701..4111b519f 100644 --- a/tests/api-resources/audio/transcriptions.test.ts +++ b/tests/api-resources/audio/transcriptions.test.ts @@ -26,6 +26,7 @@ describe('resource transcriptions', () => { const response = await client.audio.transcriptions.create({ file: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'gpt-4o-transcribe', + chunking_strategy: 'auto', include: ['logprobs'], language: 'language', prompt: 'prompt', From debe5295d077f79cc4b4eefefb008e5a10b32793 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 15 May 2025 23:47:30 +0000 Subject: [PATCH 413/509] feat(api): manual updates --- .stats.yml | 2 +- api.md | 5 + src/client.ts | 3 + src/resources/beta/beta.ts | 2 + src/resources/beta/index.ts | 1 + src/resources/beta/threads/index.ts | 1 + src/resources/beta/threads/runs/runs.ts | 44 +--- src/resources/beta/threads/threads.ts | 43 ++-- src/resources/evals/evals.ts | 49 +--- src/resources/evals/index.ts | 2 + src/resources/evals/runs/index.ts | 2 + src/resources/evals/runs/runs.ts | 233 ++++--------------- src/resources/graders/grader-models.ts | 94 +------- src/resources/index.ts | 1 + src/resources/shared.ts | 44 ++++ src/resources/vector-stores/index.ts | 1 + src/resources/vector-stores/vector-stores.ts | 75 ++---- 17 files changed, 155 insertions(+), 447 deletions(-) diff --git a/.stats.yml b/.stats.yml index 11ba2b010..202b915dc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 -config_hash: 7da27f7260075e8813ddcea542fba1bf +config_hash: bdacc55eb995c15255ec82130eb8c3bb diff --git a/api.md b/api.md index f12fc7f0d..06b734aaa 100644 --- a/api.md +++ b/api.md @@ -7,6 +7,7 @@ Types: - ComparisonFilter - CompoundFilter - ErrorObject +- EvalItem - FunctionDefinition - FunctionParameters - Metadata @@ -302,6 +303,7 @@ Types: - StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted +- VectorStoreExpirationAfter - VectorStoreSearchResponse Methods: @@ -462,6 +464,7 @@ Types: - AssistantToolChoiceOption - Thread - ThreadDeleted +- TruncationObject Methods: @@ -732,6 +735,8 @@ Types: - CreateEvalJSONLRunDataSource - CreateEvalResponsesRunDataSource - EvalAPIError +- EvalJSONLFileContentSource +- EvalJSONLFileIDSource - RunCreateResponse - RunRetrieveResponse - RunListResponse diff --git a/src/client.ts b/src/client.ts index c7819209b..1f175529c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -120,6 +120,7 @@ import { VectorStore, VectorStoreCreateParams, VectorStoreDeleted, + VectorStoreExpirationAfter, VectorStoreListParams, VectorStoreSearchParams, VectorStoreSearchResponse, @@ -1033,6 +1034,7 @@ export declare namespace OpenAI { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, @@ -1084,6 +1086,7 @@ export declare namespace OpenAI { export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; + export type EvalItem = API.EvalItem; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 1f16f7264..5b5570df6 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -90,6 +90,7 @@ import { ThreadDeleted, ThreadUpdateParams, Threads, + TruncationObject, } from './threads/threads'; import { Chat } from './chat/chat'; @@ -187,6 +188,7 @@ export declare namespace Beta { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, + type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 18746c1d4..3657a1dad 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -29,6 +29,7 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, + type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index 7eefa6553..66cef8c1e 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -67,6 +67,7 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, + type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 2e28e4ef4..509f53b2d 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -540,7 +540,7 @@ export interface Run { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy: Run.TruncationStrategy | null; + truncation_strategy: ThreadsAPI.TruncationObject | null; /** * Usage statistics related to the run. This value will be `null` if the run is not @@ -615,26 +615,6 @@ export namespace Run { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - /** * Usage statistics related to the run. This value will be `null` if the run is not * in a terminal state (i.e. `in_progress`, `queued`, etc.). @@ -838,7 +818,7 @@ export interface RunCreateParamsBase { * Body param: Controls for how a thread will be truncated prior to the run. Use * this to control the intial context window of the run. */ - truncation_strategy?: RunCreateParams.TruncationStrategy | null; + truncation_strategy?: ThreadsAPI.TruncationObject | null; } export namespace RunCreateParams { @@ -897,26 +877,6 @@ export namespace RunCreateParams { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - export type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; export type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 7af258e85..900e015d0 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -337,6 +337,26 @@ export interface ThreadDeleted { object: 'thread.deleted'; } +/** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ +export interface TruncationObject { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; +} + export interface ThreadCreateParams { /** * A list of [messages](https://platform.openai.com/docs/api-reference/messages) to @@ -725,7 +745,7 @@ export interface ThreadCreateAndRunParamsBase { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null; + truncation_strategy?: TruncationObject | null; } export namespace ThreadCreateAndRunParams { @@ -956,26 +976,6 @@ export namespace ThreadCreateAndRunParams { } } - /** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ - export interface TruncationStrategy { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; - } - export type ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; export type ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; } @@ -1343,6 +1343,7 @@ export declare namespace Threads { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, + type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index fea459353..4dacaa60f 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -3,13 +3,14 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; import * as GraderModelsAPI from '../graders/grader-models'; -import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, CreateEvalResponsesRunDataSource, EvalAPIError, + EvalJSONLFileContentSource, + EvalJSONLFileIDSource, RunCancelParams, RunCancelResponse, RunCreateParams, @@ -625,7 +626,7 @@ export namespace EvalCreateParams { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - input: Array; + input: Array; /** * The labels to classify to each item in the evaluation. @@ -665,48 +666,6 @@ export namespace EvalCreateParams { */ role: string; } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } /** @@ -795,6 +754,8 @@ export declare namespace Evals { type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, + type EvalJSONLFileContentSource as EvalJSONLFileContentSource, + type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index d59ba7b72..9ce6d6255 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -21,6 +21,8 @@ export { type CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource, type EvalAPIError, + type EvalJSONLFileContentSource, + type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index b684cb165..ff08fb646 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -14,6 +14,8 @@ export { type CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource, type EvalAPIError, + type EvalJSONLFileContentSource, + type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 6f23dc2d9..70709504d 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -80,8 +80,8 @@ export interface CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ source: - | CreateEvalCompletionsRunDataSource.FileContent - | CreateEvalCompletionsRunDataSource.FileID + | EvalJSONLFileContentSource + | EvalJSONLFileIDSource | CreateEvalCompletionsRunDataSource.StoredCompletions; /** @@ -102,38 +102,6 @@ export interface CreateEvalCompletionsRunDataSource { } export namespace CreateEvalCompletionsRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -179,7 +147,7 @@ export namespace CreateEvalCompletionsRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -187,50 +155,6 @@ export namespace CreateEvalCompletionsRunDataSource { type: 'template'; } - export namespace Template { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Message { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Message.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Message { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } - } - export interface ItemReference { /** * A reference to a variable in the "item" namespace. Ie, "item.name" @@ -271,7 +195,7 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { - source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; + source: EvalJSONLFileContentSource | EvalJSONLFileIDSource; /** * The type of data source. Always `jsonl`. @@ -279,40 +203,6 @@ export interface CreateEvalJSONLRunDataSource { type: 'jsonl'; } -export namespace CreateEvalJSONLRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } -} - /** * A ResponsesRunDataSource object describing a model sampling configuration. */ @@ -320,10 +210,7 @@ export interface CreateEvalResponsesRunDataSource { /** * A EvalResponsesSource object describing a run data source configuration. */ - source: - | CreateEvalResponsesRunDataSource.FileContent - | CreateEvalResponsesRunDataSource.FileID - | CreateEvalResponsesRunDataSource.Responses; + source: EvalJSONLFileContentSource | EvalJSONLFileIDSource | CreateEvalResponsesRunDataSource.Responses; /** * The type of run data source. Always `responses`. @@ -341,38 +228,6 @@ export interface CreateEvalResponsesRunDataSource { } export namespace CreateEvalResponsesRunDataSource { - export interface FileContent { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; - } - - export namespace FileContent { - export interface Content { - item: Record; - - sample?: Record; - } - } - - export interface FileID { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; - } - /** * A EvalResponsesSource object describing a run data source configuration. */ @@ -450,7 +305,7 @@ export namespace CreateEvalResponsesRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -470,48 +325,6 @@ export namespace CreateEvalResponsesRunDataSource { */ role: string; } - - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } } export interface ItemReference { @@ -564,6 +377,38 @@ export interface EvalAPIError { message: string; } +export interface EvalJSONLFileContentSource { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; +} + +export namespace EvalJSONLFileContentSource { + export interface Content { + item: Record; + + sample?: Record; + } +} + +export interface EvalJSONLFileIDSource { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; +} + /** * A schema representing an evaluation run. */ @@ -1276,6 +1121,8 @@ export declare namespace Runs { type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, + type EvalJSONLFileContentSource as EvalJSONLFileContentSource, + type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts index 6c43c7c03..445390067 100644 --- a/src/resources/graders/grader-models.ts +++ b/src/resources/graders/grader-models.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; -import * as ResponsesAPI from '../responses/responses'; +import * as Shared from '../shared'; export class GraderModels extends APIResource {} @@ -10,7 +10,7 @@ export class GraderModels extends APIResource {} * the evaluation. */ export interface LabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -38,50 +38,6 @@ export interface LabelModelGrader { type: 'label_model'; } -export namespace LabelModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A MultiGrader object combines the output of multiple graders to produce a single * score. @@ -140,7 +96,7 @@ export interface ScoreModelGrader { /** * The input text. This may include template strings. */ - input: Array; + input: Array; /** * The model to use for the evaluation. @@ -168,50 +124,6 @@ export interface ScoreModelGrader { sampling_params?: unknown; } -export namespace ScoreModelGrader { - /** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ - export interface Input { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | Input.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; - } - - export namespace Input { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } - } -} - /** * A StringCheckGrader object that performs a string comparison between input and * reference using a specified operation. diff --git a/src/resources/index.ts b/src/resources/index.ts index 5244fb74a..9cff486ff 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -89,6 +89,7 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 1c0006b18..d0c2aaa49 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,5 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import * as ResponsesAPI from './responses/responses'; + export type AllModels = | (string & {}) | ChatModel @@ -118,6 +120,48 @@ export interface ErrorObject { type: string; } +/** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ +export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; +} + +export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } +} + export interface FunctionDefinition { /** * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain diff --git a/src/resources/vector-stores/index.ts b/src/resources/vector-stores/index.ts index cbcb36221..5f782e44c 100644 --- a/src/resources/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -33,6 +33,7 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, + type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index de08d0494..cf0545a4a 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -250,7 +250,7 @@ export interface VectorStore { /** * The expiration policy for a vector store. */ - expires_after?: VectorStore.ExpiresAfter; + expires_after?: VectorStoreExpirationAfter; /** * The Unix timestamp (in seconds) for when the vector store will expire. @@ -285,22 +285,6 @@ export namespace VectorStore { */ total: number; } - - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } } export interface VectorStoreDeleted { @@ -311,6 +295,22 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } +/** + * The expiration policy for a vector store. + */ +export interface VectorStoreExpirationAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; +} + export interface VectorStoreSearchResponse { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -366,7 +366,7 @@ export interface VectorStoreCreateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreCreateParams.ExpiresAfter; + expires_after?: VectorStoreExpirationAfter; /** * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that @@ -391,29 +391,11 @@ export interface VectorStoreCreateParams { name?: string; } -export namespace VectorStoreCreateParams { - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } -} - export interface VectorStoreUpdateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreUpdateParams.ExpiresAfter | null; + expires_after?: VectorStoreExpirationAfter | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -431,24 +413,6 @@ export interface VectorStoreUpdateParams { name?: string | null; } -export namespace VectorStoreUpdateParams { - /** - * The expiration policy for a vector store. - */ - export interface ExpiresAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; - } -} - export interface VectorStoreListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -518,6 +482,7 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, + type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, From e68f598107aba01ce1bcab61ac616d4cf70380c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 17:11:07 +0000 Subject: [PATCH 414/509] feat(api): Updating Assistants and Evals API schemas --- .stats.yml | 6 +- api.md | 7 - src/client.ts | 5 - src/resources/beta/beta.ts | 2 - src/resources/beta/index.ts | 1 - src/resources/beta/threads/index.ts | 1 - src/resources/beta/threads/runs/runs.ts | 44 +- src/resources/beta/threads/threads.ts | 43 +- src/resources/evals/evals.ts | 210 ++- src/resources/evals/index.ts | 4 - src/resources/evals/runs/index.ts | 3 - src/resources/evals/runs/runs.ts | 1511 +++++++++++++++--- src/resources/graders/grader-models.ts | 96 +- src/resources/index.ts | 2 - src/resources/shared.ts | 45 +- src/resources/vector-stores/index.ts | 1 - src/resources/vector-stores/vector-stores.ts | 75 +- 17 files changed, 1680 insertions(+), 376 deletions(-) diff --git a/.stats.yml b/.stats.yml index 202b915dc..a3c5d081d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-161ca7f1cfd7b33c1fc07d0ce25dfe4be5a7271c394f4cb526b7fb21b0729900.yml -openapi_spec_hash: 602e14add4bee018c6774e320ce309b8 -config_hash: bdacc55eb995c15255ec82130eb8c3bb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5fa16b9a02985ae06e41be14946a9c325dc672fb014b3c19abca65880c6990e6.yml +openapi_spec_hash: da3e669f65130043b1170048c0727890 +config_hash: d8d5fda350f6db77c784f35429741a2e diff --git a/api.md b/api.md index 06b734aaa..248f7768c 100644 --- a/api.md +++ b/api.md @@ -7,7 +7,6 @@ Types: - ComparisonFilter - CompoundFilter - ErrorObject -- EvalItem - FunctionDefinition - FunctionParameters - Metadata @@ -303,7 +302,6 @@ Types: - StaticFileChunkingStrategyObjectParam - VectorStore - VectorStoreDeleted -- VectorStoreExpirationAfter - VectorStoreSearchResponse Methods: @@ -464,7 +462,6 @@ Types: - AssistantToolChoiceOption - Thread - ThreadDeleted -- TruncationObject Methods: @@ -711,7 +708,6 @@ Methods: Types: - EvalCustomDataSourceConfig -- EvalLogsDataSourceConfig - EvalStoredCompletionsDataSourceConfig - EvalCreateResponse - EvalRetrieveResponse @@ -733,10 +729,7 @@ Types: - CreateEvalCompletionsRunDataSource - CreateEvalJSONLRunDataSource -- CreateEvalResponsesRunDataSource - EvalAPIError -- EvalJSONLFileContentSource -- EvalJSONLFileIDSource - RunCreateResponse - RunRetrieveResponse - RunListResponse diff --git a/src/client.ts b/src/client.ts index 1f175529c..12fd53b59 100644 --- a/src/client.ts +++ b/src/client.ts @@ -93,7 +93,6 @@ import { EvalListParams, EvalListResponse, EvalListResponsesPage, - EvalLogsDataSourceConfig, EvalRetrieveResponse, EvalStoredCompletionsDataSourceConfig, EvalUpdateParams, @@ -120,7 +119,6 @@ import { VectorStore, VectorStoreCreateParams, VectorStoreDeleted, - VectorStoreExpirationAfter, VectorStoreListParams, VectorStoreSearchParams, VectorStoreSearchResponse, @@ -1034,7 +1032,6 @@ export declare namespace OpenAI { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, @@ -1068,7 +1065,6 @@ export declare namespace OpenAI { export { Evals as Evals, type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -1086,7 +1082,6 @@ export declare namespace OpenAI { export type ComparisonFilter = API.ComparisonFilter; export type CompoundFilter = API.CompoundFilter; export type ErrorObject = API.ErrorObject; - export type EvalItem = API.EvalItem; export type FunctionDefinition = API.FunctionDefinition; export type FunctionParameters = API.FunctionParameters; export type Metadata = API.Metadata; diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 5b5570df6..1f16f7264 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -90,7 +90,6 @@ import { ThreadDeleted, ThreadUpdateParams, Threads, - TruncationObject, } from './threads/threads'; import { Chat } from './chat/chat'; @@ -188,7 +187,6 @@ export declare namespace Beta { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, - type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 3657a1dad..18746c1d4 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -29,7 +29,6 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, - type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/index.ts b/src/resources/beta/threads/index.ts index 66cef8c1e..7eefa6553 100644 --- a/src/resources/beta/threads/index.ts +++ b/src/resources/beta/threads/index.ts @@ -67,7 +67,6 @@ export { type AssistantToolChoiceOption, type Thread, type ThreadDeleted, - type TruncationObject, type ThreadCreateParams, type ThreadUpdateParams, type ThreadCreateAndRunParams, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 509f53b2d..2e28e4ef4 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -540,7 +540,7 @@ export interface Run { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy: ThreadsAPI.TruncationObject | null; + truncation_strategy: Run.TruncationStrategy | null; /** * Usage statistics related to the run. This value will be `null` if the run is not @@ -615,6 +615,26 @@ export namespace Run { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + /** * Usage statistics related to the run. This value will be `null` if the run is not * in a terminal state (i.e. `in_progress`, `queued`, etc.). @@ -818,7 +838,7 @@ export interface RunCreateParamsBase { * Body param: Controls for how a thread will be truncated prior to the run. Use * this to control the intial context window of the run. */ - truncation_strategy?: ThreadsAPI.TruncationObject | null; + truncation_strategy?: RunCreateParams.TruncationStrategy | null; } export namespace RunCreateParams { @@ -877,6 +897,26 @@ export namespace RunCreateParams { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + export type RunCreateParamsNonStreaming = RunsAPI.RunCreateParamsNonStreaming; export type RunCreateParamsStreaming = RunsAPI.RunCreateParamsStreaming; } diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index 900e015d0..7af258e85 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -337,26 +337,6 @@ export interface ThreadDeleted { object: 'thread.deleted'; } -/** - * Controls for how a thread will be truncated prior to the run. Use this to - * control the intial context window of the run. - */ -export interface TruncationObject { - /** - * The truncation strategy to use for the thread. The default is `auto`. If set to - * `last_messages`, the thread will be truncated to the n most recent messages in - * the thread. When set to `auto`, messages in the middle of the thread will be - * dropped to fit the context length of the model, `max_prompt_tokens`. - */ - type: 'auto' | 'last_messages'; - - /** - * The number of most recent messages from the thread when constructing the context - * for the run. - */ - last_messages?: number | null; -} - export interface ThreadCreateParams { /** * A list of [messages](https://platform.openai.com/docs/api-reference/messages) to @@ -745,7 +725,7 @@ export interface ThreadCreateAndRunParamsBase { * Controls for how a thread will be truncated prior to the run. Use this to * control the intial context window of the run. */ - truncation_strategy?: TruncationObject | null; + truncation_strategy?: ThreadCreateAndRunParams.TruncationStrategy | null; } export namespace ThreadCreateAndRunParams { @@ -976,6 +956,26 @@ export namespace ThreadCreateAndRunParams { } } + /** + * Controls for how a thread will be truncated prior to the run. Use this to + * control the intial context window of the run. + */ + export interface TruncationStrategy { + /** + * The truncation strategy to use for the thread. The default is `auto`. If set to + * `last_messages`, the thread will be truncated to the n most recent messages in + * the thread. When set to `auto`, messages in the middle of the thread will be + * dropped to fit the context length of the model, `max_prompt_tokens`. + */ + type: 'auto' | 'last_messages'; + + /** + * The number of most recent messages from the thread when constructing the context + * for the run. + */ + last_messages?: number | null; + } + export type ThreadCreateAndRunParamsNonStreaming = ThreadsAPI.ThreadCreateAndRunParamsNonStreaming; export type ThreadCreateAndRunParamsStreaming = ThreadsAPI.ThreadCreateAndRunParamsStreaming; } @@ -1343,7 +1343,6 @@ export declare namespace Threads { type AssistantToolChoiceOption as AssistantToolChoiceOption, type Thread as Thread, type ThreadDeleted as ThreadDeleted, - type TruncationObject as TruncationObject, type ThreadCreateParams as ThreadCreateParams, type ThreadUpdateParams as ThreadUpdateParams, type ThreadCreateAndRunParams as ThreadCreateAndRunParams, diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 4dacaa60f..297640a87 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -3,14 +3,12 @@ import { APIResource } from '../../core/resource'; import * as Shared from '../shared'; import * as GraderModelsAPI from '../graders/grader-models'; +import * as ResponsesAPI from '../responses/responses'; import * as RunsAPI from './runs/runs'; import { CreateEvalCompletionsRunDataSource, CreateEvalJSONLRunDataSource, - CreateEvalResponsesRunDataSource, EvalAPIError, - EvalJSONLFileContentSource, - EvalJSONLFileIDSource, RunCancelParams, RunCancelResponse, RunCreateParams, @@ -98,36 +96,6 @@ export interface EvalCustomDataSourceConfig { type: 'custom'; } -/** - * A LogsDataSourceConfig which specifies the metadata property of your logs query. - * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The - * schema returned by this data source config is used to defined what variables are - * available in your evals. `item` and `sample` are both defined when using this - * data source config. - */ -export interface EvalLogsDataSourceConfig { - /** - * The json schema for the run data source items. Learn how to build JSON schemas - * [here](https://json-schema.org/). - */ - schema: Record; - - /** - * The type of data source. Always `logs`. - */ - type: 'logs'; - - /** - * 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; -} - /** * @deprecated Deprecated in favor of LogsDataSourceConfig. */ @@ -178,7 +146,7 @@ export interface EvalCreateResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalCreateResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -214,6 +182,36 @@ export interface EvalCreateResponse { } export namespace EvalCreateResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -269,7 +267,7 @@ export interface EvalRetrieveResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalRetrieveResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -305,6 +303,36 @@ export interface EvalRetrieveResponse { } export namespace EvalRetrieveResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -360,7 +388,7 @@ export interface EvalUpdateResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalUpdateResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -396,6 +424,36 @@ export interface EvalUpdateResponse { } export namespace EvalUpdateResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -451,7 +509,7 @@ export interface EvalListResponse { */ data_source_config: | EvalCustomDataSourceConfig - | EvalLogsDataSourceConfig + | EvalListResponse.Logs | EvalStoredCompletionsDataSourceConfig; /** @@ -487,6 +545,36 @@ export interface EvalListResponse { } export namespace EvalListResponse { + /** + * A LogsDataSourceConfig which specifies the metadata property of your logs query. + * This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc. The + * schema returned by this data source config is used to defined what variables are + * available in your evals. `item` and `sample` are both defined when using this + * data source config. + */ + export interface Logs { + /** + * The json schema for the run data source items. Learn how to build JSON schemas + * [here](https://json-schema.org/). + */ + schema: Record; + + /** + * The type of data source. Always `logs`. + */ + type: 'logs'; + + /** + * 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; + } + /** * A TextSimilarityGrader object which grades text based on similarity metrics. */ @@ -626,7 +714,7 @@ export namespace EvalCreateParams { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - input: Array; + input: Array; /** * The labels to classify to each item in the evaluation. @@ -666,6 +754,48 @@ export namespace EvalCreateParams { */ role: string; } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } } /** @@ -735,7 +865,6 @@ Evals.Runs = Runs; export declare namespace Evals { export { type EvalCustomDataSourceConfig as EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig as EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig as EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse as EvalCreateResponse, type EvalRetrieveResponse as EvalRetrieveResponse, @@ -752,10 +881,7 @@ export declare namespace Evals { Runs as Runs, type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, - type EvalJSONLFileContentSource as EvalJSONLFileContentSource, - type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/evals/index.ts b/src/resources/evals/index.ts index 9ce6d6255..cd74e0edc 100644 --- a/src/resources/evals/index.ts +++ b/src/resources/evals/index.ts @@ -3,7 +3,6 @@ export { Evals, type EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -19,10 +18,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource, type EvalAPIError, - type EvalJSONLFileContentSource, - type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/index.ts b/src/resources/evals/runs/index.ts index ff08fb646..e51e04c11 100644 --- a/src/resources/evals/runs/index.ts +++ b/src/resources/evals/runs/index.ts @@ -12,10 +12,7 @@ export { Runs, type CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource, type EvalAPIError, - type EvalJSONLFileContentSource, - type EvalJSONLFileIDSource, type RunCreateResponse, type RunRetrieveResponse, type RunListResponse, diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 70709504d..ebe0183ae 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -80,8 +80,8 @@ export interface CreateEvalCompletionsRunDataSource { * A StoredCompletionsRunDataSource configuration describing a set of filters */ source: - | EvalJSONLFileContentSource - | EvalJSONLFileIDSource + | CreateEvalCompletionsRunDataSource.FileContent + | CreateEvalCompletionsRunDataSource.FileID | CreateEvalCompletionsRunDataSource.StoredCompletions; /** @@ -102,6 +102,38 @@ export interface CreateEvalCompletionsRunDataSource { } export namespace CreateEvalCompletionsRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + /** * A StoredCompletionsRunDataSource configuration describing a set of filters */ @@ -147,7 +179,7 @@ export namespace CreateEvalCompletionsRunDataSource { * A list of chat messages forming the prompt or context. May include variable * references to the "item" namespace, ie {{item.name}}. */ - template: Array; + template: Array; /** * The type of input messages. Always `template`. @@ -155,6 +187,50 @@ export namespace CreateEvalCompletionsRunDataSource { type: 'template'; } + export namespace Template { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Message { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Message.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Message { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + export interface ItemReference { /** * A reference to a variable in the "item" namespace. Ie, "item.name" @@ -195,7 +271,7 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { - source: EvalJSONLFileContentSource | EvalJSONLFileIDSource; + source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; /** * The type of data source. Always `jsonl`. @@ -203,162 +279,37 @@ export interface CreateEvalJSONLRunDataSource { type: 'jsonl'; } -/** - * A ResponsesRunDataSource object describing a model sampling configuration. - */ -export interface CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - source: EvalJSONLFileContentSource | EvalJSONLFileIDSource | CreateEvalResponsesRunDataSource.Responses; - - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - input_messages?: CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; - - /** - * The name of the model to use for generating completions (e.g. "o3-mini"). - */ - model?: string; - - sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; -} - -export namespace CreateEvalResponsesRunDataSource { - /** - * A EvalResponsesSource object describing a run data source configuration. - */ - export interface Responses { - /** - * The type of run data source. Always `responses`. - */ - type: 'responses'; - - /** - * Only include items created after this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_after?: number | null; - - /** - * Only include items created before this timestamp (inclusive). This is a query - * parameter used to select responses. - */ - created_before?: number | null; - - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - - /** - * Optional string to search the 'instructions' field. This is a query parameter - * used to select responses. - */ - instructions_search?: string | null; - +export namespace CreateEvalJSONLRunDataSource { + export interface FileContent { /** - * Metadata filter for the responses. This is a query parameter used to select - * responses. + * The content of the jsonl file. */ - metadata?: unknown | null; + content: Array; /** - * The name of the model to find responses for. This is a query parameter used to - * select responses. + * The type of jsonl source. Always `file_content`. */ - model?: string | null; - - /** - * Optional reasoning effort parameter. This is a query parameter used to select - * responses. - */ - reasoning_effort?: Shared.ReasoningEffort | null; - - /** - * Sampling temperature. This is a query parameter used to select responses. - */ - temperature?: number | null; - - /** - * List of tool names. This is a query parameter used to select responses. - */ - tools?: Array | null; - - /** - * Nucleus sampling parameter. This is a query parameter used to select responses. - */ - top_p?: number | null; - - /** - * List of user identifiers. This is a query parameter used to select responses. - */ - users?: Array | null; + type: 'file_content'; } - export interface Template { - /** - * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. - */ - template: Array; + export namespace FileContent { + export interface Content { + item: Record; - /** - * The type of input messages. Always `template`. - */ - type: 'template'; - } - - export namespace Template { - export interface ChatMessage { - /** - * The content of the message. - */ - content: string; - - /** - * The role of the message (e.g. "system", "assistant", "user"). - */ - role: string; + sample?: Record; } } - export interface ItemReference { - /** - * A reference to a variable in the "item" namespace. Ie, "item.name" - */ - item_reference: string; - - /** - * The type of input messages. Always `item_reference`. - */ - type: 'item_reference'; - } - - export interface SamplingParams { - /** - * The maximum number of tokens in the generated output. - */ - max_completion_tokens?: number; - - /** - * A seed value to initialize the randomness, during sampling. - */ - seed?: number; - + export interface FileID { /** - * A higher temperature increases randomness in the outputs. + * The identifier of the file. */ - temperature?: number; + id: string; /** - * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + * The type of jsonl source. Always `file_id`. */ - top_p?: number; + type: 'file_id'; } } @@ -377,38 +328,6 @@ export interface EvalAPIError { message: string; } -export interface EvalJSONLFileContentSource { - /** - * The content of the jsonl file. - */ - content: Array; - - /** - * The type of jsonl source. Always `file_content`. - */ - type: 'file_content'; -} - -export namespace EvalJSONLFileContentSource { - export interface Content { - item: Record; - - sample?: Record; - } -} - -export interface EvalJSONLFileIDSource { - /** - * The identifier of the file. - */ - id: string; - - /** - * The type of jsonl source. Always `file_id`. - */ - type: 'file_id'; -} - /** * A schema representing an evaluation run. */ @@ -429,7 +348,7 @@ export interface RunCreateResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCreateResponse.Responses; /** * An object representing an error response from the Eval API. @@ -493,6 +412,239 @@ export interface RunCreateResponse { } export namespace RunCreateResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -588,7 +740,7 @@ export interface RunRetrieveResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunRetrieveResponse.Responses; /** * An object representing an error response from the Eval API. @@ -652,6 +804,239 @@ export interface RunRetrieveResponse { } export namespace RunRetrieveResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -744,10 +1129,7 @@ export interface RunListResponse { /** * Information about the run's data source. */ - data_source: - | CreateEvalJSONLRunDataSource - | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + data_source: CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource | RunListResponse.Responses; /** * An object representing an error response from the Eval API. @@ -779,38 +1161,271 @@ export interface RunListResponse { */ name: string; - /** - * The type of the object. Always "eval.run". - */ - object: 'eval.run'; + /** + * The type of the object. Always "eval.run". + */ + object: 'eval.run'; + + /** + * Usage statistics for each model during the evaluation run. + */ + per_model_usage: Array; + + /** + * Results per testing criteria applied during the evaluation run. + */ + per_testing_criteria_results: Array; + + /** + * The URL to the rendered evaluation run report on the UI dashboard. + */ + report_url: string; + + /** + * Counters summarizing the outcomes of the evaluation run. + */ + result_counts: RunListResponse.ResultCounts; + + /** + * The status of the evaluation run. + */ + status: string; +} + +export namespace RunListResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; - /** - * Usage statistics for each model during the evaluation run. - */ - per_model_usage: Array; + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } - /** - * Results per testing criteria applied during the evaluation run. - */ - per_testing_criteria_results: Array; + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; - /** - * The URL to the rendered evaluation run report on the UI dashboard. - */ - report_url: string; + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; - /** - * Counters summarizing the outcomes of the evaluation run. - */ - result_counts: RunListResponse.ResultCounts; + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; - /** - * The status of the evaluation run. - */ - status: string; -} + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } -export namespace RunListResponse { export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -914,7 +1529,7 @@ export interface RunCancelResponse { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCancelResponse.Responses; /** * An object representing an error response from the Eval API. @@ -978,6 +1593,239 @@ export interface RunCancelResponse { } export namespace RunCancelResponse { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface Responses { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: Responses.FileContent | Responses.FileID | Responses.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: Responses.Template | Responses.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: Responses.SamplingParams; + } + + export namespace Responses { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } + export interface PerModelUsage { /** * The number of tokens retrieved from cache. @@ -1060,7 +1908,7 @@ export interface RunCreateParams { data_source: | CreateEvalJSONLRunDataSource | CreateEvalCompletionsRunDataSource - | CreateEvalResponsesRunDataSource; + | RunCreateParams.CreateEvalResponsesRunDataSource; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -1078,6 +1926,246 @@ export interface RunCreateParams { name?: string; } +export namespace RunCreateParams { + /** + * A ResponsesRunDataSource object describing a model sampling configuration. + */ + export interface CreateEvalResponsesRunDataSource { + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + source: + | CreateEvalResponsesRunDataSource.FileContent + | CreateEvalResponsesRunDataSource.FileID + | CreateEvalResponsesRunDataSource.Responses; + + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + input_messages?: + | CreateEvalResponsesRunDataSource.Template + | CreateEvalResponsesRunDataSource.ItemReference; + + /** + * The name of the model to use for generating completions (e.g. "o3-mini"). + */ + model?: string; + + sampling_params?: CreateEvalResponsesRunDataSource.SamplingParams; + } + + export namespace CreateEvalResponsesRunDataSource { + export interface FileContent { + /** + * The content of the jsonl file. + */ + content: Array; + + /** + * The type of jsonl source. Always `file_content`. + */ + type: 'file_content'; + } + + export namespace FileContent { + export interface Content { + item: Record; + + sample?: Record; + } + } + + export interface FileID { + /** + * The identifier of the file. + */ + id: string; + + /** + * The type of jsonl source. Always `file_id`. + */ + type: 'file_id'; + } + + /** + * A EvalResponsesSource object describing a run data source configuration. + */ + export interface Responses { + /** + * The type of run data source. Always `responses`. + */ + type: 'responses'; + + /** + * Only include items created after this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_after?: number | null; + + /** + * Only include items created before this timestamp (inclusive). This is a query + * parameter used to select responses. + */ + created_before?: number | null; + + /** + * Whether the response has tool calls. This is a query parameter used to select + * responses. + */ + has_tool_calls?: boolean | null; + + /** + * Optional string to search the 'instructions' field. This is a query parameter + * used to select responses. + */ + instructions_search?: string | null; + + /** + * Metadata filter for the responses. This is a query parameter used to select + * responses. + */ + metadata?: unknown | null; + + /** + * The name of the model to find responses for. This is a query parameter used to + * select responses. + */ + model?: string | null; + + /** + * Optional reasoning effort parameter. This is a query parameter used to select + * responses. + */ + reasoning_effort?: Shared.ReasoningEffort | null; + + /** + * Sampling temperature. This is a query parameter used to select responses. + */ + temperature?: number | null; + + /** + * List of tool names. This is a query parameter used to select responses. + */ + tools?: Array | null; + + /** + * Nucleus sampling parameter. This is a query parameter used to select responses. + */ + top_p?: number | null; + + /** + * List of user identifiers. This is a query parameter used to select responses. + */ + users?: Array | null; + } + + export interface Template { + /** + * A list of chat messages forming the prompt or context. May include variable + * references to the "item" namespace, ie {{item.name}}. + */ + template: Array; + + /** + * The type of input messages. Always `template`. + */ + type: 'template'; + } + + export namespace Template { + export interface ChatMessage { + /** + * The content of the message. + */ + content: string; + + /** + * The role of the message (e.g. "system", "assistant", "user"). + */ + role: string; + } + + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface EvalItem { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace EvalItem { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } + } + + export interface ItemReference { + /** + * A reference to a variable in the "item" namespace. Ie, "item.name" + */ + item_reference: string; + + /** + * The type of input messages. Always `item_reference`. + */ + type: 'item_reference'; + } + + export interface SamplingParams { + /** + * The maximum number of tokens in the generated output. + */ + max_completion_tokens?: number; + + /** + * A seed value to initialize the randomness, during sampling. + */ + seed?: number; + + /** + * A higher temperature increases randomness in the outputs. + */ + temperature?: number; + + /** + * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. + */ + top_p?: number; + } + } +} + export interface RunRetrieveParams { /** * The ID of the evaluation to retrieve runs for. @@ -1119,10 +2207,7 @@ export declare namespace Runs { export { type CreateEvalCompletionsRunDataSource as CreateEvalCompletionsRunDataSource, type CreateEvalJSONLRunDataSource as CreateEvalJSONLRunDataSource, - type CreateEvalResponsesRunDataSource as CreateEvalResponsesRunDataSource, type EvalAPIError as EvalAPIError, - type EvalJSONLFileContentSource as EvalJSONLFileContentSource, - type EvalJSONLFileIDSource as EvalJSONLFileIDSource, type RunCreateResponse as RunCreateResponse, type RunRetrieveResponse as RunRetrieveResponse, type RunListResponse as RunListResponse, diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts index 445390067..2b08d3d14 100644 --- a/src/resources/graders/grader-models.ts +++ b/src/resources/graders/grader-models.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; -import * as Shared from '../shared'; +import * as ResponsesAPI from '../responses/responses'; export class GraderModels extends APIResource {} @@ -10,7 +10,7 @@ export class GraderModels extends APIResource {} * the evaluation. */ export interface LabelModelGrader { - input: Array; + input: Array; /** * The labels to assign to each item in the evaluation. @@ -38,6 +38,50 @@ export interface LabelModelGrader { type: 'label_model'; } +export namespace LabelModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + /** * A MultiGrader object combines the output of multiple graders to produce a single * score. @@ -59,7 +103,7 @@ export interface MultiGrader { name: string; /** - * The type of grader. + * The object type, which is always `multi`. */ type: 'multi'; } @@ -96,7 +140,7 @@ export interface ScoreModelGrader { /** * The input text. This may include template strings. */ - input: Array; + input: Array; /** * The model to use for the evaluation. @@ -124,6 +168,50 @@ export interface ScoreModelGrader { sampling_params?: unknown; } +export namespace ScoreModelGrader { + /** + * A message input to the model with a role indicating instruction following + * hierarchy. Instructions given with the `developer` or `system` role take + * precedence over instructions given with the `user` role. Messages with the + * `assistant` role are presumed to have been generated by the model in previous + * interactions. + */ + export interface Input { + /** + * Text inputs to the model - can contain template strings. + */ + content: string | ResponsesAPI.ResponseInputText | Input.OutputText; + + /** + * The role of the message input. One of `user`, `assistant`, `system`, or + * `developer`. + */ + role: 'user' | 'assistant' | 'system' | 'developer'; + + /** + * The type of the message input. Always `message`. + */ + type?: 'message'; + } + + export namespace Input { + /** + * A text output from the model. + */ + export interface OutputText { + /** + * The text output from the model. + */ + text: string; + + /** + * The type of the output text. Always `output_text`. + */ + type: 'output_text'; + } + } +} + /** * A StringCheckGrader object that performs a string comparison between input and * reference using a specified operation. diff --git a/src/resources/index.ts b/src/resources/index.ts index 9cff486ff..eb244dfda 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -32,7 +32,6 @@ export { export { Evals, type EvalCustomDataSourceConfig, - type EvalLogsDataSourceConfig, type EvalStoredCompletionsDataSourceConfig, type EvalCreateResponse, type EvalRetrieveResponse, @@ -89,7 +88,6 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, - type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/shared.ts b/src/resources/shared.ts index d0c2aaa49..adea184fd 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -1,7 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as ResponsesAPI from './responses/responses'; - export type AllModels = | (string & {}) | ChatModel @@ -43,6 +41,7 @@ export type ChatModel = | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview-2025-03-11' | 'chatgpt-4o-latest' + | 'codex-mini-latest' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' @@ -120,48 +119,6 @@ export interface ErrorObject { type: string; } -/** - * A message input to the model with a role indicating instruction following - * hierarchy. Instructions given with the `developer` or `system` role take - * precedence over instructions given with the `user` role. Messages with the - * `assistant` role are presumed to have been generated by the model in previous - * interactions. - */ -export interface EvalItem { - /** - * Text inputs to the model - can contain template strings. - */ - content: string | ResponsesAPI.ResponseInputText | EvalItem.OutputText; - - /** - * The role of the message input. One of `user`, `assistant`, `system`, or - * `developer`. - */ - role: 'user' | 'assistant' | 'system' | 'developer'; - - /** - * The type of the message input. Always `message`. - */ - type?: 'message'; -} - -export namespace EvalItem { - /** - * A text output from the model. - */ - export interface OutputText { - /** - * The text output from the model. - */ - text: string; - - /** - * The type of the output text. Always `output_text`. - */ - type: 'output_text'; - } -} - export interface FunctionDefinition { /** * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain diff --git a/src/resources/vector-stores/index.ts b/src/resources/vector-stores/index.ts index 5f782e44c..cbcb36221 100644 --- a/src/resources/vector-stores/index.ts +++ b/src/resources/vector-stores/index.ts @@ -33,7 +33,6 @@ export { type StaticFileChunkingStrategyObjectParam, type VectorStore, type VectorStoreDeleted, - type VectorStoreExpirationAfter, type VectorStoreSearchResponse, type VectorStoreCreateParams, type VectorStoreUpdateParams, diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index cf0545a4a..de08d0494 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -250,7 +250,7 @@ export interface VectorStore { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter; + expires_after?: VectorStore.ExpiresAfter; /** * The Unix timestamp (in seconds) for when the vector store will expire. @@ -285,6 +285,22 @@ export namespace VectorStore { */ total: number; } + + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } } export interface VectorStoreDeleted { @@ -295,22 +311,6 @@ export interface VectorStoreDeleted { object: 'vector_store.deleted'; } -/** - * The expiration policy for a vector store. - */ -export interface VectorStoreExpirationAfter { - /** - * Anchor timestamp after which the expiration policy applies. Supported anchors: - * `last_active_at`. - */ - anchor: 'last_active_at'; - - /** - * The number of days after the anchor time that the vector store will expire. - */ - days: number; -} - export interface VectorStoreSearchResponse { /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -366,7 +366,7 @@ export interface VectorStoreCreateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter; + expires_after?: VectorStoreCreateParams.ExpiresAfter; /** * A list of [File](https://platform.openai.com/docs/api-reference/files) IDs that @@ -391,11 +391,29 @@ export interface VectorStoreCreateParams { name?: string; } +export namespace VectorStoreCreateParams { + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } +} + export interface VectorStoreUpdateParams { /** * The expiration policy for a vector store. */ - expires_after?: VectorStoreExpirationAfter | null; + expires_after?: VectorStoreUpdateParams.ExpiresAfter | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -413,6 +431,24 @@ export interface VectorStoreUpdateParams { name?: string | null; } +export namespace VectorStoreUpdateParams { + /** + * The expiration policy for a vector store. + */ + export interface ExpiresAfter { + /** + * Anchor timestamp after which the expiration policy applies. Supported anchors: + * `last_active_at`. + */ + anchor: 'last_active_at'; + + /** + * The number of days after the anchor time that the vector store will expire. + */ + days: number; + } +} + export interface VectorStoreListParams extends CursorPageParams { /** * A cursor for use in pagination. `before` is an object ID that defines your place @@ -482,7 +518,6 @@ export declare namespace VectorStores { type StaticFileChunkingStrategyObjectParam as StaticFileChunkingStrategyObjectParam, type VectorStore as VectorStore, type VectorStoreDeleted as VectorStoreDeleted, - type VectorStoreExpirationAfter as VectorStoreExpirationAfter, type VectorStoreSearchResponse as VectorStoreSearchResponse, type VectorStoresPage as VectorStoresPage, type VectorStoreSearchResponsesPage as VectorStoreSearchResponsesPage, From 3019a7e67614942b5dc6d7e788f2b5b30b3bc874 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 May 2025 19:41:31 +0000 Subject: [PATCH 415/509] feat(api): further updates for evals API --- .stats.yml | 4 +- src/resources/beta/realtime/realtime.ts | 2 +- .../beta/realtime/transcription-sessions.ts | 2 +- src/resources/evals/evals.ts | 31 ++--- src/resources/evals/runs/runs.ts | 109 ++++++++++-------- 5 files changed, 82 insertions(+), 66 deletions(-) diff --git a/.stats.yml b/.stats.yml index a3c5d081d..afa33d93b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-5fa16b9a02985ae06e41be14946a9c325dc672fb014b3c19abca65880c6990e6.yml -openapi_spec_hash: da3e669f65130043b1170048c0727890 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-262e171d0a8150ea1192474d16ba3afdf9a054b399f1a49a9c9b697a3073c136.yml +openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b config_hash: d8d5fda350f6db77c784f35429741a2e diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index b60c945e8..c09d6c04b 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2571,7 +2571,7 @@ export interface TranscriptionSessionUpdatedEvent { * A new Realtime transcription session configuration. * * When a session is created on the server via REST API, the session object also - * contains an ephemeral key. Default TTL for keys is one minute. This property is + * contains an ephemeral key. Default TTL for keys is 10 minutes. This property is * not present when a session is updated via the WebSocket API. */ session: TranscriptionSessionsAPI.TranscriptionSession; diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index e30fbdbf5..0fc96b854 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -34,7 +34,7 @@ export class TranscriptionSessions extends APIResource { * A new Realtime transcription session configuration. * * When a session is created on the server via REST API, the session object also - * contains an ephemeral key. Default TTL for keys is one minute. This property is + * contains an ephemeral key. Default TTL for keys is 10 minutes. This property is * not present when a session is updated via the WebSocket API. */ export interface TranscriptionSession { diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index 297640a87..cc563c78f 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -32,7 +32,8 @@ export class Evals extends APIResource { /** * Create the structure of an evaluation that can be used to test a model's - * performance. An evaluation is a set of testing criteria and a datasource. After + * performance. An evaluation is a set of testing criteria and the config for a + * data source, which dictates the schema of the data used in the evaluation. After * creating an evaluation, you can run it on different models and model parameters. * We support several types of graders and datasources. For more information, see * the [Evals guide](https://platform.openai.com/docs/guides/evals). @@ -107,9 +108,9 @@ export interface EvalStoredCompletionsDataSourceConfig { schema: Record; /** - * The type of data source. Always `stored-completions`. + * The type of data source. Always `stored_completions`. */ - type: 'stored-completions'; + type: 'stored_completions'; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -128,7 +129,7 @@ export interface EvalStoredCompletionsDataSourceConfig { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalCreateResponse { /** @@ -249,7 +250,7 @@ export namespace EvalCreateResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalRetrieveResponse { /** @@ -370,7 +371,7 @@ export namespace EvalRetrieveResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalUpdateResponse { /** @@ -491,7 +492,7 @@ export namespace EvalUpdateResponse { * * - Improve the quality of my chatbot * - See how well my chatbot handles customer support - * - Check if o3-mini is better at my usecase than gpt-4o + * - Check if o4-mini is better at my usecase than gpt-4o */ export interface EvalListResponse { /** @@ -616,12 +617,16 @@ export interface EvalDeleteResponse { export interface EvalCreateParams { /** - * The configuration for the data source used for the evaluation runs. + * The configuration for the data source used for the evaluation runs. Dictates the + * schema of the data used in the evaluation. */ data_source_config: EvalCreateParams.Custom | EvalCreateParams.Logs | EvalCreateParams.StoredCompletions; /** - * A list of graders for all eval runs in this group. + * A list of graders for all eval runs in this group. Graders can reference + * variables in the data source using double curly braces notation, like + * `{{item.variable_name}}`. To reference the model's output, use the `sample` + * namespace (ie, `{{sample.output_text}}`). */ testing_criteria: Array< | EvalCreateParams.LabelModel @@ -691,13 +696,13 @@ export namespace EvalCreateParams { } /** - * Deprecated in favor of LogsDataSourceConfig. + * @deprecated Deprecated in favor of LogsDataSourceConfig. */ export interface StoredCompletions { /** - * The type of data source. Always `stored-completions`. + * The type of data source. Always `stored_completions`. */ - type: 'stored-completions'; + type: 'stored_completions'; /** * Metadata filters for the stored completions data source. @@ -712,7 +717,7 @@ export namespace EvalCreateParams { export interface LabelModel { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ input: Array; diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index ebe0183ae..55cff4f93 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -21,7 +21,9 @@ export class Runs extends APIResource { outputItems: OutputItemsAPI.OutputItems = new OutputItemsAPI.OutputItems(this._client); /** - * Create a new evaluation run. This is the endpoint that will kick off grading. + * Kicks off a new run for a given evaluation, specifying the data source, and what + * model configuration to use to test. The datasource will be validated against the + * schema specified in the config of the evaluation. */ create(evalID: string, body: RunCreateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/evals/${evalID}/runs`, { body, ...options }); @@ -77,7 +79,7 @@ export type RunListResponsesPage = CursorPage; */ export interface CreateEvalCompletionsRunDataSource { /** - * A StoredCompletionsRunDataSource configuration describing a set of filters + * Determines what populates the `item` namespace in this run's data source. */ source: | CreateEvalCompletionsRunDataSource.FileContent @@ -89,6 +91,12 @@ export interface CreateEvalCompletionsRunDataSource { */ type: 'completions'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: | CreateEvalCompletionsRunDataSource.Template | CreateEvalCompletionsRunDataSource.ItemReference; @@ -177,7 +185,7 @@ export namespace CreateEvalCompletionsRunDataSource { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -233,7 +241,7 @@ export namespace CreateEvalCompletionsRunDataSource { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.input_trajectory" */ item_reference: string; @@ -271,6 +279,9 @@ export namespace CreateEvalCompletionsRunDataSource { * eval */ export interface CreateEvalJSONLRunDataSource { + /** + * Determines what populates the `item` namespace in the data source. + */ source: CreateEvalJSONLRunDataSource.FileContent | CreateEvalJSONLRunDataSource.FileID; /** @@ -417,7 +428,7 @@ export namespace RunCreateResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -426,6 +437,12 @@ export namespace RunCreateResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -490,12 +507,6 @@ export namespace RunCreateResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -544,7 +555,7 @@ export namespace RunCreateResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -612,7 +623,7 @@ export namespace RunCreateResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -809,7 +820,7 @@ export namespace RunRetrieveResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -818,6 +829,12 @@ export namespace RunRetrieveResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -882,12 +899,6 @@ export namespace RunRetrieveResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -936,7 +947,7 @@ export namespace RunRetrieveResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1004,7 +1015,7 @@ export namespace RunRetrieveResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1198,7 +1209,7 @@ export namespace RunListResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -1207,6 +1218,12 @@ export namespace RunListResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -1271,12 +1288,6 @@ export namespace RunListResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -1325,7 +1336,7 @@ export namespace RunListResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1393,7 +1404,7 @@ export namespace RunListResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1598,7 +1609,7 @@ export namespace RunCancelResponse { */ export interface Responses { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: Responses.FileContent | Responses.FileID | Responses.Responses; @@ -1607,6 +1618,12 @@ export namespace RunCancelResponse { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: Responses.Template | Responses.ItemReference; /** @@ -1671,12 +1688,6 @@ export namespace RunCancelResponse { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -1725,7 +1736,7 @@ export namespace RunCancelResponse { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -1793,7 +1804,7 @@ export namespace RunCancelResponse { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; @@ -1932,7 +1943,7 @@ export namespace RunCreateParams { */ export interface CreateEvalResponsesRunDataSource { /** - * A EvalResponsesSource object describing a run data source configuration. + * Determines what populates the `item` namespace in this run's data source. */ source: | CreateEvalResponsesRunDataSource.FileContent @@ -1944,6 +1955,12 @@ export namespace RunCreateParams { */ type: 'responses'; + /** + * Used when sampling from a model. Dictates the structure of the messages passed + * into the model. Can either be a reference to a prebuilt trajectory (ie, + * `item.input_trajectory`), or a template with variable references to the `item` + * namespace. + */ input_messages?: | CreateEvalResponsesRunDataSource.Template | CreateEvalResponsesRunDataSource.ItemReference; @@ -2010,12 +2027,6 @@ export namespace RunCreateParams { */ created_before?: number | null; - /** - * Whether the response has tool calls. This is a query parameter used to select - * responses. - */ - has_tool_calls?: boolean | null; - /** * Optional string to search the 'instructions' field. This is a query parameter * used to select responses. @@ -2064,7 +2075,7 @@ export namespace RunCreateParams { export interface Template { /** * A list of chat messages forming the prompt or context. May include variable - * references to the "item" namespace, ie {{item.name}}. + * references to the `item` namespace, ie {{item.name}}. */ template: Array; @@ -2132,7 +2143,7 @@ export namespace RunCreateParams { export interface ItemReference { /** - * A reference to a variable in the "item" namespace. Ie, "item.name" + * A reference to a variable in the `item` namespace. Ie, "item.name" */ item_reference: string; From 3da6b062f51ee979ee0724cf98b8e60cdbcbddf9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 19 May 2025 13:13:07 +0000 Subject: [PATCH 416/509] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index afa33d93b..7a20222a3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-262e171d0a8150ea1192474d16ba3afdf9a054b399f1a49a9c9b697a3073c136.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d51538ac955164de98b0c94a0a4718d96623fe39bf31a1d168be06c93c94e645.yml openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b -config_hash: d8d5fda350f6db77c784f35429741a2e +config_hash: c42d37618b8628ce7e1c76437db5dd8f From d5d62b0c45273e746e25e389c0e268f3f463eec1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 15:11:03 +0000 Subject: [PATCH 417/509] chore(docs): grammar improvements --- SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 3b3bd8a66..4adb0c54f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -16,13 +16,13 @@ before making any information public. ## Reporting Non-SDK Related Security Issues If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by OpenAI please follow the respective company's security reporting guidelines. +or products provided by OpenAI, please follow the respective company's security reporting guidelines. ### OpenAI Terms and Policies Our Security Policy can be found at [Security Policy URL](https://openai.com/policies/coordinated-vulnerability-disclosure-policy). -Please contact disclosure@openai.com for any questions or concerns regarding security of our services. +Please contact disclosure@openai.com for any questions or concerns regarding the security of our services. --- From 0cc899456091f0b13fc98daa03a4299473f528dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 16:20:21 +0000 Subject: [PATCH 418/509] feat(api): new API tools --- .stats.yml | 6 +- api.md | 18 + src/resources/responses/responses.ts | 1533 ++++++++++++++++- .../api-resources/responses/responses.test.ts | 11 +- 4 files changed, 1533 insertions(+), 35 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7a20222a3..4b4f19c91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d51538ac955164de98b0c94a0a4718d96623fe39bf31a1d168be06c93c94e645.yml -openapi_spec_hash: 33e00a48df8f94c94f46290c489f132b -config_hash: c42d37618b8628ce7e1c76437db5dd8f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml +openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd +config_hash: bb657c3fed232a56930035de3aaed936 diff --git a/api.md b/api.md index 248f7768c..989fd6633 100644 --- a/api.md +++ b/api.md @@ -644,6 +644,10 @@ Types: - ResponseFunctionToolCallItem - ResponseFunctionToolCallOutputItem - ResponseFunctionWebSearch +- ResponseImageGenCallCompletedEvent +- ResponseImageGenCallGeneratingEvent +- ResponseImageGenCallInProgressEvent +- ResponseImageGenCallPartialImageEvent - ResponseInProgressEvent - ResponseIncludable - ResponseIncompleteEvent @@ -657,6 +661,14 @@ Types: - ResponseInputMessageItem - ResponseInputText - ResponseItem +- ResponseMcpCallArgumentsDeltaEvent +- ResponseMcpCallArgumentsDoneEvent +- ResponseMcpCallCompletedEvent +- ResponseMcpCallFailedEvent +- ResponseMcpCallInProgressEvent +- ResponseMcpListToolsCompletedEvent +- ResponseMcpListToolsFailedEvent +- ResponseMcpListToolsInProgressEvent - ResponseOutputAudio - ResponseOutputItem - ResponseOutputItemAddedEvent @@ -664,7 +676,13 @@ Types: - ResponseOutputMessage - ResponseOutputRefusal - ResponseOutputText +- ResponseOutputTextAnnotationAddedEvent +- ResponseQueuedEvent +- ResponseReasoningDeltaEvent +- ResponseReasoningDoneEvent - ResponseReasoningItem +- ResponseReasoningSummaryDeltaEvent +- ResponseReasoningSummaryDoneEvent - ResponseReasoningSummaryPartAddedEvent - ResponseReasoningSummaryPartDoneEvent - ResponseReasoningSummaryTextDeltaEvent diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 0805c3af0..1c93c28f4 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -342,6 +342,12 @@ export interface Response { */ top_p: number | null; + /** + * Whether to run the model response in the background. + * [Learn more](https://platform.openai.com/docs/guides/background). + */ + background?: boolean | null; + /** * An upper bound for the number of tokens that can be generated for a response, * including visible output tokens and @@ -387,7 +393,7 @@ export interface Response { /** * The status of the response generation. One of `completed`, `failed`, - * `in_progress`, or `incomplete`. + * `in_progress`, `cancelled`, `queued`, or `incomplete`. */ status?: ResponseStatus; @@ -615,6 +621,11 @@ export interface ResponseCodeInterpreterToolCall { * The type of the code interpreter tool call. Always `code_interpreter_call`. */ type: 'code_interpreter_call'; + + /** + * The ID of the container used to run the code. + */ + container_id?: string; } export namespace ResponseCodeInterpreterToolCall { @@ -1507,6 +1518,114 @@ export interface ResponseFunctionWebSearch { type: 'web_search_call'; } +/** + * Emitted when an image generation tool call has completed and the final image is + * available. + */ +export interface ResponseImageGenCallCompletedEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.image_generation_call.completed'. + */ + type: 'response.image_generation_call.completed'; +} + +/** + * Emitted when an image generation tool call is actively generating an image + * (intermediate state). + */ +export interface ResponseImageGenCallGeneratingEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.image_generation_call.generating'. + */ + type: 'response.image_generation_call.generating'; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number?: number; +} + +/** + * Emitted when an image generation tool call is in progress. + */ +export interface ResponseImageGenCallInProgressEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number: number; + + /** + * The type of the event. Always 'response.image_generation_call.in_progress'. + */ + type: 'response.image_generation_call.in_progress'; +} + +/** + * Emitted when a partial image is available during image generation streaming. + */ +export interface ResponseImageGenCallPartialImageEvent { + /** + * The unique identifier of the image generation item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * Base64-encoded partial image data, suitable for rendering as an image. + */ + partial_image_b64: string; + + /** + * 0-based index for the partial image (backend is 1-based, but this is 0-based for + * the user). + */ + partial_image_index: number; + + /** + * The sequence number of the image generation item being processed. + */ + sequence_number: number; + + /** + * The type of the event. Always 'response.image_generation_call.partial_image'. + */ + type: 'response.image_generation_call.partial_image'; +} + /** * Emitted when the response is in progress. */ @@ -1660,6 +1779,14 @@ export type ResponseInputItem = | ResponseFunctionToolCall | ResponseInputItem.FunctionCallOutput | ResponseReasoningItem + | ResponseInputItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseInputItem.LocalShellCall + | ResponseInputItem.LocalShellCallOutput + | ResponseInputItem.McpListTools + | ResponseInputItem.McpApprovalRequest + | ResponseInputItem.McpApprovalResponse + | ResponseInputItem.McpCall | ResponseInputItem.ItemReference; export namespace ResponseInputItem { @@ -1783,6 +1910,280 @@ export namespace ResponseInputItem { status?: 'in_progress' | 'completed' | 'incomplete' | null; } + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * The output of a local shell tool call. + */ + export interface LocalShellCallOutput { + /** + * The unique ID of the local shell tool call generated by the model. + */ + id: string; + + /** + * A JSON string of the output of the local shell tool call. + */ + output: string; + + /** + * The type of the local shell tool call output. Always `local_shell_call_output`. + */ + type: 'local_shell_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } + + /** + * A response to an MCP approval request. + */ + export interface McpApprovalResponse { + /** + * The ID of the approval request being answered. + */ + approval_request_id: string; + + /** + * Whether the request was approved. + */ + approve: boolean; + + /** + * The type of the item. Always `mcp_approval_response`. + */ + type: 'mcp_approval_response'; + + /** + * The unique ID of the approval response + */ + id?: string | null; + + /** + * Optional reason for the decision. + */ + reason?: string | null; + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } + /** * An internal identifier for an item to reference. */ @@ -1860,12 +2261,418 @@ export type ResponseItem = | ResponseComputerToolCallOutputItem | ResponseFunctionWebSearch | ResponseFunctionToolCallItem - | ResponseFunctionToolCallOutputItem; + | ResponseFunctionToolCallOutputItem + | ResponseItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseItem.LocalShellCall + | ResponseItem.LocalShellCallOutput + | ResponseItem.McpListTools + | ResponseItem.McpApprovalRequest + | ResponseItem.McpApprovalResponse + | ResponseItem.McpCall; -/** - * An audio output from the model. - */ -export interface ResponseOutputAudio { +export namespace ResponseItem { + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * The output of a local shell tool call. + */ + export interface LocalShellCallOutput { + /** + * The unique ID of the local shell tool call generated by the model. + */ + id: string; + + /** + * A JSON string of the output of the local shell tool call. + */ + output: string; + + /** + * The type of the local shell tool call output. Always `local_shell_call_output`. + */ + type: 'local_shell_call_output'; + + /** + * The status of the item. One of `in_progress`, `completed`, or `incomplete`. + */ + status?: 'in_progress' | 'completed' | 'incomplete' | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } + + /** + * A response to an MCP approval request. + */ + export interface McpApprovalResponse { + /** + * The unique ID of the approval response + */ + id: string; + + /** + * The ID of the approval request being answered. + */ + approval_request_id: string; + + /** + * Whether the request was approved. + */ + approve: boolean; + + /** + * The type of the item. Always `mcp_approval_response`. + */ + type: 'mcp_approval_response'; + + /** + * Optional reason for the decision. + */ + reason?: string | null; + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } +} + +/** + * Emitted when there is a delta (partial update) to the arguments of an MCP tool + * call. + */ +export interface ResponseMcpCallArgumentsDeltaEvent { + /** + * The partial update to the arguments for the MCP tool call. + */ + delta: unknown; + + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.arguments_delta'. + */ + type: 'response.mcp_call.arguments_delta'; +} + +/** + * Emitted when the arguments for an MCP tool call are finalized. + */ +export interface ResponseMcpCallArgumentsDoneEvent { + /** + * The finalized arguments for the MCP tool call. + */ + arguments: unknown; + + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.arguments_done'. + */ + type: 'response.mcp_call.arguments_done'; +} + +/** + * Emitted when an MCP tool call has completed successfully. + */ +export interface ResponseMcpCallCompletedEvent { + /** + * The type of the event. Always 'response.mcp_call.completed'. + */ + type: 'response.mcp_call.completed'; +} + +/** + * Emitted when an MCP tool call has failed. + */ +export interface ResponseMcpCallFailedEvent { + /** + * The type of the event. Always 'response.mcp_call.failed'. + */ + type: 'response.mcp_call.failed'; +} + +/** + * Emitted when an MCP tool call is in progress. + */ +export interface ResponseMcpCallInProgressEvent { + /** + * The unique identifier of the MCP tool call item being processed. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.mcp_call.in_progress'. + */ + type: 'response.mcp_call.in_progress'; +} + +/** + * Emitted when the list of available MCP tools has been successfully retrieved. + */ +export interface ResponseMcpListToolsCompletedEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.completed'. + */ + type: 'response.mcp_list_tools.completed'; +} + +/** + * Emitted when the attempt to list available MCP tools has failed. + */ +export interface ResponseMcpListToolsFailedEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.failed'. + */ + type: 'response.mcp_list_tools.failed'; +} + +/** + * Emitted when the system is in the process of retrieving the list of available + * MCP tools. + */ +export interface ResponseMcpListToolsInProgressEvent { + /** + * The type of the event. Always 'response.mcp_list_tools.in_progress'. + */ + type: 'response.mcp_list_tools.in_progress'; +} + +/** + * An audio output from the model. + */ +export interface ResponseOutputAudio { /** * Base64-encoded audio data from the model. */ @@ -1876,22 +2683,249 @@ export interface ResponseOutputAudio { */ transcript: string; - /** - * The type of the output audio. Always `output_audio`. - */ - type: 'output_audio'; -} + /** + * The type of the output audio. Always `output_audio`. + */ + type: 'output_audio'; +} + +/** + * An output message from the model. + */ +export type ResponseOutputItem = + | ResponseOutputMessage + | ResponseFileSearchToolCall + | ResponseFunctionToolCall + | ResponseFunctionWebSearch + | ResponseComputerToolCall + | ResponseReasoningItem + | ResponseOutputItem.ImageGenerationCall + | ResponseCodeInterpreterToolCall + | ResponseOutputItem.LocalShellCall + | ResponseOutputItem.McpCall + | ResponseOutputItem.McpListTools + | ResponseOutputItem.McpApprovalRequest; + +export namespace ResponseOutputItem { + /** + * An image generation request made by the model. + */ + export interface ImageGenerationCall { + /** + * The unique ID of the image generation call. + */ + id: string; + + /** + * The generated image encoded in base64. + */ + result: string | null; + + /** + * The status of the image generation call. + */ + status: 'in_progress' | 'completed' | 'generating' | 'failed'; + + /** + * The type of the image generation call. Always `image_generation_call`. + */ + type: 'image_generation_call'; + } + + /** + * A tool call to run a command on the local shell. + */ + export interface LocalShellCall { + /** + * The unique ID of the local shell call. + */ + id: string; + + /** + * Execute a shell command on the server. + */ + action: LocalShellCall.Action; + + /** + * The unique ID of the local shell tool call generated by the model. + */ + call_id: string; + + /** + * The status of the local shell call. + */ + status: 'in_progress' | 'completed' | 'incomplete'; + + /** + * The type of the local shell call. Always `local_shell_call`. + */ + type: 'local_shell_call'; + } + + export namespace LocalShellCall { + /** + * Execute a shell command on the server. + */ + export interface Action { + /** + * The command to run. + */ + command: Array; + + /** + * Environment variables to set for the command. + */ + env: Record; + + /** + * The type of the local shell action. Always `exec`. + */ + type: 'exec'; + + /** + * Optional timeout in milliseconds for the command. + */ + timeout_ms?: number | null; + + /** + * Optional user to run the command as. + */ + user?: string | null; + + /** + * Optional working directory to run the command in. + */ + working_directory?: string | null; + } + } + + /** + * An invocation of a tool on an MCP server. + */ + export interface McpCall { + /** + * The unique ID of the tool call. + */ + id: string; + + /** + * A JSON string of the arguments passed to the tool. + */ + arguments: string; + + /** + * The name of the tool that was run. + */ + name: string; + + /** + * The label of the MCP server running the tool. + */ + server_label: string; + + /** + * The type of the item. Always `mcp_call`. + */ + type: 'mcp_call'; + + /** + * The error from the tool call, if any. + */ + error?: string | null; + + /** + * The output from the tool call. + */ + output?: string | null; + } + + /** + * A list of tools available on an MCP server. + */ + export interface McpListTools { + /** + * The unique ID of the list. + */ + id: string; + + /** + * The label of the MCP server. + */ + server_label: string; + + /** + * The tools available on the server. + */ + tools: Array; + + /** + * The type of the item. Always `mcp_list_tools`. + */ + type: 'mcp_list_tools'; + + /** + * Error message if the server could not list tools. + */ + error?: string | null; + } + + export namespace McpListTools { + /** + * A tool available on an MCP server. + */ + export interface Tool { + /** + * The JSON schema describing the tool's input. + */ + input_schema: unknown; + + /** + * The name of the tool. + */ + name: string; + + /** + * Additional annotations about the tool. + */ + annotations?: unknown | null; + + /** + * The description of the tool. + */ + description?: string | null; + } + } + + /** + * A request for human approval of a tool invocation. + */ + export interface McpApprovalRequest { + /** + * The unique ID of the approval request. + */ + id: string; + + /** + * A JSON string of arguments for the tool. + */ + arguments: string; + + /** + * The name of the tool to run. + */ + name: string; + + /** + * The label of the MCP server making the request. + */ + server_label: string; -/** - * An output message from the model. - */ -export type ResponseOutputItem = - | ResponseOutputMessage - | ResponseFileSearchToolCall - | ResponseFunctionToolCall - | ResponseFunctionWebSearch - | ResponseComputerToolCall - | ResponseReasoningItem; + /** + * The type of the item. Always `mcp_approval_request`. + */ + type: 'mcp_approval_request'; + } +} /** * Emitted when a new output item is added. @@ -2073,6 +3107,116 @@ export namespace ResponseOutputText { } } +/** + * Emitted when an annotation is added to output text content. + */ +export interface ResponseOutputTextAnnotationAddedEvent { + /** + * The annotation object being added. (See annotation schema for details.) + */ + annotation: unknown; + + /** + * The index of the annotation within the content part. + */ + annotation_index: number; + + /** + * The index of the content part within the output item. + */ + content_index: number; + + /** + * The unique identifier of the item to which the annotation is being added. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.output_text_annotation.added'. + */ + type: 'response.output_text_annotation.added'; +} + +/** + * Emitted when a response is queued and waiting to be processed. + */ +export interface ResponseQueuedEvent { + /** + * The full response object that is queued. + */ + response: Response; + + /** + * The type of the event. Always 'response.queued'. + */ + type: 'response.queued'; +} + +/** + * Emitted when there is a delta (partial update) to the reasoning content. + */ +export interface ResponseReasoningDeltaEvent { + /** + * The index of the reasoning content part within the output item. + */ + content_index: number; + + /** + * The partial update to the reasoning content. + */ + delta: unknown; + + /** + * The unique identifier of the item for which reasoning is being updated. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The type of the event. Always 'response.reasoning.delta'. + */ + type: 'response.reasoning.delta'; +} + +/** + * Emitted when the reasoning content is finalized for an item. + */ +export interface ResponseReasoningDoneEvent { + /** + * The index of the reasoning content part within the output item. + */ + content_index: number; + + /** + * The unique identifier of the item for which reasoning is finalized. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The finalized reasoning text. + */ + text: string; + + /** + * The type of the event. Always 'response.reasoning.done'. + */ + type: 'response.reasoning.done'; +} + /** * A description of the chain of thought used by a reasoning model while generating * a response. Be sure to include these items in your `input` to the Responses API @@ -2122,6 +3266,67 @@ export namespace ResponseReasoningItem { } } +/** + * Emitted when there is a delta (partial update) to the reasoning summary content. + */ +export interface ResponseReasoningSummaryDeltaEvent { + /** + * The partial update to the reasoning summary content. + */ + delta: unknown; + + /** + * The unique identifier of the item for which the reasoning summary is being + * updated. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The index of the summary part within the output item. + */ + summary_index: number; + + /** + * The type of the event. Always 'response.reasoning_summary.delta'. + */ + type: 'response.reasoning_summary.delta'; +} + +/** + * Emitted when the reasoning summary content is finalized for an item. + */ +export interface ResponseReasoningSummaryDoneEvent { + /** + * The unique identifier of the item for which the reasoning summary is finalized. + */ + item_id: string; + + /** + * The index of the output item in the response's output array. + */ + output_index: number; + + /** + * The index of the summary part within the output item. + */ + summary_index: number; + + /** + * The finalized reasoning summary text. + */ + text: string; + + /** + * The type of the event. Always 'response.reasoning_summary.done'. + */ + type: 'response.reasoning_summary.done'; +} + /** * Emitted when a new reasoning summary part is added. */ @@ -2338,9 +3543,9 @@ export interface ResponseRefusalDoneEvent { /** * The status of the response generation. One of `completed`, `failed`, - * `in_progress`, or `incomplete`. + * `in_progress`, `cancelled`, `queued`, or `incomplete`. */ -export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'incomplete'; +export type ResponseStatus = 'completed' | 'failed' | 'in_progress' | 'cancelled' | 'queued' | 'incomplete'; /** * Emitted when there is a partial audio response. @@ -2381,7 +3586,25 @@ export type ResponseStreamEvent = | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent | ResponseWebSearchCallInProgressEvent - | ResponseWebSearchCallSearchingEvent; + | ResponseWebSearchCallSearchingEvent + | ResponseImageGenCallCompletedEvent + | ResponseImageGenCallGeneratingEvent + | ResponseImageGenCallInProgressEvent + | ResponseImageGenCallPartialImageEvent + | ResponseMcpCallArgumentsDeltaEvent + | ResponseMcpCallArgumentsDoneEvent + | ResponseMcpCallCompletedEvent + | ResponseMcpCallFailedEvent + | ResponseMcpCallInProgressEvent + | ResponseMcpListToolsCompletedEvent + | ResponseMcpListToolsFailedEvent + | ResponseMcpListToolsInProgressEvent + | ResponseOutputTextAnnotationAddedEvent + | ResponseQueuedEvent + | ResponseReasoningDeltaEvent + | ResponseReasoningDoneEvent + | ResponseReasoningSummaryDeltaEvent + | ResponseReasoningSummaryDoneEvent; /** * Emitted when a text annotation is added. @@ -2696,7 +3919,229 @@ export interface ResponseWebSearchCallSearchingEvent { /** * A tool that can be used to generate a response. */ -export type Tool = FileSearchTool | FunctionTool | WebSearchTool | ComputerTool; +export type Tool = + | FunctionTool + | FileSearchTool + | WebSearchTool + | ComputerTool + | Tool.Mcp + | Tool.CodeInterpreter + | Tool.ImageGeneration + | Tool.LocalShell; + +export namespace Tool { + /** + * Give the model access to additional tools via remote Model Context Protocol + * (MCP) servers. + * [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp). + */ + export interface Mcp { + /** + * A label for this MCP server, used to identify it in tool calls. + */ + server_label: string; + + /** + * The URL for the MCP server. + */ + server_url: string; + + /** + * The type of the MCP tool. Always `mcp`. + */ + type: 'mcp'; + + /** + * List of allowed tool names or a filter object. + */ + allowed_tools?: Array | Mcp.McpAllowedToolsFilter | null; + + /** + * Optional HTTP headers to send to the MCP server. Use for authentication or other + * purposes. + */ + headers?: Record | null; + + /** + * Specify which of the MCP server's tools require approval. + */ + require_approval?: Mcp.McpToolApprovalFilter | 'always' | 'never' | null; + } + + export namespace Mcp { + /** + * A filter object to specify which tools are allowed. + */ + export interface McpAllowedToolsFilter { + /** + * List of allowed tool names. + */ + tool_names?: Array; + } + + export interface McpToolApprovalFilter { + /** + * A list of tools that always require approval. + */ + always?: McpToolApprovalFilter.Always; + + /** + * A list of tools that never require approval. + */ + never?: McpToolApprovalFilter.Never; + + /** + * List of allowed tool names. + */ + tool_names?: Array; + } + + export namespace McpToolApprovalFilter { + /** + * A list of tools that always require approval. + */ + export interface Always { + /** + * List of tools that require approval. + */ + tool_names?: Array; + } + + /** + * A list of tools that never require approval. + */ + export interface Never { + /** + * List of tools that do not require approval. + */ + tool_names?: Array; + } + } + } + + /** + * A tool that runs Python code to help generate a response to a prompt. + */ + export interface CodeInterpreter { + /** + * The code interpreter container. Can be a container ID or an object that + * specifies uploaded file IDs to make available to your code. + */ + container: string | CodeInterpreter.CodeInterpreterToolAuto; + + /** + * The type of the code interpreter tool. Always `code_interpreter`. + */ + type: 'code_interpreter'; + } + + export namespace CodeInterpreter { + /** + * Configuration for a code interpreter container. Optionally specify the IDs of + * the files to run the code on. + */ + export interface CodeInterpreterToolAuto { + /** + * Always `auto`. + */ + type: 'auto'; + + /** + * An optional list of uploaded files to make available to your code. + */ + file_ids?: Array; + } + } + + /** + * A tool that generates images using a model like `gpt-image-1`. + */ + export interface ImageGeneration { + /** + * The type of the image generation tool. Always `image_generation`. + */ + type: 'image_generation'; + + /** + * Background type for the generated image. One of `transparent`, `opaque`, or + * `auto`. Default: `auto`. + */ + background?: 'transparent' | 'opaque' | 'auto'; + + /** + * Optional mask for inpainting. Contains `image_url` (string, optional) and + * `file_id` (string, optional). + */ + input_image_mask?: ImageGeneration.InputImageMask; + + /** + * The image generation model to use. Default: `gpt-image-1`. + */ + model?: 'gpt-image-1'; + + /** + * Moderation level for the generated image. Default: `auto`. + */ + moderation?: 'auto' | 'low'; + + /** + * Compression level for the output image. Default: 100. + */ + output_compression?: number; + + /** + * The output format of the generated image. One of `png`, `webp`, or `jpeg`. + * Default: `png`. + */ + output_format?: 'png' | 'webp' | 'jpeg'; + + /** + * Number of partial images to generate in streaming mode, from 0 (default value) + * to 3. + */ + partial_images?: number; + + /** + * The quality of the generated image. One of `low`, `medium`, `high`, or `auto`. + * Default: `auto`. + */ + quality?: 'low' | 'medium' | 'high' | 'auto'; + + /** + * The size of the generated image. One of `1024x1024`, `1024x1536`, `1536x1024`, + * or `auto`. Default: `auto`. + */ + size?: '1024x1024' | '1024x1536' | '1536x1024' | 'auto'; + } + + export namespace ImageGeneration { + /** + * Optional mask for inpainting. Contains `image_url` (string, optional) and + * `file_id` (string, optional). + */ + export interface InputImageMask { + /** + * File ID for the mask image. + */ + file_id?: string; + + /** + * Base64-encoded mask image. + */ + image_url?: string; + } + } + + /** + * A tool that allows the model to execute shell commands in a local environment. + */ + export interface LocalShell { + /** + * The type of the local shell tool. Always `local_shell`. + */ + type: 'local_shell'; + } +} /** * Use this option to force the model to call a specific function. @@ -2739,8 +4184,18 @@ export interface ToolChoiceTypes { * - `file_search` * - `web_search_preview` * - `computer_use_preview` - */ - type: 'file_search' | 'web_search_preview' | 'computer_use_preview' | 'web_search_preview_2025_03_11'; + * - `code_interpreter` + * - `mcp` + * - `image_generation` + */ + type: + | 'file_search' + | 'web_search_preview' + | 'computer_use_preview' + | 'web_search_preview_2025_03_11' + | 'image_generation' + | 'code_interpreter' + | 'mcp'; } /** @@ -2826,6 +4281,12 @@ export interface ResponseCreateParamsBase { */ model: Shared.ResponsesModel; + /** + * Whether to run the model response in the background. + * [Learn more](https://platform.openai.com/docs/guides/background). + */ + background?: boolean | null; + /** * Specify additional output data to include in the model response. Currently * supported values are: @@ -3075,6 +4536,10 @@ export declare namespace Responses { type ResponseFunctionToolCallItem as ResponseFunctionToolCallItem, type ResponseFunctionToolCallOutputItem as ResponseFunctionToolCallOutputItem, type ResponseFunctionWebSearch as ResponseFunctionWebSearch, + type ResponseImageGenCallCompletedEvent as ResponseImageGenCallCompletedEvent, + type ResponseImageGenCallGeneratingEvent as ResponseImageGenCallGeneratingEvent, + type ResponseImageGenCallInProgressEvent as ResponseImageGenCallInProgressEvent, + type ResponseImageGenCallPartialImageEvent as ResponseImageGenCallPartialImageEvent, type ResponseInProgressEvent as ResponseInProgressEvent, type ResponseIncludable as ResponseIncludable, type ResponseIncompleteEvent as ResponseIncompleteEvent, @@ -3088,6 +4553,14 @@ export declare namespace Responses { type ResponseInputMessageItem as ResponseInputMessageItem, type ResponseInputText as ResponseInputText, type ResponseItem as ResponseItem, + type ResponseMcpCallArgumentsDeltaEvent as ResponseMcpCallArgumentsDeltaEvent, + type ResponseMcpCallArgumentsDoneEvent as ResponseMcpCallArgumentsDoneEvent, + type ResponseMcpCallCompletedEvent as ResponseMcpCallCompletedEvent, + type ResponseMcpCallFailedEvent as ResponseMcpCallFailedEvent, + type ResponseMcpCallInProgressEvent as ResponseMcpCallInProgressEvent, + type ResponseMcpListToolsCompletedEvent as ResponseMcpListToolsCompletedEvent, + type ResponseMcpListToolsFailedEvent as ResponseMcpListToolsFailedEvent, + type ResponseMcpListToolsInProgressEvent as ResponseMcpListToolsInProgressEvent, type ResponseOutputAudio as ResponseOutputAudio, type ResponseOutputItem as ResponseOutputItem, type ResponseOutputItemAddedEvent as ResponseOutputItemAddedEvent, @@ -3095,7 +4568,13 @@ export declare namespace Responses { type ResponseOutputMessage as ResponseOutputMessage, type ResponseOutputRefusal as ResponseOutputRefusal, type ResponseOutputText as ResponseOutputText, + type ResponseOutputTextAnnotationAddedEvent as ResponseOutputTextAnnotationAddedEvent, + type ResponseQueuedEvent as ResponseQueuedEvent, + type ResponseReasoningDeltaEvent as ResponseReasoningDeltaEvent, + type ResponseReasoningDoneEvent as ResponseReasoningDoneEvent, type ResponseReasoningItem as ResponseReasoningItem, + type ResponseReasoningSummaryDeltaEvent as ResponseReasoningSummaryDeltaEvent, + type ResponseReasoningSummaryDoneEvent as ResponseReasoningSummaryDoneEvent, type ResponseReasoningSummaryPartAddedEvent as ResponseReasoningSummaryPartAddedEvent, type ResponseReasoningSummaryPartDoneEvent as ResponseReasoningSummaryPartDoneEvent, type ResponseReasoningSummaryTextDeltaEvent as ResponseReasoningSummaryTextDeltaEvent, diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 40b39ab55..893ffcc5e 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -23,6 +23,7 @@ describe('resource responses', () => { const response = await client.responses.create({ input: 'string', model: 'gpt-4o', + background: true, include: ['file_search_call.results'], instructions: 'instructions', max_output_tokens: 0, @@ -38,11 +39,11 @@ describe('resource responses', () => { tool_choice: 'none', tools: [ { - type: 'file_search', - vector_store_ids: ['string'], - filters: { key: 'key', type: 'eq', value: 'string' }, - max_num_results: 0, - ranking_options: { ranker: 'auto', score_threshold: 0 }, + name: 'name', + parameters: { foo: 'bar' }, + strict: true, + type: 'function', + description: 'description', }, ], top_p: 1, From 3ffca5c5b2dc6819e955ed343b2bb6e2095e7bdf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 21 May 2025 18:37:18 +0000 Subject: [PATCH 419/509] feat(api): add container endpoint --- .stats.yml | 8 +- MIGRATION.md | 9 + api.md | 37 +++ bin/migration-config.json | 105 +++++++ src/client.ts | 21 ++ src/resources/containers.ts | 3 + src/resources/containers/containers.ts | 284 ++++++++++++++++++ src/resources/containers/files.ts | 3 + src/resources/containers/files/content.ts | 28 ++ src/resources/containers/files/files.ts | 224 ++++++++++++++ src/resources/containers/files/index.ts | 14 + src/resources/containers/index.ts | 22 ++ src/resources/index.ts | 9 + src/resources/responses/responses.ts | 267 +++++++++++++++- .../containers/containers.test.ts | 72 +++++ .../containers/files/content.test.ts | 29 ++ .../containers/files/files.test.ts | 73 +++++ .../api-resources/responses/responses.test.ts | 11 + 18 files changed, 1211 insertions(+), 8 deletions(-) create mode 100644 src/resources/containers.ts create mode 100644 src/resources/containers/containers.ts create mode 100644 src/resources/containers/files.ts create mode 100644 src/resources/containers/files/content.ts create mode 100644 src/resources/containers/files/files.ts create mode 100644 src/resources/containers/files/index.ts create mode 100644 src/resources/containers/index.ts create mode 100644 tests/api-resources/containers/containers.test.ts create mode 100644 tests/api-resources/containers/files/content.test.ts create mode 100644 tests/api-resources/containers/files/files.test.ts diff --git a/.stats.yml b/.stats.yml index 4b4f19c91..41319e5e5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a5651cb97f86d1e2531af6aef8c5230f1ea350560fbae790ca2e481b30a6c217.yml -openapi_spec_hash: 66a5104fd3bb43383cf919225df7a6fd -config_hash: bb657c3fed232a56930035de3aaed936 +configured_endpoints: 111 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6af14840a810139bf407013167ce1c8fb21b6ef8eb0cc3db58b51af7d52c4b5a.yml +openapi_spec_hash: 3241bde6b273cfec0035e522bd07985d +config_hash: 7367b68a4e7db36885c1a886f57b17f6 diff --git a/MIGRATION.md b/MIGRATION.md index 4e138b42c..c679ba003 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -78,6 +78,9 @@ client.parents.children.retrieve('c_456', { parent_id: 'p_123' }); - `client.evals.runs.cancel()` - `client.evals.runs.outputItems.retrieve()` - `client.evals.runs.outputItems.list()` +- `client.containers.files.retrieve()` +- `client.containers.files.delete()` +- `client.containers.files.content.retrieve()` @@ -128,6 +131,8 @@ This affects the following methods: - `client.responses.inputItems.list()` - `client.evals.list()` - `client.evals.runs.list()` +- `client.containers.list()` +- `client.containers.files.list()` ### HTTP method naming @@ -147,6 +152,8 @@ client.beta.threads.messages.del(); client.responses.del(); client.evals.del(); client.evals.runs.del(); +client.containers.del(); +client.containers.files.del(); // After client.chat.completions.delete(); @@ -161,6 +168,8 @@ client.beta.threads.messages.delete(); client.responses.delete(); client.evals.delete(); client.evals.runs.delete(); +client.containers.delete(); +client.containers.files.delete(); ``` ### Removed `httpAgent` in favor of `fetchOptions` diff --git a/api.md b/api.md index 989fd6633..1dae138c7 100644 --- a/api.md +++ b/api.md @@ -710,6 +710,7 @@ Methods: - client.responses.create({ ...params }) -> Response - client.responses.retrieve(responseID, { ...params }) -> Response - client.responses.delete(responseID) -> void +- client.responses.cancel(responseID) -> void ## InputItems @@ -773,3 +774,39 @@ Methods: - client.evals.runs.outputItems.retrieve(outputItemID, { ...params }) -> OutputItemRetrieveResponse - client.evals.runs.outputItems.list(runID, { ...params }) -> OutputItemListResponsesPage + +# Containers + +Types: + +- ContainerCreateResponse +- ContainerRetrieveResponse +- ContainerListResponse + +Methods: + +- client.containers.create({ ...params }) -> ContainerCreateResponse +- client.containers.retrieve(containerID) -> ContainerRetrieveResponse +- client.containers.list({ ...params }) -> ContainerListResponsesPage +- client.containers.delete(containerID) -> void + +## Files + +Types: + +- FileCreateResponse +- FileRetrieveResponse +- FileListResponse + +Methods: + +- client.containers.files.create(containerID, { ...params }) -> FileCreateResponse +- client.containers.files.retrieve(fileID, { ...params }) -> FileRetrieveResponse +- client.containers.files.list(containerID, { ...params }) -> FileListResponsesPage +- client.containers.files.delete(fileID, { ...params }) -> void + +### Content + +Methods: + +- client.containers.files.content.retrieve(fileID, { ...params }) -> void diff --git a/bin/migration-config.json b/bin/migration-config.json index 9751f977c..8000d839c 100644 --- a/bin/migration-config.json +++ b/bin/migration-config.json @@ -814,6 +814,111 @@ "type": "options" } ] + }, + { + "base": "containers", + "name": "delete", + "oldName": "del" + }, + { + "base": "containers.files", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "container_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "containers.files", + "name": "delete", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldName": "del", + "oldParams": [ + { + "type": "param", + "key": "container_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] + }, + { + "base": "containers.files.content", + "name": "retrieve", + "params": [ + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "params", + "maybeOverload": false + }, + { + "type": "options" + } + ], + "oldParams": [ + { + "type": "param", + "key": "container_id", + "location": "path" + }, + { + "type": "param", + "key": "file_id", + "location": "path" + }, + { + "type": "options" + } + ] } ] } diff --git a/src/client.ts b/src/client.ts index 12fd53b59..9ebdf8f02 100644 --- a/src/client.ts +++ b/src/client.ts @@ -85,6 +85,15 @@ import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; +import { + ContainerCreateParams, + ContainerCreateResponse, + ContainerListParams, + ContainerListResponse, + ContainerListResponsesPage, + ContainerRetrieveResponse, + Containers, +} from './resources/containers/containers'; import { EvalCreateParams, EvalCreateResponse, @@ -892,6 +901,7 @@ export class OpenAI { uploads: API.Uploads = new API.Uploads(this); responses: API.Responses = new API.Responses(this); evals: API.Evals = new API.Evals(this); + containers: API.Containers = new API.Containers(this); } OpenAI.Completions = Completions; OpenAI.Chat = Chat; @@ -909,6 +919,7 @@ OpenAI.Batches = Batches; OpenAI.Uploads = UploadsAPIUploads; OpenAI.Responses = Responses; OpenAI.Evals = Evals; +OpenAI.Containers = Containers; export declare namespace OpenAI { export type RequestOptions = Opts.RequestOptions; @@ -1077,6 +1088,16 @@ export declare namespace OpenAI { type EvalListParams as EvalListParams, }; + export { + Containers as Containers, + type ContainerCreateResponse as ContainerCreateResponse, + type ContainerRetrieveResponse as ContainerRetrieveResponse, + type ContainerListResponse as ContainerListResponse, + type ContainerListResponsesPage as ContainerListResponsesPage, + type ContainerCreateParams as ContainerCreateParams, + type ContainerListParams as ContainerListParams, + }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; diff --git a/src/resources/containers.ts b/src/resources/containers.ts new file mode 100644 index 000000000..c8f3a6456 --- /dev/null +++ b/src/resources/containers.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './containers/index'; diff --git a/src/resources/containers/containers.ts b/src/resources/containers/containers.ts new file mode 100644 index 000000000..7fd73ebc0 --- /dev/null +++ b/src/resources/containers/containers.ts @@ -0,0 +1,284 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../core/resource'; +import * as FilesAPI from './files/files'; +import { + FileCreateParams, + FileCreateResponse, + FileDeleteParams, + FileListParams, + FileListResponse, + FileListResponsesPage, + FileRetrieveParams, + FileRetrieveResponse, + Files, +} from './files/files'; +import { APIPromise } from '../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination'; +import { buildHeaders } from '../../internal/headers'; +import { RequestOptions } from '../../internal/request-options'; +import { path } from '../../internal/utils/path'; + +export class Containers extends APIResource { + files: FilesAPI.Files = new FilesAPI.Files(this._client); + + /** + * Create Container + */ + create(body: ContainerCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/containers', { body, ...options }); + } + + /** + * Retrieve Container + */ + retrieve(containerID: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/containers/${containerID}`, options); + } + + /** + * List Containers + */ + list( + query: ContainerListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/containers', CursorPage, { query, ...options }); + } + + /** + * Delete Container + */ + delete(containerID: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/containers/${containerID}`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +export type ContainerListResponsesPage = CursorPage; + +export interface ContainerCreateResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerCreateResponse.ExpiresAfter; +} + +export namespace ContainerCreateResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerRetrieveResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerRetrieveResponse.ExpiresAfter; +} + +export namespace ContainerRetrieveResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerListResponse { + /** + * Unique identifier for the container. + */ + id: string; + + /** + * Unix timestamp (in seconds) when the container was created. + */ + created_at: number; + + /** + * Name of the container. + */ + name: string; + + /** + * The type of this object. + */ + object: string; + + /** + * Status of the container (e.g., active, deleted). + */ + status: string; + + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + expires_after?: ContainerListResponse.ExpiresAfter; +} + +export namespace ContainerListResponse { + /** + * The container will expire after this time period. The anchor is the reference + * point for the expiration. The minutes is the number of minutes after the anchor + * before the container expires. + */ + export interface ExpiresAfter { + /** + * The reference point for the expiration. + */ + anchor?: 'last_active_at'; + + /** + * The number of minutes after the anchor before the container expires. + */ + minutes?: number; + } +} + +export interface ContainerCreateParams { + /** + * Name of the container to create. + */ + name: string; + + /** + * Container expiration time in seconds relative to the 'anchor' time. + */ + expires_after?: ContainerCreateParams.ExpiresAfter; + + /** + * IDs of files to copy to the container. + */ + file_ids?: Array; +} + +export namespace ContainerCreateParams { + /** + * Container expiration time in seconds relative to the 'anchor' time. + */ + export interface ExpiresAfter { + /** + * Time anchor for the expiration time. Currently only 'last_active_at' is + * supported. + */ + anchor: 'last_active_at'; + + minutes: number; + } +} + +export interface ContainerListParams extends CursorPageParams { + /** + * Sort order by the `created_at` timestamp of the objects. `asc` for ascending + * order and `desc` for descending order. + */ + order?: 'asc' | 'desc'; +} + +Containers.Files = Files; + +export declare namespace Containers { + export { + type ContainerCreateResponse as ContainerCreateResponse, + type ContainerRetrieveResponse as ContainerRetrieveResponse, + type ContainerListResponse as ContainerListResponse, + type ContainerListResponsesPage as ContainerListResponsesPage, + type ContainerCreateParams as ContainerCreateParams, + type ContainerListParams as ContainerListParams, + }; + + export { + Files as Files, + type FileCreateResponse as FileCreateResponse, + type FileRetrieveResponse as FileRetrieveResponse, + type FileListResponse as FileListResponse, + type FileListResponsesPage as FileListResponsesPage, + type FileCreateParams as FileCreateParams, + type FileRetrieveParams as FileRetrieveParams, + type FileListParams as FileListParams, + type FileDeleteParams as FileDeleteParams, + }; +} diff --git a/src/resources/containers/files.ts b/src/resources/containers/files.ts new file mode 100644 index 000000000..46a5299c1 --- /dev/null +++ b/src/resources/containers/files.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './files/index'; diff --git a/src/resources/containers/files/content.ts b/src/resources/containers/files/content.ts new file mode 100644 index 000000000..e22f4bf96 --- /dev/null +++ b/src/resources/containers/files/content.ts @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import { APIPromise } from '../../../core/api-promise'; +import { buildHeaders } from '../../../internal/headers'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Content extends APIResource { + /** + * Retrieve Container File Content + */ + retrieve(fileID: string, params: ContentRetrieveParams, options?: RequestOptions): APIPromise { + const { container_id } = params; + return this._client.get(path`/containers/${container_id}/files/${fileID}/content`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +export interface ContentRetrieveParams { + container_id: string; +} + +export declare namespace Content { + export { type ContentRetrieveParams as ContentRetrieveParams }; +} diff --git a/src/resources/containers/files/files.ts b/src/resources/containers/files/files.ts new file mode 100644 index 000000000..7d7af66d5 --- /dev/null +++ b/src/resources/containers/files/files.ts @@ -0,0 +1,224 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as ContentAPI from './content'; +import { Content, ContentRetrieveParams } from './content'; +import { APIPromise } from '../../../core/api-promise'; +import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination'; +import { type Uploadable } from '../../../core/uploads'; +import { buildHeaders } from '../../../internal/headers'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Files extends APIResource { + content: ContentAPI.Content = new ContentAPI.Content(this._client); + + /** + * Create a Container File + * + * You can send either a multipart/form-data request with the raw file content, or + * a JSON request with a file ID. + */ + create( + containerID: string, + body: FileCreateParams, + options?: RequestOptions, + ): APIPromise { + return this._client.post(path`/containers/${containerID}/files`, { body, ...options }); + } + + /** + * Retrieve Container File + */ + retrieve( + fileID: string, + params: FileRetrieveParams, + options?: RequestOptions, + ): APIPromise { + const { container_id } = params; + return this._client.get(path`/containers/${container_id}/files/${fileID}`, options); + } + + /** + * List Container files + */ + list( + containerID: string, + query: FileListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList(path`/containers/${containerID}/files`, CursorPage, { + query, + ...options, + }); + } + + /** + * Delete Container File + */ + delete(fileID: string, params: FileDeleteParams, options?: RequestOptions): APIPromise { + const { container_id } = params; + return this._client.delete(path`/containers/${container_id}/files/${fileID}`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } +} + +export type FileListResponsesPage = CursorPage; + +export interface FileCreateResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileRetrieveResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileListResponse { + /** + * Unique identifier for the file. + */ + id: string; + + /** + * Size of the file in bytes. + */ + bytes: number; + + /** + * The container this file belongs to. + */ + container_id: string; + + /** + * Unix timestamp (in seconds) when the file was created. + */ + created_at: number; + + /** + * The type of this object (`container.file`). + */ + object: 'container.file'; + + /** + * Path of the file in the container. + */ + path: string; + + /** + * Source of the file (e.g., `user`, `assistant`). + */ + source: string; +} + +export interface FileCreateParams { + /** + * The File object (not file name) to be uploaded. + */ + file?: Uploadable; + + /** + * Name of the file to create. + */ + file_id?: string; +} + +export interface FileRetrieveParams { + container_id: string; +} + +export interface FileListParams extends CursorPageParams { + /** + * Sort order by the `created_at` timestamp of the objects. `asc` for ascending + * order and `desc` for descending order. + */ + order?: 'asc' | 'desc'; +} + +export interface FileDeleteParams { + container_id: string; +} + +Files.Content = Content; + +export declare namespace Files { + export { + type FileCreateResponse as FileCreateResponse, + type FileRetrieveResponse as FileRetrieveResponse, + type FileListResponse as FileListResponse, + type FileListResponsesPage as FileListResponsesPage, + type FileCreateParams as FileCreateParams, + type FileRetrieveParams as FileRetrieveParams, + type FileListParams as FileListParams, + type FileDeleteParams as FileDeleteParams, + }; + + export { Content as Content, type ContentRetrieveParams as ContentRetrieveParams }; +} diff --git a/src/resources/containers/files/index.ts b/src/resources/containers/files/index.ts new file mode 100644 index 000000000..863f438c4 --- /dev/null +++ b/src/resources/containers/files/index.ts @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Content, type ContentRetrieveParams } from './content'; +export { + Files, + type FileCreateResponse, + type FileRetrieveResponse, + type FileListResponse, + type FileCreateParams, + type FileRetrieveParams, + type FileListParams, + type FileDeleteParams, + type FileListResponsesPage, +} from './files'; diff --git a/src/resources/containers/index.ts b/src/resources/containers/index.ts new file mode 100644 index 000000000..265451481 --- /dev/null +++ b/src/resources/containers/index.ts @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Containers, + type ContainerCreateResponse, + type ContainerRetrieveResponse, + type ContainerListResponse, + type ContainerCreateParams, + type ContainerListParams, + type ContainerListResponsesPage, +} from './containers'; +export { + Files, + type FileCreateResponse, + type FileRetrieveResponse, + type FileListResponse, + type FileCreateParams, + type FileRetrieveParams, + type FileListParams, + type FileDeleteParams, + type FileListResponsesPage, +} from './files/index'; diff --git a/src/resources/index.ts b/src/resources/index.ts index eb244dfda..d64befac9 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -22,6 +22,15 @@ export { type CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming, } from './completions'; +export { + Containers, + type ContainerCreateResponse, + type ContainerRetrieveResponse, + type ContainerListResponse, + type ContainerCreateParams, + type ContainerListParams, + type ContainerListResponsesPage, +} from './containers/containers'; export { Embeddings, type CreateEmbeddingResponse, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 1c93c28f4..32ae7bce7 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -88,6 +88,25 @@ export class Responses extends APIResource { headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } + + /** + * Cancels a model response with the given ID. Only responses created with the + * `background` parameter set to `true` can be cancelled. + * [Learn more](https://platform.openai.com/docs/guides/background). + * + * @example + * ```ts + * await client.responses.cancel( + * 'resp_677efb5139a88190b512bc3fef8e535d', + * ); + * ``` + */ + cancel(responseID: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/responses/${responseID}/cancel`, { + ...options, + headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + }); + } } export type ResponseItemsPage = CursorPage; @@ -452,6 +471,11 @@ export interface ResponseAudioDeltaEvent { */ delta: string; + /** + * A sequence number for this chunk of the stream response. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.delta`. */ @@ -462,6 +486,11 @@ export interface ResponseAudioDeltaEvent { * Emitted when the audio response is complete. */ export interface ResponseAudioDoneEvent { + /** + * The sequence number of the delta. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.done`. */ @@ -477,6 +506,11 @@ export interface ResponseAudioTranscriptDeltaEvent { */ delta: string; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.transcript.delta`. */ @@ -487,6 +521,11 @@ export interface ResponseAudioTranscriptDeltaEvent { * Emitted when the full audio transcript is completed. */ export interface ResponseAudioTranscriptDoneEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.audio.transcript.done`. */ @@ -507,6 +546,11 @@ export interface ResponseCodeInterpreterCallCodeDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.code.delta`. */ @@ -527,6 +571,11 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.code.done`. */ @@ -547,6 +596,11 @@ export interface ResponseCodeInterpreterCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.completed`. */ @@ -567,6 +621,11 @@ export interface ResponseCodeInterpreterCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.in_progress`. */ @@ -587,6 +646,11 @@ export interface ResponseCodeInterpreterCallInterpretingEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.code_interpreter_call.interpreting`. */ @@ -680,6 +744,11 @@ export interface ResponseCompletedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.completed`. */ @@ -1062,6 +1131,11 @@ export interface ResponseContentPartAddedEvent { */ part: ResponseOutputText | ResponseOutputRefusal; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.content_part.added`. */ @@ -1092,6 +1166,11 @@ export interface ResponseContentPartDoneEvent { */ part: ResponseOutputText | ResponseOutputRefusal; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.content_part.done`. */ @@ -1107,6 +1186,11 @@ export interface ResponseCreatedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.created`. */ @@ -1165,6 +1249,11 @@ export interface ResponseErrorEvent { */ param: string | null; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `error`. */ @@ -1180,6 +1269,11 @@ export interface ResponseFailedEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.failed`. */ @@ -1200,6 +1294,11 @@ export interface ResponseFileSearchCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.completed`. */ @@ -1220,6 +1319,11 @@ export interface ResponseFileSearchCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.in_progress`. */ @@ -1240,6 +1344,11 @@ export interface ResponseFileSearchCallSearchingEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.file_search_call.searching`. */ @@ -1390,6 +1499,11 @@ export interface ResponseFunctionCallArgumentsDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.function_call_arguments.delta`. */ @@ -1415,6 +1529,11 @@ export interface ResponseFunctionCallArgumentsDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + type: 'response.function_call_arguments.done'; } @@ -1533,6 +1652,11 @@ export interface ResponseImageGenCallCompletedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.image_generation_call.completed'. */ @@ -1555,14 +1679,14 @@ export interface ResponseImageGenCallGeneratingEvent { output_index: number; /** - * The type of the event. Always 'response.image_generation_call.generating'. + * The sequence number of the image generation item being processed. */ - type: 'response.image_generation_call.generating'; + sequence_number: number; /** - * The sequence number of the image generation item being processed. + * The type of the event. Always 'response.image_generation_call.generating'. */ - sequence_number?: number; + type: 'response.image_generation_call.generating'; } /** @@ -1635,6 +1759,11 @@ export interface ResponseInProgressEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.in_progress`. */ @@ -1671,6 +1800,11 @@ export interface ResponseIncompleteEvent { */ response: Response; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.incomplete`. */ @@ -2567,6 +2701,11 @@ export interface ResponseMcpCallArgumentsDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.arguments_delta'. */ @@ -2592,6 +2731,11 @@ export interface ResponseMcpCallArgumentsDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.arguments_done'. */ @@ -2602,6 +2746,11 @@ export interface ResponseMcpCallArgumentsDoneEvent { * Emitted when an MCP tool call has completed successfully. */ export interface ResponseMcpCallCompletedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.completed'. */ @@ -2612,6 +2761,11 @@ export interface ResponseMcpCallCompletedEvent { * Emitted when an MCP tool call has failed. */ export interface ResponseMcpCallFailedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.failed'. */ @@ -2632,6 +2786,11 @@ export interface ResponseMcpCallInProgressEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_call.in_progress'. */ @@ -2642,6 +2801,11 @@ export interface ResponseMcpCallInProgressEvent { * Emitted when the list of available MCP tools has been successfully retrieved. */ export interface ResponseMcpListToolsCompletedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.completed'. */ @@ -2652,6 +2816,11 @@ export interface ResponseMcpListToolsCompletedEvent { * Emitted when the attempt to list available MCP tools has failed. */ export interface ResponseMcpListToolsFailedEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.failed'. */ @@ -2663,6 +2832,11 @@ export interface ResponseMcpListToolsFailedEvent { * MCP tools. */ export interface ResponseMcpListToolsInProgressEvent { + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.mcp_list_tools.in_progress'. */ @@ -2941,6 +3115,11 @@ export interface ResponseOutputItemAddedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_item.added`. */ @@ -2961,6 +3140,11 @@ export interface ResponseOutputItemDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_item.done`. */ @@ -3136,6 +3320,11 @@ export interface ResponseOutputTextAnnotationAddedEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.output_text_annotation.added'. */ @@ -3151,6 +3340,11 @@ export interface ResponseQueuedEvent { */ response: Response; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.queued'. */ @@ -3181,6 +3375,11 @@ export interface ResponseReasoningDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always 'response.reasoning.delta'. */ @@ -3206,6 +3405,11 @@ export interface ResponseReasoningDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The finalized reasoning text. */ @@ -3286,6 +3490,11 @@ export interface ResponseReasoningSummaryDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the output item. */ @@ -3311,6 +3520,11 @@ export interface ResponseReasoningSummaryDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the output item. */ @@ -3346,6 +3560,11 @@ export interface ResponseReasoningSummaryPartAddedEvent { */ part: ResponseReasoningSummaryPartAddedEvent.Part; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3393,6 +3612,11 @@ export interface ResponseReasoningSummaryPartDoneEvent { */ part: ResponseReasoningSummaryPartDoneEvent.Part; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3440,6 +3664,11 @@ export interface ResponseReasoningSummaryTextDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3465,6 +3694,11 @@ export interface ResponseReasoningSummaryTextDoneEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The index of the summary part within the reasoning summary. */ @@ -3505,6 +3739,11 @@ export interface ResponseRefusalDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.refusal.delta`. */ @@ -3535,6 +3774,11 @@ export interface ResponseRefusalDoneEvent { */ refusal: string; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.refusal.done`. */ @@ -3638,6 +3882,11 @@ export interface ResponseTextAnnotationDeltaEvent { */ output_index: number; + /** + * The sequence number of this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_text.annotation.added`. */ @@ -3766,6 +4015,11 @@ export interface ResponseTextDeltaEvent { */ output_index: number; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The type of the event. Always `response.output_text.delta`. */ @@ -3791,6 +4045,11 @@ export interface ResponseTextDoneEvent { */ output_index: number; + /** + * The sequence number for this event. + */ + sequence_number: number; + /** * The text content that is finalized. */ diff --git a/tests/api-resources/containers/containers.test.ts b/tests/api-resources/containers/containers.test.ts new file mode 100644 index 000000000..aa8bd8211 --- /dev/null +++ b/tests/api-resources/containers/containers.test.ts @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource containers', () => { + test('create: only required params', async () => { + const responsePromise = client.containers.create({ name: 'name' }); + 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('create: required and optional params', async () => { + const response = await client.containers.create({ + name: 'name', + expires_after: { anchor: 'last_active_at', minutes: 0 }, + file_ids: ['string'], + }); + }); + + test('retrieve', async () => { + const responsePromise = client.containers.retrieve('container_id'); + 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', async () => { + const responsePromise = client.containers.list(); + 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.containers.list( + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete', async () => { + const responsePromise = client.containers.delete('container_id'); + 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); + }); +}); diff --git a/tests/api-resources/containers/files/content.test.ts b/tests/api-resources/containers/files/content.test.ts new file mode 100644 index 000000000..caa78b8a6 --- /dev/null +++ b/tests/api-resources/containers/files/content.test.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource content', () => { + test('retrieve: only required params', async () => { + const responsePromise = client.containers.files.content.retrieve('file_id', { + container_id: 'container_id', + }); + 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('retrieve: required and optional params', async () => { + const response = await client.containers.files.content.retrieve('file_id', { + container_id: 'container_id', + }); + }); +}); diff --git a/tests/api-resources/containers/files/files.test.ts b/tests/api-resources/containers/files/files.test.ts new file mode 100644 index 000000000..f57b46316 --- /dev/null +++ b/tests/api-resources/containers/files/files.test.ts @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource files', () => { + test('create', async () => { + const responsePromise = client.containers.files.create('container_id', {}); + 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('retrieve: only required params', async () => { + const responsePromise = client.containers.files.retrieve('file_id', { container_id: 'container_id' }); + 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('retrieve: required and optional params', async () => { + const response = await client.containers.files.retrieve('file_id', { container_id: 'container_id' }); + }); + + test('list', async () => { + const responsePromise = client.containers.files.list('container_id'); + 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.containers.files.list( + 'container_id', + { after: 'after', limit: 0, order: 'asc' }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(OpenAI.NotFoundError); + }); + + test('delete: only required params', async () => { + const responsePromise = client.containers.files.delete('file_id', { container_id: 'container_id' }); + 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('delete: required and optional params', async () => { + const response = await client.containers.files.delete('file_id', { container_id: 'container_id' }); + }); +}); diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 893ffcc5e..b40b4d36f 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -84,4 +84,15 @@ describe('resource responses', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); + + test('cancel', async () => { + const responsePromise = client.responses.cancel('resp_677efb5139a88190b512bc3fef8e535d'); + 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); + }); }); From c07149125128687f026df0d04b304167cf6c9910 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 19:58:06 +0000 Subject: [PATCH 420/509] feat(api): new streaming helpers for background responses --- .stats.yml | 6 +- api.md | 1 - src/resources/beta/realtime/realtime.ts | 8 +- src/resources/chat/completions/completions.ts | 4 +- src/resources/containers/files/files.ts | 6 +- src/resources/responses/input-items.ts | 2 +- src/resources/responses/responses.ts | 145 +++--------------- 7 files changed, 34 insertions(+), 138 deletions(-) diff --git a/.stats.yml b/.stats.yml index 41319e5e5..017aa58a1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-6af14840a810139bf407013167ce1c8fb21b6ef8eb0cc3db58b51af7d52c4b5a.yml -openapi_spec_hash: 3241bde6b273cfec0035e522bd07985d -config_hash: 7367b68a4e7db36885c1a886f57b17f6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml +openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c +config_hash: c497f6b750cc89c0bf2eefc0bc839c70 diff --git a/api.md b/api.md index 1dae138c7..f54b286cc 100644 --- a/api.md +++ b/api.md @@ -691,7 +691,6 @@ Types: - ResponseRefusalDoneEvent - ResponseStatus - ResponseStreamEvent -- ResponseTextAnnotationDeltaEvent - ResponseTextConfig - ResponseTextDeltaEvent - ResponseTextDoneEvent diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index c09d6c04b..bdbd6872d 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -928,7 +928,7 @@ export namespace RealtimeClientEvent { * the server to stop generating audio and emit a `output_audio_buffer.cleared` * event. This event should be preceded by a `response.cancel` client event to stop * the generation of the current response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferClear { /** @@ -1227,7 +1227,7 @@ export namespace RealtimeServerEvent { * **WebRTC Only:** Emitted when the server begins streaming audio to the client. * This event is emitted after an audio content part has been added * (`response.content_part.added`) to the response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferStarted { /** @@ -1250,7 +1250,7 @@ export namespace RealtimeServerEvent { * **WebRTC Only:** Emitted when the output audio buffer has been completely * drained on the server, and no more audio is forthcoming. This event is emitted * after the full response data has been sent to the client (`response.done`). - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferStopped { /** @@ -1275,7 +1275,7 @@ export namespace RealtimeServerEvent { * (`input_audio_buffer.speech_started`), or when the client has emitted the * `output_audio_buffer.clear` event to manually cut off the current audio * response. - * [Learn more](https://platform.openai.com/docs/guides/realtime-model-capabilities#client-and-server-events-for-audio-in-webrtc). + * [Learn more](https://platform.openai.com/docs/guides/realtime-conversations#client-and-server-events-for-audio-in-webrtc). */ export interface OutputAudioBufferCleared { /** diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 585febaa6..20908614e 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1437,8 +1437,8 @@ export interface ChatCompletionCreateParamsBase { top_p?: number | null; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; diff --git a/src/resources/containers/files/files.ts b/src/resources/containers/files/files.ts index 7d7af66d5..cc98d7bf9 100644 --- a/src/resources/containers/files/files.ts +++ b/src/resources/containers/files/files.ts @@ -8,6 +8,7 @@ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pa import { type Uploadable } from '../../../core/uploads'; import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; +import { multipartFormRequestOptions } from '../../../internal/uploads'; import { path } from '../../../internal/utils/path'; export class Files extends APIResource { @@ -24,7 +25,10 @@ export class Files extends APIResource { body: FileCreateParams, options?: RequestOptions, ): APIPromise { - return this._client.post(path`/containers/${containerID}/files`, { body, ...options }); + return this._client.post( + path`/containers/${containerID}/files`, + multipartFormRequestOptions({ body, ...options }, this._client), + ); } /** diff --git a/src/resources/responses/input-items.ts b/src/resources/responses/input-items.ts index 5ac6c2a74..9ff116448 100644 --- a/src/resources/responses/input-items.ts +++ b/src/resources/responses/input-items.ts @@ -77,7 +77,7 @@ export interface InputItemListParams extends CursorPageParams { include?: Array; /** - * The order to return the input items in. Default is `asc`. + * The order to return the input items in. Default is `desc`. * * - `asc`: Return the input items in ascending order. * - `desc`: Return the input items in descending order. diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 32ae7bce7..4a15f4320 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -443,8 +443,8 @@ export interface Response { usage?: ResponseUsage; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; @@ -3825,7 +3825,6 @@ export type ResponseStreamEvent = | ResponseReasoningSummaryTextDoneEvent | ResponseRefusalDeltaEvent | ResponseRefusalDoneEvent - | ResponseTextAnnotationDeltaEvent | ResponseTextDeltaEvent | ResponseTextDoneEvent | ResponseWebSearchCallCompletedEvent @@ -3850,121 +3849,6 @@ export type ResponseStreamEvent = | ResponseReasoningSummaryDeltaEvent | ResponseReasoningSummaryDoneEvent; -/** - * Emitted when a text annotation is added. - */ -export interface ResponseTextAnnotationDeltaEvent { - /** - * A citation to a file. - */ - annotation: - | ResponseTextAnnotationDeltaEvent.FileCitation - | ResponseTextAnnotationDeltaEvent.URLCitation - | ResponseTextAnnotationDeltaEvent.FilePath; - - /** - * The index of the annotation that was added. - */ - annotation_index: number; - - /** - * The index of the content part that the text annotation was added to. - */ - content_index: number; - - /** - * The ID of the output item that the text annotation was added to. - */ - item_id: string; - - /** - * The index of the output item that the text annotation was added to. - */ - output_index: number; - - /** - * The sequence number of this event. - */ - sequence_number: number; - - /** - * The type of the event. Always `response.output_text.annotation.added`. - */ - type: 'response.output_text.annotation.added'; -} - -export namespace ResponseTextAnnotationDeltaEvent { - /** - * A citation to a file. - */ - export interface FileCitation { - /** - * The ID of the file. - */ - file_id: string; - - /** - * The index of the file in the list of files. - */ - index: number; - - /** - * The type of the file citation. Always `file_citation`. - */ - type: 'file_citation'; - } - - /** - * A citation for a web resource used to generate a model response. - */ - export interface URLCitation { - /** - * The index of the last character of the URL citation in the message. - */ - end_index: number; - - /** - * The index of the first character of the URL citation in the message. - */ - start_index: number; - - /** - * The title of the web resource. - */ - title: string; - - /** - * The type of the URL citation. Always `url_citation`. - */ - type: 'url_citation'; - - /** - * The URL of the web resource. - */ - url: string; - } - - /** - * A path to a file. - */ - export interface FilePath { - /** - * The ID of the file. - */ - file_id: string; - - /** - * The index of the file in the list of files. - */ - index: number; - - /** - * The type of the file path. Always `file_path`. - */ - type: 'file_path'; - } -} - /** * Configuration options for a text response from the model. Can be plain text or * structured JSON data. Learn more: @@ -4129,6 +4013,11 @@ export interface ResponseWebSearchCallCompletedEvent { */ output_index: number; + /** + * The sequence number of the web search call being processed. + */ + sequence_number: number; + /** * The type of the event. Always `response.web_search_call.completed`. */ @@ -4149,6 +4038,11 @@ export interface ResponseWebSearchCallInProgressEvent { */ output_index: number; + /** + * The sequence number of the web search call being processed. + */ + sequence_number: number; + /** * The type of the event. Always `response.web_search_call.in_progress`. */ @@ -4169,6 +4063,11 @@ export interface ResponseWebSearchCallSearchingEvent { */ output_index: number; + /** + * The sequence number of the web search call being processed. + */ + sequence_number: number; + /** * The type of the event. Always `response.web_search_call.searching`. */ @@ -4248,11 +4147,6 @@ export namespace Tool { * A list of tools that never require approval. */ never?: McpToolApprovalFilter.Never; - - /** - * List of allowed tool names. - */ - tool_names?: Array; } export namespace McpToolApprovalFilter { @@ -4709,8 +4603,8 @@ export interface ResponseCreateParamsBase { truncation?: 'auto' | 'disabled' | null; /** - * A unique identifier representing your end-user, which can help OpenAI to monitor - * and detect abuse. + * A stable identifier for your end-users. Used to boost cache hit rates by better + * bucketing similar requests and to help OpenAI detect and prevent abuse. * [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids). */ user?: string; @@ -4842,7 +4736,6 @@ export declare namespace Responses { type ResponseRefusalDoneEvent as ResponseRefusalDoneEvent, type ResponseStatus as ResponseStatus, type ResponseStreamEvent as ResponseStreamEvent, - type ResponseTextAnnotationDeltaEvent as ResponseTextAnnotationDeltaEvent, type ResponseTextConfig as ResponseTextConfig, type ResponseTextDeltaEvent as ResponseTextDeltaEvent, type ResponseTextDoneEvent as ResponseTextDoneEvent, From 36bc838158f48d52754fe54ada99dd8d5027796d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:06:15 +0000 Subject: [PATCH 421/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 017aa58a1..d761f22d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: c497f6b750cc89c0bf2eefc0bc839c70 +config_hash: 535b6e5f26a295d609b259c8cb8f656c From 84fc31aa903eceeb80815f6b17562fc463a71cfc Mon Sep 17 00:00:00 2001 From: Mikhail Simin Date: Tue, 27 May 2025 03:17:35 -0700 Subject: [PATCH 422/509] fix(azure): add /images/edits to deployments endpoints (#1509) * Add /images/edits to AzureOpenAI deployments endpoints --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 3b4b9a574..3a25ad3ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -772,6 +772,7 @@ const _deployments_endpoints = new Set([ '/audio/translations', '/audio/speech', '/images/generations', + '/images/edits', ]); const API_KEY_SENTINEL = ''; From 9eb98543660c86f0b11766ef95b35fa28fd16e47 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 11:42:54 +0100 Subject: [PATCH 423/509] fix(tests): port tests to new setup --- tests/index.test.ts | 92 ------------------------------- tests/lib/azure.test.ts | 22 ++++---- tests/log.test.ts | 118 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 104 deletions(-) create mode 100644 tests/log.test.ts diff --git a/tests/index.test.ts b/tests/index.test.ts index fedd0e15d..401cc5c6e 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -698,95 +698,3 @@ describe('retries', () => { expect(count).toEqual(3); }); }); - -describe('debug()', () => { - const env = process.env; - const spy = jest.spyOn(console, 'log'); - - beforeEach(() => { - jest.resetModules(); - process.env = { ...env }; - process.env['DEBUG'] = 'true'; - }); - - afterEach(() => { - process.env = env; - }); - - test('body request object with Authorization header', function () { - // Test request body includes headers object with Authorization - const headersTest = { - headers: { - Authorization: 'fakeAuthorization', - }, - }; - debug('request', headersTest); - expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { - headers: { - Authorization: 'REDACTED', - }, - }); - }); - - test('body request object with api-key header', function () { - // Test request body includes headers object with api-ley - const apiKeyTest = { - headers: { - 'api-key': 'fakeKey', - }, - }; - debug('request', apiKeyTest); - expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { - headers: { - 'api-key': 'REDACTED', - }, - }); - }); - - test('header object with Authorization header', function () { - // Test headers object with authorization header - const authorizationTest = { - authorization: 'fakeValue', - }; - debug('request', authorizationTest); - expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { - authorization: 'REDACTED', - }); - }); - - test('input args are not mutated', function () { - const authorizationTest = { - authorization: 'fakeValue', - }; - const client = new OpenAI({ - baseURL: 'http://localhost:5000/', - defaultHeaders: authorizationTest, - apiKey: 'api-key', - }); - - const { req } = client.buildRequest({ path: '/foo', method: 'post' }); - debug('request', authorizationTest); - expect((req.headers as Headers)['authorization']).toEqual('fakeValue'); - expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { - authorization: 'REDACTED', - }); - }); - - test('input headers are not mutated', function () { - const authorizationTest = { - authorization: 'fakeValue', - }; - const client = new OpenAI({ - baseURL: 'http://localhost:5000/', - defaultHeaders: authorizationTest, - apiKey: 'api-key', - }); - - const { req } = client.buildRequest({ path: '/foo', method: 'post' }); - debug('request', { headers: req.headers }); - expect((req.headers as Headers)['authorization']).toEqual('fakeValue'); - expect(spy).toHaveBeenCalledWith('OpenAI:DEBUG:request', { - authorization: 'REDACTED', - }); - }); -}); diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 8f7ca0688..ef80e275b 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -518,21 +518,19 @@ describe('azure request building', () => { }); test('handles audio translations', async () => { - expect(await client.audio.translations.create({ - model: deployment, - file: { url: 'https://example.com/', blob: new File([], '') }, - })).toMatchObject( - { url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`}, - ); + expect( + await client.audio.translations.create({ model: deployment, file: new File([], '') }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/translations?api-version=${apiVersion}`, + }); }); test('handles audio transcriptions', async () => { - expect(await client.audio.transcriptions.create({ - model: deployment, - file: { url: 'https://example.com/', blob: new File([], '') }, - })).toMatchObject( - { url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`}, - ); + expect( + await client.audio.transcriptions.create({ model: deployment, file: new File([], '') }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/audio/transcriptions?api-version=${apiVersion}`, + }); }); test('handles text to speech', async () => { diff --git a/tests/log.test.ts b/tests/log.test.ts new file mode 100644 index 000000000..131352b33 --- /dev/null +++ b/tests/log.test.ts @@ -0,0 +1,118 @@ +import OpenAI, { ClientOptions } from 'openai/index'; + +const opts: ClientOptions = { + baseURL: 'http://localhost:5000/', + logLevel: 'debug', + fetch: (url) => { + return Promise.resolve( + new Response(JSON.stringify({ url, custom: true }), { + headers: { 'Content-Type': 'application/json' }, + }), + ); + }, +}; + +describe('debug()', () => { + const env = process.env; + const spy = jest.spyOn(console, 'debug'); + + beforeEach(() => { + jest.resetModules(); + process.env = { ...env }; + process.env['DEBUG'] = 'true'; + }); + + afterEach(() => { + process.env = env; + }); + + test('body request object with Authorization header', async function () { + const client = new OpenAI(opts); + await client.post('/example', {}); + + // Check that console.debug was called with the redacted authorization header + expect(spy).toHaveBeenCalledWith( + expect.stringContaining('[log_'), + expect.objectContaining({ + headers: expect.objectContaining({ + authorization: '***', + }), + }), + ); + }); + + test('header object with Authorization header', async function () { + // Test headers object with authorization header + const client = new OpenAI({ + ...opts, + defaultHeaders: { + authorization: 'fakeValue', + }, + }); + await client.post('/example', {}); + + expect(spy).toHaveBeenCalledWith( + expect.stringContaining('[log_'), + expect.objectContaining({ + headers: expect.objectContaining({ + authorization: '***', + }), + }), + ); + }); + + test('input args are not mutated', async function () { + const authorizationTest = { + authorization: 'fakeValue', + }; + const client = new OpenAI({ + ...opts, + defaultHeaders: authorizationTest, + }); + + const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + await client.post('/foo', {}); + + // Verify that the original headers weren't mutated + expect(authorizationTest.authorization).toEqual('fakeValue'); + expect((req.headers as Headers).get('authorization')).toEqual('fakeValue'); + + expect(spy).toHaveBeenCalledWith( + expect.stringContaining('[log_'), + expect.objectContaining({ + headers: expect.objectContaining({ + authorization: '***', + }), + }), + ); + }); + + test('input headers are not mutated', async function () { + const authorizationTest = { + authorization: 'fakeValue', + }; + const client = new OpenAI({ + baseURL: 'http://localhost:5000/', + defaultHeaders: authorizationTest, + apiKey: 'api-key', + logLevel: 'debug', + fetch: opts.fetch, + }); + + const { req } = client.buildRequest({ path: '/foo', method: 'post' }); + await client.post('/foo', {}); + + // Verify that the original headers weren't mutated + expect(authorizationTest.authorization).toEqual('fakeValue'); + expect((req.headers as Headers).get('authorization')).toEqual('fakeValue'); + + expect(spy).toHaveBeenCalledWith( + expect.stringContaining('[log_'), + expect.objectContaining({ + headers: expect.objectContaining({ + authorization: '***', + }), + }), + ); + }); +}); From aceaac05c05fa318c4bff7ff340b512a6bd904b9 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 11:47:18 +0100 Subject: [PATCH 424/509] fix(tests/embeddings): avoid cross-realm issue --- tests/api-resources/embeddings.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/api-resources/embeddings.test.ts b/tests/api-resources/embeddings.test.ts index 552591787..2ba17dbf1 100644 --- a/tests/api-resources/embeddings.test.ts +++ b/tests/api-resources/embeddings.test.ts @@ -42,7 +42,7 @@ describe('resource embeddings', () => { model: 'text-embedding-3-small', }); - expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); + expect(Array.isArray(response.data?.at(0)?.embedding)).toBe(true); expect(response.data?.at(0)?.embedding.at(0)).toBe(-0.09928705543279648); }); @@ -54,7 +54,7 @@ describe('resource embeddings', () => { encoding_format: 'float', }); - expect(response.data?.at(0)?.embedding).toBeInstanceOf(Array); + expect(Array.isArray(response.data?.at(0)?.embedding)).toBe(true); expect(response.data?.at(0)?.embedding.at(0)).toBe(-0.099287055); }); From 657807c2d7cbf2c6fc9a92ce98bb7295bb156326 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 11:52:13 +0100 Subject: [PATCH 425/509] fix(responses): support streaming retrieve calls --- src/resources/responses/responses.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 347552146..c3cf03c5a 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -115,16 +115,31 @@ export class Responses extends APIResource { * ); * ``` */ + retrieve( + responseID: string, + query?: ResponseRetrieveParamsNonStreaming, + options?: RequestOptions, + ): APIPromise; + retrieve( + responseID: string, + query: ResponseRetrieveParamsStreaming, + options?: RequestOptions, + ): APIPromise>; + retrieve( + responseID: string, + query: ResponseRetrieveParams, + options?: RequestOptions, + ): APIPromise | APIPromise>; retrieve( responseID: string, query: ResponseRetrieveParams | null | undefined = {}, options?: RequestOptions, - ): APIPromise { - return ( + ): APIPromise | APIPromise> { + return ( this._client.get(path`/responses/${responseID}`, { query, ...options, - stream: query.stream ?? false, + stream: query?.stream ?? false, }) as APIPromise | APIPromise> )._thenUnwrap((rsp) => { if ('object' in rsp && rsp.object === 'response') { From 6e424b5cac1b2ea7e108ce24154be5bdddf56bdd Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 17:57:35 +0100 Subject: [PATCH 426/509] fix(helpers/zod): error on optional + not nullable fields --- .../zod-to-json-schema/parsers/object.ts | 11 ++- tests/helpers/zod.test.ts | 76 ++++++++++--------- 2 files changed, 48 insertions(+), 39 deletions(-) diff --git a/src/_vendor/zod-to-json-schema/parsers/object.ts b/src/_vendor/zod-to-json-schema/parsers/object.ts index 25e5db116..1335c6dd0 100644 --- a/src/_vendor/zod-to-json-schema/parsers/object.ts +++ b/src/_vendor/zod-to-json-schema/parsers/object.ts @@ -46,11 +46,16 @@ export function parseObjectDef(def: ZodObjectDef, refs: Refs) { propertyPath, }); if (parsedDef === undefined) return acc; - if (refs.openaiStrictMode && propDef.isOptional() && !propDef.isNullable()) { - console.warn( + if ( + refs.openaiStrictMode && + propDef.isOptional() && + !propDef.isNullable() && + typeof propDef._def?.defaultValue === 'undefined' + ) { + throw new Error( `Zod field at \`${propertyPath.join( '/', - )}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required\nThis will become an error in a future version of the SDK.`, + )}\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required`, ); } return { diff --git a/tests/helpers/zod.test.ts b/tests/helpers/zod.test.ts index 02d8a7a8f..2eb8909a8 100644 --- a/tests/helpers/zod.test.ts +++ b/tests/helpers/zod.test.ts @@ -51,7 +51,7 @@ describe('zodResponseFormat', () => { z.object({ city: z.string(), temperature: z.number(), - units: z.enum(['c', 'f']).optional(), + units: z.enum(['c', 'f']).optional().nullable(), }), 'location', ).json_schema, @@ -69,11 +69,25 @@ describe('zodResponseFormat', () => { "type": "number", }, "units": { - "enum": [ - "c", - "f", + "anyOf": [ + { + "anyOf": [ + { + "not": {}, + }, + { + "enum": [ + "c", + "f", + ], + "type": "string", + }, + ], + }, + { + "type": "null", + }, ], - "type": "string", }, }, "required": [ @@ -279,42 +293,32 @@ describe('zodResponseFormat', () => { `); }); - it('warns on optional fields', () => { - const consoleSpy = jest.spyOn(console, 'warn'); - consoleSpy.mockClear(); - - zodResponseFormat( - z.object({ - required: z.string(), - optional: z.string().optional(), - optional_and_nullable: z.string().optional().nullable(), - }), - 'schema', - ); - - expect(consoleSpy).toHaveBeenCalledWith( - 'Zod field at `#/definitions/schema/properties/optional` uses `.optional()` without `.nullable()` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required\nThis will become an error in a future version of the SDK.', + it('throws error on optional fields', () => { + expect(() => + zodResponseFormat( + z.object({ + required: z.string(), + optional: z.string().optional(), + optional_and_nullable: z.string().optional().nullable(), + }), + 'schema', + ), + ).toThrowErrorMatchingInlineSnapshot( + `"Zod field at \`#/definitions/schema/properties/optional\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required"`, ); - expect(consoleSpy).toHaveBeenCalledTimes(1); }); - it('warns on nested optional fields', () => { - const consoleSpy = jest.spyOn(console, 'warn'); - consoleSpy.mockClear(); - - zodResponseFormat( - z.object({ - foo: z.object({ bar: z.array(z.object({ can_be_missing: z.boolean().optional() })) }), - }), - 'schema', - ); - - expect(consoleSpy).toHaveBeenCalledWith( - expect.stringContaining( - 'Zod field at `#/definitions/schema/properties/foo/properties/bar/items/properties/can_be_missing` uses `.optional()`', + it('throws error on nested optional fields', () => { + expect(() => + zodResponseFormat( + z.object({ + foo: z.object({ bar: z.array(z.object({ can_be_missing: z.boolean().optional() })) }), + }), + 'schema', ), + ).toThrowErrorMatchingInlineSnapshot( + `"Zod field at \`#/definitions/schema/properties/foo/properties/bar/items/properties/can_be_missing\` uses \`.optional()\` without \`.nullable()\` which is not supported by the API. See: https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required"`, ); - expect(consoleSpy).toHaveBeenCalledTimes(1); }); it('does not warn on union nullable fields', () => { From 1e52734e28a0e474b11c90977fd3161ea2e50f8c Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 18:53:11 +0100 Subject: [PATCH 427/509] fix(ecosystem-tests/bun): bump dependencies --- ecosystem-tests/bun/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecosystem-tests/bun/package.json b/ecosystem-tests/bun/package.json index 35660b7f9..98de5fa54 100644 --- a/ecosystem-tests/bun/package.json +++ b/ecosystem-tests/bun/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "fastest-levenshtein": "^1.0.16", - "bun-types": "^1.2.4", - "typescript": "5.0.4" + "bun-types": "^1.2.14", + "typescript": "5.8.3" } } From 087580ae5ebedc88f6f219c7d00c08607722a519 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 19:26:34 +0100 Subject: [PATCH 428/509] fix(tests): don't rely on OPENAI_API_KEY env variable --- tests/log.test.ts | 1 + tests/responses.test.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/log.test.ts b/tests/log.test.ts index 131352b33..1900e83b2 100644 --- a/tests/log.test.ts +++ b/tests/log.test.ts @@ -1,6 +1,7 @@ import OpenAI, { ClientOptions } from 'openai/index'; const opts: ClientOptions = { + apiKey: 'example-api-key', baseURL: 'http://localhost:5000/', logLevel: 'debug', fetch: (url) => { diff --git a/tests/responses.test.ts b/tests/responses.test.ts index 3cb73f4e4..e17ce80af 100644 --- a/tests/responses.test.ts +++ b/tests/responses.test.ts @@ -2,7 +2,7 @@ import { APIPromise } from 'openai/api-promise'; import OpenAI from 'openai/index'; import { compareType } from './utils/typing'; -const client = new OpenAI(); +const client = new OpenAI({ apiKey: 'example-api-key' }); describe('request id', () => { test('types', () => { From 6fa06756624071fb1486c69a496ba906fef96de2 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 19:18:58 +0100 Subject: [PATCH 429/509] fix(ecosystem-tests): correct ecosystem tests setup --- ecosystem-tests/cloudflare-worker/package.json | 4 ++-- ecosystem-tests/cloudflare-worker/tsconfig.json | 4 ++-- ecosystem-tests/node-ts-cjs/tests/test-node.ts | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ecosystem-tests/cloudflare-worker/package.json b/ecosystem-tests/cloudflare-worker/package.json index bec1aab03..d2cfc17b3 100644 --- a/ecosystem-tests/cloudflare-worker/package.json +++ b/ecosystem-tests/cloudflare-worker/package.json @@ -11,12 +11,12 @@ "test:ci": "start-server-and-test start http://localhost:8787 test" }, "devDependencies": { - "@cloudflare/workers-types": "^4.20230419.0", + "@cloudflare/workers-types": "^4.20250525.0", "fastest-levenshtein": "^1.0.16", "jest": "^29.5.0", "start-server-and-test": "^2.0.0", "ts-jest": "^29.1.0", - "typescript": "5.0.4", + "typescript": "5.8.3", "wrangler": "^3.74.0" } } diff --git a/ecosystem-tests/cloudflare-worker/tsconfig.json b/ecosystem-tests/cloudflare-worker/tsconfig.json index cde90e627..b0a056a5d 100644 --- a/ecosystem-tests/cloudflare-worker/tsconfig.json +++ b/ecosystem-tests/cloudflare-worker/tsconfig.json @@ -12,8 +12,8 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, - "lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, + "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "lib": ["ESNext"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, "jsx": "react" /* Specify what JSX code is generated. */, // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ diff --git a/ecosystem-tests/node-ts-cjs/tests/test-node.ts b/ecosystem-tests/node-ts-cjs/tests/test-node.ts index 59ed83478..48ca32f56 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-node.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-node.ts @@ -1,6 +1,6 @@ import OpenAI, { toFile } from 'openai'; +import * as undici from 'undici'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; -import fetch from 'node-fetch'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; @@ -87,7 +87,8 @@ it(`streaming works`, async function () { expect(chunks.map((c) => c.choices[0]?.delta.content || '').join('')).toBeSimilarTo('This is a test', 10); }); -test(`proxied request`, async function () { +// TODO: setup proxy server +test.skip(`proxied request`, async function () { const dispatcher = new undici.ProxyAgent(process.env['ECOSYSTEM_TESTS_PROXY']!); const client = new OpenAI({ fetchOptions: { From 157248ae85d2261f9538128703d0ebbc24347c61 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 19:59:20 +0100 Subject: [PATCH 430/509] fix(ecosystem-tests/cloudflare-worker): ignore lib errors for now --- ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts | 1 + ecosystem-tests/cloudflare-worker/tsconfig.check.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts b/ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts index 39225fb8d..89e61e9dc 100644 --- a/ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts +++ b/ecosystem-tests/cloudflare-worker/src/uploadWebApiTestCases.ts @@ -131,6 +131,7 @@ export function uploadWebApiTestCases({ }); it('toFile handles ArrayBuffer', async () => { const result = await client.files.create({ + // @ts-ignore file: await toFile(new TextEncoder().encode(fineTune).buffer, 'finetune.jsonl'), purpose: 'fine-tune', }); diff --git a/ecosystem-tests/cloudflare-worker/tsconfig.check.json b/ecosystem-tests/cloudflare-worker/tsconfig.check.json index 22d6f227b..57515d1d3 100644 --- a/ecosystem-tests/cloudflare-worker/tsconfig.check.json +++ b/ecosystem-tests/cloudflare-worker/tsconfig.check.json @@ -3,6 +3,6 @@ "include": ["src"], "exclude": ["tests", "jest.config.cjs"], "compilerOptions": { - "skipLibCheck": false + "skipLibCheck": true } } From 619711ae0da5243c64c266d615703279f7651f58 Mon Sep 17 00:00:00 2001 From: Em Date: Mon, 6 Jan 2025 15:48:26 -0500 Subject: [PATCH 431/509] chore(internal): add proxy ecosystem tests --- ecosystem-tests/bun/openai.test.ts | 14 ++ ecosystem-tests/cli.ts | 225 ++++++++++-------- .../node-ts-cjs/tests/test-node.ts | 2 +- ecosystem-tests/proxy.ts | 27 +++ 4 files changed, 173 insertions(+), 95 deletions(-) create mode 100644 ecosystem-tests/proxy.ts diff --git a/ecosystem-tests/bun/openai.test.ts b/ecosystem-tests/bun/openai.test.ts index 979a4962f..29da68d79 100644 --- a/ecosystem-tests/bun/openai.test.ts +++ b/ecosystem-tests/bun/openai.test.ts @@ -43,6 +43,20 @@ test(`basic request works`, async function () { expectSimilar(completion.choices[0]?.message?.content, 'This is a test', 10); }); +test(`proxied request works`, async function () { + const client = new OpenAI({ + fetch(url, init) { + return fetch(url, { ...init, proxy: process.env['ECOSYSTEM_TESTS_PROXY'] }); + }, + }); + + const completion = await client.chat.completions.create({ + model: 'gpt-4', + messages: [{ role: 'user', content: 'Say this is a test' }], + }); + expectSimilar(completion.choices[0]?.message?.content, 'This is a test', 10); +}); + test(`raw response`, async function () { const response = await client.chat.completions .create({ diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index d4fa48b0d..9781c2b03 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -3,6 +3,8 @@ import execa from 'execa'; import yargs from 'yargs'; import assert from 'assert'; import path from 'path'; +import { createServer } from 'http'; +import { connect } from 'net'; const TAR_NAME = 'openai.tgz'; const PACK_FOLDER = '.pack'; @@ -109,6 +111,35 @@ const projectRunners = { let projectNames = Object.keys(projectRunners) as Array; const projectNamesSet = new Set(projectNames); +async function startProxy() { + const proxy = createServer((_req, res) => { + res.end(); + }); + + proxy.on('connect', (req, clientSocket, head) => { + console.log('got proxied connection'); + const serverSocket = connect(443, 'api.openai.com', () => { + clientSocket.write( + 'HTTP/1.1 200 Connection Established\r\n' + 'Proxy-agent: Node.js-Proxy\r\n' + '\r\n', + ); + serverSocket.write(head); + serverSocket.pipe(clientSocket); + clientSocket.pipe(serverSocket); + }); + }); + + await new Promise((resolve) => proxy.listen(0, '127.0.0.1', resolve)); + + const address = proxy.address(); + assert(address && typeof address !== 'string'); + process.env['ECOSYSTEM_TESTS_PROXY'] = 'http://127.0.0.1/' + address.port; + + return () => { + delete process.env['ECOSYSTEM_TESTS_PROXY']; + proxy.close(); + }; +} + function parseArgs() { return yargs(process.argv.slice(2)) .scriptName('ecosystem-tests') @@ -287,112 +318,118 @@ async function main() { await fileCache.cacheFiles(tmpFolderPath); } - if (jobs > 1) { - const queue = [...projectsToRun]; - const runningProjects = new Set(); - - const cursorLeft = '\x1B[G'; - const eraseLine = '\x1B[2K'; - - let progressDisplayed = false; - function clearProgress() { - if (progressDisplayed) { - process.stderr.write(cursorLeft + eraseLine); - progressDisplayed = false; + const stopProxy = await startProxy(); + try { + if (jobs > 1) { + const queue = [...projectsToRun]; + const runningProjects = new Set(); + + const cursorLeft = '\x1B[G'; + const eraseLine = '\x1B[2K'; + + let progressDisplayed = false; + function clearProgress() { + if (progressDisplayed) { + process.stderr.write(cursorLeft + eraseLine); + progressDisplayed = false; + } + } + const spinner = ['|', '/', '-', '\\']; + + function showProgress() { + clearProgress(); + progressDisplayed = true; + const spin = spinner[Math.floor(Date.now() / 500) % spinner.length]; + process.stderr.write( + `${spin} Running ${[...runningProjects].join(', ')}`.substring(0, process.stdout.columns - 3) + + '...', + ); } - } - const spinner = ['|', '/', '-', '\\']; - function showProgress() { - clearProgress(); - progressDisplayed = true; - const spin = spinner[Math.floor(Date.now() / 500) % spinner.length]; - process.stderr.write( - `${spin} Running ${[...runningProjects].join(', ')}`.substring(0, process.stdout.columns - 3) + '...', - ); - } + const progressInterval = setInterval(showProgress, process.stdout.isTTY ? 500 : 5000); + showProgress(); + + await Promise.all( + [...Array(jobs).keys()].map(async () => { + while (queue.length) { + const project = queue.shift(); + if (!project) { + break; + } - const progressInterval = setInterval(showProgress, process.stdout.isTTY ? 500 : 5000); - showProgress(); + // preserve interleaved ordering of writes to stdout/stderr + const chunks: { dest: 'stdout' | 'stderr'; data: string | Buffer }[] = []; + try { + runningProjects.add(project); + const child = execa( + 'yarn', + [ + 'tsn', + __filename, + project, + '--skip-pack', + '--noCleanup', + `--retry=${args.retry}`, + ...(args.live ? ['--live'] : []), + ...(args.verbose ? ['--verbose'] : []), + ...(args.deploy ? ['--deploy'] : []), + ...(args.fromNpm ? ['--from-npm'] : []), + ], + { stdio: 'pipe', encoding: 'utf8', maxBuffer: 100 * 1024 * 1024 }, + ); + child.stdout?.on('data', (data) => chunks.push({ dest: 'stdout', data })); + child.stderr?.on('data', (data) => chunks.push({ dest: 'stderr', data })); + + await child; + } catch (error) { + failed.push(project); + } finally { + runningProjects.delete(project); + } - await Promise.all( - [...Array(jobs).keys()].map(async () => { - while (queue.length) { - const project = queue.shift(); - if (!project) { - break; - } + if (IS_CI) { + console.log(`::group::${failed.includes(project) ? '❌' : '✅'} ${project}`); + } - // preserve interleaved ordering of writes to stdout/stderr - const chunks: { dest: 'stdout' | 'stderr'; data: string | Buffer }[] = []; - try { - runningProjects.add(project); - const child = execa( - 'yarn', - [ - 'tsn', - __filename, - project, - '--skip-pack', - '--noCleanup', - `--retry=${args.retry}`, - ...(args.live ? ['--live'] : []), - ...(args.verbose ? ['--verbose'] : []), - ...(args.deploy ? ['--deploy'] : []), - ...(args.fromNpm ? ['--from-npm'] : []), - ], - { stdio: 'pipe', encoding: 'utf8', maxBuffer: 100 * 1024 * 1024 }, - ); - child.stdout?.on('data', (data) => chunks.push({ dest: 'stdout', data })); - child.stderr?.on('data', (data) => chunks.push({ dest: 'stderr', data })); - - await child; - } catch (error) { - failed.push(project); - } finally { - runningProjects.delete(project); + for (const { data } of chunks) { + process.stdout.write(data); + } + if (IS_CI) console.log('::endgroup::'); } + }), + ); - if (IS_CI) { - console.log(`::group::${failed.includes(project) ? '❌' : '✅'} ${project}`); - } + clearInterval(progressInterval); + clearProgress(); + } else { + for (const project of projectsToRun) { + const fn = projectRunners[project]; - for (const { data } of chunks) { - process.stdout.write(data); - } - if (IS_CI) console.log('::endgroup::'); - } - }), - ); - - clearInterval(progressInterval); - clearProgress(); - } else { - for (const project of projectsToRun) { - const fn = projectRunners[project]; - - await withChdir(path.join(rootDir, 'ecosystem-tests', project), async () => { - console.error('\n'); - console.error(banner(`▶️ ${project}`)); - console.error('\n'); - - try { - await withRetry(fn, project, state.retry, state.retryDelay); + await withChdir(path.join(rootDir, 'ecosystem-tests', project), async () => { + console.error('\n'); + console.error(banner(`▶️ ${project}`)); console.error('\n'); - console.error(`✅ ${project}`); - } catch (err) { - if (err && (err as any).shortMessage) { - console.error((err as any).shortMessage); - } else { - console.error(err); + + try { + await withRetry(fn, project, state.retry, state.retryDelay); + console.error('\n'); + console.error(`✅ ${project}`); + } catch (err) { + if (err && (err as any).shortMessage) { + console.error((err as any).shortMessage); + } else { + console.error(err); + } + console.error('\n'); + console.error(`❌ ${project}`); + failed.push(project); } console.error('\n'); - console.error(`❌ ${project}`); - failed.push(project); - } - console.error('\n'); - }); + }); + } } + } finally { + stopProxy(); } if (!args.noCleanup) { diff --git a/ecosystem-tests/node-ts-cjs/tests/test-node.ts b/ecosystem-tests/node-ts-cjs/tests/test-node.ts index 48ca32f56..fcffd25bc 100644 --- a/ecosystem-tests/node-ts-cjs/tests/test-node.ts +++ b/ecosystem-tests/node-ts-cjs/tests/test-node.ts @@ -1,6 +1,6 @@ import OpenAI, { toFile } from 'openai'; -import * as undici from 'undici'; import { TranscriptionCreateParams } from 'openai/resources/audio/transcriptions'; +import * as undici from 'undici'; import { File as FormDataFile, Blob as FormDataBlob } from 'formdata-node'; import * as fs from 'fs'; import { distance } from 'fastest-levenshtein'; diff --git a/ecosystem-tests/proxy.ts b/ecosystem-tests/proxy.ts new file mode 100644 index 000000000..ab05685a3 --- /dev/null +++ b/ecosystem-tests/proxy.ts @@ -0,0 +1,27 @@ +import { createServer } from 'http'; +import { connect } from 'net'; + +async function startProxy() { + const proxy = createServer((_req, res) => { + res.end(); + }); + + proxy.on('connect', (req, clientSocket, head) => { + const serverSocket = connect(443, 'api.openai.com', () => { + clientSocket.write( + 'HTTP/1.1 200 Connection Established\r\n' + 'Proxy-agent: Node.js-Proxy\r\n' + '\r\n', + ); + serverSocket.write(head); + serverSocket.pipe(clientSocket); + clientSocket.pipe(serverSocket); + }); + }); + + await new Promise((resolve) => proxy.listen(0, '127.0.0.1', resolve)); + + console.log(proxy.address()!.toString()) + + return () => { + proxy.close() + } +} From da6ed5fc4c9ec203d9add28c34c90532b0334a3e Mon Sep 17 00:00:00 2001 From: Em Date: Fri, 31 Jan 2025 18:19:23 -0500 Subject: [PATCH 432/509] chore(tests): switch proxy tests to fetchOptions --- ecosystem-tests/bun/openai.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecosystem-tests/bun/openai.test.ts b/ecosystem-tests/bun/openai.test.ts index 29da68d79..823a04a21 100644 --- a/ecosystem-tests/bun/openai.test.ts +++ b/ecosystem-tests/bun/openai.test.ts @@ -45,8 +45,8 @@ test(`basic request works`, async function () { test(`proxied request works`, async function () { const client = new OpenAI({ - fetch(url, init) { - return fetch(url, { ...init, proxy: process.env['ECOSYSTEM_TESTS_PROXY'] }); + fetchOptions: { + proxy: process.env['ECOSYSTEM_TESTS_PROXY'], }, }); From cb4194f08a2dcb4fc4231bf1b74ed5d6e0aca435 Mon Sep 17 00:00:00 2001 From: Em Date: Mon, 17 Feb 2025 13:02:31 -0500 Subject: [PATCH 433/509] chore(internal): add Bun.File ecosystem test --- ecosystem-tests/bun/openai.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ecosystem-tests/bun/openai.test.ts b/ecosystem-tests/bun/openai.test.ts index 823a04a21..f8facc521 100644 --- a/ecosystem-tests/bun/openai.test.ts +++ b/ecosystem-tests/bun/openai.test.ts @@ -131,6 +131,14 @@ test('handles fs.ReadStream', async function () { expectSimilar(result.text, correctAnswer, 12); }); +test('handles Bun.File', async function () { + const result = await client.audio.transcriptions.create({ + file: Bun.file('sample1.mp3'), + model, + }); + expectSimilar(result.text, correctAnswer, 12); +}); + const fineTune = `{"prompt": "", "completion": ""}`; // @ts-ignore avoid DOM lib for testing purposes From 6207a2a03d3279423de594eed18c5efb4ce321af Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 22:21:27 +0000 Subject: [PATCH 434/509] chore: improve publish-npm script --latest tag logic --- bin/publish-npm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/publish-npm b/bin/publish-npm index 4c21181bb..2505decac 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -4,19 +4,35 @@ set -eux npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" -# Build the project yarn build - -# Navigate to the dist directory cd dist -# Get the version from package.json +# Get latest version from npm +# +# If the package doesn't exist, yarn will return +# {"type":"error","data":"Received invalid response from npm."} +# where .data.version doesn't exist so LAST_VERSION will be an empty string. +LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')" + +# Get current version from package.json VERSION="$(node -p "require('./package.json').version")" -# Extract the pre-release tag if it exists +# Check if current version is pre-release (e.g. alpha / beta / rc) +CURRENT_IS_PRERELEASE=false if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then - # Extract the part before any dot in the pre-release identifier - TAG="${BASH_REMATCH[1]}" + CURRENT_IS_PRERELEASE=true + CURRENT_TAG="${BASH_REMATCH[1]}" +fi + +# Check if last version is a stable release +LAST_IS_STABLE_RELEASE=true +if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then + LAST_IS_STABLE_RELEASE=false +fi + +# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease. +if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then + TAG="$CURRENT_TAG" else TAG="latest" fi From 5b34fcdd1454b8cccbaaf05ace6516afb3b09273 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 19:36:07 +0000 Subject: [PATCH 435/509] chore: deprecate Assistants API --- .stats.yml | 2 +- src/resources/beta/threads/messages.ts | 46 ++++---------------- src/resources/beta/threads/runs/runs.ts | 55 ++++-------------------- src/resources/beta/threads/runs/steps.ts | 24 +++-------- src/resources/beta/threads/threads.ts | 36 ++++------------ 5 files changed, 31 insertions(+), 132 deletions(-) diff --git a/.stats.yml b/.stats.yml index d761f22d7..c2644b7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 535b6e5f26a295d609b259c8cb8f656c +config_hash: 3b590818075ca4b54949578b97494525 diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index c3834ebe6..43779d427 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -7,17 +7,14 @@ import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import { CursorPage, type CursorPageParams } from '../../../pagination'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Messages extends APIResource { /** * Create a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.create( - * 'thread_id', - * { content: 'string', role: 'user' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create( threadId: string, @@ -34,13 +31,7 @@ export class Messages extends APIResource { /** * Retrieve a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.retrieve( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/messages/${messageId}`, { @@ -52,13 +43,7 @@ export class Messages extends APIResource { /** * Modifies a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.update( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update( threadId: string, @@ -76,15 +61,7 @@ export class Messages extends APIResource { /** * Returns a list of messages for a given thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const message of client.beta.threads.messages.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, @@ -110,14 +87,7 @@ export class Messages extends APIResource { /** * Deletes a message. * - * @example - * ```ts - * const messageDeleted = - * await client.beta.threads.messages.del( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ del(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}/messages/${messageId}`, { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 25356df3c..fd5d82457 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -40,19 +40,16 @@ import { import { CursorPage, type CursorPageParams } from '../../../../pagination'; import { Stream } from '../../../../streaming'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); /** * Create a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.create( - * 'thread_id', - * { assistant_id: 'assistant_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create( threadId: string, @@ -87,13 +84,7 @@ export class Runs extends APIResource { /** * Retrieves a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.retrieve( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/runs/${runId}`, { @@ -105,13 +96,7 @@ export class Runs extends APIResource { /** * Modifies a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.update( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update( threadId: string, @@ -129,15 +114,7 @@ export class Runs extends APIResource { /** * Returns a list of runs belonging to a thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const run of client.beta.threads.runs.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, @@ -163,13 +140,7 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. * - * @example - * ```ts - * const run = await client.beta.threads.runs.cancel( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, { @@ -272,15 +243,7 @@ export class Runs extends APIResource { * tool calls once they're all completed. All outputs must be submitted in a single * request. * - * @example - * ```ts - * const run = - * await client.beta.threads.runs.submitToolOutputs( - * 'thread_id', - * 'run_id', - * { tool_outputs: [{}] }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ submitToolOutputs( threadId: string, diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index abd8d40ed..0907f69c4 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -7,19 +7,14 @@ import * as StepsAPI from './steps'; import * as Shared from '../../../shared'; import { CursorPage, type CursorPageParams } from '../../../../pagination'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Steps extends APIResource { /** * Retrieves a run step. * - * @example - * ```ts - * const runStep = - * await client.beta.threads.runs.steps.retrieve( - * 'thread_id', - * 'run_id', - * 'step_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve( threadId: string, @@ -54,16 +49,7 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const runStep of client.beta.threads.runs.steps.list( - * 'thread_id', - * 'run_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index c0c6bc8e4..b27729371 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -67,6 +67,9 @@ import { } from './runs/runs'; import { Stream } from '../../../streaming'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); @@ -74,10 +77,7 @@ export class Threads extends APIResource { /** * Create a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.create(); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; @@ -98,12 +98,7 @@ export class Threads extends APIResource { /** * Retrieves a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.retrieve( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}`, { @@ -115,12 +110,7 @@ export class Threads extends APIResource { /** * Modifies a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.update( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update(threadId: string, body: ThreadUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}`, { @@ -133,12 +123,7 @@ export class Threads extends APIResource { /** * Delete a thread. * - * @example - * ```ts - * const threadDeleted = await client.beta.threads.del( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ del(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}`, { @@ -150,12 +135,7 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. * - * @example - * ```ts - * const run = await client.beta.threads.createAndRun({ - * assistant_id: 'assistant_id', - * }); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ createAndRun( body: ThreadCreateAndRunParamsNonStreaming, From e29a0092e9b077c2a99cd521a316aea4c25ea632 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 28 May 2025 20:37:38 +0100 Subject: [PATCH 436/509] refactor(client): remove deprecated runFunctions method --- MIGRATION.md | 5 + src/lib/AbstractChatCompletionRunner.ts | 140 +++---------------- src/lib/ChatCompletionRunner.ts | 15 -- src/lib/ChatCompletionStreamingRunner.ts | 15 -- src/lib/RunnableFunction.ts | 22 --- src/lib/chatCompletionUtils.ts | 7 - src/resources/beta/chat/completions.ts | 1 - tests/lib/ChatCompletionRunFunctions.test.ts | 8 +- 8 files changed, 29 insertions(+), 184 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index c679ba003..ac9a4a22b 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -347,6 +347,11 @@ export type FineTuningJobsPage = CursorPage; If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level. +### Removed deprecated `.runFunctions` methods + +The deprecated `client.beta.chat.completions.runFunctions()` method and all of it's surrounding types have been removed, instead you should use +`client.beta.chat.completions.runTools()`. + ### `openai/src` directory removed Previously IDEs may have auto-completed imports from the `openai/src` directory, however this diff --git a/src/lib/AbstractChatCompletionRunner.ts b/src/lib/AbstractChatCompletionRunner.ts index 144196aae..622112257 100644 --- a/src/lib/AbstractChatCompletionRunner.ts +++ b/src/lib/AbstractChatCompletionRunner.ts @@ -1,10 +1,11 @@ -import { type CompletionUsage } from '../resources/completions'; -import { - type ChatCompletion, - type ChatCompletionMessage, - type ChatCompletionMessageParam, - type ChatCompletionCreateParams, - type ChatCompletionTool, +import type { CompletionUsage } from '../resources/completions'; +import type { + ChatCompletion, + ChatCompletionMessage, + ChatCompletionMessageParam, + ChatCompletionCreateParams, + ChatCompletionTool, + ChatCompletionMessageToolCall, } from '../resources/chat/completions'; import { OpenAIError } from '../error'; import { @@ -13,17 +14,14 @@ import { type BaseFunctionsArgs, RunnableToolFunction, } from './RunnableFunction'; -import { ChatCompletionFunctionRunnerParams, ChatCompletionToolRunnerParams } from './ChatCompletionRunner'; -import { - ChatCompletionStreamingFunctionRunnerParams, - ChatCompletionStreamingToolRunnerParams, -} from './ChatCompletionStreamingRunner'; -import { isAssistantMessage, isFunctionMessage, isToolMessage } from './chatCompletionUtils'; +import type { ChatCompletionToolRunnerParams } from './ChatCompletionRunner'; +import type { ChatCompletionStreamingToolRunnerParams } from './ChatCompletionStreamingRunner'; +import { isAssistantMessage, isToolMessage } from './chatCompletionUtils'; import { BaseEvents, EventStream } from './EventStream'; -import { ParsedChatCompletion } from '../resources/beta/chat/completions'; -import OpenAI from '../index'; +import type { ParsedChatCompletion } from '../resources/beta/chat/completions'; +import type OpenAI from '../index'; import { isAutoParsableTool, parseChatCompletion } from '../lib/parser'; -import { RequestOptions } from '../internal/request-options'; +import type { RequestOptions } from '../internal/request-options'; const DEFAULT_MAX_CHAT_COMPLETIONS = 10; export interface RunnerOptions extends RequestOptions { @@ -60,11 +58,9 @@ export class AbstractChatCompletionRunner< if (emit) { this._emit('message', message); - if ((isFunctionMessage(message) || isToolMessage(message)) && message.content) { + if (isToolMessage(message) && message.content) { // Note, this assumes that {role: 'tool', content: …} is always the result of a call of tool of type=function. this._emit('functionCallResult', message.content as string); - } else if (isAssistantMessage(message) && message.function_call) { - this._emit('functionCall', message.function_call); } else if (isAssistantMessage(message) && message.tool_calls) { for (const tool_call of message.tool_calls) { if (tool_call.type === 'function') { @@ -104,17 +100,12 @@ export class AbstractChatCompletionRunner< while (i-- > 0) { const message = this.messages[i]; if (isAssistantMessage(message)) { - const { function_call, ...rest } = message; - // TODO: support audio here const ret: Omit = { - ...rest, + ...message, content: (message as ChatCompletionMessage).content ?? null, refusal: (message as ChatCompletionMessage).refusal ?? null, }; - if (function_call) { - ret.function_call = function_call; - } return ret; } } @@ -130,12 +121,9 @@ export class AbstractChatCompletionRunner< return this.#getFinalMessage(); } - #getFinalFunctionCall(): ChatCompletionMessage.FunctionCall | undefined { + #getFinalFunctionCall(): ChatCompletionMessageToolCall.Function | undefined { for (let i = this.messages.length - 1; i >= 0; i--) { const message = this.messages[i]; - if (isAssistantMessage(message) && message?.function_call) { - return message.function_call; - } if (isAssistantMessage(message) && message?.tool_calls?.length) { return message.tool_calls.at(-1)?.function; } @@ -148,7 +136,7 @@ export class AbstractChatCompletionRunner< * @returns a promise that resolves with the content of the final FunctionCall, or rejects * if an error occurred or the stream ended prematurely without producing a ChatCompletionMessage. */ - async finalFunctionCall(): Promise { + async finalFunctionCall(): Promise { await this.done(); return this.#getFinalFunctionCall(); } @@ -156,9 +144,6 @@ export class AbstractChatCompletionRunner< #getFinalFunctionCallResult(): string | undefined { for (let i = this.messages.length - 1; i >= 0; i--) { const message = this.messages[i]; - if (isFunctionMessage(message) && message.content != null) { - return message.content; - } if ( isToolMessage(message) && message.content != null && @@ -266,91 +251,6 @@ export class AbstractChatCompletionRunner< return await this._createChatCompletion(client, params, options); } - protected async _runFunctions( - client: OpenAI, - params: - | ChatCompletionFunctionRunnerParams - | ChatCompletionStreamingFunctionRunnerParams, - options?: RunnerOptions, - ) { - const role = 'function' as const; - const { function_call = 'auto', stream, ...restParams } = params; - const singleFunctionToCall = typeof function_call !== 'string' && function_call?.name; - const { maxChatCompletions = DEFAULT_MAX_CHAT_COMPLETIONS } = options || {}; - - const functionsByName: Record> = {}; - for (const f of params.functions) { - functionsByName[f.name || f.function.name] = f; - } - - const functions: ChatCompletionCreateParams.Function[] = params.functions.map( - (f): ChatCompletionCreateParams.Function => ({ - name: f.name || f.function.name, - parameters: f.parameters as Record, - description: f.description, - }), - ); - - for (const message of params.messages) { - this._addMessage(message, false); - } - - for (let i = 0; i < maxChatCompletions; ++i) { - const chatCompletion: ChatCompletion = await this._createChatCompletion( - client, - { - ...restParams, - function_call, - functions, - messages: [...this.messages], - }, - options, - ); - const message = chatCompletion.choices[0]?.message; - if (!message) { - throw new OpenAIError(`missing message in ChatCompletion response`); - } - if (!message.function_call) return; - const { name, arguments: args } = message.function_call; - const fn = functionsByName[name]; - if (!fn) { - const content = `Invalid function_call: ${JSON.stringify(name)}. Available options are: ${functions - .map((f) => JSON.stringify(f.name)) - .join(', ')}. Please try again`; - - this._addMessage({ role, name, content }); - continue; - } else if (singleFunctionToCall && singleFunctionToCall !== name) { - const content = `Invalid function_call: ${JSON.stringify(name)}. ${JSON.stringify( - singleFunctionToCall, - )} requested. Please try again`; - - this._addMessage({ role, name, content }); - continue; - } - - let parsed; - try { - parsed = isRunnableFunctionWithParse(fn) ? await fn.parse(args) : args; - } catch (error) { - this._addMessage({ - role, - name, - content: error instanceof Error ? error.message : String(error), - }); - continue; - } - - // @ts-expect-error it can't rule out `never` type. - const rawContent = await fn.function(parsed, this); - const content = this.#stringifyFunctionCallResult(rawContent); - - this._addMessage({ role, name, content }); - - if (singleFunctionToCall) return; - } - } - protected async _runTools( client: OpenAI, params: @@ -490,13 +390,13 @@ export class AbstractChatCompletionRunner< } export interface AbstractChatCompletionRunnerEvents extends BaseEvents { - functionCall: (functionCall: ChatCompletionMessage.FunctionCall) => void; + functionCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; message: (message: ChatCompletionMessageParam) => void; chatCompletion: (completion: ChatCompletion) => void; finalContent: (contentSnapshot: string) => void; finalMessage: (message: ChatCompletionMessageParam) => void; finalChatCompletion: (completion: ChatCompletion) => void; - finalFunctionCall: (functionCall: ChatCompletionMessage.FunctionCall) => void; + finalFunctionCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; functionCallResult: (content: string) => void; finalFunctionCallResult: (content: string) => void; totalUsage: (usage: CompletionUsage) => void; diff --git a/src/lib/ChatCompletionRunner.ts b/src/lib/ChatCompletionRunner.ts index 9e68e6671..1318d9eae 100644 --- a/src/lib/ChatCompletionRunner.ts +++ b/src/lib/ChatCompletionRunner.ts @@ -34,21 +34,6 @@ export class ChatCompletionRunner extends AbstractChatCompletion ChatCompletionRunnerEvents, ParsedT > { - /** @deprecated - please use `runTools` instead. */ - static runFunctions( - client: OpenAI, - params: ChatCompletionFunctionRunnerParams, - options?: RunnerOptions, - ): ChatCompletionRunner { - const runner = new ChatCompletionRunner(); - const opts = { - ...options, - headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runFunctions' }, - }; - runner._run(() => runner._runFunctions(client, params, opts)); - return runner; - } - static runTools( client: OpenAI, params: ChatCompletionToolRunnerParams, diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index 32b66b006..cbacdce63 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -38,21 +38,6 @@ export class ChatCompletionStreamingRunner return runner; } - /** @deprecated - please use `runTools` instead. */ - static runFunctions( - client: OpenAI, - params: ChatCompletionStreamingFunctionRunnerParams, - options?: RunnerOptions, - ): ChatCompletionStreamingRunner { - const runner = new ChatCompletionStreamingRunner(null); - const opts = { - ...options, - headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runFunctions' }, - }; - runner._run(() => runner._runFunctions(client, params, opts)); - return runner; - } - static runTools( client: OpenAI, params: ChatCompletionStreamingToolRunnerParams, diff --git a/src/lib/RunnableFunction.ts b/src/lib/RunnableFunction.ts index a645f5ebe..d387245cd 100644 --- a/src/lib/RunnableFunction.ts +++ b/src/lib/RunnableFunction.ts @@ -99,28 +99,6 @@ export type RunnableTools = : FunctionsArgs[Index]; }; -/** - * This is helper class for passing a `function` and `parse` where the `function` - * argument type matches the `parse` return type. - * - * @deprecated - please use ParsingToolFunction instead. - */ -export class ParsingFunction { - function: RunnableFunctionWithParse['function']; - parse: RunnableFunctionWithParse['parse']; - parameters: RunnableFunctionWithParse['parameters']; - description: RunnableFunctionWithParse['description']; - name?: RunnableFunctionWithParse['name']; - - constructor(input: RunnableFunctionWithParse) { - this.function = input.function; - this.parse = input.parse; - this.parameters = input.parameters; - this.description = input.description; - this.name = input.name; - } -} - /** * This is helper class for passing a `function` and `parse` where the `function` * argument type matches the `parse` return type. diff --git a/src/lib/chatCompletionUtils.ts b/src/lib/chatCompletionUtils.ts index 7e9f8a093..2bf0d5b47 100644 --- a/src/lib/chatCompletionUtils.ts +++ b/src/lib/chatCompletionUtils.ts @@ -1,6 +1,5 @@ import { type ChatCompletionAssistantMessageParam, - type ChatCompletionFunctionMessageParam, type ChatCompletionMessageParam, type ChatCompletionToolMessageParam, } from '../resources'; @@ -11,12 +10,6 @@ export const isAssistantMessage = ( return message?.role === 'assistant'; }; -export const isFunctionMessage = ( - message: ChatCompletionMessageParam | null | undefined, -): message is ChatCompletionFunctionMessageParam => { - return message?.role === 'function'; -}; - export const isToolMessage = ( message: ChatCompletionMessageParam | null | undefined, ): message is ChatCompletionToolMessageParam => { diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index 15ec3f7e4..2b3f619e0 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -24,7 +24,6 @@ export { type RunnableFunctions, type RunnableFunctionWithParse, type RunnableFunctionWithoutParse, - ParsingFunction, ParsingToolFunction, } from '../../../lib/RunnableFunction'; export { type ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index f2ce1c029..51f648f55 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -130,12 +130,12 @@ class RunnerListener { readonly contents: string[] = []; readonly messages: ChatCompletionMessageParam[] = []; readonly chatCompletions: OpenAI.Chat.ChatCompletion[] = []; - readonly functionCalls: OpenAI.Chat.ChatCompletionMessage.FunctionCall[] = []; + readonly functionCalls: OpenAI.Chat.ChatCompletionMessageToolCall.Function[] = []; readonly functionCallResults: string[] = []; finalContent: string | null = null; finalMessage: ChatCompletionMessageParam | undefined; finalChatCompletion: OpenAI.Chat.ChatCompletion | undefined; - finalFunctionCall: OpenAI.Chat.ChatCompletionMessage.FunctionCall | undefined; + finalFunctionCall: OpenAI.Chat.ChatCompletionMessageToolCall.Function | undefined; finalFunctionCallResult: string | undefined; totalUsage: OpenAI.CompletionUsage | undefined; error: OpenAIError | undefined; @@ -247,13 +247,13 @@ class StreamingRunnerListener { readonly eventContents: [string, string][] = []; readonly eventMessages: ChatCompletionMessageParam[] = []; readonly eventChatCompletions: OpenAI.Chat.ChatCompletion[] = []; - readonly eventFunctionCalls: OpenAI.Chat.ChatCompletionMessage.FunctionCall[] = []; + readonly eventFunctionCalls: OpenAI.Chat.ChatCompletionMessageToolCall.Function[] = []; readonly eventFunctionCallResults: string[] = []; finalContent: string | null = null; finalMessage: ChatCompletionMessageParam | undefined; finalChatCompletion: OpenAI.Chat.ChatCompletion | undefined; - finalFunctionCall: OpenAI.Chat.ChatCompletionMessage.FunctionCall | undefined; + finalFunctionCall: OpenAI.Chat.ChatCompletionMessageToolCall.Function | undefined; finalFunctionCallResult: string | undefined; error: OpenAIError | undefined; gotConnect = false; From 1f59811d1c5616ff949e01cb2f90cfc62fdefc7e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 22:21:24 +0000 Subject: [PATCH 437/509] chore: improve publish-npm script --latest tag logic --- bin/publish-npm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/publish-npm b/bin/publish-npm index 4c21181bb..2505decac 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -4,19 +4,35 @@ set -eux npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" -# Build the project yarn build - -# Navigate to the dist directory cd dist -# Get the version from package.json +# Get latest version from npm +# +# If the package doesn't exist, yarn will return +# {"type":"error","data":"Received invalid response from npm."} +# where .data.version doesn't exist so LAST_VERSION will be an empty string. +LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')" + +# Get current version from package.json VERSION="$(node -p "require('./package.json').version")" -# Extract the pre-release tag if it exists +# Check if current version is pre-release (e.g. alpha / beta / rc) +CURRENT_IS_PRERELEASE=false if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then - # Extract the part before any dot in the pre-release identifier - TAG="${BASH_REMATCH[1]}" + CURRENT_IS_PRERELEASE=true + CURRENT_TAG="${BASH_REMATCH[1]}" +fi + +# Check if last version is a stable release +LAST_IS_STABLE_RELEASE=true +if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then + LAST_IS_STABLE_RELEASE=false +fi + +# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease. +if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then + TAG="$CURRENT_TAG" else TAG="latest" fi From 1726e6bfe0f4e83db79ac2f2939b4131d797b42a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 19:36:08 +0000 Subject: [PATCH 438/509] chore: deprecate Assistants API --- .stats.yml | 2 +- src/resources/beta/threads/messages.ts | 45 ++++---------------- src/resources/beta/threads/runs/runs.ts | 54 ++++-------------------- src/resources/beta/threads/runs/steps.ts | 23 +++------- src/resources/beta/threads/threads.ts | 36 ++++------------ 5 files changed, 31 insertions(+), 129 deletions(-) diff --git a/.stats.yml b/.stats.yml index d761f22d7..c2644b7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 535b6e5f26a295d609b259c8cb8f656c +config_hash: 3b590818075ca4b54949578b97494525 diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index 53ca21b11..b487d3988 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -9,17 +9,14 @@ import { buildHeaders } from '../../../internal/headers'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Messages extends APIResource { /** * Create a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.create( - * 'thread_id', - * { content: 'string', role: 'user' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create(threadID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/threads/${threadID}/messages`, { @@ -32,13 +29,7 @@ export class Messages extends APIResource { /** * Retrieve a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.retrieve( - * 'message_id', - * { thread_id: 'thread_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(messageID: string, params: MessageRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -51,13 +42,7 @@ export class Messages extends APIResource { /** * Modifies a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.update( - * 'message_id', - * { thread_id: 'thread_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update(messageID: string, params: MessageUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; @@ -71,15 +56,7 @@ export class Messages extends APIResource { /** * Returns a list of messages for a given thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const message of client.beta.threads.messages.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadID: string, @@ -96,13 +73,7 @@ export class Messages extends APIResource { /** * Deletes a message. * - * @example - * ```ts - * const messageDeleted = - * await client.beta.threads.messages.delete('message_id', { - * thread_id: 'thread_id', - * }); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ delete( messageID: string, diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 2e28e4ef4..506c6897a 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -41,19 +41,16 @@ import { sleep } from '../../../../internal/utils/sleep'; import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream'; import { path } from '../../../../internal/utils/path'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); /** * Create a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.create( - * 'thread_id', - * { assistant_id: 'assistant_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create(threadID: string, params: RunCreateParamsNonStreaming, options?: RequestOptions): APIPromise; create( @@ -84,13 +81,7 @@ export class Runs extends APIResource { /** * Retrieves a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.retrieve( - * 'run_id', - * { thread_id: 'thread_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(runID: string, params: RunRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -103,13 +94,7 @@ export class Runs extends APIResource { /** * Modifies a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.update( - * 'run_id', - * { thread_id: 'thread_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update(runID: string, params: RunUpdateParams, options?: RequestOptions): APIPromise { const { thread_id, ...body } = params; @@ -123,15 +108,7 @@ export class Runs extends APIResource { /** * Returns a list of runs belonging to a thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const run of client.beta.threads.runs.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadID: string, @@ -148,13 +125,7 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. * - * @example - * ```ts - * const run = await client.beta.threads.runs.cancel( - * 'run_id', - * { thread_id: 'thread_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ cancel(runID: string, params: RunCancelParams, options?: RequestOptions): APIPromise { const { thread_id } = params; @@ -260,14 +231,7 @@ export class Runs extends APIResource { * tool calls once they're all completed. All outputs must be submitted in a single * request. * - * @example - * ```ts - * const run = - * await client.beta.threads.runs.submitToolOutputs( - * 'run_id', - * { thread_id: 'thread_id', tool_outputs: [{}] }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ submitToolOutputs( runID: string, diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index 90115f18b..bbbafb543 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -9,18 +9,14 @@ import { buildHeaders } from '../../../../internal/headers'; import { RequestOptions } from '../../../../internal/request-options'; import { path } from '../../../../internal/utils/path'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Steps extends APIResource { /** * Retrieves a run step. * - * @example - * ```ts - * const runStep = - * await client.beta.threads.runs.steps.retrieve('step_id', { - * thread_id: 'thread_id', - * run_id: 'run_id', - * }); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(stepID: string, params: StepRetrieveParams, options?: RequestOptions): APIPromise { const { thread_id, run_id, ...query } = params; @@ -34,16 +30,7 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const runStep of client.beta.threads.runs.steps.list( - * 'run_id', - * { thread_id: 'thread_id' }, - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list(runID: string, params: StepListParams, options?: RequestOptions): PagePromise { const { thread_id, ...query } = params; diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index daf9aa509..ea86b8fca 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -72,6 +72,9 @@ import { RequestOptions } from '../../../internal/request-options'; import { AssistantStream, ThreadCreateAndRunParamsBaseStream } from '../../../lib/AssistantStream'; import { path } from '../../../internal/utils/path'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); @@ -79,10 +82,7 @@ export class Threads extends APIResource { /** * Create a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.create(); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create(body: ThreadCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.post('/threads', { @@ -95,12 +95,7 @@ export class Threads extends APIResource { /** * Retrieves a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.retrieve( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadID: string, options?: RequestOptions): APIPromise { return this._client.get(path`/threads/${threadID}`, { @@ -112,12 +107,7 @@ export class Threads extends APIResource { /** * Modifies a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.update( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update(threadID: string, body: ThreadUpdateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/threads/${threadID}`, { @@ -130,12 +120,7 @@ export class Threads extends APIResource { /** * Delete a thread. * - * @example - * ```ts - * const threadDeleted = await client.beta.threads.delete( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ delete(threadID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/threads/${threadID}`, { @@ -147,12 +132,7 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. * - * @example - * ```ts - * const run = await client.beta.threads.createAndRun({ - * assistant_id: 'assistant_id', - * }); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ createAndRun(body: ThreadCreateAndRunParamsNonStreaming, options?: RequestOptions): APIPromise; createAndRun( From 43b870d1651d0c13e4ec10a53de2dfbae276c3e7 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Tue, 27 May 2025 18:24:16 +0100 Subject: [PATCH 439/509] docs(migration): mention zod helpers error --- MIGRATION.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index ac9a4a22b..3560899b4 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -310,6 +310,36 @@ import OpenAI from 'openai'; The `openai/shims` imports have been removed. Your global types must now be [correctly configured](#minimum-types-requirements). +### Zod helpers optionality error + +Previously, the following code would just output a warning to the console, now it will throw an error. + +```ts +const completion = await client.beta.chat.completions.parse({ + // ... + response_format: zodResponseFormat( + z.object({ + optional_property: z.string().optional(), + }), + 'schema', + ), +}); +``` + +You must mark optional properties with `.nullable()` as purely optional fields are not supported by the [API](https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required). + +```ts +const completion = await client.beta.chat.completions.parse({ + // ... + response_format: zodResponseFormat( + z.object({ + optional_property: z.string().optional().nullable(), + }), + 'schema', + ), +}); +``` + ### Pagination changes The `for await` syntax **is not affected**. This still works as-is: From 469ad7b9d76b674aa3fd829128a54758ab7adfbd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 14:19:32 +0000 Subject: [PATCH 440/509] feat(api): Config update for pakrym-stream-param --- .stats.yml | 6 +- src/resources/beta/realtime/realtime.ts | 68 +++++++++++ src/resources/beta/realtime/sessions.ts | 34 ++++++ .../beta/realtime/transcription-sessions.ts | 34 ++++++ src/resources/responses/responses.ts | 115 +++++++++++++----- .../api-resources/responses/responses.test.ts | 11 +- 6 files changed, 222 insertions(+), 46 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2644b7f7..c958c3acd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml -openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 3b590818075ca4b54949578b97494525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml +openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 +config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5ced1574f..b9a1788ac 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2094,6 +2094,11 @@ export namespace SessionUpdateEvent { * Realtime session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -2219,6 +2224,35 @@ export namespace SessionUpdateEvent { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is @@ -2399,6 +2433,11 @@ export namespace TranscriptionSessionUpdate { * Realtime transcription session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -2451,6 +2490,35 @@ export namespace TranscriptionSessionUpdate { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index a55a2678c..d6fb1135e 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -485,6 +485,11 @@ export namespace SessionCreateResponse { } export interface SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: SessionCreateParams.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -610,6 +615,35 @@ export interface SessionCreateParams { } export namespace SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index 83e8c47ad..5c14540f8 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -149,6 +149,11 @@ export namespace TranscriptionSession { } export interface TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: TranscriptionSessionCreateParams.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -201,6 +206,35 @@ export interface TranscriptionSessionCreateParams { } export namespace TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index a0839e432..eeaff8a11 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -7,7 +7,7 @@ import { addOutputText, } from '../../lib/ResponsesParser'; import * as Core from '../../core'; -import { APIPromise, isRequestOptions } from '../../core'; +import { APIPromise } from '../../core'; import { APIResource } from '../../resource'; import * as Shared from '../shared'; import * as InputItemsAPI from './input-items'; @@ -117,38 +117,26 @@ export class Responses extends APIResource { responseId: string, query?: ResponseRetrieveParamsNonStreaming, options?: Core.RequestOptions, - ): Core.APIPromise; + ): APIPromise; retrieve( responseId: string, - query?: ResponseRetrieveParamsStreaming, + query: ResponseRetrieveParamsStreaming, options?: Core.RequestOptions, - ): Core.APIPromise>; - retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise; + ): APIPromise>; retrieve( responseId: string, - query: ResponseRetrieveParams | Core.RequestOptions, + query?: ResponseRetrieveParamsBase | undefined, options?: Core.RequestOptions, - ): Core.APIPromise | Core.APIPromise>; + ): APIPromise | Response>; retrieve( responseId: string, - query: ResponseRetrieveParams | Core.RequestOptions = {}, + query: ResponseRetrieveParams | undefined = {}, options?: Core.RequestOptions, - ): Core.APIPromise | Core.APIPromise> { - if (isRequestOptions(query) && options === undefined) { - return this.retrieve(responseId, {}, query); - } - return ( - this._client.get(`/responses/${responseId}`, { - query, - ...options, - stream: query.stream ?? false, - }) as APIPromise | APIPromise> - )._thenUnwrap((rsp) => { - if ('object' in rsp && rsp.object === 'response') { - addOutputText(rsp as Response); - } - - return rsp; + ): APIPromise | APIPromise> { + return this._client.get(`/responses/${responseId}`, { + query, + ...options, + stream: query?.stream ?? false, }) as APIPromise | APIPromise>; } @@ -3320,6 +3308,8 @@ export interface ResponseOutputText { * The type of the output text. Always `output_text`. */ type: 'output_text'; + + logprobs?: Array; } export namespace ResponseOutputText { @@ -3392,6 +3382,32 @@ export namespace ResponseOutputText { */ type: 'file_path'; } + + /** + * The log probability of a token. + */ + export interface Logprob { + token: string; + + bytes: Array; + + logprob: number; + + top_logprobs: Array; + } + + export namespace Logprob { + /** + * The top log probability of a token. + */ + export interface TopLogprob { + token: string; + + bytes: Array; + + logprob: number; + } + } } /** @@ -4742,7 +4758,8 @@ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase stream: true; } -export type ResponseRetrieveParams = ResponseRetrieveParamsStreaming | ResponseRetrieveParamsNonStreaming; +export type ResponseRetrieveParams = ResponseRetrieveParamsNonStreaming | ResponseRetrieveParamsStreaming; + export interface ResponseRetrieveParamsBase { /** * Additional fields to include in the response. See the `include` parameter for @@ -4750,21 +4767,51 @@ export interface ResponseRetrieveParamsBase { */ include?: Array; - starting_after?: number | null; - stream?: boolean | null; + /** + * The sequence number of the event after which to start streaming. + */ + starting_after?: number; + + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: boolean; } -export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { - stream: true; +export namespace ResponseRetrieveParams { + export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; + export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; } + export interface ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase { - stream?: false | null; + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: false; } -export namespace ResponseRetrieveParams { - export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; - export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; +export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream: true; } + Responses.InputItems = InputItems; export declare namespace Responses { @@ -4870,6 +4917,8 @@ export declare namespace Responses { type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, type ResponseRetrieveParams as ResponseRetrieveParams, + type ResponseRetrieveParamsNonStreaming as ResponseRetrieveParamsNonStreaming, + type ResponseRetrieveParamsStreaming as ResponseRetrieveParamsStreaming, }; export { diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index f8e653c52..97847b28a 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -64,21 +64,12 @@ describe('resource responses', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('retrieve: 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.responses.retrieve( 'resp_677efb5139a88190b512bc3fef8e535d', - { include: ['file_search_call.results'] }, + { include: ['file_search_call.results'], starting_after: 0, stream: false }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); From 83129d7eac3dd784bb1c29fa344c5b808a59db73 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 01:54:00 +0000 Subject: [PATCH 441/509] fix(client): return binary content from `get /containers/{container_id}/files/{file_id}/content` --- .stats.yml | 2 +- api.md | 2 +- src/resources/containers/files/content.ts | 6 ++++-- tests/api-resources/containers/files/content.test.ts | 12 ------------ 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index c958c3acd..6bbd6aae7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c +config_hash: d23f847b9ebb3f427d0f198035bd3e9f diff --git a/api.md b/api.md index fde6fa2a3..86d6435dd 100644 --- a/api.md +++ b/api.md @@ -809,4 +809,4 @@ Methods: Methods: -- client.containers.files.content.retrieve(containerId, fileId) -> void +- client.containers.files.content.retrieve(containerId, fileId) -> Response diff --git a/src/resources/containers/files/content.ts b/src/resources/containers/files/content.ts index efb33a87f..e99d75459 100644 --- a/src/resources/containers/files/content.ts +++ b/src/resources/containers/files/content.ts @@ -2,15 +2,17 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; +import { type Response } from '../../../_shims/index'; export class Content extends APIResource { /** * Retrieve Container File Content */ - retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { + retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/containers/${containerId}/files/${fileId}/content`, { ...options, - headers: { Accept: '*/*', ...options?.headers }, + headers: { Accept: 'application/binary', ...options?.headers }, + __binaryResponse: true, }); } } diff --git a/tests/api-resources/containers/files/content.test.ts b/tests/api-resources/containers/files/content.test.ts index 9215c001a..c4b10fdf4 100644 --- a/tests/api-resources/containers/files/content.test.ts +++ b/tests/api-resources/containers/files/content.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -9,17 +8,6 @@ const client = new OpenAI({ }); describe('resource content', () => { - test('retrieve', async () => { - const responsePromise = client.containers.files.content.retrieve('container_id', 'file_id'); - 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('retrieve: request options instead of 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( From b4d1b4627622157593a06f64f02ee5aa72deb6b3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 20:46:50 +0000 Subject: [PATCH 442/509] feat(api): Config update for pakrym-stream-param --- .stats.yml | 6 +- src/resources/beta/realtime/realtime.ts | 68 ++++++++++++ src/resources/beta/realtime/sessions.ts | 34 ++++++ .../beta/realtime/transcription-sessions.ts | 34 ++++++ src/resources/responses/responses.ts | 101 +++++++++++++----- .../api-resources/responses/responses.test.ts | 2 +- 6 files changed, 217 insertions(+), 28 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2644b7f7..c958c3acd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml -openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 3b590818075ca4b54949578b97494525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml +openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 +config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index bdbd6872d..21550a29e 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2094,6 +2094,11 @@ export namespace SessionUpdateEvent { * Realtime session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -2219,6 +2224,35 @@ export namespace SessionUpdateEvent { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is @@ -2399,6 +2433,11 @@ export namespace TranscriptionSessionUpdate { * Realtime transcription session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -2451,6 +2490,35 @@ export namespace TranscriptionSessionUpdate { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 04cf658d2..7d7a27f13 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -487,6 +487,11 @@ export namespace SessionCreateResponse { } export interface SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: SessionCreateParams.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -612,6 +617,35 @@ export interface SessionCreateParams { } export namespace SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index 0fc96b854..8f6dec5f7 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -148,6 +148,11 @@ export namespace TranscriptionSession { } export interface TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: TranscriptionSessionCreateParams.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -200,6 +205,35 @@ export interface TranscriptionSessionCreateParams { } export namespace TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index c3cf03c5a..e5400dcea 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -127,26 +127,18 @@ export class Responses extends APIResource { ): APIPromise>; retrieve( responseID: string, - query: ResponseRetrieveParams, + query?: ResponseRetrieveParamsBase | undefined, options?: RequestOptions, - ): APIPromise | APIPromise>; + ): APIPromise | Response>; retrieve( responseID: string, - query: ResponseRetrieveParams | null | undefined = {}, + query: ResponseRetrieveParams | undefined = {}, options?: RequestOptions, ): APIPromise | APIPromise> { - return ( - this._client.get(path`/responses/${responseID}`, { - query, - ...options, - stream: query?.stream ?? false, - }) as APIPromise | APIPromise> - )._thenUnwrap((rsp) => { - if ('object' in rsp && rsp.object === 'response') { - addOutputText(rsp as Response); - } - - return rsp; + return this._client.get(path`/responses/${responseID}`, { + query, + ...options, + stream: query?.stream ?? false, }) as APIPromise | APIPromise>; } @@ -3316,6 +3308,8 @@ export interface ResponseOutputText { * The type of the output text. Always `output_text`. */ type: 'output_text'; + + logprobs?: Array; } export namespace ResponseOutputText { @@ -3388,6 +3382,32 @@ export namespace ResponseOutputText { */ type: 'file_path'; } + + /** + * The log probability of a token. + */ + export interface Logprob { + token: string; + + bytes: Array; + + logprob: number; + + top_logprobs: Array; + } + + export namespace Logprob { + /** + * The top log probability of a token. + */ + export interface TopLogprob { + token: string; + + bytes: Array; + + logprob: number; + } + } } /** @@ -4738,7 +4758,8 @@ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase stream: true; } -export type ResponseRetrieveParams = ResponseRetrieveParamsStreaming | ResponseRetrieveParamsNonStreaming; +export type ResponseRetrieveParams = ResponseRetrieveParamsNonStreaming | ResponseRetrieveParamsStreaming; + export interface ResponseRetrieveParamsBase { /** * Additional fields to include in the response. See the `include` parameter for @@ -4746,21 +4767,51 @@ export interface ResponseRetrieveParamsBase { */ include?: Array; - starting_after?: number | null; - stream?: boolean | null; + /** + * The sequence number of the event after which to start streaming. + */ + starting_after?: number; + + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: boolean; } -export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { - stream: true; +export namespace ResponseRetrieveParams { + export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; + export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; } + export interface ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase { - stream?: false | null; + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: false; } -export namespace ResponseRetrieveParams { - export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; - export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; +export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream: true; } + Responses.InputItems = InputItems; export declare namespace Responses { @@ -4866,6 +4917,8 @@ export declare namespace Responses { type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, type ResponseRetrieveParams as ResponseRetrieveParams, + type ResponseRetrieveParamsNonStreaming as ResponseRetrieveParamsNonStreaming, + type ResponseRetrieveParamsStreaming as ResponseRetrieveParamsStreaming, }; export { diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index b40b4d36f..f1480f8c3 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -68,7 +68,7 @@ describe('resource responses', () => { await expect( client.responses.retrieve( 'resp_677efb5139a88190b512bc3fef8e535d', - { include: ['file_search_call.results'] }, + { include: ['file_search_call.results'], starting_after: 0, stream: false }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); From 899869b40ab5f64145c48521378f1925f6b5b33a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 01:54:03 +0000 Subject: [PATCH 443/509] fix(client): return binary content from `get /containers/{container_id}/files/{file_id}/content` --- .stats.yml | 2 +- api.md | 2 +- src/resources/containers/files/content.ts | 5 +++-- .../api-resources/containers/files/content.test.ts | 13 ------------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.stats.yml b/.stats.yml index c958c3acd..6bbd6aae7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c +config_hash: d23f847b9ebb3f427d0f198035bd3e9f diff --git a/api.md b/api.md index f54b286cc..c367a06f0 100644 --- a/api.md +++ b/api.md @@ -808,4 +808,4 @@ Methods: Methods: -- client.containers.files.content.retrieve(fileID, { ...params }) -> void +- client.containers.files.content.retrieve(fileID, { ...params }) -> Response diff --git a/src/resources/containers/files/content.ts b/src/resources/containers/files/content.ts index e22f4bf96..76ceb1703 100644 --- a/src/resources/containers/files/content.ts +++ b/src/resources/containers/files/content.ts @@ -10,11 +10,12 @@ export class Content extends APIResource { /** * Retrieve Container File Content */ - retrieve(fileID: string, params: ContentRetrieveParams, options?: RequestOptions): APIPromise { + retrieve(fileID: string, params: ContentRetrieveParams, options?: RequestOptions): APIPromise { const { container_id } = params; return this._client.get(path`/containers/${container_id}/files/${fileID}/content`, { ...options, - headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), + headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]), + __binaryResponse: true, }); } } diff --git a/tests/api-resources/containers/files/content.test.ts b/tests/api-resources/containers/files/content.test.ts index caa78b8a6..1792ed49a 100644 --- a/tests/api-resources/containers/files/content.test.ts +++ b/tests/api-resources/containers/files/content.test.ts @@ -8,19 +8,6 @@ const client = new OpenAI({ }); describe('resource content', () => { - test('retrieve: only required params', async () => { - const responsePromise = client.containers.files.content.retrieve('file_id', { - container_id: 'container_id', - }); - 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('retrieve: required and optional params', async () => { const response = await client.containers.files.content.retrieve('file_id', { container_id: 'container_id', From 3508099991ecfa260d77678037275133130e09dc Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 29 May 2025 17:10:32 +0100 Subject: [PATCH 444/509] chore(migration): add beta handling --- bin/migration-config.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/migration-config.json b/bin/migration-config.json index 8000d839c..26d644698 100644 --- a/bin/migration-config.json +++ b/bin/migration-config.json @@ -8,6 +8,21 @@ "name": "delete", "oldName": "del" }, + { + "base": "chat.completions", + "name": "stream", + "oldBase": "beta.chat.completions" + }, + { + "base": "chat.completions", + "name": "parse", + "oldBase": "beta.chat.completions" + }, + { + "base": "chat.completions", + "name": "runTools", + "oldBase": "beta.chat.completions" + }, { "base": "files", "name": "delete", From f74373020ab01ace999a72d916e017db0177bf16 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 15:16:12 +0000 Subject: [PATCH 445/509] fix: compat with more runtimes --- src/internal/detect-platform.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts index c5e273b97..e82d95c92 100644 --- a/src/internal/detect-platform.ts +++ b/src/internal/detect-platform.ts @@ -85,10 +85,10 @@ const getPlatformProperties = (): PlatformProperties => { return { 'X-Stainless-Lang': 'js', 'X-Stainless-Package-Version': VERSION, - 'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform), - 'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch), + 'X-Stainless-OS': normalizePlatform((globalThis as any).process.platform ?? 'unknown'), + 'X-Stainless-Arch': normalizeArch((globalThis as any).process.arch ?? 'unknown'), 'X-Stainless-Runtime': 'node', - 'X-Stainless-Runtime-Version': (globalThis as any).process.version, + 'X-Stainless-Runtime-Version': (globalThis as any).process.version ?? 'unknown', }; } From fdd6f6672ec577cbb6876fe3857a2161402513c3 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 28 May 2025 20:56:00 +0100 Subject: [PATCH 446/509] refactor(functions): rename function helper methods to include tools --- examples/tool-call-helpers-zod.ts | 6 ++-- examples/tool-call-helpers.ts | 6 ++-- src/lib/AbstractChatCompletionRunner.ts | 34 ++++++++++---------- src/lib/ChatCompletionRunner.ts | 9 +----- src/lib/ChatCompletionStreamingRunner.ts | 9 +----- src/resources/beta/chat/completions.ts | 12 ++----- tests/lib/ChatCompletionRunFunctions.test.ts | 34 ++++++++++---------- 7 files changed, 46 insertions(+), 64 deletions(-) diff --git a/examples/tool-call-helpers-zod.ts b/examples/tool-call-helpers-zod.ts index 0d31b4933..4ac1bc41c 100755 --- a/examples/tool-call-helpers-zod.ts +++ b/examples/tool-call-helpers-zod.ts @@ -73,8 +73,10 @@ async function main() { ], }) .on('message', (msg) => console.log('msg', msg)) - .on('functionCall', (functionCall) => console.log('functionCall', functionCall)) - .on('functionCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult)) + .on('finalFunctionToolCall', (functionCall) => console.log('functionCall', functionCall)) + .on('finalFunctionToolCallResult', (functionCallResult) => + console.log('functionCallResult', functionCallResult), + ) .on('content', (diff) => process.stdout.write(diff)); const result = await runner.finalChatCompletion(); diff --git a/examples/tool-call-helpers.ts b/examples/tool-call-helpers.ts index 21b86f8fb..a680f6da9 100755 --- a/examples/tool-call-helpers.ts +++ b/examples/tool-call-helpers.ts @@ -82,8 +82,10 @@ async function main() { ], }) .on('message', (msg) => console.log('msg', msg)) - .on('functionCall', (functionCall) => console.log('functionCall', functionCall)) - .on('functionCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult)) + .on('functionToolCall', (functionCall) => console.log('functionCall', functionCall)) + .on('functionToolCallResult', (functionCallResult) => + console.log('functionCallResult', functionCallResult), + ) .on('content', (diff) => process.stdout.write(diff)); const result = await runner.finalChatCompletion(); diff --git a/src/lib/AbstractChatCompletionRunner.ts b/src/lib/AbstractChatCompletionRunner.ts index 622112257..7a3286cc1 100644 --- a/src/lib/AbstractChatCompletionRunner.ts +++ b/src/lib/AbstractChatCompletionRunner.ts @@ -12,7 +12,7 @@ import { type RunnableFunction, isRunnableFunctionWithParse, type BaseFunctionsArgs, - RunnableToolFunction, + type RunnableToolFunction, } from './RunnableFunction'; import type { ChatCompletionToolRunnerParams } from './ChatCompletionRunner'; import type { ChatCompletionStreamingToolRunnerParams } from './ChatCompletionStreamingRunner'; @@ -60,11 +60,11 @@ export class AbstractChatCompletionRunner< this._emit('message', message); if (isToolMessage(message) && message.content) { // Note, this assumes that {role: 'tool', content: …} is always the result of a call of tool of type=function. - this._emit('functionCallResult', message.content as string); + this._emit('functionToolCallResult', message.content as string); } else if (isAssistantMessage(message) && message.tool_calls) { for (const tool_call of message.tool_calls) { if (tool_call.type === 'function') { - this._emit('functionCall', tool_call.function); + this._emit('functionToolCall', tool_call.function); } } } @@ -121,7 +121,7 @@ export class AbstractChatCompletionRunner< return this.#getFinalMessage(); } - #getFinalFunctionCall(): ChatCompletionMessageToolCall.Function | undefined { + #getFinalFunctionToolCall(): ChatCompletionMessageToolCall.Function | undefined { for (let i = this.messages.length - 1; i >= 0; i--) { const message = this.messages[i]; if (isAssistantMessage(message) && message?.tool_calls?.length) { @@ -136,12 +136,12 @@ export class AbstractChatCompletionRunner< * @returns a promise that resolves with the content of the final FunctionCall, or rejects * if an error occurred or the stream ended prematurely without producing a ChatCompletionMessage. */ - async finalFunctionCall(): Promise { + async finalFunctionToolCall(): Promise { await this.done(); - return this.#getFinalFunctionCall(); + return this.#getFinalFunctionToolCall(); } - #getFinalFunctionCallResult(): string | undefined { + #getFinalFunctionToolCallResult(): string | undefined { for (let i = this.messages.length - 1; i >= 0; i--) { const message = this.messages[i]; if ( @@ -161,9 +161,9 @@ export class AbstractChatCompletionRunner< return; } - async finalFunctionCallResult(): Promise { + async finalFunctionToolCallResult(): Promise { await this.done(); - return this.#getFinalFunctionCallResult(); + return this.#getFinalFunctionToolCallResult(); } #calculateTotalUsage(): CompletionUsage { @@ -201,11 +201,11 @@ export class AbstractChatCompletionRunner< const finalContent = this.#getFinalContent(); if (finalContent) this._emit('finalContent', finalContent); - const finalFunctionCall = this.#getFinalFunctionCall(); - if (finalFunctionCall) this._emit('finalFunctionCall', finalFunctionCall); + const finalFunctionCall = this.#getFinalFunctionToolCall(); + if (finalFunctionCall) this._emit('finalFunctionToolCall', finalFunctionCall); - const finalFunctionCallResult = this.#getFinalFunctionCallResult(); - if (finalFunctionCallResult != null) this._emit('finalFunctionCallResult', finalFunctionCallResult); + const finalFunctionCallResult = this.#getFinalFunctionToolCallResult(); + if (finalFunctionCallResult != null) this._emit('finalFunctionToolCallResult', finalFunctionCallResult); if (this._chatCompletions.some((c) => c.usage)) { this._emit('totalUsage', this.#calculateTotalUsage()); @@ -390,14 +390,14 @@ export class AbstractChatCompletionRunner< } export interface AbstractChatCompletionRunnerEvents extends BaseEvents { - functionCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; + functionToolCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; message: (message: ChatCompletionMessageParam) => void; chatCompletion: (completion: ChatCompletion) => void; finalContent: (contentSnapshot: string) => void; finalMessage: (message: ChatCompletionMessageParam) => void; finalChatCompletion: (completion: ChatCompletion) => void; - finalFunctionCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; - functionCallResult: (content: string) => void; - finalFunctionCallResult: (content: string) => void; + finalFunctionToolCall: (functionCall: ChatCompletionMessageToolCall.Function) => void; + functionToolCallResult: (content: string) => void; + finalFunctionToolCallResult: (content: string) => void; totalUsage: (usage: CompletionUsage) => void; } diff --git a/src/lib/ChatCompletionRunner.ts b/src/lib/ChatCompletionRunner.ts index 1318d9eae..a5edaf741 100644 --- a/src/lib/ChatCompletionRunner.ts +++ b/src/lib/ChatCompletionRunner.ts @@ -2,7 +2,7 @@ import { type ChatCompletionMessageParam, type ChatCompletionCreateParamsNonStreaming, } from '../resources/chat/completions'; -import { type RunnableFunctions, type BaseFunctionsArgs, RunnableTools } from './RunnableFunction'; +import { type BaseFunctionsArgs, RunnableTools } from './RunnableFunction'; import { AbstractChatCompletionRunner, AbstractChatCompletionRunnerEvents, @@ -16,13 +16,6 @@ export interface ChatCompletionRunnerEvents extends AbstractChatCompletionRunner content: (content: string) => void; } -export type ChatCompletionFunctionRunnerParams = Omit< - ChatCompletionCreateParamsNonStreaming, - 'functions' -> & { - functions: RunnableFunctions; -}; - export type ChatCompletionToolRunnerParams = Omit< ChatCompletionCreateParamsNonStreaming, 'tools' diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index cbacdce63..eb8fcc357 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -4,7 +4,7 @@ import { } from '../resources/chat/completions'; import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner'; import { type ReadableStream } from '../internal/shim-types'; -import { RunnableTools, type BaseFunctionsArgs, type RunnableFunctions } from './RunnableFunction'; +import { RunnableTools, type BaseFunctionsArgs } from './RunnableFunction'; import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream'; import OpenAI from '../index'; import { AutoParseableTool } from '../lib/parser'; @@ -14,13 +14,6 @@ export interface ChatCompletionStreamEvents extends AbstractChatCompletionRunner chunk: (chunk: ChatCompletionChunk, snapshot: ChatCompletionSnapshot) => void; } -export type ChatCompletionStreamingFunctionRunnerParams = Omit< - ChatCompletionCreateParamsStreaming, - 'functions' -> & { - functions: RunnableFunctions; -}; - export type ChatCompletionStreamingToolRunnerParams = Omit< ChatCompletionCreateParamsStreaming, 'tools' diff --git a/src/resources/beta/chat/completions.ts b/src/resources/beta/chat/completions.ts index 2b3f619e0..dd9a02521 100644 --- a/src/resources/beta/chat/completions.ts +++ b/src/resources/beta/chat/completions.ts @@ -15,13 +15,8 @@ import { } from '../../chat/completions'; import { ExtractParsedContentFromParams, parseChatCompletion, validateInputTools } from '../../../lib/parser'; +export { ChatCompletionStreamingRunner } from '../../../lib/ChatCompletionStreamingRunner'; export { - ChatCompletionStreamingRunner, - type ChatCompletionStreamingFunctionRunnerParams, -} from '../../../lib/ChatCompletionStreamingRunner'; -export { - type RunnableFunction, - type RunnableFunctions, type RunnableFunctionWithParse, type RunnableFunctionWithoutParse, ParsingToolFunction, @@ -29,10 +24,7 @@ export { export { type ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; export { type ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; export { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; -export { - ChatCompletionRunner, - type ChatCompletionFunctionRunnerParams, -} from '../../../lib/ChatCompletionRunner'; +export { ChatCompletionRunner } from '../../../lib/ChatCompletionRunner'; import { RequestOptions } from '../../../internal/request-options'; import { type APIPromise } from '../../../index'; diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index 51f648f55..ffe17fb98 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -151,13 +151,13 @@ class RunnerListener { .on('content', (content) => this.contents.push(content)) .on('message', (message) => this.messages.push(message)) .on('chatCompletion', (completion) => this.chatCompletions.push(completion)) - .on('functionCall', (functionCall) => this.functionCalls.push(functionCall)) - .on('functionCallResult', (result) => this.functionCallResults.push(result)) + .on('functionToolCall', (functionCall) => this.functionCalls.push(functionCall)) + .on('functionToolCallResult', (result) => this.functionCallResults.push(result)) .on('finalContent', (content) => (this.finalContent = content)) .on('finalMessage', (message) => (this.finalMessage = message)) .on('finalChatCompletion', (completion) => (this.finalChatCompletion = completion)) - .on('finalFunctionCall', (functionCall) => (this.finalFunctionCall = functionCall)) - .on('finalFunctionCallResult', (result) => (this.finalFunctionCallResult = result)) + .on('finalFunctionToolCall', (functionCall) => (this.finalFunctionCall = functionCall)) + .on('finalFunctionToolCallResult', (result) => (this.finalFunctionCallResult = result)) .on('totalUsage', (usage) => (this.totalUsage = usage)) .on('error', (error) => (this.error = error)) .on('abort', (error) => ((this.error = error), (this.gotAbort = true))) @@ -175,8 +175,8 @@ class RunnerListener { await expect(this.runner.finalChatCompletion()).rejects.toThrow(error); await expect(this.runner.finalMessage()).rejects.toThrow(error); await expect(this.runner.finalContent()).rejects.toThrow(error); - await expect(this.runner.finalFunctionCall()).rejects.toThrow(error); - await expect(this.runner.finalFunctionCallResult()).rejects.toThrow(error); + await expect(this.runner.finalFunctionToolCall()).rejects.toThrow(error); + await expect(this.runner.finalFunctionToolCallResult()).rejects.toThrow(error); await expect(this.runner.totalUsage()).rejects.toThrow(error); await expect(this.runner.done()).rejects.toThrow(error); } else { @@ -214,11 +214,11 @@ class RunnerListener { expect(this.finalChatCompletion).toEqual(this.chatCompletions[this.chatCompletions.length - 1]); expect(await this.runner.finalChatCompletion()).toEqual(this.finalChatCompletion); expect(this.finalFunctionCall).toEqual(this.functionCalls[this.functionCalls.length - 1]); - expect(await this.runner.finalFunctionCall()).toEqual(this.finalFunctionCall); + expect(await this.runner.finalFunctionToolCall()).toEqual(this.finalFunctionCall); expect(this.finalFunctionCallResult).toEqual( this.functionCallResults[this.functionCallResults.length - 1], ); - expect(await this.runner.finalFunctionCallResult()).toEqual(this.finalFunctionCallResult); + expect(await this.runner.finalFunctionToolCallResult()).toEqual(this.finalFunctionCallResult); expect(this.chatCompletions).toEqual(this.runner.allChatCompletions()); expect(this.messages).toEqual(this.runner.messages.slice(-this.messages.length)); if (this.chatCompletions.some((c) => c.usage)) { @@ -266,13 +266,13 @@ class StreamingRunnerListener { .on('content', (delta, snapshot) => this.eventContents.push([delta, snapshot])) .on('message', (message) => this.eventMessages.push(message)) .on('chatCompletion', (completion) => this.eventChatCompletions.push(completion)) - .on('functionCall', (functionCall) => this.eventFunctionCalls.push(functionCall)) - .on('functionCallResult', (result) => this.eventFunctionCallResults.push(result)) + .on('functionToolCall', (functionCall) => this.eventFunctionCalls.push(functionCall)) + .on('functionToolCallResult', (result) => this.eventFunctionCallResults.push(result)) .on('finalContent', (content) => (this.finalContent = content)) .on('finalMessage', (message) => (this.finalMessage = message)) .on('finalChatCompletion', (completion) => (this.finalChatCompletion = completion)) - .on('finalFunctionCall', (functionCall) => (this.finalFunctionCall = functionCall)) - .on('finalFunctionCallResult', (result) => (this.finalFunctionCallResult = result)) + .on('finalFunctionToolCall', (functionCall) => (this.finalFunctionCall = functionCall)) + .on('finalFunctionToolCallResult', (result) => (this.finalFunctionCallResult = result)) .on('error', (error) => (this.error = error)) .on('abort', (abort) => (this.error = abort)) .on('end', () => (this.gotEnd = true)); @@ -285,8 +285,8 @@ class StreamingRunnerListener { await expect(this.runner.finalChatCompletion()).rejects.toThrow(error); await expect(this.runner.finalMessage()).rejects.toThrow(error); await expect(this.runner.finalContent()).rejects.toThrow(error); - await expect(this.runner.finalFunctionCall()).rejects.toThrow(error); - await expect(this.runner.finalFunctionCallResult()).rejects.toThrow(error); + await expect(this.runner.finalFunctionToolCall()).rejects.toThrow(error); + await expect(this.runner.finalFunctionToolCallResult()).rejects.toThrow(error); await expect(this.runner.done()).rejects.toThrow(error); } else { expect(this.error).toBeUndefined(); @@ -318,11 +318,11 @@ class StreamingRunnerListener { expect(this.finalChatCompletion).toEqual(this.eventChatCompletions[this.eventChatCompletions.length - 1]); expect(await this.runner.finalChatCompletion()).toEqual(this.finalChatCompletion); expect(this.finalFunctionCall).toEqual(this.eventFunctionCalls[this.eventFunctionCalls.length - 1]); - expect(await this.runner.finalFunctionCall()).toEqual(this.finalFunctionCall); + expect(await this.runner.finalFunctionToolCall()).toEqual(this.finalFunctionCall); expect(this.finalFunctionCallResult).toEqual( this.eventFunctionCallResults[this.eventFunctionCallResults.length - 1], ); - expect(await this.runner.finalFunctionCallResult()).toEqual(this.finalFunctionCallResult); + expect(await this.runner.finalFunctionToolCallResult()).toEqual(this.finalFunctionCallResult); expect(this.eventChatCompletions).toEqual(this.runner.allChatCompletions()); expect(this.eventMessages).toEqual(this.runner.messages.slice(-this.eventMessages.length)); if (error) { @@ -1603,7 +1603,7 @@ describe('resource completions', () => { }, { signal: controller.signal }, ); - runner.on('functionCallResult', () => controller.abort()); + runner.on('functionToolCallResult', () => controller.abort()); const listener = new StreamingRunnerListener(runner); await handleRequest(async function* (request): AsyncIterable { From eb773ee26df88ab6da5918521c5e979860a5aaee Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 28 May 2025 21:24:29 +0100 Subject: [PATCH 447/509] docs(migration): mention function renames --- MIGRATION.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/MIGRATION.md b/MIGRATION.md index 3560899b4..28b58a93a 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -382,6 +382,42 @@ If you were importing these classes at runtime, you'll need to switch to importi The deprecated `client.beta.chat.completions.runFunctions()` method and all of it's surrounding types have been removed, instead you should use `client.beta.chat.completions.runTools()`. +### `.runTools()` event / method names + +To better align with the tool-based API, several event names in the ChatCompletionRunner have been renamed: + +```ts +// Before +openai.beta.chat.completions + .runTools({ + // .. + }) + .on('functionCall', (functionCall) => console.log('functionCall', functionCall)) + .on('functionCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult)) + .on('finalFunctionCall', (functionCall) => console.log('finalFunctionCall', functionCall)) + .on('finalFunctionCallResult', (result) => console.log('finalFunctionCallResult', result)); + +// After +openai.beta.chat.completions + .runTools({ + // .. + }) + .on('functionToolCall', (functionCall) => console.log('functionCall', functionCall)) + .on('functionToolCallResult', (functionCallResult) => console.log('functionCallResult', functionCallResult)) + .on('finalFunctionToolCall', (functionCall) => console.log('finalFunctionCall', functionCall)) + .on('finalFunctionToolCallResult', (result) => console.log('finalFunctionCallResult', result)); +``` + +The following event names have been changed: +- `functionCall` → `functionToolCall` +- `functionCallResult` → `functionToolCallResult` +- `finalFunctionCall` → `finalFunctionToolCall` +- `finalFunctionCallResult` → `finalFunctionToolCallResult` + +Additionally, the following methods have been renamed: +- `runner.finalFunctionCall()` → `runner.finalFunctionToolCall()` +- `runner.finalFunctionCallResult()` → `runner.finalFunctionToolCallResult()` + ### `openai/src` directory removed Previously IDEs may have auto-completed imports from the `openai/src` directory, however this From ce9f11431cc170056d699c6e6b3a94801121415e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:06:17 +0000 Subject: [PATCH 448/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 017aa58a1..d761f22d7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: c497f6b750cc89c0bf2eefc0bc839c70 +config_hash: 535b6e5f26a295d609b259c8cb8f656c From 0e4b98261e412417dd0f6d1c799ef77398bfb7c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 22 May 2025 21:30:52 +0000 Subject: [PATCH 449/509] chore(internal): fix release workflows --- bin/check-release-environment | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/check-release-environment b/bin/check-release-environment index e51564b7d..dbfd546bf 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,6 +2,10 @@ errors=() +if [ -z "${STAINLESS_API_KEY}" ]; then + errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") +fi + if [ -z "${NPM_TOKEN}" ]; then errors+=("The OPENAI_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi From 4b180597633a527c435e049d885103ab06311b90 Mon Sep 17 00:00:00 2001 From: Mikhail Simin Date: Tue, 27 May 2025 03:17:35 -0700 Subject: [PATCH 450/509] fix(azure): add /images/edits to deployments endpoints (#1509) * Add /images/edits to AzureOpenAI deployments endpoints --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 3b4b9a574..3a25ad3ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -772,6 +772,7 @@ const _deployments_endpoints = new Set([ '/audio/translations', '/audio/speech', '/images/generations', + '/images/edits', ]); const API_KEY_SENTINEL = ''; From 6d3cc5c99ba005c39a1550b30c4243ba454b9cb1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 27 May 2025 22:21:27 +0000 Subject: [PATCH 451/509] chore: improve publish-npm script --latest tag logic --- bin/publish-npm | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/bin/publish-npm b/bin/publish-npm index 4c21181bb..2505decac 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -4,19 +4,35 @@ set -eux npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" -# Build the project yarn build - -# Navigate to the dist directory cd dist -# Get the version from package.json +# Get latest version from npm +# +# If the package doesn't exist, yarn will return +# {"type":"error","data":"Received invalid response from npm."} +# where .data.version doesn't exist so LAST_VERSION will be an empty string. +LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')" + +# Get current version from package.json VERSION="$(node -p "require('./package.json').version")" -# Extract the pre-release tag if it exists +# Check if current version is pre-release (e.g. alpha / beta / rc) +CURRENT_IS_PRERELEASE=false if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then - # Extract the part before any dot in the pre-release identifier - TAG="${BASH_REMATCH[1]}" + CURRENT_IS_PRERELEASE=true + CURRENT_TAG="${BASH_REMATCH[1]}" +fi + +# Check if last version is a stable release +LAST_IS_STABLE_RELEASE=true +if [[ -z "$LAST_VERSION" || "$LAST_VERSION" =~ -([a-zA-Z]+) ]]; then + LAST_IS_STABLE_RELEASE=false +fi + +# Use a corresponding alpha/beta tag if there already is a stable release and we're publishing a prerelease. +if $CURRENT_IS_PRERELEASE && $LAST_IS_STABLE_RELEASE; then + TAG="$CURRENT_TAG" else TAG="latest" fi From 0be23b98b6be9f8922d035270b1c907307010a29 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 19:36:07 +0000 Subject: [PATCH 452/509] chore: deprecate Assistants API --- .stats.yml | 2 +- src/resources/beta/threads/messages.ts | 46 ++++---------------- src/resources/beta/threads/runs/runs.ts | 55 ++++-------------------- src/resources/beta/threads/runs/steps.ts | 24 +++-------- src/resources/beta/threads/threads.ts | 36 ++++------------ 5 files changed, 31 insertions(+), 132 deletions(-) diff --git a/.stats.yml b/.stats.yml index d761f22d7..c2644b7f7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 535b6e5f26a295d609b259c8cb8f656c +config_hash: 3b590818075ca4b54949578b97494525 diff --git a/src/resources/beta/threads/messages.ts b/src/resources/beta/threads/messages.ts index c3834ebe6..43779d427 100644 --- a/src/resources/beta/threads/messages.ts +++ b/src/resources/beta/threads/messages.ts @@ -7,17 +7,14 @@ import * as Shared from '../../shared'; import * as AssistantsAPI from '../assistants'; import { CursorPage, type CursorPageParams } from '../../../pagination'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Messages extends APIResource { /** * Create a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.create( - * 'thread_id', - * { content: 'string', role: 'user' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create( threadId: string, @@ -34,13 +31,7 @@ export class Messages extends APIResource { /** * Retrieve a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.retrieve( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/messages/${messageId}`, { @@ -52,13 +43,7 @@ export class Messages extends APIResource { /** * Modifies a message. * - * @example - * ```ts - * const message = await client.beta.threads.messages.update( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update( threadId: string, @@ -76,15 +61,7 @@ export class Messages extends APIResource { /** * Returns a list of messages for a given thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const message of client.beta.threads.messages.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, @@ -110,14 +87,7 @@ export class Messages extends APIResource { /** * Deletes a message. * - * @example - * ```ts - * const messageDeleted = - * await client.beta.threads.messages.del( - * 'thread_id', - * 'message_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ del(threadId: string, messageId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}/messages/${messageId}`, { diff --git a/src/resources/beta/threads/runs/runs.ts b/src/resources/beta/threads/runs/runs.ts index 25356df3c..fd5d82457 100644 --- a/src/resources/beta/threads/runs/runs.ts +++ b/src/resources/beta/threads/runs/runs.ts @@ -40,19 +40,16 @@ import { import { CursorPage, type CursorPageParams } from '../../../../pagination'; import { Stream } from '../../../../streaming'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Runs extends APIResource { steps: StepsAPI.Steps = new StepsAPI.Steps(this._client); /** * Create a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.create( - * 'thread_id', - * { assistant_id: 'assistant_id' }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create( threadId: string, @@ -87,13 +84,7 @@ export class Runs extends APIResource { /** * Retrieves a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.retrieve( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}/runs/${runId}`, { @@ -105,13 +96,7 @@ export class Runs extends APIResource { /** * Modifies a run. * - * @example - * ```ts - * const run = await client.beta.threads.runs.update( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update( threadId: string, @@ -129,15 +114,7 @@ export class Runs extends APIResource { /** * Returns a list of runs belonging to a thread. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const run of client.beta.threads.runs.list( - * 'thread_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, @@ -163,13 +140,7 @@ export class Runs extends APIResource { /** * Cancels a run that is `in_progress`. * - * @example - * ```ts - * const run = await client.beta.threads.runs.cancel( - * 'thread_id', - * 'run_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ cancel(threadId: string, runId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}/runs/${runId}/cancel`, { @@ -272,15 +243,7 @@ export class Runs extends APIResource { * tool calls once they're all completed. All outputs must be submitted in a single * request. * - * @example - * ```ts - * const run = - * await client.beta.threads.runs.submitToolOutputs( - * 'thread_id', - * 'run_id', - * { tool_outputs: [{}] }, - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ submitToolOutputs( threadId: string, diff --git a/src/resources/beta/threads/runs/steps.ts b/src/resources/beta/threads/runs/steps.ts index abd8d40ed..0907f69c4 100644 --- a/src/resources/beta/threads/runs/steps.ts +++ b/src/resources/beta/threads/runs/steps.ts @@ -7,19 +7,14 @@ import * as StepsAPI from './steps'; import * as Shared from '../../../shared'; import { CursorPage, type CursorPageParams } from '../../../../pagination'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Steps extends APIResource { /** * Retrieves a run step. * - * @example - * ```ts - * const runStep = - * await client.beta.threads.runs.steps.retrieve( - * 'thread_id', - * 'run_id', - * 'step_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve( threadId: string, @@ -54,16 +49,7 @@ export class Steps extends APIResource { /** * Returns a list of run steps belonging to a run. * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const runStep of client.beta.threads.runs.steps.list( - * 'thread_id', - * 'run_id', - * )) { - * // ... - * } - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ list( threadId: string, diff --git a/src/resources/beta/threads/threads.ts b/src/resources/beta/threads/threads.ts index c0c6bc8e4..b27729371 100644 --- a/src/resources/beta/threads/threads.ts +++ b/src/resources/beta/threads/threads.ts @@ -67,6 +67,9 @@ import { } from './runs/runs'; import { Stream } from '../../../streaming'; +/** + * @deprecated The Assistants API is deprecated in favor of the Responses API + */ export class Threads extends APIResource { runs: RunsAPI.Runs = new RunsAPI.Runs(this._client); messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); @@ -74,10 +77,7 @@ export class Threads extends APIResource { /** * Create a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.create(); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ create(body?: ThreadCreateParams, options?: Core.RequestOptions): Core.APIPromise; create(options?: Core.RequestOptions): Core.APIPromise; @@ -98,12 +98,7 @@ export class Threads extends APIResource { /** * Retrieves a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.retrieve( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ retrieve(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/threads/${threadId}`, { @@ -115,12 +110,7 @@ export class Threads extends APIResource { /** * Modifies a thread. * - * @example - * ```ts - * const thread = await client.beta.threads.update( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ update(threadId: string, body: ThreadUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post(`/threads/${threadId}`, { @@ -133,12 +123,7 @@ export class Threads extends APIResource { /** * Delete a thread. * - * @example - * ```ts - * const threadDeleted = await client.beta.threads.del( - * 'thread_id', - * ); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ del(threadId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.delete(`/threads/${threadId}`, { @@ -150,12 +135,7 @@ export class Threads extends APIResource { /** * Create a thread and run it in one request. * - * @example - * ```ts - * const run = await client.beta.threads.createAndRun({ - * assistant_id: 'assistant_id', - * }); - * ``` + * @deprecated The Assistants API is deprecated in favor of the Responses API */ createAndRun( body: ThreadCreateAndRunParamsNonStreaming, From 71c3d31dad568030fd563a0b5c7c2bd26d472df1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 14:19:32 +0000 Subject: [PATCH 453/509] feat(api): Config update for pakrym-stream-param --- .stats.yml | 6 +- src/resources/beta/realtime/realtime.ts | 68 +++++++++++ src/resources/beta/realtime/sessions.ts | 34 ++++++ .../beta/realtime/transcription-sessions.ts | 34 ++++++ src/resources/responses/responses.ts | 115 +++++++++++++----- .../api-resources/responses/responses.test.ts | 11 +- 6 files changed, 222 insertions(+), 46 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2644b7f7..c958c3acd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml -openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 3b590818075ca4b54949578b97494525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml +openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 +config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5ced1574f..b9a1788ac 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2094,6 +2094,11 @@ export namespace SessionUpdateEvent { * Realtime session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -2219,6 +2224,35 @@ export namespace SessionUpdateEvent { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is @@ -2399,6 +2433,11 @@ export namespace TranscriptionSessionUpdate { * Realtime transcription session object configuration. */ export interface Session { + /** + * Configuration options for the generated client secret. + */ + client_secret?: Session.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -2451,6 +2490,35 @@ export namespace TranscriptionSessionUpdate { } export namespace Session { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index a55a2678c..d6fb1135e 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -485,6 +485,11 @@ export namespace SessionCreateResponse { } export interface SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: SessionCreateParams.ClientSecret; + /** * The format of input audio. Options are `pcm16`, `g711_ulaw`, or `g711_alaw`. For * `pcm16`, input audio must be 16-bit PCM at a 24kHz sample rate, single channel @@ -610,6 +615,35 @@ export interface SessionCreateParams { } export namespace SessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/beta/realtime/transcription-sessions.ts b/src/resources/beta/realtime/transcription-sessions.ts index 83e8c47ad..5c14540f8 100644 --- a/src/resources/beta/realtime/transcription-sessions.ts +++ b/src/resources/beta/realtime/transcription-sessions.ts @@ -149,6 +149,11 @@ export namespace TranscriptionSession { } export interface TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + client_secret?: TranscriptionSessionCreateParams.ClientSecret; + /** * The set of items to include in the transcription. Current available items are: * @@ -201,6 +206,35 @@ export interface TranscriptionSessionCreateParams { } export namespace TranscriptionSessionCreateParams { + /** + * Configuration options for the generated client secret. + */ + export interface ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + expires_at?: ClientSecret.ExpiresAt; + } + + export namespace ClientSecret { + /** + * Configuration for the ephemeral token expiration. + */ + export interface ExpiresAt { + /** + * The anchor point for the ephemeral token expiration. Only `created_at` is + * currently supported. + */ + anchor?: 'created_at'; + + /** + * The number of seconds from the anchor point to the expiration. Select a value + * between `10` and `7200`. + */ + seconds?: number; + } + } + /** * Configuration for input audio noise reduction. This can be set to `null` to turn * off. Noise reduction filters audio added to the input audio buffer before it is diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index a0839e432..eeaff8a11 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -7,7 +7,7 @@ import { addOutputText, } from '../../lib/ResponsesParser'; import * as Core from '../../core'; -import { APIPromise, isRequestOptions } from '../../core'; +import { APIPromise } from '../../core'; import { APIResource } from '../../resource'; import * as Shared from '../shared'; import * as InputItemsAPI from './input-items'; @@ -117,38 +117,26 @@ export class Responses extends APIResource { responseId: string, query?: ResponseRetrieveParamsNonStreaming, options?: Core.RequestOptions, - ): Core.APIPromise; + ): APIPromise; retrieve( responseId: string, - query?: ResponseRetrieveParamsStreaming, + query: ResponseRetrieveParamsStreaming, options?: Core.RequestOptions, - ): Core.APIPromise>; - retrieve(responseId: string, options?: Core.RequestOptions): Core.APIPromise; + ): APIPromise>; retrieve( responseId: string, - query: ResponseRetrieveParams | Core.RequestOptions, + query?: ResponseRetrieveParamsBase | undefined, options?: Core.RequestOptions, - ): Core.APIPromise | Core.APIPromise>; + ): APIPromise | Response>; retrieve( responseId: string, - query: ResponseRetrieveParams | Core.RequestOptions = {}, + query: ResponseRetrieveParams | undefined = {}, options?: Core.RequestOptions, - ): Core.APIPromise | Core.APIPromise> { - if (isRequestOptions(query) && options === undefined) { - return this.retrieve(responseId, {}, query); - } - return ( - this._client.get(`/responses/${responseId}`, { - query, - ...options, - stream: query.stream ?? false, - }) as APIPromise | APIPromise> - )._thenUnwrap((rsp) => { - if ('object' in rsp && rsp.object === 'response') { - addOutputText(rsp as Response); - } - - return rsp; + ): APIPromise | APIPromise> { + return this._client.get(`/responses/${responseId}`, { + query, + ...options, + stream: query?.stream ?? false, }) as APIPromise | APIPromise>; } @@ -3320,6 +3308,8 @@ export interface ResponseOutputText { * The type of the output text. Always `output_text`. */ type: 'output_text'; + + logprobs?: Array; } export namespace ResponseOutputText { @@ -3392,6 +3382,32 @@ export namespace ResponseOutputText { */ type: 'file_path'; } + + /** + * The log probability of a token. + */ + export interface Logprob { + token: string; + + bytes: Array; + + logprob: number; + + top_logprobs: Array; + } + + export namespace Logprob { + /** + * The top log probability of a token. + */ + export interface TopLogprob { + token: string; + + bytes: Array; + + logprob: number; + } + } } /** @@ -4742,7 +4758,8 @@ export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase stream: true; } -export type ResponseRetrieveParams = ResponseRetrieveParamsStreaming | ResponseRetrieveParamsNonStreaming; +export type ResponseRetrieveParams = ResponseRetrieveParamsNonStreaming | ResponseRetrieveParamsStreaming; + export interface ResponseRetrieveParamsBase { /** * Additional fields to include in the response. See the `include` parameter for @@ -4750,21 +4767,51 @@ export interface ResponseRetrieveParamsBase { */ include?: Array; - starting_after?: number | null; - stream?: boolean | null; + /** + * The sequence number of the event after which to start streaming. + */ + starting_after?: number; + + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: boolean; } -export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { - stream: true; +export namespace ResponseRetrieveParams { + export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; + export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; } + export interface ResponseRetrieveParamsNonStreaming extends ResponseRetrieveParamsBase { - stream?: false | null; + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream?: false; } -export namespace ResponseRetrieveParams { - export type ResponseRetrieveParamsStreaming = ResponsesAPI.ResponseRetrieveParamsStreaming; - export type ResponseRetrieveParamsNonStreaming = ResponsesAPI.ResponseRetrieveParamsNonStreaming; +export interface ResponseRetrieveParamsStreaming extends ResponseRetrieveParamsBase { + /** + * If set to true, the model response data will be streamed to the client as it is + * generated using + * [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). + * See the + * [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming) + * for more information. + */ + stream: true; } + Responses.InputItems = InputItems; export declare namespace Responses { @@ -4870,6 +4917,8 @@ export declare namespace Responses { type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, type ResponseRetrieveParams as ResponseRetrieveParams, + type ResponseRetrieveParamsNonStreaming as ResponseRetrieveParamsNonStreaming, + type ResponseRetrieveParamsStreaming as ResponseRetrieveParamsStreaming, }; export { diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index f8e653c52..97847b28a 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -64,21 +64,12 @@ describe('resource responses', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('retrieve: request options instead of 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.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d', { - path: '/_stainless_unknown_path', - }), - ).rejects.toThrow(OpenAI.NotFoundError); - }); - test('retrieve: 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.responses.retrieve( 'resp_677efb5139a88190b512bc3fef8e535d', - { include: ['file_search_call.results'] }, + { include: ['file_search_call.results'], starting_after: 0, stream: false }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); From 8502966ed2fee9162ad14fdf04c893e1fa130a51 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 01:54:00 +0000 Subject: [PATCH 454/509] fix(client): return binary content from `get /containers/{container_id}/files/{file_id}/content` --- .stats.yml | 2 +- api.md | 2 +- src/resources/containers/files/content.ts | 6 ++++-- tests/api-resources/containers/files/content.test.ts | 12 ------------ 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/.stats.yml b/.stats.yml index c958c3acd..6bbd6aae7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c +config_hash: d23f847b9ebb3f427d0f198035bd3e9f diff --git a/api.md b/api.md index fde6fa2a3..86d6435dd 100644 --- a/api.md +++ b/api.md @@ -809,4 +809,4 @@ Methods: Methods: -- client.containers.files.content.retrieve(containerId, fileId) -> void +- client.containers.files.content.retrieve(containerId, fileId) -> Response diff --git a/src/resources/containers/files/content.ts b/src/resources/containers/files/content.ts index efb33a87f..e99d75459 100644 --- a/src/resources/containers/files/content.ts +++ b/src/resources/containers/files/content.ts @@ -2,15 +2,17 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; +import { type Response } from '../../../_shims/index'; export class Content extends APIResource { /** * Retrieve Container File Content */ - retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { + retrieve(containerId: string, fileId: string, options?: Core.RequestOptions): Core.APIPromise { return this._client.get(`/containers/${containerId}/files/${fileId}/content`, { ...options, - headers: { Accept: '*/*', ...options?.headers }, + headers: { Accept: 'application/binary', ...options?.headers }, + __binaryResponse: true, }); } } diff --git a/tests/api-resources/containers/files/content.test.ts b/tests/api-resources/containers/files/content.test.ts index 9215c001a..c4b10fdf4 100644 --- a/tests/api-resources/containers/files/content.test.ts +++ b/tests/api-resources/containers/files/content.test.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import OpenAI from 'openai'; -import { Response } from 'node-fetch'; const client = new OpenAI({ apiKey: 'My API Key', @@ -9,17 +8,6 @@ const client = new OpenAI({ }); describe('resource content', () => { - test('retrieve', async () => { - const responsePromise = client.containers.files.content.retrieve('container_id', 'file_id'); - 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('retrieve: request options instead of 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( From 7704e54f048c75f5fd96fa26e2b7b56cf0900a80 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 14:20:31 +0000 Subject: [PATCH 455/509] release: 4.104.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 21 +++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7bd02ca78..e7bff8e4e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.103.0" + ".": "4.104.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e9589bc1..22fe5f789 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## 4.104.0 (2025-05-29) + +Full Changelog: [v4.103.0...v4.104.0](https://github.com/openai/openai-node/compare/v4.103.0...v4.104.0) + +### Features + +* **api:** Config update for pakrym-stream-param ([469ad7b](https://github.com/openai/openai-node/commit/469ad7b9d76b674aa3fd829128a54758ab7adfbd)) + + +### Bug Fixes + +* **azure:** add /images/edits to deployments endpoints ([#1509](https://github.com/openai/openai-node/issues/1509)) ([84fc31a](https://github.com/openai/openai-node/commit/84fc31aa903eceeb80815f6b17562fc463a71cfc)) +* **client:** return binary content from `get /containers/{container_id}/files/{file_id}/content` ([83129d7](https://github.com/openai/openai-node/commit/83129d7eac3dd784bb1c29fa344c5b808a59db73)) + + +### Chores + +* deprecate Assistants API ([5b34fcd](https://github.com/openai/openai-node/commit/5b34fcdd1454b8cccbaaf05ace6516afb3b09273)) +* improve publish-npm script --latest tag logic ([6207a2a](https://github.com/openai/openai-node/commit/6207a2a03d3279423de594eed18c5efb4ce321af)) +* **internal:** fix release workflows ([353349d](https://github.com/openai/openai-node/commit/353349de9ee10d32d3243cb5c60a8ae982c49d37)) + ## 4.103.0 (2025-05-22) Full Changelog: [v4.102.0...v4.103.0](https://github.com/openai/openai-node/compare/v4.102.0...v4.103.0) diff --git a/jsr.json b/jsr.json index b35a86451..64467ad45 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.103.0", + "version": "4.104.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index ba999c878..7fd868a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.103.0", + "version": "4.104.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 81be9e239..42c4cab74 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.103.0'; // x-release-please-version +export const VERSION = '4.104.0'; // x-release-please-version From a899c9748de17ef468a03a97b9ed82124189ff4c Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 29 May 2025 17:22:29 +0100 Subject: [PATCH 456/509] chore(internal): bump migration cli version --- bin/cli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cli b/bin/cli index bda25277e..0bbffe6ba 100755 --- a/bin/cli +++ b/bin/cli @@ -10,7 +10,7 @@ const commands = { 'npx', [ '-y', - 'https://github.com/stainless-api/migrate-ts/releases/download/0.0.2/stainless-api-migrate-0.0.2-6.tgz', + 'https://github.com/stainless-api/migrate-ts/releases/download/0.0.3/stainless-api-migrate-0.0.3.tgz', '--migrationConfig', require.resolve('./migration-config.json'), ...process.argv.slice(3), From 4c622f9f55529e3aab30c834349d341038499db1 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Wed, 28 May 2025 21:42:40 +0100 Subject: [PATCH 457/509] feat(client): promote beta completions methods to GA --- MIGRATION.md | 38 +++++- .../node-ts-cjs-auto/tests/test.ts | 4 +- examples/logprobs.ts | 2 +- examples/parsing-run-tools.ts | 2 +- examples/parsing-stream.ts | 2 +- examples/parsing-tools-stream.ts | 2 +- examples/parsing-tools.ts | 2 +- examples/parsing.ts | 2 +- examples/stream-to-client-express.ts | 2 +- examples/stream-to-client-next.ts | 2 +- examples/stream.ts | 2 +- examples/tool-call-helpers-zod.ts | 2 +- examples/tool-call-helpers.ts | 2 +- examples/ui-generation.ts | 2 +- helpers.md | 12 +- src/helpers/zod.ts | 2 +- src/lib/AbstractChatCompletionRunner.ts | 2 +- src/lib/ChatCompletionStream.ts | 2 +- src/lib/parser.ts | 2 +- src/resources/beta/beta.ts | 5 - src/resources/beta/chat/chat.ts | 12 -- src/resources/beta/chat/completions.ts | 118 ------------------ src/resources/beta/chat/index.ts | 4 - src/resources/beta/index.ts | 1 - src/resources/chat/completions/completions.ts | 106 ++++++++++++++++ src/resources/chat/completions/index.ts | 1 + tests/lib/ChatCompletionRunFunctions.test.ts | 42 +++---- tests/lib/ChatCompletionStream.test.ts | 6 +- tests/lib/parser.test.ts | 12 +- 29 files changed, 193 insertions(+), 200 deletions(-) delete mode 100644 src/resources/beta/chat/chat.ts delete mode 100644 src/resources/beta/chat/completions.ts delete mode 100644 src/resources/beta/chat/index.ts diff --git a/MIGRATION.md b/MIGRATION.md index 28b58a93a..9d48435e3 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -315,7 +315,7 @@ The `openai/shims` imports have been removed. Your global types must now be [cor Previously, the following code would just output a warning to the console, now it will throw an error. ```ts -const completion = await client.beta.chat.completions.parse({ +const completion = await client.chat.completions.parse({ // ... response_format: zodResponseFormat( z.object({ @@ -329,7 +329,7 @@ const completion = await client.beta.chat.completions.parse({ You must mark optional properties with `.nullable()` as purely optional fields are not supported by the [API](https://platform.openai.com/docs/guides/structured-outputs?api-mode=responses#all-fields-must-be-required). ```ts -const completion = await client.beta.chat.completions.parse({ +const completion = await client.chat.completions.parse({ // ... response_format: zodResponseFormat( z.object({ @@ -377,10 +377,36 @@ export type FineTuningJobsPage = CursorPage; If you were importing these classes at runtime, you'll need to switch to importing the base class or only import them at the type-level. +### Beta chat namespace removed + +The `beta.chat` namespace has been removed. All chat completion methods that were previously in beta have been moved to the main `chat.completions` namespace: + +```ts +// Before +client.beta.chat.completions.parse() +client.beta.chat.completions.stream() +client.beta.chat.completions.runTools() + +// After +client.chat.completions.parse() +client.chat.completions.stream() +client.chat.completions.runTools() +``` + +Additionally, related types have been moved: + +```ts +// Before +import { ParsedChatCompletion, ParsedChoice, ParsedFunction } from 'openai/resources/beta/chat/completions'; + +// After +import { ParsedChatCompletion, ParsedChoice, ParsedFunction } from 'openai/resources/chat/completions'; +``` + ### Removed deprecated `.runFunctions` methods -The deprecated `client.beta.chat.completions.runFunctions()` method and all of it's surrounding types have been removed, instead you should use -`client.beta.chat.completions.runTools()`. +The deprecated `client.chat.completions.runFunctions()` method and all of it's surrounding types have been removed, instead you should use +`client.chat.completions.runTools()`. ### `.runTools()` event / method names @@ -388,7 +414,7 @@ To better align with the tool-based API, several event names in the ChatCompleti ```ts // Before -openai.beta.chat.completions +openai.chat.completions .runTools({ // .. }) @@ -398,7 +424,7 @@ openai.beta.chat.completions .on('finalFunctionCallResult', (result) => console.log('finalFunctionCallResult', result)); // After -openai.beta.chat.completions +openai.chat.completions .runTools({ // .. }) diff --git a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts index 7782ae1d2..e9a7f94e1 100644 --- a/ecosystem-tests/node-ts-cjs-auto/tests/test.ts +++ b/ecosystem-tests/node-ts-cjs-auto/tests/test.ts @@ -76,7 +76,7 @@ it(`ChatCompletionStream works`, async function () { let finalMessage: OpenAI.Chat.ChatCompletionMessageParam | undefined; let finalChatCompletion: OpenAI.Chat.ChatCompletion | undefined; - const stream = client.beta.chat.completions + const stream = client.chat.completions .stream({ model: 'gpt-4', messages: [{ role: 'user', content: 'Say this is a test' }], @@ -120,7 +120,7 @@ it(`aborting ChatCompletionStream works`, async function () { let emittedError: any; let caughtError: any; const controller = new AbortController(); - const stream = client.beta.chat.completions + const stream = client.chat.completions .stream( { model: 'gpt-4', diff --git a/examples/logprobs.ts b/examples/logprobs.ts index 8cf274a14..47dcad259 100755 --- a/examples/logprobs.ts +++ b/examples/logprobs.ts @@ -6,7 +6,7 @@ import OpenAI from 'openai'; const openai = new OpenAI(); async function main() { - const stream = await openai.beta.chat.completions + const stream = await openai.chat.completions .stream({ model: 'gpt-4', messages: [{ role: 'user', content: 'Say this is a test' }], diff --git a/examples/parsing-run-tools.ts b/examples/parsing-run-tools.ts index a3c544c3d..f94e932ad 100644 --- a/examples/parsing-run-tools.ts +++ b/examples/parsing-run-tools.ts @@ -28,7 +28,7 @@ const Condition = z.object({ const openai = new OpenAI(); async function main() { - const runner = openai.beta.chat.completions + const runner = openai.chat.completions .runTools({ model: 'gpt-4o-2024-08-06', messages: [{ role: 'user', content: `What are the last 10 orders?` }], diff --git a/examples/parsing-stream.ts b/examples/parsing-stream.ts index d9eda0a4b..08c95d91b 100644 --- a/examples/parsing-stream.ts +++ b/examples/parsing-stream.ts @@ -15,7 +15,7 @@ const MathResponse = z.object({ async function main() { const client = new OpenAI(); - const stream = client.beta.chat.completions + const stream = client.chat.completions .stream({ model: 'gpt-4o-2024-08-06', messages: [ diff --git a/examples/parsing-tools-stream.ts b/examples/parsing-tools-stream.ts index c527abd00..971e22c40 100644 --- a/examples/parsing-tools-stream.ts +++ b/examples/parsing-tools-stream.ts @@ -12,7 +12,7 @@ async function main() { const client = new OpenAI(); const refusal = process.argv.includes('refusal'); - const stream = client.beta.chat.completions + const stream = client.chat.completions .stream({ model: 'gpt-4o-2024-08-06', messages: [ diff --git a/examples/parsing-tools.ts b/examples/parsing-tools.ts index 8eaea3807..e570d8b6b 100644 --- a/examples/parsing-tools.ts +++ b/examples/parsing-tools.ts @@ -38,7 +38,7 @@ const Query = z.object({ async function main() { const client = new OpenAI(); - const completion = await client.beta.chat.completions.parse({ + const completion = await client.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { diff --git a/examples/parsing.ts b/examples/parsing.ts index d92cc2720..3e71f74f3 100644 --- a/examples/parsing.ts +++ b/examples/parsing.ts @@ -15,7 +15,7 @@ const MathResponse = z.object({ async function main() { const client = new OpenAI(); - const completion = await client.beta.chat.completions.parse({ + const completion = await client.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { role: 'system', content: 'You are a helpful math tutor.' }, diff --git a/examples/stream-to-client-express.ts b/examples/stream-to-client-express.ts index f688f42e7..22bf210c1 100755 --- a/examples/stream-to-client-express.ts +++ b/examples/stream-to-client-express.ts @@ -30,7 +30,7 @@ app.post('/', async (req: Request, res: Response) => { try { console.log('Received request:', req.body); - const stream = openai.beta.chat.completions.stream({ + const stream = openai.chat.completions.stream({ model: 'gpt-3.5-turbo', stream: true, messages: [{ role: 'user', content: req.body }], diff --git a/examples/stream-to-client-next.ts b/examples/stream-to-client-next.ts index c5c1ff317..5ea91b2d7 100755 --- a/examples/stream-to-client-next.ts +++ b/examples/stream-to-client-next.ts @@ -25,7 +25,7 @@ export const runtime = 'edge'; export default async function handler(req: NextApiRequest, res: NextApiResponse) { const openai = new OpenAI(); - const stream = openai.beta.chat.completions.stream({ + const stream = openai.chat.completions.stream({ model: 'gpt-3.5-turbo', stream: true, // @ts-ignore diff --git a/examples/stream.ts b/examples/stream.ts index 86dbde8b8..a5210e643 100644 --- a/examples/stream.ts +++ b/examples/stream.ts @@ -5,7 +5,7 @@ import OpenAI from 'openai'; const openai = new OpenAI(); async function main() { - const runner = openai.beta.chat.completions + const runner = openai.chat.completions .stream({ model: 'gpt-3.5-turbo', messages: [{ role: 'user', content: 'Say this is a test' }], diff --git a/examples/tool-call-helpers-zod.ts b/examples/tool-call-helpers-zod.ts index 4ac1bc41c..b4e1aedcf 100755 --- a/examples/tool-call-helpers-zod.ts +++ b/examples/tool-call-helpers-zod.ts @@ -34,7 +34,7 @@ async function getBook({ id }: GetParams) { } async function main() { - const runner = openai.beta.chat.completions + const runner = openai.chat.completions .runTools({ model: 'gpt-4-1106-preview', stream: true, diff --git a/examples/tool-call-helpers.ts b/examples/tool-call-helpers.ts index a680f6da9..18baacdb4 100755 --- a/examples/tool-call-helpers.ts +++ b/examples/tool-call-helpers.ts @@ -63,7 +63,7 @@ const tools: RunnableToolFunction[] = [ ]; async function main() { - const runner = await openai.beta.chat.completions + const runner = await openai.chat.completions .runTools({ model: 'gpt-4-1106-preview', stream: true, diff --git a/examples/ui-generation.ts b/examples/ui-generation.ts index 84636b1f0..003bb7568 100644 --- a/examples/ui-generation.ts +++ b/examples/ui-generation.ts @@ -31,7 +31,7 @@ const UISchema: z.ZodType = z.lazy(() => ); async function main() { - const completion = await openai.beta.chat.completions.parse({ + const completion = await openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { diff --git a/helpers.md b/helpers.md index 41b352e5e..8b25fe0a5 100644 --- a/helpers.md +++ b/helpers.md @@ -2,7 +2,7 @@ The OpenAI API supports extracting JSON from the model with the `response_format` request param, for more details on the API, see [this guide](https://platform.openai.com/docs/guides/structured-outputs). -The SDK provides a `client.beta.chat.completions.parse()` method which is a wrapper over the `client.chat.completions.create()` that +The SDK provides a `client.chat.completions.parse()` method which is a wrapper over the `client.chat.completions.create()` that provides richer integrations with TS specific types & returns a `ParsedChatCompletion` object, which is an extension of the standard `ChatCompletion` type. ## Auto-parsing response content with Zod schemas @@ -27,7 +27,7 @@ const MathResponse = z.object({ const client = new OpenAI(); -const completion = await client.beta.chat.completions.parse({ +const completion = await client.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { role: 'system', content: 'You are a helpful math tutor.' }, @@ -93,7 +93,7 @@ const Query = z.object({ }); const client = new OpenAI(); -const completion = await client.beta.chat.completions.parse({ +const completion = await client.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -122,7 +122,7 @@ main(); ### Differences from `.create()` -The `beta.chat.completions.parse()` method imposes some additional restrictions on it's usage that `chat.completions.create()` does not. +The `chat.completions.parse()` method imposes some additional restrictions on it's usage that `chat.completions.create()` does not. - If the completion completes with `finish_reason` set to `length` or `content_filter`, the `LengthFinishReasonError` / `ContentFilterFinishReasonError` errors will be raised. - Only strict function tools can be passed, e.g. `{type: 'function', function: {..., strict: true}}` @@ -304,7 +304,7 @@ See an example of streaming helpers in action in [`examples/stream.ts`](examples ### Automated function calls -We provide the `openai.beta.chat.completions.runTools({…})` +We provide the `openai.chat.completions.runTools({…})` convenience helper for using function tool calls with the `/chat/completions` endpoint which automatically call the JavaScript functions you provide and sends their results back to the `/chat/completions` endpoint, @@ -323,7 +323,7 @@ import OpenAI from 'openai'; const client = new OpenAI(); async function main() { - const runner = client.beta.chat.completions + const runner = client.chat.completions .runTools({ model: 'gpt-4o', messages: [{ role: 'user', content: 'How is the weather this week?' }], diff --git a/src/helpers/zod.ts b/src/helpers/zod.ts index de4c3ba93..d12e7f3ca 100644 --- a/src/helpers/zod.ts +++ b/src/helpers/zod.ts @@ -32,7 +32,7 @@ function zodToJsonSchema(schema: ZodType, options: { name: string }): Record extends ChatCompletionMessage { - parsed: ParsedT | null; - tool_calls?: Array; -} - -export interface ParsedChoice extends ChatCompletion.Choice { - message: ParsedChatCompletionMessage; -} - -export interface ParsedChatCompletion extends ChatCompletion { - choices: Array>; -} - -export type ChatCompletionParseParams = ChatCompletionCreateParamsNonStreaming; - -export class Completions extends APIResource { - parse>( - body: Params, - options?: RequestOptions, - ): APIPromise> { - validateInputTools(body.tools); - - return this._client.chat.completions - .create(body, { - ...options, - headers: { - ...options?.headers, - 'X-Stainless-Helper-Method': 'beta.chat.completions.parse', - }, - }) - ._thenUnwrap((completion) => parseChatCompletion(completion, body)); - } - - /** - * A convenience helper for using tool calls with the /chat/completions endpoint - * which automatically calls the JavaScript functions you provide and sends their - * results back to the /chat/completions endpoint, looping as long as the model - * requests function calls. - * - * For more details and examples, see - * [the docs](https://github.com/openai/openai-node#automated-function-calls) - */ - runTools< - Params extends ChatCompletionToolRunnerParams, - ParsedT = ExtractParsedContentFromParams, - >(body: Params, options?: RunnerOptions): ChatCompletionRunner; - - runTools< - Params extends ChatCompletionStreamingToolRunnerParams, - ParsedT = ExtractParsedContentFromParams, - >(body: Params, options?: RunnerOptions): ChatCompletionStreamingRunner; - - runTools< - Params extends ChatCompletionToolRunnerParams | ChatCompletionStreamingToolRunnerParams, - ParsedT = ExtractParsedContentFromParams, - >( - body: Params, - options?: RunnerOptions, - ): ChatCompletionRunner | ChatCompletionStreamingRunner { - if (body.stream) { - return ChatCompletionStreamingRunner.runTools( - this._client, - body as ChatCompletionStreamingToolRunnerParams, - options, - ); - } - - return ChatCompletionRunner.runTools(this._client, body as ChatCompletionToolRunnerParams, options); - } - - /** - * Creates a chat completion stream - */ - stream>( - body: Params, - options?: RequestOptions, - ): ChatCompletionStream { - return ChatCompletionStream.createChatCompletion(this._client, body, options); - } -} diff --git a/src/resources/beta/chat/index.ts b/src/resources/beta/chat/index.ts deleted file mode 100644 index 23b1b8ff3..000000000 --- a/src/resources/beta/chat/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Chat } from './chat'; -export { Completions } from './completions'; diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index 18746c1d4..a4d5a7ea6 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -20,7 +20,6 @@ export { } from './assistants'; export { Beta } from './beta'; export { Realtime } from './realtime/index'; -export { Chat } from './chat/index'; export { Threads, type AssistantResponseFormatOption, diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 20908614e..82bb2e27c 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -12,6 +12,14 @@ import { Stream } from '../../../core/streaming'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; +import { ChatCompletionRunner } from '../../../lib/ChatCompletionRunner'; +import { ChatCompletionStreamingRunner } from '../../../lib/ChatCompletionStreamingRunner'; +import { RunnerOptions } from '../../../lib/AbstractChatCompletionRunner'; +import { ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; +import { ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; +import { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; +import { ExtractParsedContentFromParams, parseChatCompletion, validateInputTools } from '../../../lib/parser'; + export class Completions extends APIResource { messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); @@ -129,8 +137,106 @@ export class Completions extends APIResource { delete(completionID: string, options?: RequestOptions): APIPromise { return this._client.delete(path`/chat/completions/${completionID}`, options); } + + parse>( + body: Params, + options?: RequestOptions, + ): APIPromise> { + validateInputTools(body.tools); + + return this._client.chat.completions + .create(body, { + ...options, + headers: { + ...options?.headers, + 'X-Stainless-Helper-Method': 'chat.completions.parse', + }, + }) + ._thenUnwrap((completion) => parseChatCompletion(completion, body)); + } + + /** + * A convenience helper for using tool calls with the /chat/completions endpoint + * which automatically calls the JavaScript functions you provide and sends their + * results back to the /chat/completions endpoint, looping as long as the model + * requests function calls. + * + * For more details and examples, see + * [the docs](https://github.com/openai/openai-node#automated-function-calls) + */ + runTools< + Params extends ChatCompletionToolRunnerParams, + ParsedT = ExtractParsedContentFromParams, + >(body: Params, options?: RunnerOptions): ChatCompletionRunner; + + runTools< + Params extends ChatCompletionStreamingToolRunnerParams, + ParsedT = ExtractParsedContentFromParams, + >(body: Params, options?: RunnerOptions): ChatCompletionStreamingRunner; + + runTools< + Params extends ChatCompletionToolRunnerParams | ChatCompletionStreamingToolRunnerParams, + ParsedT = ExtractParsedContentFromParams, + >( + body: Params, + options?: RunnerOptions, + ): ChatCompletionRunner | ChatCompletionStreamingRunner { + if (body.stream) { + return ChatCompletionStreamingRunner.runTools( + this._client, + body as ChatCompletionStreamingToolRunnerParams, + options, + ); + } + + return ChatCompletionRunner.runTools(this._client, body as ChatCompletionToolRunnerParams, options); + } + + /** + * Creates a chat completion stream + */ + stream>( + body: Params, + options?: RequestOptions, + ): ChatCompletionStream { + return ChatCompletionStream.createChatCompletion(this._client, body, options); + } +} + +export interface ParsedFunction extends ChatCompletionMessageToolCall.Function { + parsed_arguments?: unknown; } +export interface ParsedFunctionToolCall extends ChatCompletionMessageToolCall { + function: ParsedFunction; +} + +export interface ParsedChatCompletionMessage extends ChatCompletionMessage { + parsed: ParsedT | null; + tool_calls?: Array; +} + +export interface ParsedChoice extends ChatCompletion.Choice { + message: ParsedChatCompletionMessage; +} + +export interface ParsedChatCompletion extends ChatCompletion { + choices: Array>; +} + +export type ChatCompletionParseParams = ChatCompletionCreateParamsNonStreaming; + +export { ChatCompletionStreamingRunner } from '../../../lib/ChatCompletionStreamingRunner'; +export { + type RunnableFunctionWithParse, + type RunnableFunctionWithoutParse, + ParsingToolFunction, +} from '../../../lib/RunnableFunction'; +export { type ChatCompletionToolRunnerParams } from '../../../lib/ChatCompletionRunner'; +export { type ChatCompletionStreamingToolRunnerParams } from '../../../lib/ChatCompletionStreamingRunner'; +export { ChatCompletionStream, type ChatCompletionStreamParams } from '../../../lib/ChatCompletionStream'; +export { ChatCompletionRunner } from '../../../lib/ChatCompletionRunner'; + export type ChatCompletionsPage = CursorPage; export type ChatCompletionStoreMessagesPage = CursorPage; diff --git a/src/resources/chat/completions/index.ts b/src/resources/chat/completions/index.ts index 32d0eb408..ce1897258 100644 --- a/src/resources/chat/completions/index.ts +++ b/src/resources/chat/completions/index.ts @@ -39,4 +39,5 @@ export { type ChatCompletionStoreMessagesPage, type ChatCompletionsPage, } from './completions'; +export * from './completions'; export { Messages, type MessageListParams } from './messages'; diff --git a/tests/lib/ChatCompletionRunFunctions.test.ts b/tests/lib/ChatCompletionRunFunctions.test.ts index ffe17fb98..42ea3de98 100644 --- a/tests/lib/ChatCompletionRunFunctions.test.ts +++ b/tests/lib/ChatCompletionRunFunctions.test.ts @@ -7,7 +7,7 @@ import { type ChatCompletionToolRunnerParams, ChatCompletionStreamingRunner, type ChatCompletionStreamingToolRunnerParams, -} from 'openai/resources/beta/chat/completions'; +} from 'openai/resources/chat/completions'; import type { ChatCompletionMessageParam } from 'openai/resources/chat/completions'; import { isAssistantMessage } from '../../src/lib/chatCompletionUtils'; import { mockFetch } from '../utils/mock-fetch'; @@ -339,7 +339,7 @@ class StreamingRunnerListener { function _typeTests() { const openai = new OpenAI(); - openai.beta.chat.completions.runTools({ + openai.chat.completions.runTools({ messages: [ { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' }, ], @@ -380,7 +380,7 @@ function _typeTests() { }, ], }); - openai.beta.chat.completions.runTools({ + openai.chat.completions.runTools({ messages: [ { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' }, ], @@ -396,7 +396,7 @@ function _typeTests() { }), ], }); - openai.beta.chat.completions.runTools({ + openai.chat.completions.runTools({ messages: [ { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' }, ], @@ -438,7 +438,7 @@ function _typeTests() { }), ], }); - openai.beta.chat.completions.runTools({ + openai.chat.completions.runTools({ messages: [ { role: 'user', content: 'can you tell me how many properties are in {"a": 1, "b": 2, "c": 3}' }, ], @@ -500,7 +500,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', tools: [ @@ -639,7 +639,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); const controller = new AbortController(); - const runner = openai.beta.chat.completions.runTools( + const runner = openai.chat.completions.runTools( { messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -726,7 +726,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ messages: [ { role: 'user', @@ -886,7 +886,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ messages: [ { role: 'user', @@ -1135,7 +1135,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', tool_choice: { @@ -1223,7 +1223,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', tools: [ @@ -1459,7 +1459,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -1583,7 +1583,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); const controller = new AbortController(); - const runner = openai.beta.chat.completions.runTools( + const runner = openai.chat.completions.runTools( { stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], @@ -1667,7 +1667,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ stream: true, messages: [ { @@ -1805,7 +1805,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ stream: true, messages: [ { @@ -2007,7 +2007,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -2093,7 +2093,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.runTools({ + const runner = openai.chat.completions.runTools({ stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -2317,7 +2317,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.stream({ + const runner = openai.chat.completions.stream({ stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -2355,7 +2355,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: 'something1234', baseURL: 'http://127.0.0.1:4010/', fetch }); - const runner = openai.beta.chat.completions.stream({ + const runner = openai.chat.completions.stream({ stream: true, messages: [{ role: 'user', content: 'tell me what the weather is like' }], model: 'gpt-3.5-turbo', @@ -2394,7 +2394,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: '...', fetch }); - const stream = openai.beta.chat.completions.stream( + const stream = openai.chat.completions.stream( { max_tokens: 1024, model: 'gpt-3.5-turbo', @@ -2418,7 +2418,7 @@ describe('resource completions', () => { const openai = new OpenAI({ apiKey: '...', fetch }); - const stream = openai.beta.chat.completions.stream( + const stream = openai.chat.completions.stream( { max_tokens: 1024, model: 'gpt-3.5-turbo', diff --git a/tests/lib/ChatCompletionStream.test.ts b/tests/lib/ChatCompletionStream.test.ts index 34c5fd204..7d78b712a 100644 --- a/tests/lib/ChatCompletionStream.test.ts +++ b/tests/lib/ChatCompletionStream.test.ts @@ -8,7 +8,7 @@ jest.setTimeout(1000 * 30); describe('.stream()', () => { it('works', async () => { const stream = await makeStreamSnapshotRequest((openai) => - openai.beta.chat.completions.stream({ + openai.chat.completions.stream({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -49,7 +49,7 @@ describe('.stream()', () => { const stream = ( await makeStreamSnapshotRequest((openai) => - openai.beta.chat.completions.stream({ + openai.chat.completions.stream({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -208,7 +208,7 @@ describe('.stream()', () => { const stream = ( await makeStreamSnapshotRequest((openai) => - openai.beta.chat.completions.stream({ + openai.chat.completions.stream({ model: 'gpt-4o-2024-08-06', messages: [ { diff --git a/tests/lib/parser.test.ts b/tests/lib/parser.test.ts index fa8123f5c..74cca7253 100644 --- a/tests/lib/parser.test.ts +++ b/tests/lib/parser.test.ts @@ -8,7 +8,7 @@ describe('.parse()', () => { describe('zod', () => { it('deserialises response_format', async () => { const completion = await makeSnapshotRequest((openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -60,7 +60,7 @@ describe('.parse()', () => { ); const completion = await makeSnapshotRequest((openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -448,7 +448,7 @@ describe('.parse()', () => { const completion = await makeSnapshotRequest( (openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -698,7 +698,7 @@ describe('.parse()', () => { const completion = await makeSnapshotRequest( (openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -905,7 +905,7 @@ describe('.parse()', () => { const completion = await makeSnapshotRequest( (openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { @@ -1030,7 +1030,7 @@ describe('.parse()', () => { const completion = await makeSnapshotRequest( (openai) => - openai.beta.chat.completions.parse({ + openai.chat.completions.parse({ model: 'gpt-4o-2024-08-06', messages: [ { From 47a83508645b0b5a0e4bf994f753c5752717fdc2 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 29 May 2025 17:32:27 +0100 Subject: [PATCH 458/509] chore: revert temporary version change --- jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsr.json b/jsr.json index dca12b1ff..64467ad45 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.0.0-alpha.0", + "version": "4.104.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 837fd2e14..3cc448d05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.0.0-alpha.0", + "version": "4.104.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 2205d0775..42c4cab74 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.0.0-alpha.0'; // x-release-please-version +export const VERSION = '4.104.0'; // x-release-please-version From 4dd408d630fcb92a515313523bcb668e7cc20da4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 16:38:55 +0000 Subject: [PATCH 459/509] release: 5.0.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 266 ++++++++++++++++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 270 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b33fcdcea..32dbe0e2b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.0.0-alpha.0" + ".": "5.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 22fe5f789..d4696422c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,271 @@ # Changelog +## 5.0.0 (2025-05-29) + +Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/compare/v5.0.0-alpha.0...v5.0.0) + +### Features + +* add audio helpers ([ec5067d](https://github.com/openai/openai-node/commit/ec5067deba1fe4202d90db42e45c3bd774936af1)) +* add migration guide ([cfd2088](https://github.com/openai/openai-node/commit/cfd2088219464381077dec62d38d1830ab0b43f3)) +* add SKIP_BREW env var to ./scripts/bootstrap ([7ea4a24](https://github.com/openai/openai-node/commit/7ea4a244d5b39e0745aea1a89abff940e2c3922f)) +* **api:** add /v1/responses and built-in tools ([91af47c](https://github.com/openai/openai-node/commit/91af47cc4f62b08a451bc39f44c64244a71c1f2c)) +* **api:** add /v1/responses and built-in tools ([0612242](https://github.com/openai/openai-node/commit/06122424a4d783aff07b7089b64986fb35bc24e4)) +* **api:** add `get /chat/completions` endpoint ([9697139](https://github.com/openai/openai-node/commit/9697139a5f38bcc2dffa3322ff575eb1fc8b4e35)) +* **api:** add `get /chat/completions` endpoint ([16c67be](https://github.com/openai/openai-node/commit/16c67be29bbb976660ac01d76f54e8735e71c1e0)) +* **api:** add `get /responses/{response_id}/input_items` endpoint ([f2c5aba](https://github.com/openai/openai-node/commit/f2c5aba736f99550a9a7837be22b39b36a7495d0)) +* **api:** add `get /responses/{response_id}/input_items` endpoint ([3676d34](https://github.com/openai/openai-node/commit/3676d34127cd88a67dde6e6d24f2b6a7b65d3073)) +* **api:** add container endpoint ([3ffca5c](https://github.com/openai/openai-node/commit/3ffca5c5b2dc6819e955ed343b2bb6e2095e7bdf)) +* **api:** add container endpoint ([e973476](https://github.com/openai/openai-node/commit/e9734764625275c50ef612ff934804be8cb2adff)) +* **api:** Add evalapi to sdk ([70092d7](https://github.com/openai/openai-node/commit/70092d768426b8e0dd4bca21e7a3dea009e25b9f)) +* **api:** Add evalapi to sdk ([#1456](https://github.com/openai/openai-node/issues/1456)) ([33b66f5](https://github.com/openai/openai-node/commit/33b66f517e756e63c676efee97f7122b3cf165d1)) +* **api:** add gpt-4.5-preview ([1d4478d](https://github.com/openai/openai-node/commit/1d4478d7935028e20a9d9d11ff29ff8b991c44f9)) +* **api:** add gpt-4.5-preview ([#1349](https://github.com/openai/openai-node/issues/1349)) ([bb269a1](https://github.com/openai/openai-node/commit/bb269a1a6fda11c533fb88fa1250a342a5a11ed0)) +* **api:** add image sizes, reasoning encryption ([0c25021](https://github.com/openai/openai-node/commit/0c2502187f8895f029277a7be9825862f458e9aa)) +* **api:** add image sizes, reasoning encryption ([31cd88f](https://github.com/openai/openai-node/commit/31cd88fae84f630c8e86e1acab6c4cd9283c886c)) +* **api:** add o3 and o4-mini model IDs ([19cda5d](https://github.com/openai/openai-node/commit/19cda5d3b908238ae6c6f5609ac3a118d4d8acc2)) +* **api:** add o3 and o4-mini model IDs ([a0d0000](https://github.com/openai/openai-node/commit/a0d000094f69db82974de4ba792cd07d4ab59c21)) +* **api:** Add reinforcement fine-tuning api support ([e6bbaf5](https://github.com/openai/openai-node/commit/e6bbaf577aa6bdf3bcdaf25a5a7d4e8202831c7a)) +* **api:** Add reinforcement fine-tuning api support ([fabe6ec](https://github.com/openai/openai-node/commit/fabe6ec948c08c11588f6168f0a7560bf307d780)) +* **api:** add support for storing chat completions ([59da177](https://github.com/openai/openai-node/commit/59da1771b93158d5d89efc9e63e1ef9c09a634f3)) +* **api:** add support for storing chat completions ([#1327](https://github.com/openai/openai-node/issues/1327)) ([be1ca6b](https://github.com/openai/openai-node/commit/be1ca6b9a6732214ac21ca375b5b0a9b7f492fd6)) +* **api:** adding gpt-4.1 family of model IDs ([8a2a745](https://github.com/openai/openai-node/commit/8a2a7454bee0fbe9e4729d47f6b894e5f25d68f5)) +* **api:** adding gpt-4.1 family of model IDs ([840e7de](https://github.com/openai/openai-node/commit/840e7de7870835488d4c823d97afdf5d53a739be)) +* **api:** adding new image model support ([a0010fd](https://github.com/openai/openai-node/commit/a0010fdb60fe723ebc70103cceca552aca51855e)) +* **api:** adding new image model support ([c353531](https://github.com/openai/openai-node/commit/c353531a238863e7f386a66dcee9f02b8115dd47)) +* **api:** Config update for pakrym-stream-param ([71c3d31](https://github.com/openai/openai-node/commit/71c3d31dad568030fd563a0b5c7c2bd26d472df1)) +* **api:** Config update for pakrym-stream-param ([b4d1b46](https://github.com/openai/openai-node/commit/b4d1b4627622157593a06f64f02ee5aa72deb6b3)) +* **api:** Config update for pakrym-stream-param ([469ad7b](https://github.com/openai/openai-node/commit/469ad7b9d76b674aa3fd829128a54758ab7adfbd)) +* **api:** further updates for evals API ([3019a7e](https://github.com/openai/openai-node/commit/3019a7e67614942b5dc6d7e788f2b5b30b3bc874)) +* **api:** further updates for evals API ([3f6f248](https://github.com/openai/openai-node/commit/3f6f248191b45015924be76fd5154d149c4ed8a0)) +* **api:** manual updates ([debe529](https://github.com/openai/openai-node/commit/debe5295d077f79cc4b4eefefb008e5a10b32793)) +* **api:** manual updates ([e83286b](https://github.com/openai/openai-node/commit/e83286b10b20d3e4c02903739b045af5cbf71cde)) +* **api:** manual updates ([959eace](https://github.com/openai/openai-node/commit/959eace6ec132a83f731fa496d5b8b7a11fa6bb2)) +* **api:** manual updates ([179a607](https://github.com/openai/openai-node/commit/179a607a89fabda32ebad62cc7ee86b5332a29f4)) +* **api:** manual updates ([0cb0c86](https://github.com/openai/openai-node/commit/0cb0c863b3bda6e6d72b3b5cdba3c8791db9bb77)) +* **api:** manual updates ([678ae6b](https://github.com/openai/openai-node/commit/678ae6b7112ed9b27d092b3234dd034d572deb9c)) +* **api:** manual updates ([4560dc6](https://github.com/openai/openai-node/commit/4560dc62f8c65e9857085409e382760aa601d60b)) +* **api:** manual updates ([554c3b1](https://github.com/openai/openai-node/commit/554c3b142024bec8010474cd7e42b99a209d4daa)) +* **api:** manual updates ([b893d81](https://github.com/openai/openai-node/commit/b893d81420359c712dab6997c2dbc9f309549712)) +* **api:** manual updates ([c1c2819](https://github.com/openai/openai-node/commit/c1c281983e23dcfdca964720265d3cba28b17795)) +* **api:** manual updates ([efce6d3](https://github.com/openai/openai-node/commit/efce6d3d719ad463b035b22e9a1cf461ab62b5af)) +* **api:** manual updates ([32afb00](https://github.com/openai/openai-node/commit/32afb0022939b19069c37fcd9cabfe666ea86b77)) +* **api:** new API tools ([0cc8994](https://github.com/openai/openai-node/commit/0cc899456091f0b13fc98daa03a4299473f528dc)) +* **api:** new API tools ([fb4014f](https://github.com/openai/openai-node/commit/fb4014ffac7b220d37bd03c94fa745386b010bf0)) +* **api:** new models for TTS, STT, + new audio features for Realtime ([1eab9ed](https://github.com/openai/openai-node/commit/1eab9edf9e5eb08e7c3d0d0ff21f378cacf7cb5b)) +* **api:** new models for TTS, STT, + new audio features for Realtime ([#1407](https://github.com/openai/openai-node/issues/1407)) ([d11b13c](https://github.com/openai/openai-node/commit/d11b13cdf5412f03e551365297a27e610a36edda)) +* **api:** new streaming helpers for background responses ([c071491](https://github.com/openai/openai-node/commit/c07149125128687f026df0d04b304167cf6c9910)) +* **api:** new streaming helpers for background responses ([1ddd6ff](https://github.com/openai/openai-node/commit/1ddd6ff182b09d696954fda4bde50fb82f1d6585)) +* **api:** o1-pro now available through the API ([3540b06](https://github.com/openai/openai-node/commit/3540b069fcec32ab5acbdf3def579f21759dada6)) +* **api:** o1-pro now available through the API ([#1398](https://github.com/openai/openai-node/issues/1398)) ([aefd267](https://github.com/openai/openai-node/commit/aefd2675154ff848032a7fec856f0db6ed2ad629)) +* **api:** responses x eval api ([b349ade](https://github.com/openai/openai-node/commit/b349adeff0df0b6c56d937da082900e7331d1ab6)) +* **api:** responses x eval api ([ea1d56c](https://github.com/openai/openai-node/commit/ea1d56c979ad7136aa584a773904b0570ba14783)) +* **api:** Updating Assistants and Evals API schemas ([e68f598](https://github.com/openai/openai-node/commit/e68f598107aba01ce1bcab61ac616d4cf70380c9)) +* **api:** Updating Assistants and Evals API schemas ([8cc63d3](https://github.com/openai/openai-node/commit/8cc63d351057678d474fe1a16e3077370c83fddb)) +* **client:** accept RFC6838 JSON content types ([67da9ce](https://github.com/openai/openai-node/commit/67da9ce89ea010813779b98c18fea84d9964c7de)) +* **client:** add Realtime API support ([7737d25](https://github.com/openai/openai-node/commit/7737d2547c5c6c45004fe281b8122c9e2adc0efb)) +* **client:** add withOptions helper ([7e9ea85](https://github.com/openai/openai-node/commit/7e9ea85f63a0989b3446834d9e1a94c0d050cf87)) +* **client:** improve logging ([ead0ba4](https://github.com/openai/openai-node/commit/ead0ba4dc9f51c35007c5fe20f9954855f558652)) +* **client:** promote beta completions methods to GA ([4c622f9](https://github.com/openai/openai-node/commit/4c622f9f55529e3aab30c834349d341038499db1)) +* version 5 ([855144b](https://github.com/openai/openai-node/commit/855144b105c647b91a389c08c07f215d39ff8920)) +* version 5 ([855144b](https://github.com/openai/openai-node/commit/855144b105c647b91a389c08c07f215d39ff8920)) + + +### Bug Fixes + +* **api:** add missing file rank enum + more metadata ([b943a0a](https://github.com/openai/openai-node/commit/b943a0ae4682a410172e1063a9424f5150cd9010)) +* **api:** correct some Responses types ([3ca8965](https://github.com/openai/openai-node/commit/3ca89652489e911890d0be9a2e93341ef026a20f)) +* **api:** correct some Responses types ([#1391](https://github.com/openai/openai-node/issues/1391)) ([e983d0c](https://github.com/openai/openai-node/commit/e983d0c61d33b106f149d87eed90378bd0bbc349)) +* **api:** improve type resolution when importing as a package ([b6bf469](https://github.com/openai/openai-node/commit/b6bf4694cbd0ab86e7d6689289faed9ddbfb46ee)) +* **api:** improve type resolution when importing as a package ([#1444](https://github.com/openai/openai-node/issues/1444)) ([4af79dd](https://github.com/openai/openai-node/commit/4af79ddd5b19925fa09d9ae877470aa8304535c2)) +* **assistants:** handle `thread.run.incomplete` event ([a2714bb](https://github.com/openai/openai-node/commit/a2714bb5253ade80cb15455ceb8f6dbea63cb1d0)) +* **audio:** correctly handle transcription streaming ([9c7d352](https://github.com/openai/openai-node/commit/9c7d352181c690156e26c9538c00edff6db5b384)) +* avoid type error in certain environments ([#1413](https://github.com/openai/openai-node/issues/1413)) ([f395e95](https://github.com/openai/openai-node/commit/f395e9584ac63780442bb54c2d292914eaecf3c7)) +* **azure/audio:** use model param for deployments ([0eda70a](https://github.com/openai/openai-node/commit/0eda70adc3c88c12792c1eee9c3279579a86d412)) +* **azure:** add /images/edits to deployments endpoints ([#1509](https://github.com/openai/openai-node/issues/1509)) ([4b18059](https://github.com/openai/openai-node/commit/4b180597633a527c435e049d885103ab06311b90)) +* **azure:** add /images/edits to deployments endpoints ([#1509](https://github.com/openai/openai-node/issues/1509)) ([84fc31a](https://github.com/openai/openai-node/commit/84fc31aa903eceeb80815f6b17562fc463a71cfc)) +* **azure:** use correct internal method ([a9c7821](https://github.com/openai/openai-node/commit/a9c78216d88379bc1d5103b30970f041d22083b8)) +* **client:** always overwrite when merging headers ([c160550](https://github.com/openai/openai-node/commit/c160550761eed22b038ac8a5b477729fe298834c)) +* **client:** fix export map for index exports ([#1328](https://github.com/openai/openai-node/issues/1328)) ([26d5868](https://github.com/openai/openai-node/commit/26d5868dd53045bc820a607100eab1070785f50c)) +* **client:** fix export map for index exports, accept BunFile ([9416c96](https://github.com/openai/openai-node/commit/9416c96fdc12c9ea22da04ac317d93cb2ad94f57)) +* **client:** fix TypeError with undefined File ([0e980d0](https://github.com/openai/openai-node/commit/0e980d05e8e1fb4befae443fb84b8b9fab8dbd50)) +* **client:** remove duplicate types ([bee2ce5](https://github.com/openai/openai-node/commit/bee2ce5841f25b1f56cdc1fd0b36b0758d2c9bdc)) +* **client:** remove duplicate types ([#1410](https://github.com/openai/openai-node/issues/1410)) ([23fd3ff](https://github.com/openai/openai-node/commit/23fd3ffef3b19656b27576b4d0c613d19ea1ae2f)) +* **client:** return binary content from `get /containers/{container_id}/files/{file_id}/content` ([8502966](https://github.com/openai/openai-node/commit/8502966ed2fee9162ad14fdf04c893e1fa130a51)) +* **client:** return binary content from `get /containers/{container_id}/files/{file_id}/content` ([899869b](https://github.com/openai/openai-node/commit/899869b40ab5f64145c48521378f1925f6b5b33a)) +* **client:** return binary content from `get /containers/{container_id}/files/{file_id}/content` ([83129d7](https://github.com/openai/openai-node/commit/83129d7eac3dd784bb1c29fa344c5b808a59db73)) +* **client:** send `X-Stainless-Timeout` in seconds ([5a272a7](https://github.com/openai/openai-node/commit/5a272a76515b09810fcb5d0ca63dd6050d1a8023)) +* **client:** send `X-Stainless-Timeout` in seconds ([#1442](https://github.com/openai/openai-node/issues/1442)) ([5e5e460](https://github.com/openai/openai-node/commit/5e5e4607a103fcb6257c071bb4bf57902ee6415f)) +* **client:** send all configured auth headers ([ee01414](https://github.com/openai/openai-node/commit/ee01414c206f18a537f3616bcf1e208aab311030)) +* compat with more runtimes ([f743730](https://github.com/openai/openai-node/commit/f74373020ab01ace999a72d916e017db0177bf16)) +* correct imports ([21f2107](https://github.com/openai/openai-node/commit/21f210782b1ee3b33231cfed0277ab8e3a764bcb)) +* correctly decode multi-byte characters over multiple chunks ([f3d7083](https://github.com/openai/openai-node/commit/f3d708390a36427206edfc67875a7987eb483e55)) +* **docs:** correct docstring on responses.stream ([1847673](https://github.com/openai/openai-node/commit/1847673de09586c809e1057a6b08c604471e13ff)) +* **ecosystem-tests/bun:** bump dependencies ([1e52734](https://github.com/openai/openai-node/commit/1e52734e28a0e474b11c90977fd3161ea2e50f8c)) +* **ecosystem-tests/cloudflare-worker:** ignore lib errors for now ([157248a](https://github.com/openai/openai-node/commit/157248ae85d2261f9538128703d0ebbc24347c61)) +* **ecosystem-tests:** correct ecosystem tests setup ([6fa0675](https://github.com/openai/openai-node/commit/6fa06756624071fb1486c69a496ba906fef96de2)) +* **embeddings:** correctly decode base64 data ([#1448](https://github.com/openai/openai-node/issues/1448)) ([d6b99c8](https://github.com/openai/openai-node/commit/d6b99c8fcbd35ef6b45d66f487aea759c01febbc)) +* **exports:** add missing type exports ([a816029](https://github.com/openai/openai-node/commit/a81602996a1d9c3ceda79d88fe163a1e6b823e77)) +* **exports:** add missing type exports ([#1417](https://github.com/openai/openai-node/issues/1417)) ([06c03d7](https://github.com/openai/openai-node/commit/06c03d7125d8331679dd206d0e34705d65669046)) +* **exports:** ensure resource imports don't require /index ([d028ad7](https://github.com/openai/openai-node/commit/d028ad7b0debb585534acb73fa5cafe6f8d90f37)) +* **helpers/zod:** error on optional + not nullable fields ([6e424b5](https://github.com/openai/openai-node/commit/6e424b5cac1b2ea7e108ce24154be5bdddf56bdd)) +* **internal:** add mts file + crypto shim types ([a06deb8](https://github.com/openai/openai-node/commit/a06deb8aec21ecf8bfbc369112da10a790039178)) +* **internal:** clean up undefined File test ([da43aa9](https://github.com/openai/openai-node/commit/da43aa91586fe80137c6500e850dca82085936b8)) +* **internal:** fix file uploads in node 18 jest ([abfff03](https://github.com/openai/openai-node/commit/abfff03f49e62e195d112229127be674cc44497d)) +* **internal:** work around https://github.com/vercel/next.js/issues/76881 ([#1427](https://github.com/openai/openai-node/issues/1427)) ([84edc62](https://github.com/openai/openai-node/commit/84edc62d05eddaefee0973f9687fcfdd43b0afa9)) +* **jsr:** correct zod config ([04e30c0](https://github.com/openai/openai-node/commit/04e30c03ce0496a718aebf4cc2daac82ebba1ddb)) +* **jsr:** export realtime helpers ([0ea64eb](https://github.com/openai/openai-node/commit/0ea64eb2bde99e243761ea2e3d9d3c294c9f7fbc)) +* **jsr:** export zod helpers ([77e1180](https://github.com/openai/openai-node/commit/77e118082334710cab361efb95934422e4db6b18)) +* **mcp:** remove unused tools.ts ([752f4f1](https://github.com/openai/openai-node/commit/752f4f182116df46e4e25d6f94dcffbe504b89fd)) +* **mcp:** remove unused tools.ts ([#1445](https://github.com/openai/openai-node/issues/1445)) ([4ba9947](https://github.com/openai/openai-node/commit/4ba994773b41a3ed05a3ad908b235fc5f3810dfc)) +* optimize sse chunk reading off-by-one error ([a7effe8](https://github.com/openai/openai-node/commit/a7effe8ba3a65a535ae082d3d4e0d639aba7b7c1)) +* optimize sse chunk reading off-by-one error ([#1339](https://github.com/openai/openai-node/issues/1339)) ([b0b4189](https://github.com/openai/openai-node/commit/b0b4189420e1c5bb5fc4bbb8925f88fe65f9b217)) +* **package:** add chat/completions.ts back in ([#1333](https://github.com/openai/openai-node/issues/1333)) ([ee34833](https://github.com/openai/openai-node/commit/ee34833b6d097bda278ea07d261527e0bf51bf65)) +* **package:** add chat/completions.ts back in ([#1333](https://github.com/openai/openai-node/issues/1333)) ([1f38cc1](https://github.com/openai/openai-node/commit/1f38cc1976f4091a90a38d49e6ddc1c22e5c39ab)) +* **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([40e8dd2](https://github.com/openai/openai-node/commit/40e8dd2de0329c6cff53717d49c6e07852b352e2)) +* **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([6d056bf](https://github.com/openai/openai-node/commit/6d056bf95c9be4046decf20ec4c98dfa2bea2723)) +* **realtime:** call .toString() on WebSocket url ([#1324](https://github.com/openai/openai-node/issues/1324)) ([6e9444c](https://github.com/openai/openai-node/commit/6e9444c6c77a93ff4ce06bd5b27a9c236ba6f307)) +* **responses:** correct computer use enum value ([66fb815](https://github.com/openai/openai-node/commit/66fb8157217de604d7f535e917b085fa8b6754d4)) +* **responses:** correct reasoning output type ([1698b95](https://github.com/openai/openai-node/commit/1698b95af215ed5a3f0fcf512779efe89a95d4d2)) +* **responses:** correct reasoning output type ([9cb9576](https://github.com/openai/openai-node/commit/9cb95763cab5678c5098b37ad0fe1ec83d2c1cb7)) +* **responses:** correctly add output_text ([8ae07cc](https://github.com/openai/openai-node/commit/8ae07cc036895529a028134451fe2ab5c1661871)) +* **responses:** support streaming retrieve calls ([657807c](https://github.com/openai/openai-node/commit/657807c2d7cbf2c6fc9a92ce98bb7295bb156326)) +* **tests/embeddings:** avoid cross-realm issue ([aceaac0](https://github.com/openai/openai-node/commit/aceaac05c05fa318c4bff7ff340b512a6bd904b9)) +* **tests:** don't rely on OPENAI_API_KEY env variable ([087580a](https://github.com/openai/openai-node/commit/087580ae5ebedc88f6f219c7d00c08607722a519)) +* **tests:** manually reset node:buffer File ([1d18ed4](https://github.com/openai/openai-node/commit/1d18ed4f90436e7041835d201c8cb1c373ded418)) +* **tests:** port tests to new setup ([9eb9854](https://github.com/openai/openai-node/commit/9eb98543660c86f0b11766ef95b35fa28fd16e47)) +* **tests:** stop using node:stream ([317a04d](https://github.com/openai/openai-node/commit/317a04d8d189ee33a9dd5308668296a708b391a8)) +* **threads:** remove unused duplicative types ([0b77c7c](https://github.com/openai/openai-node/commit/0b77c7c9da64962fd50854be06661cdce549d326)) +* **types:** export AssistantStream ([#1472](https://github.com/openai/openai-node/issues/1472)) ([bc492ba](https://github.com/openai/openai-node/commit/bc492ba124cddd545eec7a1199712452c573a7a4)) +* **types:** export ParseableToolsParams ([#1486](https://github.com/openai/openai-node/issues/1486)) ([3e7c92c](https://github.com/openai/openai-node/commit/3e7c92c8a76c1f747610d63d9d69a88b796ee9fc)) +* **types:** ignore missing `id` in responses pagination ([d2be74a](https://github.com/openai/openai-node/commit/d2be74a28dec48cd7d88db88af95e8bc608cdede)) +* **types:** improve responses type names ([96ed4db](https://github.com/openai/openai-node/commit/96ed4dbd0c142d30d6cf80c2f850e77e02bd47a4)) +* **types:** improve responses type names ([#1392](https://github.com/openai/openai-node/issues/1392)) ([4548326](https://github.com/openai/openai-node/commit/454832606ebe9d5cf8ffd436eac09375f682c495)) +* **zod:** warn on optional field usage ([#1469](https://github.com/openai/openai-node/issues/1469)) ([aea2d12](https://github.com/openai/openai-node/commit/aea2d123d200e6a7eae11e66583127270a8db8bf)) + + +### Performance Improvements + +* **embedding:** default embedding creation to base64 ([#1312](https://github.com/openai/openai-node/issues/1312)) ([be00d29](https://github.com/openai/openai-node/commit/be00d29fadb2b78920bcae1e6e72750bc6f973a4)), closes [#1310](https://github.com/openai/openai-node/issues/1310) + + +### Chores + +* add hash of OpenAPI spec/config inputs to .stats.yml ([1b0a94d](https://github.com/openai/openai-node/commit/1b0a94d088c2891fcad0ca0de3a1e4e205a7c9cf)) +* add hash of OpenAPI spec/config inputs to .stats.yml ([48921aa](https://github.com/openai/openai-node/commit/48921aaabc3456408907e4bcf1cc074a9228c459)) +* add missing type alias exports ([5d75cb9](https://github.com/openai/openai-node/commit/5d75cb95019ae77eafb0c878b355f09a1f87c3bd)) +* add missing type alias exports ([#1390](https://github.com/openai/openai-node/issues/1390)) ([f4647cc](https://github.com/openai/openai-node/commit/f4647cc7546d06145bf34113be22aabbd1b7e7ee)) +* **api:** updates to supported Voice IDs ([28130c7](https://github.com/openai/openai-node/commit/28130c7fe172dd90fcf2036dc72750e485e42645)) +* **api:** updates to supported Voice IDs ([#1424](https://github.com/openai/openai-node/issues/1424)) ([fb0e96a](https://github.com/openai/openai-node/commit/fb0e96a7fa8c020ac6109951bb36f9a4ada24d03)) +* **ci:** add timeout thresholds for CI jobs ([5775451](https://github.com/openai/openai-node/commit/5775451a55212687ba998b332c1394528d98121f)) +* **ci:** add timeout thresholds for CI jobs ([939f636](https://github.com/openai/openai-node/commit/939f6365c304c037e0473207d85bbc2f2731b105)) +* **ci:** bump node version for release workflows ([bbf5d45](https://github.com/openai/openai-node/commit/bbf5d45259a8bfba62e2217955597ec0f6cfead4)) +* **ci:** only use depot for staging repos ([c59c3b5](https://github.com/openai/openai-node/commit/c59c3b5ead95b424b27c8c9f2120ad4283fb280e)) +* **ci:** only use depot for staging repos ([214da39](https://github.com/openai/openai-node/commit/214da398c76f46d40994665f3ca7e10e203e9579)) +* **ci:** run on more branches and use depot runners ([e17a4f8](https://github.com/openai/openai-node/commit/e17a4f8e1fc3de02c953421debf39827ea72d52c)) +* **ci:** run on more branches and use depot runners ([ead76fc](https://github.com/openai/openai-node/commit/ead76fc6429ac52a1c8b008ac5c0afcefaa0bae5)) +* **client:** drop support for EOL node versions ([a326944](https://github.com/openai/openai-node/commit/a326944e8a8822bc70f86d7046de3142f9dff530)) +* **client:** expose headers on some streaming errors ([#1423](https://github.com/openai/openai-node/issues/1423)) ([6c93a23](https://github.com/openai/openai-node/commit/6c93a23b79f335a21c65b52d1192890a5325ed6d)) +* **client:** minor internal fixes ([5032c28](https://github.com/openai/openai-node/commit/5032c2802bd51885270badf47e27768f62240d25)) +* **client:** minor internal fixes ([6558b7c](https://github.com/openai/openai-node/commit/6558b7ca8aef2f98f47a07bc206eb4a789097510)) +* **client:** more accurate streaming errors ([0c21914](https://github.com/openai/openai-node/commit/0c21914d90b0ef1073d99c539cf9ef18912b8d0b)) +* **client:** move misc public files to new `core/` directory, deprecate old paths ([38c9d54](https://github.com/openai/openai-node/commit/38c9d548fded9000cde85270b38085c61905b5c1)) +* **client:** only accept standard types for file uploads ([53e35c8](https://github.com/openai/openai-node/commit/53e35c8b10a8e3ef95c0d644d59ab915225b8114)) +* deprecate Assistants API ([0be23b9](https://github.com/openai/openai-node/commit/0be23b98b6be9f8922d035270b1c907307010a29)) +* deprecate Assistants API ([1726e6b](https://github.com/openai/openai-node/commit/1726e6bfe0f4e83db79ac2f2939b4131d797b42a)) +* deprecate Assistants API ([5b34fcd](https://github.com/openai/openai-node/commit/5b34fcdd1454b8cccbaaf05ace6516afb3b09273)) +* **docs:** add missing deprecation warnings ([5495529](https://github.com/openai/openai-node/commit/54955295ff5c7ab0fecb522b3aaadaaecb229d51)) +* **docs:** add missing deprecation warnings ([995075b](https://github.com/openai/openai-node/commit/995075b632051b5bb33c0381056107b2fe93931e)) +* **docs:** grammar improvements ([d5d62b0](https://github.com/openai/openai-node/commit/d5d62b0c45273e746e25e389c0e268f3f463eec1)) +* **docs:** grammar improvements ([7761cfb](https://github.com/openai/openai-node/commit/7761cfb0a8a56d056a73c046a6a613f66ada4abe)) +* **docs:** improve docs for withResponse/asResponse ([9f4c30b](https://github.com/openai/openai-node/commit/9f4c30b9bcc2f373b3087dba69bd837f96f79d81)) +* **docs:** improve migration doc ([732d870](https://github.com/openai/openai-node/commit/732d87001cbd9aa095e7b58dc843e86547e3f510)) +* **docs:** update zod tool call example, fix azure tests ([f18ced8](https://github.com/openai/openai-node/commit/f18ced883e4b5d689e0569d9b163b1958688b669)) +* **exports:** cleaner resource index imports ([0da1c16](https://github.com/openai/openai-node/commit/0da1c1653896f872b9f17e8a3248c8206994c535)) +* **exports:** cleaner resource index imports ([#1396](https://github.com/openai/openai-node/issues/1396)) ([023d106](https://github.com/openai/openai-node/commit/023d106185abf62f892bff66faf617eb45777004)) +* **exports:** stop using path fallbacks ([09af7ff](https://github.com/openai/openai-node/commit/09af7ffd42458c6c26d9325060fcb8925aca7c81)) +* **exports:** stop using path fallbacks ([#1397](https://github.com/openai/openai-node/issues/1397)) ([7c3d212](https://github.com/openai/openai-node/commit/7c3d212b47ee3090f5bbb82dd21026ba532da6e0)) +* fix example types ([20f179d](https://github.com/openai/openai-node/commit/20f179db1bb681db5d1a91adcaab16012d6ffcdf)) +* improve publish-npm script --latest tag logic ([6d3cc5c](https://github.com/openai/openai-node/commit/6d3cc5c99ba005c39a1550b30c4243ba454b9cb1)) +* improve publish-npm script --latest tag logic ([1f59811](https://github.com/openai/openai-node/commit/1f59811d1c5616ff949e01cb2f90cfc62fdefc7e)) +* improve publish-npm script --latest tag logic ([6207a2a](https://github.com/openai/openai-node/commit/6207a2a03d3279423de594eed18c5efb4ce321af)) +* **internal:** add aliases for Record and Array ([8957ff4](https://github.com/openai/openai-node/commit/8957ff47e6dc6cbaf750482c76929e99e5eca48c)) +* **internal:** add aliases for Record and Array ([#1443](https://github.com/openai/openai-node/issues/1443)) ([1cb66b6](https://github.com/openai/openai-node/commit/1cb66b6ccbcecaa6e48b90d37d8cac4840bb69a4)) +* **internal:** add back release workflow ([ca6266e](https://github.com/openai/openai-node/commit/ca6266eea5229056a3bc2b5e4225b9ea9eaa459e)) +* **internal:** add Bun.File ecosystem test ([cb4194f](https://github.com/openai/openai-node/commit/cb4194f08a2dcb4fc4231bf1b74ed5d6e0aca435)) +* **internal:** add missing return type annotation ([00ce31b](https://github.com/openai/openai-node/commit/00ce31bb6248002b0e575db2dfdd5c4bbbbcb37d)) +* **internal:** add missing return type annotation ([#1334](https://github.com/openai/openai-node/issues/1334)) ([13aab10](https://github.com/openai/openai-node/commit/13aab101588c2eee1250d7c50b2abfeca1c5fa3d)) +* **internal:** add proxy ecosystem tests ([619711a](https://github.com/openai/openai-node/commit/619711ae0da5243c64c266d615703279f7651f58)) +* **internal:** bump migration cli version ([a899c97](https://github.com/openai/openai-node/commit/a899c9748de17ef468a03a97b9ed82124189ff4c)) +* **internal:** codegen related update ([fa48353](https://github.com/openai/openai-node/commit/fa48353ffd03bfa2fb81ee16a9fb5fae0b0073c1)) +* **internal:** codegen related update ([c735a3c](https://github.com/openai/openai-node/commit/c735a3c24ac8255df50f89c519fb7dfc617db045)) +* **internal:** fix devcontainers setup ([873e273](https://github.com/openai/openai-node/commit/873e273b8c4e4e7f45feec466896b7e5ce0d8577)) +* **internal:** fix devcontainers setup ([#1343](https://github.com/openai/openai-node/issues/1343)) ([9485f5d](https://github.com/openai/openai-node/commit/9485f5d4d6718bff7f579223c9aa528898451533)) +* **internal:** fix eslint ignores ([ad5a9b6](https://github.com/openai/openai-node/commit/ad5a9b6f07002df70764f1b9e5d6cd675eba87ea)) +* **internal:** fix examples ([db23ff3](https://github.com/openai/openai-node/commit/db23ff3a179229557de07eefcda879492435b572)) +* **internal:** fix examples ([#1457](https://github.com/openai/openai-node/issues/1457)) ([a100f0a](https://github.com/openai/openai-node/commit/a100f0a0e1d336f8a78c8bbd9e3703cda3f0c5d8)) +* **internal:** fix format script ([3e1ea40](https://github.com/openai/openai-node/commit/3e1ea4063327ac34f4f46536600a8923f96dbbb0)) +* **internal:** fix formatting ([6469d53](https://github.com/openai/openai-node/commit/6469d5323b653f19e90a7470d81c914c640c6f8b)) +* **internal:** fix lint ([45a372c](https://github.com/openai/openai-node/commit/45a372ca0436f2f79c2387665b1c1bc04fd3bfed)) +* **internal:** fix release workflows ([0e4b982](https://github.com/openai/openai-node/commit/0e4b98261e412417dd0f6d1c799ef77398bfb7c0)) +* **internal:** fix release workflows ([353349d](https://github.com/openai/openai-node/commit/353349de9ee10d32d3243cb5c60a8ae982c49d37)) +* **internal:** fix tests failing on node v18 ([c54270a](https://github.com/openai/openai-node/commit/c54270a58ada1d0d7878ce80c7c2093a56fed158)) +* **internal:** fix tests not always being type checked ([0266b41](https://github.com/openai/openai-node/commit/0266b41efa311205f0fc51b6dc6d29ab003254a6)) +* **internal:** improve node 18 shims ([ee3f483](https://github.com/openai/openai-node/commit/ee3f48333a1d73a096f3417b2701fd722e4fbc68)) +* **internal:** minor client file refactoring ([d1aa00a](https://github.com/openai/openai-node/commit/d1aa00afc760f73624a8a109600c03deba40e72b)) +* **internal:** only run examples workflow in main repo ([#1450](https://github.com/openai/openai-node/issues/1450)) ([93569f3](https://github.com/openai/openai-node/commit/93569f39799512604db439af20f0ef0ad3dae295)) +* **internal:** reduce CI branch coverage ([bb39dba](https://github.com/openai/openai-node/commit/bb39dbae2830f64ede70f0ae1cea2935d1720911)) +* **internal:** reduce CI branch coverage ([77fc77f](https://github.com/openai/openai-node/commit/77fc77f7d05d03eafe6c8f002044c60c4bab3c64)) +* **internal:** refactor utils ([e7fbfbc](https://github.com/openai/openai-node/commit/e7fbfbce41c00aaa7d3b75a4bf001c7562b5b722)) +* **internal:** remove CI condition ([ef43345](https://github.com/openai/openai-node/commit/ef43345f0828a5313b595ed1715094d110f2f44e)) +* **internal:** remove CI condition ([#1381](https://github.com/openai/openai-node/issues/1381)) ([e905c95](https://github.com/openai/openai-node/commit/e905c95a27213ee65210b061ead4c982de01648b)) +* **internal:** remove unnecessary todo ([b55321e](https://github.com/openai/openai-node/commit/b55321e2d0713d41b4050e8ccf0ac4eefb45be3a)) +* **internal:** run CI on update-specs branch ([9c45ef3](https://github.com/openai/openai-node/commit/9c45ef37249e7db3ba8aa2e81886ffe306b95da4)) +* **internal:** run example files in CI ([#1357](https://github.com/openai/openai-node/issues/1357)) ([1044c48](https://github.com/openai/openai-node/commit/1044c487566569e773d5f6c1a94ce6b614e62b80)) +* **internal:** share typescript helpers ([2470933](https://github.com/openai/openai-node/commit/247093374538f0e714178134c38813bc4fde9ecf)) +* **internal:** skip broken test ([5b81f62](https://github.com/openai/openai-node/commit/5b81f62ac12969cf0a6da8bf0bfde81ff025e092)) +* **internal:** skip broken test ([#1458](https://github.com/openai/openai-node/issues/1458)) ([58f4559](https://github.com/openai/openai-node/commit/58f4559d952f6e56a8f27a6bcaba0acf295623df)) +* **internal:** update @types/bun ([d94b41a](https://github.com/openai/openai-node/commit/d94b41a58e24c82c3f7369bd1360b394e93cf1dd)) +* **internal:** update release workflows ([2cbf49a](https://github.com/openai/openai-node/commit/2cbf49a0b9a8cfbee29cec558c5ccdcebd72396f)) +* **internal:** upload builds and expand CI branch coverage ([3dcbe17](https://github.com/openai/openai-node/commit/3dcbe171d4d2a93e645828b39395363f064136b0)) +* **internal:** upload builds and expand CI branch coverage ([#1460](https://github.com/openai/openai-node/issues/1460)) ([2d45287](https://github.com/openai/openai-node/commit/2d452879000c07f3ef4e775e19a527f5f6fa7b4c)) +* **internal:** version bump ([b40e830](https://github.com/openai/openai-node/commit/b40e8302ec11683b6a360a050236ad1284afc760)) +* **internal:** version bump ([5123fe0](https://github.com/openai/openai-node/commit/5123fe08a56f3d0040b1cc67129382f3eacc3cca)) +* **internal:** version bump ([#1393](https://github.com/openai/openai-node/issues/1393)) ([2e49526](https://github.com/openai/openai-node/commit/2e495267329b6853edff76c415e4c5ddc5e143e8)) +* **migration:** add beta handling ([3508099](https://github.com/openai/openai-node/commit/3508099991ecfa260d77678037275133130e09dc)) +* move ChatModel type to shared ([236dbf4](https://github.com/openai/openai-node/commit/236dbf4092fccf7697852c6341a8f38f0241770c)) +* **package:** remove engines ([500a82f](https://github.com/openai/openai-node/commit/500a82f45d46697be14987e12d896acb2b109d32)) +* **perf:** faster base64 decoding ([11b9534](https://github.com/openai/openai-node/commit/11b9534d317f87cdcb1934ead013f058865e675e)) +* Remove deprecated/unused remote spec feature ([00bdda3](https://github.com/openai/openai-node/commit/00bdda332097787a1b09ef903b3304d3e61cde1c)) +* Remove deprecated/unused remote spec feature ([71950f6](https://github.com/openai/openai-node/commit/71950f6e891ba0813c25b2992db93a61ef6c9664)) +* revert temporary version change ([47a8350](https://github.com/openai/openai-node/commit/47a83508645b0b5a0e4bf994f753c5752717fdc2)) +* **tests:** improve enum examples ([0b30331](https://github.com/openai/openai-node/commit/0b30331a7e89ed9c400bb1b9ebfb33867a00f8bd)) +* **tests:** improve enum examples ([#1454](https://github.com/openai/openai-node/issues/1454)) ([15a86c9](https://github.com/openai/openai-node/commit/15a86c958bf300486907f2498e1028fc9bc50b00)) +* **tests:** stop using node-fetch, don't directly upload FormDataFile ([ebd464f](https://github.com/openai/openai-node/commit/ebd464f5ad07f440ad476c0a7ce733947da414e2)) +* **tests:** switch proxy tests to fetchOptions ([da6ed5f](https://github.com/openai/openai-node/commit/da6ed5fc4c9ec203d9add28c34c90532b0334a3e)) +* **types:** improved go to definition on fetchOptions ([f1712cd](https://github.com/openai/openai-node/commit/f1712cdea42e9d95d4b2dc40aae5cebc8e14c76d)) +* update next to 14.2.25 for CVE-2025-29927 ([1ed4288](https://github.com/openai/openai-node/commit/1ed4288c7b9ca8fcb00e524bc6f39c255c6661c5)) +* workaround build errors ([e4a7f67](https://github.com/openai/openai-node/commit/e4a7f674f719a87bb78378a5ce4639d84620e17a)) +* workaround build errors ([d6b396b](https://github.com/openai/openai-node/commit/d6b396b94d9ccf64ddfe945069012b6162225fa9)) + + +### Documentation + +* add examples to tsdocs ([e8d2092](https://github.com/openai/openai-node/commit/e8d2092e51015b05fe7ef33ef5a9d7652846b137)) +* fix "procesing" -> "processing" in realtime examples ([#1406](https://github.com/openai/openai-node/issues/1406)) ([dfbdc65](https://github.com/openai/openai-node/commit/dfbdc65d3ed17f0063d02906239371b88e04e5fd)) +* **migration:** mention function renames ([eb773ee](https://github.com/openai/openai-node/commit/eb773ee26df88ab6da5918521c5e979860a5aaee)) +* **migration:** mention zod helpers error ([43b870d](https://github.com/openai/openai-node/commit/43b870d1651d0c13e4ec10a53de2dfbae276c3e7)) +* **readme:** fix typo ([c44ed98](https://github.com/openai/openai-node/commit/c44ed98a3e7f497a656d612037667dd1f2e6816b)) +* **readme:** fix typo ([0989ddc](https://github.com/openai/openai-node/commit/0989ddcfd5ed0a149bbc67d61f93e0f49c397c72)) +* update URLs from stainlessapi.com to stainless.com ([e4e737d](https://github.com/openai/openai-node/commit/e4e737d90718d077c266e4c382a1535fc4bf1c69)) +* update URLs from stainlessapi.com to stainless.com ([#1352](https://github.com/openai/openai-node/issues/1352)) ([634a209](https://github.com/openai/openai-node/commit/634a209a6025640e2849133f6997af8faa28d4d8)) + + +### Refactors + +* **client:** remove deprecated runFunctions method ([e29a009](https://github.com/openai/openai-node/commit/e29a0092e9b077c2a99cd521a316aea4c25ea632)) +* **functions:** rename function helper methods to include tools ([fdd6f66](https://github.com/openai/openai-node/commit/fdd6f6672ec577cbb6876fe3857a2161402513c3)) + ## 4.104.0 (2025-05-29) Full Changelog: [v4.103.0...v4.104.0](https://github.com/openai/openai-node/compare/v4.103.0...v4.104.0) diff --git a/jsr.json b/jsr.json index 64467ad45..7a4e70a43 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "4.104.0", + "version": "5.0.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 3cc448d05..4f1f39394 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "4.104.0", + "version": "5.0.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 42c4cab74..e156b0eaa 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.104.0'; // x-release-please-version +export const VERSION = '5.0.0'; // x-release-please-version From 90b100dcf504ecf0b98620702cb6bd0988695320 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 17:35:50 +0000 Subject: [PATCH 460/509] chore: sync changes --- .github/workflows/create-releases.yml | 2 +- .stats.yml | 2 +- MIGRATION.md | 4 ++-- bin/migration-config.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index e3eaa86dd..9b3d78700 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -29,7 +29,7 @@ jobs: if: ${{ steps.release.outputs.releases_created }} uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '20' - name: Install dependencies if: ${{ steps.release.outputs.releases_created }} diff --git a/.stats.yml b/.stats.yml index 6bbd6aae7..eeeb041d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: d23f847b9ebb3f427d0f198035bd3e9f +config_hash: e618aa8ff61aea826540916336de65a6 diff --git a/MIGRATION.md b/MIGRATION.md index 9d48435e3..afed9869c 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -174,10 +174,10 @@ client.containers.files.delete(); ### Removed `httpAgent` in favor of `fetchOptions` -The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/stainless-sdks/openai-typescript#fetch-options). +The `httpAgent` client option has been removed in favor of a [platform-specific `fetchOptions` property](https://github.com/openai/openai-node#fetch-options). This change was made as `httpAgent` relied on `node:http` agents which are not supported by any runtime's builtin fetch implementation. -If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/stainless-sdks/openai-typescript#configuring-proxies). +If you were using `httpAgent` for proxy support, check out the [new proxy documentation](https://github.com/openai/openai-node#configuring-proxies). Before: diff --git a/bin/migration-config.json b/bin/migration-config.json index 26d644698..7e23911ce 100644 --- a/bin/migration-config.json +++ b/bin/migration-config.json @@ -1,6 +1,6 @@ { "pkg": "openai", - "githubRepo": "https://github.com/stainless-sdks/openai-typescript", + "githubRepo": "https://github.com/openai/openai-node", "clientClass": "OpenAI", "methods": [ { From de37b55e6e95d7089ee845d4144883d93bb18ca0 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 29 May 2025 18:37:54 +0100 Subject: [PATCH 461/509] chore(types): add missing type annotation --- src/core/pagination.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/pagination.ts b/src/core/pagination.ts index 6120ba4e8..6b187e9f5 100644 --- a/src/core/pagination.ts +++ b/src/core/pagination.ts @@ -104,7 +104,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; From 296468cdebb7c0efb586fb36ea080f8f24717bcc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 17:39:03 +0000 Subject: [PATCH 462/509] release: 5.0.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 32dbe0e2b..9d5573ce6 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.0.0" + ".": "5.0.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index d4696422c..391c3e671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 5.0.1 (2025-05-29) + +Full Changelog: [v5.0.0...v5.0.1](https://github.com/openai/openai-node/compare/v5.0.0...v5.0.1) + +### Chores + +* sync changes ([90b100d](https://github.com/openai/openai-node/commit/90b100dcf504ecf0b98620702cb6bd0988695320)) +* **types:** add missing type annotation ([de37b55](https://github.com/openai/openai-node/commit/de37b55e6e95d7089ee845d4144883d93bb18ca0)) + ## 5.0.0 (2025-05-29) Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/compare/v5.0.0-alpha.0...v5.0.0) diff --git a/jsr.json b/jsr.json index 7a4e70a43..67f675283 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.0.0", + "version": "5.0.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 4f1f39394..bffacc0ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.0.0", + "version": "5.0.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index e156b0eaa..191fb8e76 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.0.0'; // x-release-please-version +export const VERSION = '5.0.1'; // x-release-please-version From 1428a8b4f82e79695c2cbed5e12ca0da4958423b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 14:52:14 +0000 Subject: [PATCH 463/509] chore(deps): bump eslint-plugin-prettier --- package.json | 5 +---- yarn.lock | 34 ++++++++++++++-------------------- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index bffacc0ad..7f623e6c4 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^9.20.1", - "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-prettier": "^5.4.1", "eslint-plugin-unused-imports": "^4.1.4", "execa": "^5.1.1", "fast-check": "^3.22.0", @@ -51,9 +51,6 @@ "ws": "^8.18.0", "zod": "^3.23.8" }, - "resolutions": { - "synckit": "0.8.8" - }, "imports": { "openai": ".", "openai/*": "./src/*" diff --git a/yarn.lock b/yarn.lock index c8dd560c5..110f00260 100644 --- a/yarn.lock +++ b/yarn.lock @@ -714,10 +714,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@pkgr/core@^0.1.0": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.1.1.tgz#1ec17e2edbec25c8306d424ecfbf13c7de1aaa31" - integrity sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA== +"@pkgr/core@^0.2.4": + version "0.2.4" + resolved "https://registry.yarnpkg.com/@pkgr/core/-/core-0.2.4.tgz#d897170a2b0ba51f78a099edccd968f7b103387c" + integrity sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw== "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -1554,13 +1554,13 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -eslint-plugin-prettier@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.3.tgz#c4af01691a6fa9905207f0fbba0d7bea0902cce5" - integrity sha512-qJ+y0FfCp/mQYQ/vWQ3s7eUlFEL4PyKfAJxsnYTJ4YT73nsJBWqmEpFryxV9OeUiqmsTsYJ5Y+KDNaeP31wrRw== +eslint-plugin-prettier@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.4.1.tgz#99b55d7dd70047886b2222fdd853665f180b36af" + integrity sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg== dependencies: prettier-linter-helpers "^1.0.0" - synckit "^0.9.1" + synckit "^0.11.7" eslint-plugin-unused-imports@^4.1.4: version "4.1.4" @@ -3217,13 +3217,12 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== -synckit@0.8.8, synckit@^0.9.1: - version "0.8.8" - resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.8.tgz#fe7fe446518e3d3d49f5e429f443cf08b6edfcd7" - integrity sha512-HwOKAP7Wc5aRGYdKH+dw0PRRpbO841v2DENBtjnR5HFWoiNByAl7vrx3p0G/rCyYXQsrxqtX48TImFtPcIHSpQ== +synckit@^0.11.7: + version "0.11.8" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.11.8.tgz#b2aaae998a4ef47ded60773ad06e7cb821f55457" + integrity sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A== dependencies: - "@pkgr/core" "^0.1.0" - tslib "^2.6.2" + "@pkgr/core" "^0.2.4" test-exclude@^6.0.0: version "6.0.0" @@ -3327,11 +3326,6 @@ tsconfig-paths@^4.0.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.6.2: - version "2.6.2" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" - integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== - tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" From a65428fc81e05f681eab806e7efc6ad26062221b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 30 May 2025 15:45:21 +0000 Subject: [PATCH 464/509] chore(internal): codegen related update --- jest.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.ts b/jest.config.ts index ed3ba8754..5d98b45f9 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -15,6 +15,7 @@ const config: JestConfigWithTsJest = { '/dist/', '/deno/', '/deno_tests/', + '/packages/', ], testPathIgnorePatterns: ['scripts'], // prettierPath: require.resolve('prettier-2'), From 992a9d84fe412d96496b11b7a6be5c927f78db6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:35:57 +0000 Subject: [PATCH 465/509] fix(api): Fix evals and code interpreter interfaces --- .stats.yml | 6 +- api.md | 2 +- src/resources/audio/transcriptions.ts | 4 +- src/resources/chat/completions/completions.ts | 12 ++-- src/resources/fine-tuning/alpha/graders.ts | 13 ++-- src/resources/fine-tuning/jobs/jobs.ts | 2 +- src/resources/graders/grader-models.ts | 9 +-- src/resources/images.ts | 2 +- src/resources/responses/responses.ts | 67 ++++++++++++++----- .../fine-tuning/alpha/graders.test.ts | 3 +- 10 files changed, 80 insertions(+), 40 deletions(-) diff --git a/.stats.yml b/.stats.yml index eeeb041d2..6f5097c53 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml -openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: e618aa8ff61aea826540916336de65a6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2bcc845d8635bf93ddcf9ee723af4d7928248412a417bee5fc10d863a1e13867.yml +openapi_spec_hash: 865230cb3abeb01bd85de05891af23c4 +config_hash: ed1e6b3c5f93d12b80d31167f55c557c diff --git a/api.md b/api.md index c367a06f0..269566a57 100644 --- a/api.md +++ b/api.md @@ -709,7 +709,7 @@ Methods: - client.responses.create({ ...params }) -> Response - client.responses.retrieve(responseID, { ...params }) -> Response - client.responses.delete(responseID) -> void -- client.responses.cancel(responseID) -> void +- client.responses.cancel(responseID) -> Response ## InputItems diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 3b9d34222..33622bb84 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -199,7 +199,7 @@ export namespace TranscriptionTextDeltaEvent { /** * The bytes that were used to generate the log probability. */ - bytes?: Array; + bytes?: Array; /** * The log probability of the token. @@ -244,7 +244,7 @@ export namespace TranscriptionTextDoneEvent { /** * The bytes that were used to generate the log probability. */ - bytes?: Array; + bytes?: Array; /** * The log probability of the token. diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 82bb2e27c..583deccf8 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -280,9 +280,9 @@ export interface ChatCompletion { * 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. * - If set to 'flex', the request will be processed with the Flex Processing * service tier. * [Learn more](https://platform.openai.com/docs/guides/flex-processing). @@ -531,9 +531,9 @@ export interface ChatCompletionChunk { * 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. * - If set to 'flex', the request will be processed with the Flex Processing * service tier. * [Learn more](https://platform.openai.com/docs/guides/flex-processing). @@ -1453,9 +1453,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. * - If set to 'flex', the request will be processed with the Flex Processing * service tier. * [Learn more](https://platform.openai.com/docs/guides/flex-processing). diff --git a/src/resources/fine-tuning/alpha/graders.ts b/src/resources/fine-tuning/alpha/graders.ts index 043511703..17b53ba3b 100644 --- a/src/resources/fine-tuning/alpha/graders.ts +++ b/src/resources/fine-tuning/alpha/graders.ts @@ -20,7 +20,6 @@ export class Graders extends APIResource { * type: 'string_check', * }, * model_sample: 'model_sample', - * reference_answer: 'string', * }); * ``` */ @@ -134,14 +133,20 @@ export interface GraderRunParams { | GraderModelsAPI.MultiGrader; /** - * The model sample to be evaluated. + * The model sample to be evaluated. This value will be used to populate the + * `sample` namespace. See + * [the guide](https://platform.openai.com/docs/guides/graders) for more details. + * The `output_json` variable will be populated if the model sample is a valid JSON + * string. */ model_sample: string; /** - * The reference answer for the evaluation. + * The dataset item provided to the grader. This will be used to populate the + * `item` namespace. See + * [the guide](https://platform.openai.com/docs/guides/graders) for more details. */ - reference_answer: string | unknown | Array | number; + item?: unknown; } export interface GraderValidateParams { diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index c1ed972c2..1c43289e4 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -295,7 +295,7 @@ export namespace FineTuningJob { * Number of examples in each batch. A larger batch size means that model * parameters are updated less frequently, but with lower variance. */ - batch_size?: unknown | 'auto' | number | null; + batch_size?: 'auto' | number | null; /** * Scaling factor for the learning rate. A smaller learning rate may be useful to diff --git a/src/resources/graders/grader-models.ts b/src/resources/graders/grader-models.ts index 2b08d3d14..18ae60acf 100644 --- a/src/resources/graders/grader-models.ts +++ b/src/resources/graders/grader-models.ts @@ -92,10 +92,11 @@ export interface MultiGrader { */ calculate_output: string; - graders: Record< - string, - StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader - >; + /** + * A StringCheckGrader object that performs a string comparison between input and + * reference using a specified operation. + */ + graders: StringCheckGrader | TextSimilarityGrader | PythonGrader | ScoreModelGrader | LabelModelGrader; /** * The name of the grader. diff --git a/src/resources/images.ts b/src/resources/images.ts index 9b7bacf87..fdc51abe3 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -193,7 +193,7 @@ export interface ImageEditParams { * The image(s) to edit. Must be a supported image file or an array of images. * * For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than - * 25MB. You can provide up to 16 images. + * 50MB. You can provide up to 16 images. * * For `dall-e-2`, you can only provide one image, and it should be a square `png` * file less than 4MB. diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index e5400dcea..a443f101a 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -185,16 +185,13 @@ export class Responses extends APIResource { * * @example * ```ts - * await client.responses.cancel( + * const response = await client.responses.cancel( * 'resp_677efb5139a88190b512bc3fef8e535d', * ); * ``` */ - cancel(responseID: string, options?: RequestOptions): APIPromise { - return this._client.post(path`/responses/${responseID}/cancel`, { - ...options, - headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), - }); + cancel(responseID: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/responses/${responseID}/cancel`, options); } } @@ -488,9 +485,9 @@ export interface Response { * 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. * - If set to 'flex', the request will be processed with the Flex Processing * service tier. * [Learn more](https://platform.openai.com/docs/guides/flex-processing). @@ -643,9 +640,9 @@ export interface ResponseCodeInterpreterCallCodeDeltaEvent { sequence_number: number; /** - * The type of the event. Always `response.code_interpreter_call.code.delta`. + * The type of the event. Always `response.code_interpreter_call_code.delta`. */ - type: 'response.code_interpreter_call.code.delta'; + type: 'response.code_interpreter_call_code.delta'; } /** @@ -668,9 +665,9 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent { sequence_number: number; /** - * The type of the event. Always `response.code_interpreter_call.code.done`. + * The type of the event. Always `response.code_interpreter_call_code.done`. */ - type: 'response.code_interpreter_call.code.done'; + type: 'response.code_interpreter_call_code.done'; } /** @@ -1875,12 +1872,15 @@ export interface ResponseInProgressEvent { * multi-turn conversations when using the Responses API statelessly (like when * the `store` parameter is set to `false`, or when an organization is enrolled * in the zero data retention program). + * - `code_interpreter_call.outputs`: Includes the outputs of python code execution + * in code interpreter tool call items. */ export type ResponseIncludable = | 'file_search_call.results' | 'message.input_image.image_url' | 'computer_call_output.output.image_url' - | 'reasoning.encrypted_content'; + | 'reasoning.encrypted_content' + | 'code_interpreter_call.outputs'; /** * An event that is emitted when a response finishes as incomplete. @@ -3296,7 +3296,10 @@ export interface ResponseOutputText { * The annotations of the text output. */ annotations: Array< - ResponseOutputText.FileCitation | ResponseOutputText.URLCitation | ResponseOutputText.FilePath + | ResponseOutputText.FileCitation + | ResponseOutputText.URLCitation + | ResponseOutputText.ContainerFileCitation + | ResponseOutputText.FilePath >; /** @@ -3363,6 +3366,36 @@ export namespace ResponseOutputText { url: string; } + /** + * A citation for a container file used to generate a model response. + */ + export interface ContainerFileCitation { + /** + * The ID of the container file. + */ + container_id: string; + + /** + * The index of the last character of the container file citation in the message. + */ + end_index: number; + + /** + * The ID of the file. + */ + file_id: string; + + /** + * The index of the first character of the container file citation in the message. + */ + start_index: number; + + /** + * The type of the container file citation. Always `container_file_citation`. + */ + type: 'container_file_citation'; + } + /** * A path to a file. */ @@ -4573,6 +4606,8 @@ export interface ResponseCreateParamsBase { * multi-turn conversations when using the Responses API statelessly (like when * the `store` parameter is set to `false`, or when an organization is enrolled * in the zero data retention program). + * - `code_interpreter_call.outputs`: Includes the outputs of python code execution + * in code interpreter tool call items. */ include?: Array | null; @@ -4631,9 +4666,9 @@ export interface ResponseCreateParamsBase { * 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. * - If set to 'flex', the request will be processed with the Flex Processing * service tier. * [Learn more](https://platform.openai.com/docs/guides/flex-processing). diff --git a/tests/api-resources/fine-tuning/alpha/graders.test.ts b/tests/api-resources/fine-tuning/alpha/graders.test.ts index a34373e85..13288e0c3 100644 --- a/tests/api-resources/fine-tuning/alpha/graders.test.ts +++ b/tests/api-resources/fine-tuning/alpha/graders.test.ts @@ -12,7 +12,6 @@ describe('resource graders', () => { const responsePromise = client.fineTuning.alpha.graders.run({ grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, model_sample: 'model_sample', - reference_answer: 'string', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -27,7 +26,7 @@ describe('resource graders', () => { const response = await client.fineTuning.alpha.graders.run({ grader: { input: 'input', name: 'name', operation: 'eq', reference: 'reference', type: 'string_check' }, model_sample: 'model_sample', - reference_answer: 'string', + item: {}, }); }); From 75e864306c2f8678504b0ad6ea7fc47a3e526036 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 19:36:26 +0000 Subject: [PATCH 466/509] release: 5.0.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9d5573ce6..162da8580 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.0.1" + ".": "5.0.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 391c3e671..8de970e00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 5.0.2 (2025-06-02) + +Full Changelog: [v5.0.1...v5.0.2](https://github.com/openai/openai-node/compare/v5.0.1...v5.0.2) + +### Bug Fixes + +* **api:** Fix evals and code interpreter interfaces ([992a9d8](https://github.com/openai/openai-node/commit/992a9d84fe412d96496b11b7a6be5c927f78db6c)) + + +### Chores + +* **deps:** bump eslint-plugin-prettier ([1428a8b](https://github.com/openai/openai-node/commit/1428a8b4f82e79695c2cbed5e12ca0da4958423b)) +* **internal:** codegen related update ([a65428f](https://github.com/openai/openai-node/commit/a65428fc81e05f681eab806e7efc6ad26062221b)) + ## 5.0.1 (2025-05-29) Full Changelog: [v5.0.0...v5.0.1](https://github.com/openai/openai-node/compare/v5.0.0...v5.0.1) diff --git a/jsr.json b/jsr.json index 67f675283..7aa6f8e0c 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.0.1", + "version": "5.0.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 7f623e6c4..26c90a5d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.0.1", + "version": "5.0.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 191fb8e76..812d7d576 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.0.1'; // x-release-please-version +export const VERSION = '5.0.2'; // x-release-please-version From 9b5c898fe5099859252d3c3fd62010d6aa552fef Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Jun 2025 21:30:19 +0000 Subject: [PATCH 467/509] chore: adjust eslint.config.mjs ignore pattern --- eslint.config.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index e44b82f24..33cb4be6f 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -10,7 +10,7 @@ export default tseslint.config( parserOptions: { sourceType: 'module' }, }, files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'], - ignores: ['dist/**', 'ecosystem-tests/**'], + ignores: ['dist/', 'ecosystem-tests/'], plugins: { '@typescript-eslint': tseslint.plugin, 'unused-imports': unusedImports, From 00458acacd2a08352f8fce7ff1b606e9411f786a Mon Sep 17 00:00:00 2001 From: stainless-em Date: Tue, 3 Jun 2025 11:54:09 -0400 Subject: [PATCH 468/509] remove shim-types imports in custom code --- src/lib/AssistantStream.ts | 1 - src/lib/ChatCompletionStream.ts | 1 - src/lib/ChatCompletionStreamingRunner.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index b9226bf3a..7d6cb2d77 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -18,7 +18,6 @@ import { RunSubmitToolOutputsParamsBase, RunSubmitToolOutputsParamsStreaming, } from '../resources/beta/threads/runs/runs'; -import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import { APIUserAbortError, OpenAIError } from '../error'; import { diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index 5036d4f60..832fca4f3 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -17,7 +17,6 @@ import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import OpenAI from '../index'; import { ParsedChatCompletion } from '../resources/chat/completions'; diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index eb8fcc357..78637856e 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -3,7 +3,6 @@ import { type ChatCompletionCreateParamsStreaming, } from '../resources/chat/completions'; import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner'; -import { type ReadableStream } from '../internal/shim-types'; import { RunnableTools, type BaseFunctionsArgs } from './RunnableFunction'; import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream'; import OpenAI from '../index'; From 1219f090b02b8d53f29abf5a0e7564af0f9f68fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 16:54:55 +0000 Subject: [PATCH 469/509] feat(api): add new realtime and audio models, realtime session options --- .stats.yml | 4 +- src/resources/beta/realtime/realtime.ts | 40 ++++++++ src/resources/beta/realtime/sessions.ts | 122 +++++++++++++++++++++++- src/resources/shared.ts | 1 + 4 files changed, 164 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6f5097c53..33711925e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-2bcc845d8635bf93ddcf9ee723af4d7928248412a417bee5fc10d863a1e13867.yml -openapi_spec_hash: 865230cb3abeb01bd85de05891af23c4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-04213ea42074f52b8e7e60e101ed7d7ae47b8abcc233c7e8eae310bba544454d.yml +openapi_spec_hash: 5fb148608764103ba3700cd6bda4f22e config_hash: ed1e6b3c5f93d12b80d31167f55c557c diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 21550a29e..13b5ba5df 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2162,6 +2162,7 @@ export namespace SessionUpdateEvent { | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-realtime-preview-2025-06-03' | 'gpt-4o-mini-realtime-preview' | 'gpt-4o-mini-realtime-preview-2024-12-17'; @@ -2171,6 +2172,13 @@ export namespace SessionUpdateEvent { */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the + * minimum speed. 1.5 is the maximum speed. This value can only be changed in + * between model turns, not while a response is in progress. + */ + speed?: number; + /** * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a * temperature of 0.8 is highly recommended for best performance. @@ -2188,6 +2196,15 @@ export namespace SessionUpdateEvent { */ tools?: Array; + /** + * Configuration options for tracing. Set to null to disable tracing. Once tracing + * is enabled for a session, the configuration cannot be modified. + * + * `auto` will create a trace for the session with default values for the workflow + * name, group id, and metadata. + */ + tracing?: 'auto' | Session.UnionMember1; + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model @@ -2326,6 +2343,29 @@ export namespace SessionUpdateEvent { type?: 'function'; } + /** + * Granular configuration for tracing. + */ + export interface UnionMember1 { + /** + * The group id to attach to this trace to enable filtering and grouping in the + * traces dashboard. + */ + group_id?: string; + + /** + * The arbitrary metadata to attach to this trace to enable filtering in the traces + * dashboard. + */ + metadata?: unknown; + + /** + * The name of the workflow to attach to this trace. This is used to name the trace + * in the traces dashboard. + */ + workflow_name?: string; + } + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 7d7a27f13..1e0e7b987 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -102,6 +102,7 @@ export interface Session { | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-realtime-preview-2025-06-03' | 'gpt-4o-mini-realtime-preview' | 'gpt-4o-mini-realtime-preview-2024-12-17'; @@ -111,6 +112,13 @@ export interface Session { */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the + * minimum speed. 1.5 is the maximum speed. This value can only be changed in + * between model turns, not while a response is in progress. + */ + speed?: number; + /** * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a * temperature of 0.8 is highly recommended for best performance. @@ -128,6 +136,15 @@ export interface Session { */ tools?: Array; + /** + * Configuration options for tracing. Set to null to disable tracing. Once tracing + * is enabled for a session, the configuration cannot be modified. + * + * `auto` will create a trace for the session with default values for the workflow + * name, group id, and metadata. + */ + tracing?: 'auto' | Session.UnionMember1; + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model @@ -145,7 +162,8 @@ export interface Session { /** * The voice the model uses to respond. Voice cannot be changed during the session * once the model has responded with audio at least once. Current voice options are - * `alloy`, `ash`, `ballad`, `coral`, `echo` `sage`, `shimmer` and `verse`. + * `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, + * `shimmer`, and `verse`. */ voice?: | (string & {}) @@ -236,6 +254,29 @@ export namespace Session { type?: 'function'; } + /** + * Granular configuration for tracing. + */ + export interface UnionMember1 { + /** + * The group id to attach to this trace to enable filtering and grouping in the + * traces dashboard. + */ + group_id?: string; + + /** + * The arbitrary metadata to attach to this trace to enable filtering in the traces + * dashboard. + */ + metadata?: unknown; + + /** + * The name of the workflow to attach to this trace. This is used to name the trace + * in the traces dashboard. + */ + workflow_name?: string; + } + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model @@ -353,6 +394,13 @@ export interface SessionCreateResponse { */ output_audio_format?: string; + /** + * The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the + * minimum speed. 1.5 is the maximum speed. This value can only be changed in + * between model turns, not while a response is in progress. + */ + speed?: number; + /** * Sampling temperature for the model, limited to [0.6, 1.2]. Defaults to 0.8. */ @@ -369,6 +417,15 @@ export interface SessionCreateResponse { */ tools?: Array; + /** + * Configuration options for tracing. Set to null to disable tracing. Once tracing + * is enabled for a session, the configuration cannot be modified. + * + * `auto` will create a trace for the session with default values for the workflow + * name, group id, and metadata. + */ + tracing?: 'auto' | SessionCreateResponse.UnionMember1; + /** * Configuration for turn detection. Can be set to `null` to turn off. Server VAD * means that the model will detect the start and end of speech based on audio @@ -453,6 +510,29 @@ export namespace SessionCreateResponse { type?: 'function'; } + /** + * Granular configuration for tracing. + */ + export interface UnionMember1 { + /** + * The group id to attach to this trace to enable filtering and grouping in the + * traces dashboard. + */ + group_id?: string; + + /** + * The arbitrary metadata to attach to this trace to enable filtering in the traces + * dashboard. + */ + metadata?: unknown; + + /** + * The name of the workflow to attach to this trace. This is used to name the trace + * in the traces dashboard. + */ + workflow_name?: string; + } + /** * Configuration for turn detection. Can be set to `null` to turn off. Server VAD * means that the model will detect the start and end of speech based on audio @@ -555,6 +635,7 @@ export interface SessionCreateParams { | 'gpt-4o-realtime-preview' | 'gpt-4o-realtime-preview-2024-10-01' | 'gpt-4o-realtime-preview-2024-12-17' + | 'gpt-4o-realtime-preview-2025-06-03' | 'gpt-4o-mini-realtime-preview' | 'gpt-4o-mini-realtime-preview-2024-12-17'; @@ -564,6 +645,13 @@ export interface SessionCreateParams { */ output_audio_format?: 'pcm16' | 'g711_ulaw' | 'g711_alaw'; + /** + * The speed of the model's spoken response. 1.0 is the default speed. 0.25 is the + * minimum speed. 1.5 is the maximum speed. This value can only be changed in + * between model turns, not while a response is in progress. + */ + speed?: number; + /** * Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a * temperature of 0.8 is highly recommended for best performance. @@ -581,6 +669,15 @@ export interface SessionCreateParams { */ tools?: Array; + /** + * Configuration options for tracing. Set to null to disable tracing. Once tracing + * is enabled for a session, the configuration cannot be modified. + * + * `auto` will create a trace for the session with default values for the workflow + * name, group id, and metadata. + */ + tracing?: 'auto' | SessionCreateParams.UnionMember1; + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model @@ -719,6 +816,29 @@ export namespace SessionCreateParams { type?: 'function'; } + /** + * Granular configuration for tracing. + */ + export interface UnionMember1 { + /** + * The group id to attach to this trace to enable filtering and grouping in the + * traces dashboard. + */ + group_id?: string; + + /** + * The arbitrary metadata to attach to this trace to enable filtering in the traces + * dashboard. + */ + metadata?: unknown; + + /** + * The name of the workflow to attach to this trace. This is used to name the trace + * in the traces dashboard. + */ + workflow_name?: string; + } + /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be * set to `null` to turn off, in which case the client must manually trigger model diff --git a/src/resources/shared.ts b/src/resources/shared.ts index adea184fd..d3a6a96e8 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -34,6 +34,7 @@ export type ChatModel = | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' + | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' From 7c296d62bbde52ec84e3af78ed12f1cd196f9d52 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:05:26 +0000 Subject: [PATCH 470/509] chore(api): update type names --- .stats.yml | 4 ++-- src/resources/beta/realtime/realtime.ts | 4 ++-- src/resources/beta/realtime/sessions.ts | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 33711925e..035814eca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-04213ea42074f52b8e7e60e101ed7d7ae47b8abcc233c7e8eae310bba544454d.yml -openapi_spec_hash: 5fb148608764103ba3700cd6bda4f22e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0205acb1015d29b2312a48526734c0399f93026d4fe2dff5c7768f566e333fd2.yml +openapi_spec_hash: 1772cc9056c2f6dfb2a4e9cb77ee6343 config_hash: ed1e6b3c5f93d12b80d31167f55c557c diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 13b5ba5df..5f38aae3a 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -2203,7 +2203,7 @@ export namespace SessionUpdateEvent { * `auto` will create a trace for the session with default values for the workflow * name, group id, and metadata. */ - tracing?: 'auto' | Session.UnionMember1; + tracing?: 'auto' | Session.TracingConfiguration; /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be @@ -2346,7 +2346,7 @@ export namespace SessionUpdateEvent { /** * Granular configuration for tracing. */ - export interface UnionMember1 { + export interface TracingConfiguration { /** * The group id to attach to this trace to enable filtering and grouping in the * traces dashboard. diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index 1e0e7b987..d39d2d202 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -143,7 +143,7 @@ export interface Session { * `auto` will create a trace for the session with default values for the workflow * name, group id, and metadata. */ - tracing?: 'auto' | Session.UnionMember1; + tracing?: 'auto' | Session.TracingConfiguration; /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be @@ -257,7 +257,7 @@ export namespace Session { /** * Granular configuration for tracing. */ - export interface UnionMember1 { + export interface TracingConfiguration { /** * The group id to attach to this trace to enable filtering and grouping in the * traces dashboard. @@ -424,7 +424,7 @@ export interface SessionCreateResponse { * `auto` will create a trace for the session with default values for the workflow * name, group id, and metadata. */ - tracing?: 'auto' | SessionCreateResponse.UnionMember1; + tracing?: 'auto' | SessionCreateResponse.TracingConfiguration; /** * Configuration for turn detection. Can be set to `null` to turn off. Server VAD @@ -513,7 +513,7 @@ export namespace SessionCreateResponse { /** * Granular configuration for tracing. */ - export interface UnionMember1 { + export interface TracingConfiguration { /** * The group id to attach to this trace to enable filtering and grouping in the * traces dashboard. @@ -676,7 +676,7 @@ export interface SessionCreateParams { * `auto` will create a trace for the session with default values for the workflow * name, group id, and metadata. */ - tracing?: 'auto' | SessionCreateParams.UnionMember1; + tracing?: 'auto' | SessionCreateParams.TracingConfiguration; /** * Configuration for turn detection, ether Server VAD or Semantic VAD. This can be @@ -819,7 +819,7 @@ export namespace SessionCreateParams { /** * Granular configuration for tracing. */ - export interface UnionMember1 { + export interface TracingConfiguration { /** * The group id to attach to this trace to enable filtering and grouping in the * traces dashboard. From b6ee9f336e9d369ae48d7bf2a736ac59bd899947 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 17:05:59 +0000 Subject: [PATCH 471/509] release: 5.1.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 162da8580..affd1ab3d 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.0.2" + ".": "5.1.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de970e00..ea12ff509 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 5.1.0 (2025-06-03) + +Full Changelog: [v5.0.2...v5.1.0](https://github.com/openai/openai-node/compare/v5.0.2...v5.1.0) + +### Features + +* **api:** add new realtime and audio models, realtime session options ([1219f09](https://github.com/openai/openai-node/commit/1219f090b02b8d53f29abf5a0e7564af0f9f68fc)) + + +### Chores + +* adjust eslint.config.mjs ignore pattern ([9b5c898](https://github.com/openai/openai-node/commit/9b5c898fe5099859252d3c3fd62010d6aa552fef)) +* **api:** update type names ([7c296d6](https://github.com/openai/openai-node/commit/7c296d62bbde52ec84e3af78ed12f1cd196f9d52)) + ## 5.0.2 (2025-06-02) Full Changelog: [v5.0.1...v5.0.2](https://github.com/openai/openai-node/compare/v5.0.1...v5.0.2) diff --git a/jsr.json b/jsr.json index 7aa6f8e0c..26b7bbd20 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.0.2", + "version": "5.1.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 26c90a5d0..3c7181019 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.0.2", + "version": "5.1.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 812d7d576..0d43855fe 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.0.2'; // x-release-please-version +export const VERSION = '5.1.0'; // x-release-please-version From 5754fce4bc82b21579c2148af2ace84163fe4feb Mon Sep 17 00:00:00 2001 From: Em Date: Tue, 3 Jun 2025 14:02:04 -0400 Subject: [PATCH 472/509] revert "remove shim-types imports in custom code" This reverts commit 00458acacd2a08352f8fce7ff1b606e9411f786a. --- src/lib/AssistantStream.ts | 1 + src/lib/ChatCompletionStream.ts | 1 + src/lib/ChatCompletionStreamingRunner.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index 7d6cb2d77..b9226bf3a 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -18,6 +18,7 @@ import { RunSubmitToolOutputsParamsBase, RunSubmitToolOutputsParamsStreaming, } from '../resources/beta/threads/runs/runs'; +import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import { APIUserAbortError, OpenAIError } from '../error'; import { diff --git a/src/lib/ChatCompletionStream.ts b/src/lib/ChatCompletionStream.ts index 832fca4f3..5036d4f60 100644 --- a/src/lib/ChatCompletionStream.ts +++ b/src/lib/ChatCompletionStream.ts @@ -17,6 +17,7 @@ import { AbstractChatCompletionRunner, type AbstractChatCompletionRunnerEvents, } from './AbstractChatCompletionRunner'; +import { type ReadableStream } from '../internal/shim-types'; import { Stream } from '../streaming'; import OpenAI from '../index'; import { ParsedChatCompletion } from '../resources/chat/completions'; diff --git a/src/lib/ChatCompletionStreamingRunner.ts b/src/lib/ChatCompletionStreamingRunner.ts index 78637856e..eb8fcc357 100644 --- a/src/lib/ChatCompletionStreamingRunner.ts +++ b/src/lib/ChatCompletionStreamingRunner.ts @@ -3,6 +3,7 @@ import { type ChatCompletionCreateParamsStreaming, } from '../resources/chat/completions'; import { RunnerOptions, type AbstractChatCompletionRunnerEvents } from './AbstractChatCompletionRunner'; +import { type ReadableStream } from '../internal/shim-types'; import { RunnableTools, type BaseFunctionsArgs } from './RunnableFunction'; import { ChatCompletionSnapshot, ChatCompletionStream } from './ChatCompletionStream'; import OpenAI from '../index'; From 030f5909946b330cc41a4f1dd846952ff97ee86e Mon Sep 17 00:00:00 2001 From: Em Date: Tue, 3 Jun 2025 14:33:03 -0400 Subject: [PATCH 473/509] fix lint --- ecosystem-tests/cli.ts | 5 ----- ecosystem-tests/proxy.ts | 6 +++--- eslint.config.mjs | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/ecosystem-tests/cli.ts b/ecosystem-tests/cli.ts index 9781c2b03..4ca7a0e4e 100644 --- a/ecosystem-tests/cli.ts +++ b/ecosystem-tests/cli.ts @@ -562,11 +562,6 @@ async function withChdir(newDir: string, fn: () => Promise): Promise { } } -function checkNever(x: never, detail: any = x): never { - // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new Error(`checkNever: impossible to call: ${detail}`); -} - async function pathExists(path: string) { try { await fs.access(path); diff --git a/ecosystem-tests/proxy.ts b/ecosystem-tests/proxy.ts index ab05685a3..756a6c013 100644 --- a/ecosystem-tests/proxy.ts +++ b/ecosystem-tests/proxy.ts @@ -19,9 +19,9 @@ async function startProxy() { await new Promise((resolve) => proxy.listen(0, '127.0.0.1', resolve)); - console.log(proxy.address()!.toString()) + console.log(proxy.address()!.toString()); return () => { - proxy.close() - } + proxy.close(); + }; } diff --git a/eslint.config.mjs b/eslint.config.mjs index 33cb4be6f..f816a1613 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -10,7 +10,7 @@ export default tseslint.config( parserOptions: { sourceType: 'module' }, }, files: ['**/*.ts', '**/*.mts', '**/*.cts', '**/*.js', '**/*.mjs', '**/*.cjs'], - ignores: ['dist/', 'ecosystem-tests/'], + ignores: ['dist/'], plugins: { '@typescript-eslint': tseslint.plugin, 'unused-imports': unusedImports, @@ -34,7 +34,7 @@ export default tseslint.config( }, }, { - files: ['tests/**', 'examples/**'], + files: ['tests/**', 'examples/**', 'ecosystem-tests/**'], rules: { 'no-restricted-imports': 'off', }, From 065d3b08b29e10d7af58bb66816245f71f386833 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 09:04:13 +0000 Subject: [PATCH 474/509] chore(docs): use top-level-await in example snippets --- README.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0f4449006..77a98746c 100644 --- a/README.md +++ b/README.md @@ -132,22 +132,18 @@ a subclass of `APIError` will be thrown: ```ts -async function main() { - const job = await client.fineTuning.jobs - .create({ model: 'gpt-4o', training_file: 'file-abc123' }) - .catch(async (err) => { - if (err instanceof OpenAI.APIError) { - console.log(err.request_id); - console.log(err.status); // 400 - console.log(err.name); // BadRequestError - console.log(err.headers); // {server: 'nginx', ...} - } else { - throw err; - } - }); -} - -main(); +const job = await client.fineTuning.jobs + .create({ model: 'gpt-4o', training_file: 'file-abc123' }) + .catch(async (err) => { + if (err instanceof OpenAI.APIError) { + console.log(err.request_id); + console.log(err.status); // 400 + console.log(err.name); // BadRequestError + console.log(err.headers); // {server: 'nginx', ...} + } else { + throw err; + } + }); ``` Error codes are as follows: From 771ae818c32d855778c3847d9005efb80b0a8cd5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 21:53:29 +0000 Subject: [PATCH 475/509] chore(internal): fix readablestream types in node 20 --- scripts/build | 2 -- scripts/lint | 2 ++ src/internal/shim-types.d.ts | 28 ---------------------------- src/internal/shim-types.ts | 26 ++++++++++++++++++++++++++ src/internal/shims.ts | 4 ++-- 5 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 src/internal/shim-types.d.ts create mode 100644 src/internal/shim-types.ts diff --git a/scripts/build b/scripts/build index d268d6627..beb4da8f7 100755 --- a/scripts/build +++ b/scripts/build @@ -37,8 +37,6 @@ npm exec tsc-multi # when building .mjs node scripts/utils/fix-index-exports.cjs cp tsconfig.dist-src.json dist/src/tsconfig.json -cp src/internal/shim-types.d.ts dist/internal/shim-types.d.ts -cp src/internal/shim-types.d.ts dist/internal/shim-types.d.mts node scripts/utils/postprocess-files.cjs diff --git a/scripts/lint b/scripts/lint index 3ffb78a64..97a3df83e 100755 --- a/scripts/lint +++ b/scripts/lint @@ -19,3 +19,5 @@ node scripts/utils/attw-report.cjs echo "==> Running publint" ./node_modules/.bin/publint dist +echo "==> Running jsr publish --dry-run" +(cd dist-deno && npx jsr publish --dry-run --allow-dirty) diff --git a/src/internal/shim-types.d.ts b/src/internal/shim-types.d.ts deleted file mode 100644 index fe48144fa..000000000 --- a/src/internal/shim-types.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -/** - * Shims for types that we can't always rely on being available globally. - * - * Note: these only exist at the type-level, there is no corresponding runtime - * version for any of these symbols. - */ - -/** - * In order to properly access the global `NodeJS` type, if it's available, we - * need to make use of declaration shadowing. Without this, any checks for the - * presence of `NodeJS.ReadableStream` will fail. - */ -declare namespace NodeJS { - interface ReadableStream {} -} - -type HasProperties = keyof T extends never ? false : true; - -// @ts-ignore -type _ReadableStream = - // @ts-ignore - HasProperties extends true ? NodeJS.ReadableStream : ReadableStream; - -// @ts-ignore -declare const _ReadableStream: unknown extends typeof ReadableStream ? never : typeof ReadableStream; -export { _ReadableStream as ReadableStream }; diff --git a/src/internal/shim-types.ts b/src/internal/shim-types.ts new file mode 100644 index 000000000..8ddf7b0ad --- /dev/null +++ b/src/internal/shim-types.ts @@ -0,0 +1,26 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +/** + * Shims for types that we can't always rely on being available globally. + * + * Note: these only exist at the type-level, there is no corresponding runtime + * version for any of these symbols. + */ + +type NeverToAny = T extends never ? any : T; + +/** @ts-ignore */ +type _DOMReadableStream = globalThis.ReadableStream; + +/** @ts-ignore */ +type _NodeReadableStream = import('stream/web').ReadableStream; + +type _ConditionalNodeReadableStream = + typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream; + +type _ReadableStream = NeverToAny< + | ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream) + | ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream) +>; + +export type { _ReadableStream as ReadableStream }; diff --git a/src/internal/shims.ts b/src/internal/shims.ts index b1196d141..588ce43ab 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -7,8 +7,8 @@ * messages in cases where an environment isn't fully supported. */ -import { type Fetch } from './builtin-types'; -import { type ReadableStream } from './shim-types'; +import type { Fetch } from './builtin-types'; +import type { ReadableStream } from './shim-types'; export function getDefaultFetch(): Fetch { if (typeof fetch !== 'undefined') { From 8f5e7f3ffaad7bdd0424743eb68a63f918dbabb8 Mon Sep 17 00:00:00 2001 From: Lucas Levandoski <56331958+Lucas-Levandoski@users.noreply.github.com> Date: Thu, 5 Jun 2025 12:48:43 -0300 Subject: [PATCH 476/509] fix(assistants): handle thread.run.incomplete while streaming --- src/lib/AssistantStream.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/AssistantStream.ts b/src/lib/AssistantStream.ts index b9226bf3a..bb2a2b5b3 100644 --- a/src/lib/AssistantStream.ts +++ b/src/lib/AssistantStream.ts @@ -719,6 +719,7 @@ export class AssistantStream #handleRun(this: AssistantStream, event: RunStreamEvent) { this.#currentRunSnapshot = event.data; + switch (event.event) { case 'thread.run.created': break; @@ -731,6 +732,7 @@ export class AssistantStream case 'thread.run.failed': case 'thread.run.completed': case 'thread.run.expired': + case 'thread.run.incomplete': this.#finalRun = event.data; if (this.#currentToolCall) { this._emit('toolCallDone', this.#currentToolCall); From 1649e587fe42e4a9b47912f0df8192e163c7ecf6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 15:49:12 +0000 Subject: [PATCH 477/509] release: 5.1.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index affd1ab3d..6c8775576 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.1.0" + ".": "5.1.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ea12ff509..6acc4963f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 5.1.1 (2025-06-05) + +Full Changelog: [v5.1.0...v5.1.1](https://github.com/openai/openai-node/compare/v5.1.0...v5.1.1) + +### Bug Fixes + +* **assistants:** handle thread.run.incomplete while streaming ([8f5e7f3](https://github.com/openai/openai-node/commit/8f5e7f3ffaad7bdd0424743eb68a63f918dbabb8)) + + +### Chores + +* **docs:** use top-level-await in example snippets ([065d3b0](https://github.com/openai/openai-node/commit/065d3b08b29e10d7af58bb66816245f71f386833)) +* **internal:** fix readablestream types in node 20 ([771ae81](https://github.com/openai/openai-node/commit/771ae818c32d855778c3847d9005efb80b0a8cd5)) + ## 5.1.0 (2025-06-03) Full Changelog: [v5.0.2...v5.1.0](https://github.com/openai/openai-node/compare/v5.0.2...v5.1.0) diff --git a/jsr.json b/jsr.json index 26b7bbd20..bd734c294 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.1.0", + "version": "5.1.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 3c7181019..1e425a912 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.1.0", + "version": "5.1.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 0d43855fe..08dfa7aba 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.1.0'; // x-release-please-version +export const VERSION = '5.1.1'; // x-release-please-version From 44ac3d96eb258cd777edb02004763ccef253ae7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:59:08 +0000 Subject: [PATCH 478/509] chore: avoid type error in certain environments --- src/internal/uploads.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index b21555747..fbc48b298 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -138,7 +138,7 @@ export const createForm = async >( // We check for Blob not File because Bun.File doesn't inherit from File, // but they both inherit from Blob and have a `name` property at runtime. -const isNamedBlob = (value: object) => value instanceof Blob && 'name' in value; +const isNamedBlob = (value: unknown) => value instanceof Blob && 'name' in value; const isUploadable = (value: unknown) => typeof value === 'object' && From 18484cceea615a01b62590b9b626b9e2140c7dd9 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 9 Jun 2025 11:48:44 +0100 Subject: [PATCH 479/509] fix(changelog): remove duplicated entries --- CHANGELOG.md | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6acc4963f..b5a5af923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,33 +61,18 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ * add migration guide ([cfd2088](https://github.com/openai/openai-node/commit/cfd2088219464381077dec62d38d1830ab0b43f3)) * add SKIP_BREW env var to ./scripts/bootstrap ([7ea4a24](https://github.com/openai/openai-node/commit/7ea4a244d5b39e0745aea1a89abff940e2c3922f)) * **api:** add /v1/responses and built-in tools ([91af47c](https://github.com/openai/openai-node/commit/91af47cc4f62b08a451bc39f44c64244a71c1f2c)) -* **api:** add /v1/responses and built-in tools ([0612242](https://github.com/openai/openai-node/commit/06122424a4d783aff07b7089b64986fb35bc24e4)) * **api:** add `get /chat/completions` endpoint ([9697139](https://github.com/openai/openai-node/commit/9697139a5f38bcc2dffa3322ff575eb1fc8b4e35)) -* **api:** add `get /chat/completions` endpoint ([16c67be](https://github.com/openai/openai-node/commit/16c67be29bbb976660ac01d76f54e8735e71c1e0)) * **api:** add `get /responses/{response_id}/input_items` endpoint ([f2c5aba](https://github.com/openai/openai-node/commit/f2c5aba736f99550a9a7837be22b39b36a7495d0)) -* **api:** add `get /responses/{response_id}/input_items` endpoint ([3676d34](https://github.com/openai/openai-node/commit/3676d34127cd88a67dde6e6d24f2b6a7b65d3073)) * **api:** add container endpoint ([3ffca5c](https://github.com/openai/openai-node/commit/3ffca5c5b2dc6819e955ed343b2bb6e2095e7bdf)) -* **api:** add container endpoint ([e973476](https://github.com/openai/openai-node/commit/e9734764625275c50ef612ff934804be8cb2adff)) * **api:** Add evalapi to sdk ([70092d7](https://github.com/openai/openai-node/commit/70092d768426b8e0dd4bca21e7a3dea009e25b9f)) -* **api:** Add evalapi to sdk ([#1456](https://github.com/openai/openai-node/issues/1456)) ([33b66f5](https://github.com/openai/openai-node/commit/33b66f517e756e63c676efee97f7122b3cf165d1)) * **api:** add gpt-4.5-preview ([1d4478d](https://github.com/openai/openai-node/commit/1d4478d7935028e20a9d9d11ff29ff8b991c44f9)) -* **api:** add gpt-4.5-preview ([#1349](https://github.com/openai/openai-node/issues/1349)) ([bb269a1](https://github.com/openai/openai-node/commit/bb269a1a6fda11c533fb88fa1250a342a5a11ed0)) * **api:** add image sizes, reasoning encryption ([0c25021](https://github.com/openai/openai-node/commit/0c2502187f8895f029277a7be9825862f458e9aa)) -* **api:** add image sizes, reasoning encryption ([31cd88f](https://github.com/openai/openai-node/commit/31cd88fae84f630c8e86e1acab6c4cd9283c886c)) * **api:** add o3 and o4-mini model IDs ([19cda5d](https://github.com/openai/openai-node/commit/19cda5d3b908238ae6c6f5609ac3a118d4d8acc2)) -* **api:** add o3 and o4-mini model IDs ([a0d0000](https://github.com/openai/openai-node/commit/a0d000094f69db82974de4ba792cd07d4ab59c21)) * **api:** Add reinforcement fine-tuning api support ([e6bbaf5](https://github.com/openai/openai-node/commit/e6bbaf577aa6bdf3bcdaf25a5a7d4e8202831c7a)) -* **api:** Add reinforcement fine-tuning api support ([fabe6ec](https://github.com/openai/openai-node/commit/fabe6ec948c08c11588f6168f0a7560bf307d780)) * **api:** add support for storing chat completions ([59da177](https://github.com/openai/openai-node/commit/59da1771b93158d5d89efc9e63e1ef9c09a634f3)) -* **api:** add support for storing chat completions ([#1327](https://github.com/openai/openai-node/issues/1327)) ([be1ca6b](https://github.com/openai/openai-node/commit/be1ca6b9a6732214ac21ca375b5b0a9b7f492fd6)) * **api:** adding gpt-4.1 family of model IDs ([8a2a745](https://github.com/openai/openai-node/commit/8a2a7454bee0fbe9e4729d47f6b894e5f25d68f5)) -* **api:** adding gpt-4.1 family of model IDs ([840e7de](https://github.com/openai/openai-node/commit/840e7de7870835488d4c823d97afdf5d53a739be)) * **api:** adding new image model support ([a0010fd](https://github.com/openai/openai-node/commit/a0010fdb60fe723ebc70103cceca552aca51855e)) -* **api:** adding new image model support ([c353531](https://github.com/openai/openai-node/commit/c353531a238863e7f386a66dcee9f02b8115dd47)) -* **api:** Config update for pakrym-stream-param ([71c3d31](https://github.com/openai/openai-node/commit/71c3d31dad568030fd563a0b5c7c2bd26d472df1)) -* **api:** Config update for pakrym-stream-param ([b4d1b46](https://github.com/openai/openai-node/commit/b4d1b4627622157593a06f64f02ee5aa72deb6b3)) * **api:** Config update for pakrym-stream-param ([469ad7b](https://github.com/openai/openai-node/commit/469ad7b9d76b674aa3fd829128a54758ab7adfbd)) -* **api:** further updates for evals API ([3019a7e](https://github.com/openai/openai-node/commit/3019a7e67614942b5dc6d7e788f2b5b30b3bc874)) * **api:** further updates for evals API ([3f6f248](https://github.com/openai/openai-node/commit/3f6f248191b45015924be76fd5154d149c4ed8a0)) * **api:** manual updates ([debe529](https://github.com/openai/openai-node/commit/debe5295d077f79cc4b4eefefb008e5a10b32793)) * **api:** manual updates ([e83286b](https://github.com/openai/openai-node/commit/e83286b10b20d3e4c02903739b045af5cbf71cde)) @@ -101,33 +86,23 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ * **api:** manual updates ([c1c2819](https://github.com/openai/openai-node/commit/c1c281983e23dcfdca964720265d3cba28b17795)) * **api:** manual updates ([efce6d3](https://github.com/openai/openai-node/commit/efce6d3d719ad463b035b22e9a1cf461ab62b5af)) * **api:** manual updates ([32afb00](https://github.com/openai/openai-node/commit/32afb0022939b19069c37fcd9cabfe666ea86b77)) -* **api:** new API tools ([0cc8994](https://github.com/openai/openai-node/commit/0cc899456091f0b13fc98daa03a4299473f528dc)) * **api:** new API tools ([fb4014f](https://github.com/openai/openai-node/commit/fb4014ffac7b220d37bd03c94fa745386b010bf0)) -* **api:** new models for TTS, STT, + new audio features for Realtime ([1eab9ed](https://github.com/openai/openai-node/commit/1eab9edf9e5eb08e7c3d0d0ff21f378cacf7cb5b)) * **api:** new models for TTS, STT, + new audio features for Realtime ([#1407](https://github.com/openai/openai-node/issues/1407)) ([d11b13c](https://github.com/openai/openai-node/commit/d11b13cdf5412f03e551365297a27e610a36edda)) -* **api:** new streaming helpers for background responses ([c071491](https://github.com/openai/openai-node/commit/c07149125128687f026df0d04b304167cf6c9910)) * **api:** new streaming helpers for background responses ([1ddd6ff](https://github.com/openai/openai-node/commit/1ddd6ff182b09d696954fda4bde50fb82f1d6585)) -* **api:** o1-pro now available through the API ([3540b06](https://github.com/openai/openai-node/commit/3540b069fcec32ab5acbdf3def579f21759dada6)) * **api:** o1-pro now available through the API ([#1398](https://github.com/openai/openai-node/issues/1398)) ([aefd267](https://github.com/openai/openai-node/commit/aefd2675154ff848032a7fec856f0db6ed2ad629)) -* **api:** responses x eval api ([b349ade](https://github.com/openai/openai-node/commit/b349adeff0df0b6c56d937da082900e7331d1ab6)) * **api:** responses x eval api ([ea1d56c](https://github.com/openai/openai-node/commit/ea1d56c979ad7136aa584a773904b0570ba14783)) -* **api:** Updating Assistants and Evals API schemas ([e68f598](https://github.com/openai/openai-node/commit/e68f598107aba01ce1bcab61ac616d4cf70380c9)) * **api:** Updating Assistants and Evals API schemas ([8cc63d3](https://github.com/openai/openai-node/commit/8cc63d351057678d474fe1a16e3077370c83fddb)) * **client:** accept RFC6838 JSON content types ([67da9ce](https://github.com/openai/openai-node/commit/67da9ce89ea010813779b98c18fea84d9964c7de)) * **client:** add Realtime API support ([7737d25](https://github.com/openai/openai-node/commit/7737d2547c5c6c45004fe281b8122c9e2adc0efb)) * **client:** add withOptions helper ([7e9ea85](https://github.com/openai/openai-node/commit/7e9ea85f63a0989b3446834d9e1a94c0d050cf87)) * **client:** improve logging ([ead0ba4](https://github.com/openai/openai-node/commit/ead0ba4dc9f51c35007c5fe20f9954855f558652)) * **client:** promote beta completions methods to GA ([4c622f9](https://github.com/openai/openai-node/commit/4c622f9f55529e3aab30c834349d341038499db1)) -* version 5 ([855144b](https://github.com/openai/openai-node/commit/855144b105c647b91a389c08c07f215d39ff8920)) -* version 5 ([855144b](https://github.com/openai/openai-node/commit/855144b105c647b91a389c08c07f215d39ff8920)) ### Bug Fixes * **api:** add missing file rank enum + more metadata ([b943a0a](https://github.com/openai/openai-node/commit/b943a0ae4682a410172e1063a9424f5150cd9010)) -* **api:** correct some Responses types ([3ca8965](https://github.com/openai/openai-node/commit/3ca89652489e911890d0be9a2e93341ef026a20f)) * **api:** correct some Responses types ([#1391](https://github.com/openai/openai-node/issues/1391)) ([e983d0c](https://github.com/openai/openai-node/commit/e983d0c61d33b106f149d87eed90378bd0bbc349)) -* **api:** improve type resolution when importing as a package ([b6bf469](https://github.com/openai/openai-node/commit/b6bf4694cbd0ab86e7d6689289faed9ddbfb46ee)) * **api:** improve type resolution when importing as a package ([#1444](https://github.com/openai/openai-node/issues/1444)) ([4af79dd](https://github.com/openai/openai-node/commit/4af79ddd5b19925fa09d9ae877470aa8304535c2)) * **assistants:** handle `thread.run.incomplete` event ([a2714bb](https://github.com/openai/openai-node/commit/a2714bb5253ade80cb15455ceb8f6dbea63cb1d0)) * **audio:** correctly handle transcription streaming ([9c7d352](https://github.com/openai/openai-node/commit/9c7d352181c690156e26c9538c00edff6db5b384)) @@ -167,17 +142,12 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ * **jsr:** correct zod config ([04e30c0](https://github.com/openai/openai-node/commit/04e30c03ce0496a718aebf4cc2daac82ebba1ddb)) * **jsr:** export realtime helpers ([0ea64eb](https://github.com/openai/openai-node/commit/0ea64eb2bde99e243761ea2e3d9d3c294c9f7fbc)) * **jsr:** export zod helpers ([77e1180](https://github.com/openai/openai-node/commit/77e118082334710cab361efb95934422e4db6b18)) -* **mcp:** remove unused tools.ts ([752f4f1](https://github.com/openai/openai-node/commit/752f4f182116df46e4e25d6f94dcffbe504b89fd)) * **mcp:** remove unused tools.ts ([#1445](https://github.com/openai/openai-node/issues/1445)) ([4ba9947](https://github.com/openai/openai-node/commit/4ba994773b41a3ed05a3ad908b235fc5f3810dfc)) -* optimize sse chunk reading off-by-one error ([a7effe8](https://github.com/openai/openai-node/commit/a7effe8ba3a65a535ae082d3d4e0d639aba7b7c1)) * optimize sse chunk reading off-by-one error ([#1339](https://github.com/openai/openai-node/issues/1339)) ([b0b4189](https://github.com/openai/openai-node/commit/b0b4189420e1c5bb5fc4bbb8925f88fe65f9b217)) -* **package:** add chat/completions.ts back in ([#1333](https://github.com/openai/openai-node/issues/1333)) ([ee34833](https://github.com/openai/openai-node/commit/ee34833b6d097bda278ea07d261527e0bf51bf65)) * **package:** add chat/completions.ts back in ([#1333](https://github.com/openai/openai-node/issues/1333)) ([1f38cc1](https://github.com/openai/openai-node/commit/1f38cc1976f4091a90a38d49e6ddc1c22e5c39ab)) -* **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([40e8dd2](https://github.com/openai/openai-node/commit/40e8dd2de0329c6cff53717d49c6e07852b352e2)) * **parsing:** remove tool_calls default empty array ([#1341](https://github.com/openai/openai-node/issues/1341)) ([6d056bf](https://github.com/openai/openai-node/commit/6d056bf95c9be4046decf20ec4c98dfa2bea2723)) * **realtime:** call .toString() on WebSocket url ([#1324](https://github.com/openai/openai-node/issues/1324)) ([6e9444c](https://github.com/openai/openai-node/commit/6e9444c6c77a93ff4ce06bd5b27a9c236ba6f307)) * **responses:** correct computer use enum value ([66fb815](https://github.com/openai/openai-node/commit/66fb8157217de604d7f535e917b085fa8b6754d4)) -* **responses:** correct reasoning output type ([1698b95](https://github.com/openai/openai-node/commit/1698b95af215ed5a3f0fcf512779efe89a95d4d2)) * **responses:** correct reasoning output type ([9cb9576](https://github.com/openai/openai-node/commit/9cb95763cab5678c5098b37ad0fe1ec83d2c1cb7)) * **responses:** correctly add output_text ([8ae07cc](https://github.com/openai/openai-node/commit/8ae07cc036895529a028134451fe2ab5c1661871)) * **responses:** support streaming retrieve calls ([657807c](https://github.com/openai/openai-node/commit/657807c2d7cbf2c6fc9a92ce98bb7295bb156326)) @@ -190,7 +160,6 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ * **types:** export AssistantStream ([#1472](https://github.com/openai/openai-node/issues/1472)) ([bc492ba](https://github.com/openai/openai-node/commit/bc492ba124cddd545eec7a1199712452c573a7a4)) * **types:** export ParseableToolsParams ([#1486](https://github.com/openai/openai-node/issues/1486)) ([3e7c92c](https://github.com/openai/openai-node/commit/3e7c92c8a76c1f747610d63d9d69a88b796ee9fc)) * **types:** ignore missing `id` in responses pagination ([d2be74a](https://github.com/openai/openai-node/commit/d2be74a28dec48cd7d88db88af95e8bc608cdede)) -* **types:** improve responses type names ([96ed4db](https://github.com/openai/openai-node/commit/96ed4dbd0c142d30d6cf80c2f850e77e02bd47a4)) * **types:** improve responses type names ([#1392](https://github.com/openai/openai-node/issues/1392)) ([4548326](https://github.com/openai/openai-node/commit/454832606ebe9d5cf8ffd436eac09375f682c495)) * **zod:** warn on optional field usage ([#1469](https://github.com/openai/openai-node/issues/1469)) ([aea2d12](https://github.com/openai/openai-node/commit/aea2d123d200e6a7eae11e66583127270a8db8bf)) @@ -203,94 +172,63 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ ### Chores * add hash of OpenAPI spec/config inputs to .stats.yml ([1b0a94d](https://github.com/openai/openai-node/commit/1b0a94d088c2891fcad0ca0de3a1e4e205a7c9cf)) -* add hash of OpenAPI spec/config inputs to .stats.yml ([48921aa](https://github.com/openai/openai-node/commit/48921aaabc3456408907e4bcf1cc074a9228c459)) * add missing type alias exports ([5d75cb9](https://github.com/openai/openai-node/commit/5d75cb95019ae77eafb0c878b355f09a1f87c3bd)) -* add missing type alias exports ([#1390](https://github.com/openai/openai-node/issues/1390)) ([f4647cc](https://github.com/openai/openai-node/commit/f4647cc7546d06145bf34113be22aabbd1b7e7ee)) * **api:** updates to supported Voice IDs ([28130c7](https://github.com/openai/openai-node/commit/28130c7fe172dd90fcf2036dc72750e485e42645)) -* **api:** updates to supported Voice IDs ([#1424](https://github.com/openai/openai-node/issues/1424)) ([fb0e96a](https://github.com/openai/openai-node/commit/fb0e96a7fa8c020ac6109951bb36f9a4ada24d03)) * **ci:** add timeout thresholds for CI jobs ([5775451](https://github.com/openai/openai-node/commit/5775451a55212687ba998b332c1394528d98121f)) -* **ci:** add timeout thresholds for CI jobs ([939f636](https://github.com/openai/openai-node/commit/939f6365c304c037e0473207d85bbc2f2731b105)) * **ci:** bump node version for release workflows ([bbf5d45](https://github.com/openai/openai-node/commit/bbf5d45259a8bfba62e2217955597ec0f6cfead4)) * **ci:** only use depot for staging repos ([c59c3b5](https://github.com/openai/openai-node/commit/c59c3b5ead95b424b27c8c9f2120ad4283fb280e)) -* **ci:** only use depot for staging repos ([214da39](https://github.com/openai/openai-node/commit/214da398c76f46d40994665f3ca7e10e203e9579)) * **ci:** run on more branches and use depot runners ([e17a4f8](https://github.com/openai/openai-node/commit/e17a4f8e1fc3de02c953421debf39827ea72d52c)) -* **ci:** run on more branches and use depot runners ([ead76fc](https://github.com/openai/openai-node/commit/ead76fc6429ac52a1c8b008ac5c0afcefaa0bae5)) * **client:** drop support for EOL node versions ([a326944](https://github.com/openai/openai-node/commit/a326944e8a8822bc70f86d7046de3142f9dff530)) * **client:** expose headers on some streaming errors ([#1423](https://github.com/openai/openai-node/issues/1423)) ([6c93a23](https://github.com/openai/openai-node/commit/6c93a23b79f335a21c65b52d1192890a5325ed6d)) * **client:** minor internal fixes ([5032c28](https://github.com/openai/openai-node/commit/5032c2802bd51885270badf47e27768f62240d25)) -* **client:** minor internal fixes ([6558b7c](https://github.com/openai/openai-node/commit/6558b7ca8aef2f98f47a07bc206eb4a789097510)) * **client:** more accurate streaming errors ([0c21914](https://github.com/openai/openai-node/commit/0c21914d90b0ef1073d99c539cf9ef18912b8d0b)) * **client:** move misc public files to new `core/` directory, deprecate old paths ([38c9d54](https://github.com/openai/openai-node/commit/38c9d548fded9000cde85270b38085c61905b5c1)) * **client:** only accept standard types for file uploads ([53e35c8](https://github.com/openai/openai-node/commit/53e35c8b10a8e3ef95c0d644d59ab915225b8114)) * deprecate Assistants API ([0be23b9](https://github.com/openai/openai-node/commit/0be23b98b6be9f8922d035270b1c907307010a29)) -* deprecate Assistants API ([1726e6b](https://github.com/openai/openai-node/commit/1726e6bfe0f4e83db79ac2f2939b4131d797b42a)) -* deprecate Assistants API ([5b34fcd](https://github.com/openai/openai-node/commit/5b34fcdd1454b8cccbaaf05ace6516afb3b09273)) -* **docs:** add missing deprecation warnings ([5495529](https://github.com/openai/openai-node/commit/54955295ff5c7ab0fecb522b3aaadaaecb229d51)) * **docs:** add missing deprecation warnings ([995075b](https://github.com/openai/openai-node/commit/995075b632051b5bb33c0381056107b2fe93931e)) -* **docs:** grammar improvements ([d5d62b0](https://github.com/openai/openai-node/commit/d5d62b0c45273e746e25e389c0e268f3f463eec1)) * **docs:** grammar improvements ([7761cfb](https://github.com/openai/openai-node/commit/7761cfb0a8a56d056a73c046a6a613f66ada4abe)) * **docs:** improve docs for withResponse/asResponse ([9f4c30b](https://github.com/openai/openai-node/commit/9f4c30b9bcc2f373b3087dba69bd837f96f79d81)) * **docs:** improve migration doc ([732d870](https://github.com/openai/openai-node/commit/732d87001cbd9aa095e7b58dc843e86547e3f510)) * **docs:** update zod tool call example, fix azure tests ([f18ced8](https://github.com/openai/openai-node/commit/f18ced883e4b5d689e0569d9b163b1958688b669)) -* **exports:** cleaner resource index imports ([0da1c16](https://github.com/openai/openai-node/commit/0da1c1653896f872b9f17e8a3248c8206994c535)) * **exports:** cleaner resource index imports ([#1396](https://github.com/openai/openai-node/issues/1396)) ([023d106](https://github.com/openai/openai-node/commit/023d106185abf62f892bff66faf617eb45777004)) * **exports:** stop using path fallbacks ([09af7ff](https://github.com/openai/openai-node/commit/09af7ffd42458c6c26d9325060fcb8925aca7c81)) * **exports:** stop using path fallbacks ([#1397](https://github.com/openai/openai-node/issues/1397)) ([7c3d212](https://github.com/openai/openai-node/commit/7c3d212b47ee3090f5bbb82dd21026ba532da6e0)) * fix example types ([20f179d](https://github.com/openai/openai-node/commit/20f179db1bb681db5d1a91adcaab16012d6ffcdf)) -* improve publish-npm script --latest tag logic ([6d3cc5c](https://github.com/openai/openai-node/commit/6d3cc5c99ba005c39a1550b30c4243ba454b9cb1)) -* improve publish-npm script --latest tag logic ([1f59811](https://github.com/openai/openai-node/commit/1f59811d1c5616ff949e01cb2f90cfc62fdefc7e)) * improve publish-npm script --latest tag logic ([6207a2a](https://github.com/openai/openai-node/commit/6207a2a03d3279423de594eed18c5efb4ce321af)) -* **internal:** add aliases for Record and Array ([8957ff4](https://github.com/openai/openai-node/commit/8957ff47e6dc6cbaf750482c76929e99e5eca48c)) * **internal:** add aliases for Record and Array ([#1443](https://github.com/openai/openai-node/issues/1443)) ([1cb66b6](https://github.com/openai/openai-node/commit/1cb66b6ccbcecaa6e48b90d37d8cac4840bb69a4)) * **internal:** add back release workflow ([ca6266e](https://github.com/openai/openai-node/commit/ca6266eea5229056a3bc2b5e4225b9ea9eaa459e)) * **internal:** add Bun.File ecosystem test ([cb4194f](https://github.com/openai/openai-node/commit/cb4194f08a2dcb4fc4231bf1b74ed5d6e0aca435)) -* **internal:** add missing return type annotation ([00ce31b](https://github.com/openai/openai-node/commit/00ce31bb6248002b0e575db2dfdd5c4bbbbcb37d)) * **internal:** add missing return type annotation ([#1334](https://github.com/openai/openai-node/issues/1334)) ([13aab10](https://github.com/openai/openai-node/commit/13aab101588c2eee1250d7c50b2abfeca1c5fa3d)) * **internal:** add proxy ecosystem tests ([619711a](https://github.com/openai/openai-node/commit/619711ae0da5243c64c266d615703279f7651f58)) * **internal:** bump migration cli version ([a899c97](https://github.com/openai/openai-node/commit/a899c9748de17ef468a03a97b9ed82124189ff4c)) -* **internal:** codegen related update ([fa48353](https://github.com/openai/openai-node/commit/fa48353ffd03bfa2fb81ee16a9fb5fae0b0073c1)) * **internal:** codegen related update ([c735a3c](https://github.com/openai/openai-node/commit/c735a3c24ac8255df50f89c519fb7dfc617db045)) -* **internal:** fix devcontainers setup ([873e273](https://github.com/openai/openai-node/commit/873e273b8c4e4e7f45feec466896b7e5ce0d8577)) * **internal:** fix devcontainers setup ([#1343](https://github.com/openai/openai-node/issues/1343)) ([9485f5d](https://github.com/openai/openai-node/commit/9485f5d4d6718bff7f579223c9aa528898451533)) * **internal:** fix eslint ignores ([ad5a9b6](https://github.com/openai/openai-node/commit/ad5a9b6f07002df70764f1b9e5d6cd675eba87ea)) -* **internal:** fix examples ([db23ff3](https://github.com/openai/openai-node/commit/db23ff3a179229557de07eefcda879492435b572)) * **internal:** fix examples ([#1457](https://github.com/openai/openai-node/issues/1457)) ([a100f0a](https://github.com/openai/openai-node/commit/a100f0a0e1d336f8a78c8bbd9e3703cda3f0c5d8)) * **internal:** fix format script ([3e1ea40](https://github.com/openai/openai-node/commit/3e1ea4063327ac34f4f46536600a8923f96dbbb0)) * **internal:** fix formatting ([6469d53](https://github.com/openai/openai-node/commit/6469d5323b653f19e90a7470d81c914c640c6f8b)) * **internal:** fix lint ([45a372c](https://github.com/openai/openai-node/commit/45a372ca0436f2f79c2387665b1c1bc04fd3bfed)) -* **internal:** fix release workflows ([0e4b982](https://github.com/openai/openai-node/commit/0e4b98261e412417dd0f6d1c799ef77398bfb7c0)) * **internal:** fix release workflows ([353349d](https://github.com/openai/openai-node/commit/353349de9ee10d32d3243cb5c60a8ae982c49d37)) * **internal:** fix tests failing on node v18 ([c54270a](https://github.com/openai/openai-node/commit/c54270a58ada1d0d7878ce80c7c2093a56fed158)) * **internal:** fix tests not always being type checked ([0266b41](https://github.com/openai/openai-node/commit/0266b41efa311205f0fc51b6dc6d29ab003254a6)) * **internal:** improve node 18 shims ([ee3f483](https://github.com/openai/openai-node/commit/ee3f48333a1d73a096f3417b2701fd722e4fbc68)) * **internal:** minor client file refactoring ([d1aa00a](https://github.com/openai/openai-node/commit/d1aa00afc760f73624a8a109600c03deba40e72b)) * **internal:** only run examples workflow in main repo ([#1450](https://github.com/openai/openai-node/issues/1450)) ([93569f3](https://github.com/openai/openai-node/commit/93569f39799512604db439af20f0ef0ad3dae295)) -* **internal:** reduce CI branch coverage ([bb39dba](https://github.com/openai/openai-node/commit/bb39dbae2830f64ede70f0ae1cea2935d1720911)) * **internal:** reduce CI branch coverage ([77fc77f](https://github.com/openai/openai-node/commit/77fc77f7d05d03eafe6c8f002044c60c4bab3c64)) * **internal:** refactor utils ([e7fbfbc](https://github.com/openai/openai-node/commit/e7fbfbce41c00aaa7d3b75a4bf001c7562b5b722)) -* **internal:** remove CI condition ([ef43345](https://github.com/openai/openai-node/commit/ef43345f0828a5313b595ed1715094d110f2f44e)) * **internal:** remove CI condition ([#1381](https://github.com/openai/openai-node/issues/1381)) ([e905c95](https://github.com/openai/openai-node/commit/e905c95a27213ee65210b061ead4c982de01648b)) * **internal:** remove unnecessary todo ([b55321e](https://github.com/openai/openai-node/commit/b55321e2d0713d41b4050e8ccf0ac4eefb45be3a)) * **internal:** run CI on update-specs branch ([9c45ef3](https://github.com/openai/openai-node/commit/9c45ef37249e7db3ba8aa2e81886ffe306b95da4)) * **internal:** run example files in CI ([#1357](https://github.com/openai/openai-node/issues/1357)) ([1044c48](https://github.com/openai/openai-node/commit/1044c487566569e773d5f6c1a94ce6b614e62b80)) * **internal:** share typescript helpers ([2470933](https://github.com/openai/openai-node/commit/247093374538f0e714178134c38813bc4fde9ecf)) -* **internal:** skip broken test ([5b81f62](https://github.com/openai/openai-node/commit/5b81f62ac12969cf0a6da8bf0bfde81ff025e092)) * **internal:** skip broken test ([#1458](https://github.com/openai/openai-node/issues/1458)) ([58f4559](https://github.com/openai/openai-node/commit/58f4559d952f6e56a8f27a6bcaba0acf295623df)) * **internal:** update @types/bun ([d94b41a](https://github.com/openai/openai-node/commit/d94b41a58e24c82c3f7369bd1360b394e93cf1dd)) * **internal:** update release workflows ([2cbf49a](https://github.com/openai/openai-node/commit/2cbf49a0b9a8cfbee29cec558c5ccdcebd72396f)) -* **internal:** upload builds and expand CI branch coverage ([3dcbe17](https://github.com/openai/openai-node/commit/3dcbe171d4d2a93e645828b39395363f064136b0)) * **internal:** upload builds and expand CI branch coverage ([#1460](https://github.com/openai/openai-node/issues/1460)) ([2d45287](https://github.com/openai/openai-node/commit/2d452879000c07f3ef4e775e19a527f5f6fa7b4c)) -* **internal:** version bump ([b40e830](https://github.com/openai/openai-node/commit/b40e8302ec11683b6a360a050236ad1284afc760)) -* **internal:** version bump ([5123fe0](https://github.com/openai/openai-node/commit/5123fe08a56f3d0040b1cc67129382f3eacc3cca)) -* **internal:** version bump ([#1393](https://github.com/openai/openai-node/issues/1393)) ([2e49526](https://github.com/openai/openai-node/commit/2e495267329b6853edff76c415e4c5ddc5e143e8)) * **migration:** add beta handling ([3508099](https://github.com/openai/openai-node/commit/3508099991ecfa260d77678037275133130e09dc)) * move ChatModel type to shared ([236dbf4](https://github.com/openai/openai-node/commit/236dbf4092fccf7697852c6341a8f38f0241770c)) * **package:** remove engines ([500a82f](https://github.com/openai/openai-node/commit/500a82f45d46697be14987e12d896acb2b109d32)) * **perf:** faster base64 decoding ([11b9534](https://github.com/openai/openai-node/commit/11b9534d317f87cdcb1934ead013f058865e675e)) -* Remove deprecated/unused remote spec feature ([00bdda3](https://github.com/openai/openai-node/commit/00bdda332097787a1b09ef903b3304d3e61cde1c)) -* Remove deprecated/unused remote spec feature ([71950f6](https://github.com/openai/openai-node/commit/71950f6e891ba0813c25b2992db93a61ef6c9664)) -* revert temporary version change ([47a8350](https://github.com/openai/openai-node/commit/47a83508645b0b5a0e4bf994f753c5752717fdc2)) -* **tests:** improve enum examples ([0b30331](https://github.com/openai/openai-node/commit/0b30331a7e89ed9c400bb1b9ebfb33867a00f8bd)) * **tests:** improve enum examples ([#1454](https://github.com/openai/openai-node/issues/1454)) ([15a86c9](https://github.com/openai/openai-node/commit/15a86c958bf300486907f2498e1028fc9bc50b00)) * **tests:** stop using node-fetch, don't directly upload FormDataFile ([ebd464f](https://github.com/openai/openai-node/commit/ebd464f5ad07f440ad476c0a7ce733947da414e2)) * **tests:** switch proxy tests to fetchOptions ([da6ed5f](https://github.com/openai/openai-node/commit/da6ed5fc4c9ec203d9add28c34c90532b0334a3e)) @@ -304,11 +242,9 @@ Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/ * add examples to tsdocs ([e8d2092](https://github.com/openai/openai-node/commit/e8d2092e51015b05fe7ef33ef5a9d7652846b137)) * fix "procesing" -> "processing" in realtime examples ([#1406](https://github.com/openai/openai-node/issues/1406)) ([dfbdc65](https://github.com/openai/openai-node/commit/dfbdc65d3ed17f0063d02906239371b88e04e5fd)) -* **migration:** mention function renames ([eb773ee](https://github.com/openai/openai-node/commit/eb773ee26df88ab6da5918521c5e979860a5aaee)) * **migration:** mention zod helpers error ([43b870d](https://github.com/openai/openai-node/commit/43b870d1651d0c13e4ec10a53de2dfbae276c3e7)) * **readme:** fix typo ([c44ed98](https://github.com/openai/openai-node/commit/c44ed98a3e7f497a656d612037667dd1f2e6816b)) * **readme:** fix typo ([0989ddc](https://github.com/openai/openai-node/commit/0989ddcfd5ed0a149bbc67d61f93e0f49c397c72)) -* update URLs from stainlessapi.com to stainless.com ([e4e737d](https://github.com/openai/openai-node/commit/e4e737d90718d077c266e4c382a1535fc4bf1c69)) * update URLs from stainlessapi.com to stainless.com ([#1352](https://github.com/openai/openai-node/issues/1352)) ([634a209](https://github.com/openai/openai-node/commit/634a209a6025640e2849133f6997af8faa28d4d8)) From b3d488feff5acb020f5db6f27ea94884c56bc767 Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Mon, 9 Jun 2025 11:50:23 +0100 Subject: [PATCH 480/509] docs(changelog): reference MIGRATION.md closes #1539 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a5af923..a373cabdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,8 @@ Full Changelog: [v5.0.0...v5.0.1](https://github.com/openai/openai-node/compare/ ## 5.0.0 (2025-05-29) +This release migrates from node-fetch to builtin fetch, for full release notes see [MIGRATION.md](https://github.com/openai/openai-node/blob/master/MIGRATION.md). + Full Changelog: [v5.0.0-alpha.0...v5.0.0](https://github.com/openai/openai-node/compare/v5.0.0-alpha.0...v5.0.0) ### Features From 64844f1be2da9658a603fac304d1387f28a110a4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:47:31 +0000 Subject: [PATCH 481/509] feat(api): Add tools and structured outputs to evals --- .stats.yml | 4 +- src/resources/evals/runs/runs.ts | 300 +++++++++++++++++++++++++++++++ 2 files changed, 302 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 035814eca..25b450006 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0205acb1015d29b2312a48526734c0399f93026d4fe2dff5c7768f566e333fd2.yml -openapi_spec_hash: 1772cc9056c2f6dfb2a4e9cb77ee6343 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4865dda2b62927bd141cbc85f81be3d88602f103e2c581e15eb1caded3e3aaa2.yml +openapi_spec_hash: 7d14a9b23ef4ac93ea46d629601b6f6b config_hash: ed1e6b3c5f93d12b80d31167f55c557c diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 55cff4f93..5df206cb9 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -3,6 +3,7 @@ import { APIResource } from '../../../core/resource'; import * as Shared from '../../shared'; import * as ResponsesAPI from '../../responses/responses'; +import * as CompletionsAPI from '../../chat/completions/completions'; import * as OutputItemsAPI from './output-items'; import { OutputItemListParams, @@ -257,6 +258,23 @@ export namespace CreateEvalCompletionsRunDataSource { */ max_completion_tokens?: number; + /** + * An object specifying the format that the model must output. + * + * Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured + * Outputs which ensures the model will match your supplied JSON schema. Learn more + * in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + response_format?: + | Shared.ResponseFormatText + | Shared.ResponseFormatJSONSchema + | Shared.ResponseFormatJSONObject; + /** * A seed value to initialize the randomness, during sampling. */ @@ -267,6 +285,13 @@ export namespace CreateEvalCompletionsRunDataSource { */ temperature?: number; + /** + * A list of tools the model may call. Currently, only functions are supported as a + * tool. Use this to provide a list of functions the model may generate JSON inputs + * for. A max of 128 functions are supported. + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ @@ -649,11 +674,66 @@ export namespace RunCreateResponse { */ temperature?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: SamplingParams.Text; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ top_p?: number; } + + export namespace SamplingParams { + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + export interface Text { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponsesAPI.ResponseFormatTextConfig; + } + } } export interface PerModelUsage { @@ -1041,11 +1121,66 @@ export namespace RunRetrieveResponse { */ temperature?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: SamplingParams.Text; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ top_p?: number; } + + export namespace SamplingParams { + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + export interface Text { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponsesAPI.ResponseFormatTextConfig; + } + } } export interface PerModelUsage { @@ -1430,11 +1565,66 @@ export namespace RunListResponse { */ temperature?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: SamplingParams.Text; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ top_p?: number; } + + export namespace SamplingParams { + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + export interface Text { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponsesAPI.ResponseFormatTextConfig; + } + } } export interface PerModelUsage { @@ -1830,11 +2020,66 @@ export namespace RunCancelResponse { */ temperature?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: SamplingParams.Text; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ top_p?: number; } + + export namespace SamplingParams { + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + export interface Text { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponsesAPI.ResponseFormatTextConfig; + } + } } export interface PerModelUsage { @@ -2169,11 +2414,66 @@ export namespace RunCreateParams { */ temperature?: number; + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + text?: SamplingParams.Text; + + /** + * An array of tools the model may call while generating a response. You can + * specify which tool to use by setting the `tool_choice` parameter. + * + * The two categories of tools you can provide the model are: + * + * - **Built-in tools**: Tools that are provided by OpenAI that extend the model's + * capabilities, like + * [web search](https://platform.openai.com/docs/guides/tools-web-search) or + * [file search](https://platform.openai.com/docs/guides/tools-file-search). + * Learn more about + * [built-in tools](https://platform.openai.com/docs/guides/tools). + * - **Function calls (custom tools)**: Functions that are defined by you, enabling + * the model to call your own code. Learn more about + * [function calling](https://platform.openai.com/docs/guides/function-calling). + */ + tools?: Array; + /** * An alternative to temperature for nucleus sampling; 1.0 includes all tokens. */ top_p?: number; } + + export namespace SamplingParams { + /** + * Configuration options for a text response from the model. Can be plain text or + * structured JSON data. Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs) + */ + export interface Text { + /** + * An object specifying the format that the model must output. + * + * Configuring `{ "type": "json_schema" }` enables Structured Outputs, which + * ensures the model will match your supplied JSON schema. Learn more in the + * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + * + * The default format is `{ "type": "text" }` with no additional options. + * + * **Not recommended for gpt-4o and newer models:** + * + * Setting to `{ "type": "json_object" }` enables the older JSON mode, which + * ensures the message the model generates is valid JSON. Using `json_schema` is + * preferred for models that support it. + */ + format?: ResponsesAPI.ResponseFormatTextConfig; + } + } } } From f5dee4ebcdf60271e48d7d956f570eebb72b2695 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 15:48:30 +0000 Subject: [PATCH 482/509] release: 5.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 23 +++++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6c8775576..b5e915730 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.1.1" + ".": "5.2.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a373cabdb..ae565e0ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +## 5.2.0 (2025-06-09) + +Full Changelog: [v5.1.1...v5.2.0](https://github.com/openai/openai-node/compare/v5.1.1...v5.2.0) + +### Features + +* **api:** Add tools and structured outputs to evals ([64844f1](https://github.com/openai/openai-node/commit/64844f1be2da9658a603fac304d1387f28a110a4)) + + +### Bug Fixes + +* **changelog:** remove duplicated entries ([18484cc](https://github.com/openai/openai-node/commit/18484cceea615a01b62590b9b626b9e2140c7dd9)) + + +### Chores + +* avoid type error in certain environments ([44ac3d9](https://github.com/openai/openai-node/commit/44ac3d96eb258cd777edb02004763ccef253ae7a)) + + +### Documentation + +* **changelog:** reference MIGRATION.md ([b3d488f](https://github.com/openai/openai-node/commit/b3d488feff5acb020f5db6f27ea94884c56bc767)), closes [#1539](https://github.com/openai/openai-node/issues/1539) + ## 5.1.1 (2025-06-05) Full Changelog: [v5.1.0...v5.1.1](https://github.com/openai/openai-node/compare/v5.1.0...v5.1.1) diff --git a/jsr.json b/jsr.json index bd734c294..e16515fd8 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.1.1", + "version": "5.2.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 1e425a912..3b846b774 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.1.1", + "version": "5.2.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 08dfa7aba..a7cd4eea8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.1.1'; // x-release-please-version +export const VERSION = '5.2.0'; // x-release-please-version From 9988f8ea50a370abfc03bc97882d1ddd83837217 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:38:03 +0000 Subject: [PATCH 483/509] feat(api): Add o3-pro model IDs --- .stats.yml | 6 +++--- src/resources/shared.ts | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 25b450006..c9e264655 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4865dda2b62927bd141cbc85f81be3d88602f103e2c581e15eb1caded3e3aaa2.yml -openapi_spec_hash: 7d14a9b23ef4ac93ea46d629601b6f6b -config_hash: ed1e6b3c5f93d12b80d31167f55c557c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-3ae9c18dd7ccfc3ac5206f24394665f563a19015cfa8847b2801a2694d012abc.yml +openapi_spec_hash: 48175b03b58805cd5c80793c66fd54e5 +config_hash: 4caff63b74a41f71006987db702f2918 diff --git a/src/resources/shared.ts b/src/resources/shared.ts index d3a6a96e8..32f87a5f8 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -5,6 +5,8 @@ export type AllModels = | ChatModel | 'o1-pro' | 'o1-pro-2025-03-19' + | 'o3-pro' + | 'o3-pro-2025-06-10' | 'computer-use-preview' | 'computer-use-preview-2025-03-11'; @@ -297,5 +299,7 @@ export type ResponsesModel = | ChatModel | 'o1-pro' | 'o1-pro-2025-03-19' + | 'o3-pro' + | 'o3-pro-2025-06-10' | 'computer-use-preview' | 'computer-use-preview-2025-03-11'; From 5a83783361a832a61c0841b680cf1373c0179c89 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 16:38:32 +0000 Subject: [PATCH 484/509] release: 5.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b5e915730..ce65b73e4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.2.0" + ".": "5.3.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ae565e0ee..1446910c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 5.3.0 (2025-06-10) + +Full Changelog: [v5.2.0...v5.3.0](https://github.com/openai/openai-node/compare/v5.2.0...v5.3.0) + +### Features + +* **api:** Add o3-pro model IDs ([9988f8e](https://github.com/openai/openai-node/commit/9988f8ea50a370abfc03bc97882d1ddd83837217)) + ## 5.2.0 (2025-06-09) Full Changelog: [v5.1.1...v5.2.0](https://github.com/openai/openai-node/compare/v5.1.1...v5.2.0) diff --git a/jsr.json b/jsr.json index e16515fd8..d079c8f25 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.2.0", + "version": "5.3.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 3b846b774..56e5b2352 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.2.0", + "version": "5.3.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index a7cd4eea8..b17877a92 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.2.0'; // x-release-please-version +export const VERSION = '5.3.0'; // x-release-please-version From 03bd2dd07fa5cedf44b1b13120983c74a9b50f53 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 15:59:30 +0000 Subject: [PATCH 485/509] =?UTF-8?q?fix:=20publish=20script=20=E2=80=94=20h?= =?UTF-8?q?andle=20NPM=20errors=20correctly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/publish-npm | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/bin/publish-npm b/bin/publish-npm index 2505decac..fa2243d24 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -7,15 +7,35 @@ npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" yarn build cd dist +# Get package name and version from package.json +PACKAGE_NAME="$(jq -r -e '.name' ./package.json)" +VERSION="$(jq -r -e '.version' ./package.json)" + # Get latest version from npm # -# If the package doesn't exist, yarn will return -# {"type":"error","data":"Received invalid response from npm."} -# where .data.version doesn't exist so LAST_VERSION will be an empty string. -LAST_VERSION="$(yarn info --json 2> /dev/null | jq -r '.data.version')" - -# Get current version from package.json -VERSION="$(node -p "require('./package.json').version")" +# If the package doesn't exist, npm will return: +# { +# "error": { +# "code": "E404", +# "summary": "Unpublished on 2025-06-05T09:54:53.528Z", +# "detail": "'the_package' is not in this registry..." +# } +# } +NPM_INFO="$(npm view "$PACKAGE_NAME" version --json 2>/dev/null || true)" + +# Check if we got an E404 error +if echo "$NPM_INFO" | jq -e '.error.code == "E404"' > /dev/null 2>&1; then + # Package doesn't exist yet, no last version + LAST_VERSION="" +elif echo "$NPM_INFO" | jq -e '.error' > /dev/null 2>&1; then + # Report other errors + echo "ERROR: npm returned unexpected data:" + echo "$NPM_INFO" + exit 1 +else + # Success - get the version + LAST_VERSION=$(echo "$NPM_INFO" | jq -r '.') # strip quotes +fi # Check if current version is pre-release (e.g. alpha / beta / rc) CURRENT_IS_PRERELEASE=false From d023fde8394ff9247f6b1e15c4e89e5e6167be37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 17:50:11 +0000 Subject: [PATCH 486/509] chore(internal): add pure annotations, make base APIResource abstract --- package.json | 2 +- scripts/build | 2 +- src/core/resource.ts | 2 +- src/internal/headers.ts | 10 +++++----- src/internal/qs/formats.ts | 3 ++- src/internal/qs/stringify.ts | 37 +++++++++++++++++------------------- src/internal/qs/utils.ts | 28 +++++++++++++-------------- src/internal/uploads.ts | 2 +- src/internal/utils/log.ts | 2 +- src/internal/utils/path.ts | 2 +- src/internal/utils/values.ts | 3 +++ tsc-multi.json | 12 ++++++++++-- yarn.lock | 6 +++--- 13 files changed, 60 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index 56e5b2352..ce36ec025 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "typescript": "5.8.3", "ws": "^8.18.0", diff --git a/scripts/build b/scripts/build index beb4da8f7..1ee175252 100755 --- a/scripts/build +++ b/scripts/build @@ -31,7 +31,7 @@ fi node scripts/utils/make-dist-package-json.cjs > dist/package.json # build to .js/.mjs/.d.ts files -npm exec tsc-multi +./node_modules/.bin/tsc-multi # we need to patch index.js so that `new module.exports()` works for cjs backwards # compat. No way to get that from index.ts because it would cause compile errors # when building .mjs diff --git a/src/core/resource.ts b/src/core/resource.ts index 8ba97f70a..d9a191e58 100644 --- a/src/core/resource.ts +++ b/src/core/resource.ts @@ -2,7 +2,7 @@ import type { OpenAI } from '../client'; -export class APIResource { +export abstract class APIResource { protected _client: OpenAI; constructor(client: OpenAI) { diff --git a/src/internal/headers.ts b/src/internal/headers.ts index 5cc03ce32..c724a9d22 100644 --- a/src/internal/headers.ts +++ b/src/internal/headers.ts @@ -1,5 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import { isReadonlyArray } from './utils/values'; + type HeaderValue = string | undefined | null; export type HeadersLike = | Headers @@ -9,7 +11,7 @@ export type HeadersLike = | null | NullableHeaders; -const brand_privateNullableHeaders = Symbol('brand.privateNullableHeaders'); +const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders'); /** * @internal @@ -25,8 +27,6 @@ export type NullableHeaders = { nulls: Set; }; -const isArray = Array.isArray as (val: unknown) => val is readonly unknown[]; - function* iterateHeaders(headers: HeadersLike): IterableIterator { if (!headers) return; @@ -43,7 +43,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator; if (headers instanceof Headers) { iter = headers.entries(); - } else if (isArray(headers)) { + } else if (isReadonlyArray(headers)) { iter = headers; } else { shouldClear = true; @@ -52,7 +52,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator String(v); export const formatters: Record string> = { RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'), - RFC3986: (v: PropertyKey) => String(v), + RFC3986: default_formatter, }; export const RFC1738 = 'RFC1738'; export const RFC3986 = 'RFC3986'; diff --git a/src/internal/qs/stringify.ts b/src/internal/qs/stringify.ts index 67497561a..7e71387f5 100644 --- a/src/internal/qs/stringify.ts +++ b/src/internal/qs/stringify.ts @@ -1,8 +1,7 @@ -import { encode, is_buffer, maybe_map } from './utils'; -import { default_format, formatters } from './formats'; +import { encode, is_buffer, maybe_map, has } from './utils'; +import { default_format, default_formatter, formatters } from './formats'; import type { NonNullableProperties, StringifyOptions } from './types'; - -const has = Object.prototype.hasOwnProperty; +import { isArray } from '../utils/values'; const array_prefix_generators = { brackets(prefix: PropertyKey) { @@ -17,13 +16,11 @@ const array_prefix_generators = { }, }; -const is_array = Array.isArray; -const push = Array.prototype.push; const push_to_array = function (arr: any[], value_or_array: any) { - push.apply(arr, is_array(value_or_array) ? value_or_array : [value_or_array]); + Array.prototype.push.apply(arr, isArray(value_or_array) ? value_or_array : [value_or_array]); }; -const to_ISO = Date.prototype.toISOString; +let toISOString; const defaults = { addQueryPrefix: false, @@ -38,11 +35,11 @@ const defaults = { encoder: encode, encodeValuesOnly: false, format: default_format, - formatter: formatters[default_format], + formatter: default_formatter, /** @deprecated */ indices: false, serializeDate(date) { - return to_ISO.call(date); + return (toISOString ??= Function.prototype.call.bind(Date.prototype.toISOString))(date); }, skipNulls: false, strictNullHandling: false, @@ -105,7 +102,7 @@ function inner_stringify( obj = filter(prefix, obj); } else if (obj instanceof Date) { obj = serializeDate?.(obj); - } else if (generateArrayPrefix === 'comma' && is_array(obj)) { + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { obj = maybe_map(obj, function (value) { if (value instanceof Date) { return serializeDate?.(value); @@ -148,14 +145,14 @@ function inner_stringify( } let obj_keys; - if (generateArrayPrefix === 'comma' && is_array(obj)) { + if (generateArrayPrefix === 'comma' && isArray(obj)) { // we need to join elements in if (encodeValuesOnly && encoder) { // @ts-expect-error values only obj = maybe_map(obj, encoder); } obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; - } else if (is_array(filter)) { + } else if (isArray(filter)) { obj_keys = filter; } else { const keys = Object.keys(obj); @@ -165,9 +162,9 @@ function inner_stringify( const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix); const adjusted_prefix = - commaRoundTrip && is_array(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix; + commaRoundTrip && isArray(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix; - if (allowEmptyArrays && is_array(obj) && obj.length === 0) { + if (allowEmptyArrays && isArray(obj) && obj.length === 0) { return adjusted_prefix + '[]'; } @@ -184,7 +181,7 @@ function inner_stringify( // @ts-ignore const encoded_key = allowDots && encodeDotInKeys ? (key as any).replace(/\./g, '%2E') : key; const key_prefix = - is_array(obj) ? + isArray(obj) ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjusted_prefix, encoded_key) : adjusted_prefix @@ -205,7 +202,7 @@ function inner_stringify( skipNulls, encodeDotInKeys, // @ts-ignore - generateArrayPrefix === 'comma' && encodeValuesOnly && is_array(obj) ? null : encoder, + generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, @@ -244,7 +241,7 @@ function normalize_stringify_options( let format = default_format; if (typeof opts.format !== 'undefined') { - if (!has.call(formatters, opts.format)) { + if (!has(formatters, opts.format)) { throw new TypeError('Unknown format option provided.'); } format = opts.format; @@ -252,7 +249,7 @@ function normalize_stringify_options( const formatter = formatters[format]; let filter = defaults.filter; - if (typeof opts.filter === 'function' || is_array(opts.filter)) { + if (typeof opts.filter === 'function' || isArray(opts.filter)) { filter = opts.filter; } @@ -316,7 +313,7 @@ export function stringify(object: any, opts: StringifyOptions = {}) { if (typeof options.filter === 'function') { filter = options.filter; obj = filter('', obj); - } else if (is_array(options.filter)) { + } else if (isArray(options.filter)) { filter = options.filter; obj_keys = filter; } diff --git a/src/internal/qs/utils.ts b/src/internal/qs/utils.ts index 113b18fb9..4cd56579c 100644 --- a/src/internal/qs/utils.ts +++ b/src/internal/qs/utils.ts @@ -1,10 +1,13 @@ import { RFC1738 } from './formats'; import type { DefaultEncoder, Format } from './types'; +import { isArray } from '../utils/values'; -const has = Object.prototype.hasOwnProperty; -const is_array = Array.isArray; +export let has = (obj: object, key: PropertyKey): boolean => ( + (has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)), + has(obj, key) +); -const hex_table = (() => { +const hex_table = /* @__PURE__ */ (() => { const array = []; for (let i = 0; i < 256; ++i) { array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); @@ -20,7 +23,7 @@ function compact_queue>(queue: Array<{ obj: T; pro const obj = item.obj[item.prop]; - if (is_array(obj)) { + if (isArray(obj)) { const compacted: unknown[] = []; for (let j = 0; j < obj.length; ++j) { @@ -56,13 +59,10 @@ export function merge( } if (typeof source !== 'object') { - if (is_array(target)) { + if (isArray(target)) { target.push(source); } else if (target && typeof target === 'object') { - if ( - (options && (options.plainObjects || options.allowPrototypes)) || - !has.call(Object.prototype, source) - ) { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) { target[source] = true; } } else { @@ -77,14 +77,14 @@ export function merge( } let mergeTarget = target; - if (is_array(target) && !is_array(source)) { + if (isArray(target) && !isArray(source)) { // @ts-ignore mergeTarget = array_to_object(target, options); } - if (is_array(target) && is_array(source)) { + if (isArray(target) && isArray(source)) { source.forEach(function (item, i) { - if (has.call(target, i)) { + if (has(target, i)) { const targetItem = target[i]; if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { target[i] = merge(targetItem, item, options); @@ -101,7 +101,7 @@ export function merge( return Object.keys(source).reduce(function (acc, key) { const value = source[key]; - if (has.call(acc, key)) { + if (has(acc, key)) { acc[key] = merge(acc[key], value, options); } else { acc[key] = value; @@ -254,7 +254,7 @@ export function combine(a: any, b: any) { } export function maybe_map(val: T[], fn: (v: T) => T) { - if (is_array(val)) { + if (isArray(val)) { const mapped = []; for (let i = 0; i < val.length; i += 1) { mapped.push(fn(val[i]!)); diff --git a/src/internal/uploads.ts b/src/internal/uploads.ts index fbc48b298..2f7271164 100644 --- a/src/internal/uploads.ts +++ b/src/internal/uploads.ts @@ -90,7 +90,7 @@ export const multipartFormRequestOptions = async ( return { ...opts, body: await createForm(opts.body, fetch) }; }; -const supportsFormDataMap = new WeakMap>(); +const supportsFormDataMap = /** @__PURE__ */ new WeakMap>(); /** * node-fetch doesn't support the global FormData object in recent node versions. Instead of sending diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index 1aec41276..e1df9cef6 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -58,7 +58,7 @@ const noopLogger = { debug: noop, }; -let cachedLoggers = new WeakMap(); +let cachedLoggers = /** @__PURE__ */ new WeakMap(); export function loggerFor(client: OpenAI): Logger { const logger = client.logger; diff --git a/src/internal/utils/path.ts b/src/internal/utils/path.ts index 0dceb10f1..122066855 100644 --- a/src/internal/utils/path.ts +++ b/src/internal/utils/path.ts @@ -60,4 +60,4 @@ export const createPathTagFunction = (pathEncoder = encodeURIPath) => /** * URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced. */ -export const path = createPathTagFunction(encodeURIPath); +export const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath); diff --git a/src/internal/utils/values.ts b/src/internal/utils/values.ts index aee03b055..801974e84 100644 --- a/src/internal/utils/values.ts +++ b/src/internal/utils/values.ts @@ -9,6 +9,9 @@ export const isAbsoluteURL = (url: string): boolean => { return startsWithSchemeRegexp.test(url); }; +export let isArray = (val: unknown): val is unknown[] => ((isArray = Array.isArray), isArray(val)); +export let isReadonlyArray = isArray as (val: unknown) => val is readonly unknown[]; + /** Returns an object if the given value isn't an object, otherwise returns as-is */ export function maybeObj(x: unknown): object { if (typeof x !== 'object') { diff --git a/tsc-multi.json b/tsc-multi.json index 170bac7a4..384ddac5b 100644 --- a/tsc-multi.json +++ b/tsc-multi.json @@ -1,7 +1,15 @@ { "targets": [ - { "extname": ".js", "module": "commonjs", "shareHelpers": "internal/tslib.js" }, - { "extname": ".mjs", "module": "esnext", "shareHelpers": "internal/tslib.mjs" } + { + "extname": ".js", + "module": "commonjs", + "shareHelpers": "internal/tslib.js" + }, + { + "extname": ".mjs", + "module": "esnext", + "shareHelpers": "internal/tslib.mjs" + } ], "projects": ["tsconfig.build.json"] } diff --git a/yarn.lock b/yarn.lock index 110f00260..5d6fa2487 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3302,9 +3302,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz": - version "1.1.4" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.4/tsc-multi-1.1.4.tgz#cbed459a9e902f5295ec3daaf1c7aa3b10427e55" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz": + version "1.1.7" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz#52f40adf8b808bd0b633346d11cc4a8aeea465cd" dependencies: debug "^4.3.7" fast-glob "^3.3.2" From abb0ab59201f68df4cfaf9335488fe5f40fe1b6b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 17:08:45 +0000 Subject: [PATCH 487/509] chore(client): refactor imports --- src/client.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/client.ts b/src/client.ts index 9ebdf8f02..fa978e957 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5,7 +5,6 @@ import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestIni import { uuid4 } from './internal/utils/uuid'; import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; -import { type Logger, type LogLevel, parseLogLevel } from './internal/utils/log'; export type { Logger, LogLevel } from './internal/utils/log'; import { castToError, isAbortError } from './internal/errors'; import type { APIResponseProps } from './internal/parse'; @@ -20,10 +19,6 @@ import { AbstractPage, type CursorPageParams, CursorPageResponse, PageResponse } import * as Uploads from './core/uploads'; import * as API from './resources/index'; import { APIPromise } from './core/api-promise'; -import { type Fetch } from './internal/builtin-types'; -import { isRunningInBrowser } from './internal/detect-platform'; -import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; -import { FinalRequestOptions, RequestOptions } from './internal/request-options'; import { Batch, BatchCreateParams, @@ -79,9 +74,6 @@ import { ModerationTextInput, Moderations, } from './resources/moderations'; -import { readEnv } from './internal/utils/env'; -import { formatRequestDetails, loggerFor } from './internal/utils/log'; -import { isEmptyObj } from './internal/utils/values'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; @@ -174,6 +166,19 @@ import { ChatCompletionUserMessageParam, ChatCompletionsPage, } from './resources/chat/completions/completions'; +import { type Fetch } from './internal/builtin-types'; +import { isRunningInBrowser } from './internal/detect-platform'; +import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; +import { FinalRequestOptions, RequestOptions } from './internal/request-options'; +import { readEnv } from './internal/utils/env'; +import { + type LogLevel, + type Logger, + formatRequestDetails, + loggerFor, + parseLogLevel, +} from './internal/utils/log'; +import { isEmptyObj } from './internal/utils/values'; export interface ClientOptions { /** From 20f480e41bd586b958d37ef3bd06d2813b7335c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:25:19 +0000 Subject: [PATCH 488/509] feat(client): add support for endpoint-specific base URLs --- package.json | 2 +- src/client.ts | 20 ++++++++++++++++---- src/internal/request-options.ts | 1 + tests/index.test.ts | 22 ++++++++++++++++++++++ yarn.lock | 6 +++--- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index ce36ec025..c865c9d0c 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "publint": "^0.2.12", "ts-jest": "^29.1.0", "ts-node": "^10.5.0", - "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz", + "tsc-multi": "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz", "tsconfig-paths": "^4.0.0", "typescript": "5.8.3", "ws": "^8.18.0", diff --git a/src/client.ts b/src/client.ts index fa978e957..f33e13ead 100644 --- a/src/client.ts +++ b/src/client.ts @@ -372,6 +372,13 @@ export class OpenAI { }); } + /** + * Check whether the base URL is set to its default. + */ + #baseURLOverridden(): boolean { + return this.baseURL !== 'https://api.openai.com/v1'; + } + protected defaultQuery(): Record | undefined { return this._options.defaultQuery; } @@ -405,11 +412,16 @@ export class OpenAI { return Errors.APIError.generate(status, error, message, headers); } - buildURL(path: string, query: Record | null | undefined): string { + buildURL( + path: string, + query: Record | null | undefined, + defaultBaseURL?: string | undefined, + ): string { + const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL; const url = isAbsoluteURL(path) ? new URL(path) - : new URL(this.baseURL + (this.baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); + : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); const defaultQuery = this.defaultQuery(); if (!isEmptyObj(defaultQuery)) { @@ -773,9 +785,9 @@ export class OpenAI { { retryCount = 0 }: { retryCount?: number } = {}, ): { req: FinalizedRequestInit; url: string; timeout: number } { const options = { ...inputOptions }; - const { method, path, query } = options; + const { method, path, query, defaultBaseURL } = options; - const url = this.buildURL(path!, query as Record); + const url = this.buildURL(path!, query as Record, defaultBaseURL); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); options.timeout = options.timeout ?? this.timeout; const { bodyHeaders, body } = this.buildBody({ options }); diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 78daa4199..7ee5c622d 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -21,6 +21,7 @@ export type RequestOptions = { fetchOptions?: MergedRequestInit; signal?: AbortSignal | undefined | null; idempotencyKey?: string; + defaultBaseURL?: string | undefined; __metadata?: Record; __binaryResponse?: boolean | undefined; diff --git a/tests/index.test.ts b/tests/index.test.ts index 401cc5c6e..e61902eea 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -310,6 +310,28 @@ describe('instantiate client', () => { const client = new OpenAI({ apiKey: 'My API Key' }); expect(client.baseURL).toEqual('https://api.openai.com/v1'); }); + + test('in request options', () => { + const client = new OpenAI({ apiKey: 'My API Key' }); + expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( + 'http://localhost:5000/option/foo', + ); + }); + + test('in request options overridden by client options', () => { + const client = new OpenAI({ apiKey: 'My API Key', baseURL: 'http://localhost:5000/client' }); + expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( + 'http://localhost:5000/client/foo', + ); + }); + + test('in request options overridden by env variable', () => { + process.env['OPENAI_BASE_URL'] = 'http://localhost:5000/env'; + const client = new OpenAI({ apiKey: 'My API Key' }); + expect(client.buildURL('/foo', null, 'http://localhost:5000/option')).toEqual( + 'http://localhost:5000/env/foo', + ); + }); }); test('maxRetries option is correctly set', () => { diff --git a/yarn.lock b/yarn.lock index 5d6fa2487..e95b98c26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3302,9 +3302,9 @@ ts-node@^10.5.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" -"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz": - version "1.1.7" - resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.7/tsc-multi.tgz#52f40adf8b808bd0b633346d11cc4a8aeea465cd" +"tsc-multi@https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz": + version "1.1.8" + resolved "https://github.com/stainless-api/tsc-multi/releases/download/v1.1.8/tsc-multi.tgz#f544b359b8f05e607771ffacc280e58201476b04" dependencies: debug "^4.3.7" fast-glob "^3.3.2" From 3f9aaf33984e00df41e85a0c7b80b79d7214693c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:28:36 +0000 Subject: [PATCH 489/509] feat(api): add reusable prompt IDs --- .stats.yml | 6 +-- api.md | 1 + src/resources/chat/completions/completions.ts | 6 +-- src/resources/fine-tuning/jobs/jobs.ts | 10 ++-- src/resources/images.ts | 14 ++++++ src/resources/responses/responses.ts | 48 ++++++++++++++++--- tests/api-resources/images.test.ts | 2 + .../api-resources/responses/responses.test.ts | 1 + 8 files changed, 71 insertions(+), 17 deletions(-) diff --git a/.stats.yml b/.stats.yml index c9e264655..feda32cff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-3ae9c18dd7ccfc3ac5206f24394665f563a19015cfa8847b2801a2694d012abc.yml -openapi_spec_hash: 48175b03b58805cd5c80793c66fd54e5 -config_hash: 4caff63b74a41f71006987db702f2918 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml +openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946 +config_hash: fd2af1d5eff0995bb7dc02ac9a34851d diff --git a/api.md b/api.md index 269566a57..4e2de3252 100644 --- a/api.md +++ b/api.md @@ -677,6 +677,7 @@ Types: - ResponseOutputRefusal - ResponseOutputText - ResponseOutputTextAnnotationAddedEvent +- ResponsePrompt - ResponseQueuedEvent - ResponseReasoningDeltaEvent - ResponseReasoningDoneEvent diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index 583deccf8..a88e27e98 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -291,7 +291,7 @@ export interface ChatCompletion { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -542,7 +542,7 @@ export interface ChatCompletionChunk { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -1464,7 +1464,7 @@ export interface ChatCompletionCreateParamsBase { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; /** * Not supported with latest reasoning models `o3` and `o4-mini`. diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 1c43289e4..7e8f672e5 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -25,7 +25,7 @@ export class Jobs extends APIResource { * Response includes details of the enqueued job including job status and the name * of the fine-tuned models once complete. * - * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization) * * @example * ```ts @@ -42,7 +42,7 @@ export class Jobs extends APIResource { /** * Get info about a fine-tuning job. * - * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) + * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization) * * @example * ```ts @@ -449,7 +449,8 @@ export interface JobCreateParams { * [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input) * format. * - * See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) + * See the + * [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) * for more details. */ training_file: string; @@ -508,7 +509,8 @@ export interface JobCreateParams { * Your dataset must be formatted as a JSONL file. You must upload your file with * the purpose `fine-tune`. * - * See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning) + * See the + * [fine-tuning guide](https://platform.openai.com/docs/guides/model-optimization) * for more details. */ validation_file?: string | null; diff --git a/src/resources/images.ts b/src/resources/images.ts index fdc51abe3..23b7d1507 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -237,6 +237,20 @@ export interface ImageEditParams { */ n?: number | null; + /** + * The compression level (0-100%) for the generated images. This parameter is only + * supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and + * defaults to 100. + */ + output_compression?: number | null; + + /** + * The format in which the generated images are returned. This parameter is only + * supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`. The + * default value is `png`. + */ + output_format?: 'png' | 'jpeg' | 'webp' | null; + /** * The quality of the image that will be generated. `high`, `medium` and `low` are * only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality. diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index a443f101a..1cb0788e0 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -358,14 +358,13 @@ export interface Response { incomplete_details: Response.IncompleteDetails | null; /** - * Inserts a system (or developer) message as the first item in the model's - * context. + * A system (or developer) message inserted into the model's context. * * When using along with `previous_response_id`, the instructions from a previous * response will not be carried over to the next response. This makes it simple to * swap out system (or developer) messages in new responses. */ - instructions: string | null; + instructions: string | Array | null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -469,6 +468,12 @@ export interface Response { */ previous_response_id?: string | null; + /** + * Reference to a prompt template and its variables. + * [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). + */ + prompt?: ResponsePrompt | null; + /** * **o-series models only** * @@ -496,7 +501,7 @@ export interface Response { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; /** * The status of the response generation. One of `completed`, `failed`, @@ -3483,6 +3488,29 @@ export interface ResponseOutputTextAnnotationAddedEvent { type: 'response.output_text_annotation.added'; } +/** + * Reference to a prompt template and its variables. + * [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). + */ +export interface ResponsePrompt { + /** + * The unique identifier of the prompt template to use. + */ + id: string; + + /** + * Optional map of values to substitute in for variables in your prompt. The + * substitution values can either be strings, or other Response input types like + * images or files. + */ + variables?: Record | null; + + /** + * Optional version of the prompt template. + */ + version?: string | null; +} + /** * Emitted when a response is queued and waiting to be processed. */ @@ -4612,8 +4640,7 @@ export interface ResponseCreateParamsBase { include?: Array | null; /** - * Inserts a system (or developer) message as the first item in the model's - * context. + * A system (or developer) message inserted into the model's context. * * When using along with `previous_response_id`, the instructions from a previous * response will not be carried over to the next response. This makes it simple to @@ -4650,6 +4677,12 @@ export interface ResponseCreateParamsBase { */ previous_response_id?: string | null; + /** + * Reference to a prompt template and its variables. + * [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts). + */ + prompt?: ResponsePrompt | null; + /** * **o-series models only** * @@ -4677,7 +4710,7 @@ export interface ResponseCreateParamsBase { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; /** * Whether to store the generated model response for later retrieval via API. @@ -4922,6 +4955,7 @@ export declare namespace Responses { type ResponseOutputRefusal as ResponseOutputRefusal, type ResponseOutputText as ResponseOutputText, type ResponseOutputTextAnnotationAddedEvent as ResponseOutputTextAnnotationAddedEvent, + type ResponsePrompt as ResponsePrompt, type ResponseQueuedEvent as ResponseQueuedEvent, type ResponseReasoningDeltaEvent as ResponseReasoningDeltaEvent, type ResponseReasoningDoneEvent as ResponseReasoningDoneEvent, diff --git a/tests/api-resources/images.test.ts b/tests/api-resources/images.test.ts index ba62d993c..2fcfd34c8 100644 --- a/tests/api-resources/images.test.ts +++ b/tests/api-resources/images.test.ts @@ -54,6 +54,8 @@ describe('resource images', () => { mask: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'string', n: 1, + output_compression: 100, + output_format: 'png', quality: 'high', response_format: 'url', size: '1024x1024', diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index f1480f8c3..afe5a293a 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -30,6 +30,7 @@ describe('resource responses', () => { metadata: { foo: 'string' }, parallel_tool_calls: true, previous_response_id: 'previous_response_id', + prompt: { id: 'id', variables: { foo: 'string' }, version: 'version' }, reasoning: { effort: 'low', generate_summary: 'auto', summary: 'auto' }, service_tier: 'auto', store: true, From 079c2abbf7fa6364daab863797e48c119b096436 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 18:29:02 +0000 Subject: [PATCH 490/509] release: 5.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 20 ++++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ce65b73e4..448d10afc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.3.0" + ".": "5.4.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1446910c6..a3b2d6ccb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 5.4.0 (2025-06-16) + +Full Changelog: [v5.3.0...v5.4.0](https://github.com/openai/openai-node/compare/v5.3.0...v5.4.0) + +### Features + +* **api:** add reusable prompt IDs ([c720bb3](https://github.com/openai/openai-node/commit/c720bb3fb909cdef1cc679df38357f046d3d2756)) +* **client:** add support for endpoint-specific base URLs ([05f558b](https://github.com/openai/openai-node/commit/05f558bcdd362ae56000fe515a24593363d59e83)) + + +### Bug Fixes + +* publish script — handle NPM errors correctly ([a803cce](https://github.com/openai/openai-node/commit/a803cce6d44116eaba34f2bd7cb0f5d8f5c72be8)) + + +### Chores + +* **client:** refactor imports ([9eb4470](https://github.com/openai/openai-node/commit/9eb44703432d7e22290564013f8e1798c82918a3)) +* **internal:** add pure annotations, make base APIResource abstract ([418eb02](https://github.com/openai/openai-node/commit/418eb02e3ebe3ef58d851405f9eb5cae275194b4)) + ## 5.3.0 (2025-06-10) Full Changelog: [v5.2.0...v5.3.0](https://github.com/openai/openai-node/compare/v5.2.0...v5.3.0) diff --git a/jsr.json b/jsr.json index d079c8f25..4d018d709 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.3.0", + "version": "5.4.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index c865c9d0c..0aeb9e260 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.3.0", + "version": "5.4.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index b17877a92..0e5f6f831 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.3.0'; // x-release-please-version +export const VERSION = '5.4.0'; // x-release-please-version From ab6b57c241dc7c57e411fae572842da801e9828b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 19:05:07 +0000 Subject: [PATCH 491/509] feat(api): manual updates --- .stats.yml | 2 +- api.md | 2 +- .../fine-tuning/checkpoints/checkpoints.ts | 2 + .../fine-tuning/checkpoints/index.ts | 1 + .../fine-tuning/checkpoints/permissions.ts | 88 ++++++++----------- 5 files changed, 40 insertions(+), 55 deletions(-) diff --git a/.stats.yml b/.stats.yml index feda32cff..7e42b77a2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946 -config_hash: fd2af1d5eff0995bb7dc02ac9a34851d +config_hash: dc5515e257676a27cb1ace1784aa92b3 diff --git a/api.md b/api.md index 4e2de3252..284ecf469 100644 --- a/api.md +++ b/api.md @@ -259,7 +259,7 @@ Types: Methods: - client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage -- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse +- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponsesPage - client.fineTuning.checkpoints.permissions.delete(permissionID, { ...params }) -> PermissionDeleteResponse ## Alpha diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts index da055b0e4..124c7faaf 100644 --- a/src/resources/fine-tuning/checkpoints/checkpoints.ts +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -10,6 +10,7 @@ import { PermissionDeleteResponse, PermissionRetrieveParams, PermissionRetrieveResponse, + PermissionRetrieveResponsesPage, Permissions, } from './permissions'; @@ -26,6 +27,7 @@ export declare namespace Checkpoints { type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionRetrieveResponsesPage as PermissionRetrieveResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, type PermissionDeleteParams as PermissionDeleteParams, diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts index 7e04fc667..0457329bc 100644 --- a/src/resources/fine-tuning/checkpoints/index.ts +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -10,4 +10,5 @@ export { type PermissionRetrieveParams, type PermissionDeleteParams, type PermissionCreateResponsesPage, + type PermissionRetrieveResponsesPage, } from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index 9217f324c..75b89090e 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; -import { Page, PagePromise } from '../../../core/pagination'; +import { CursorPage, type CursorPageParams, Page, PagePromise } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; @@ -44,21 +44,24 @@ export class Permissions extends APIResource { * * @example * ```ts - * const permission = - * await client.fineTuning.checkpoints.permissions.retrieve( - * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', - * ); + * // Automatically fetches more pages as needed. + * for await (const permissionRetrieveResponse of client.fineTuning.checkpoints.permissions.retrieve( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * )) { + * // ... + * } * ``` */ retrieve( fineTunedModelCheckpoint: string, query: PermissionRetrieveParams | null | undefined = {}, options?: RequestOptions, - ): APIPromise { - return this._client.get(path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, { - query, - ...options, - }); + ): PagePromise { + return this._client.getAPIList( + path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, + CursorPage, + { query, ...options }, + ); } /** @@ -95,6 +98,8 @@ export class Permissions extends APIResource { // Note: no pagination actually occurs yet, this is for forwards-compatibility. export type PermissionCreateResponsesPage = Page; +export type PermissionRetrieveResponsesPage = CursorPage; + /** * The `checkpoint.permission` object represents a permission for a fine-tuned * model checkpoint. @@ -121,44 +126,30 @@ export interface PermissionCreateResponse { project_id: string; } +/** + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. + */ export interface PermissionRetrieveResponse { - data: Array; - - has_more: boolean; - - object: 'list'; - - first_id?: string | null; - - last_id?: string | null; -} - -export namespace PermissionRetrieveResponse { /** - * The `checkpoint.permission` object represents a permission for a fine-tuned - * model checkpoint. + * The permission identifier, which can be referenced in the API endpoints. */ - export interface Data { - /** - * The permission identifier, which can be referenced in the API endpoints. - */ - id: string; + id: string; - /** - * The Unix timestamp (in seconds) for when the permission was created. - */ - created_at: number; + /** + * 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 object type, which is always "checkpoint.permission". + */ + object: 'checkpoint.permission'; - /** - * The project identifier that the permission is for. - */ - project_id: string; - } + /** + * The project identifier that the permission is for. + */ + project_id: string; } export interface PermissionDeleteResponse { @@ -185,17 +176,7 @@ export interface PermissionCreateParams { project_ids: Array; } -export interface PermissionRetrieveParams { - /** - * Identifier for the last permission ID from the previous pagination request. - */ - after?: string; - - /** - * Number of permissions to retrieve. - */ - limit?: number; - +export interface PermissionRetrieveParams extends CursorPageParams { /** * The order in which to retrieve permissions. */ @@ -220,6 +201,7 @@ export declare namespace Permissions { type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, + type PermissionRetrieveResponsesPage as PermissionRetrieveResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, type PermissionDeleteParams as PermissionDeleteParams, From 52726ae4225c907e9b576624effbbe9ddfcb3124 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 19:05:35 +0000 Subject: [PATCH 492/509] release: 5.5.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 448d10afc..9bf38528e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.4.0" + ".": "5.5.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a3b2d6ccb..a1468adc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 5.5.0 (2025-06-16) + +Full Changelog: [v5.4.0...v5.5.0](https://github.com/openai/openai-node/compare/v5.4.0...v5.5.0) + +### Features + +* **api:** manual updates ([ab6b57c](https://github.com/openai/openai-node/commit/ab6b57c241dc7c57e411fae572842da801e9828b)) + ## 5.4.0 (2025-06-16) Full Changelog: [v5.3.0...v5.4.0](https://github.com/openai/openai-node/compare/v5.3.0...v5.4.0) diff --git a/jsr.json b/jsr.json index 4d018d709..3c60db04f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.4.0", + "version": "5.5.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 0aeb9e260..360116934 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.4.0", + "version": "5.5.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 0e5f6f831..6e85b9937 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.4.0'; // x-release-please-version +export const VERSION = '5.5.0'; // x-release-please-version From e1cf00cf2a2ce832d759f3253f10826d3c16338e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 00:08:59 +0000 Subject: [PATCH 493/509] chore(ci): enable for pull requests --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 99a5453f2..8ca5d8263 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,10 @@ on: - 'integrated/**' - 'stl-preview-head/**' - 'stl-preview-base/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: From d289711b7ee66ba764c142990efe7e533385a450 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 05:08:04 +0000 Subject: [PATCH 494/509] release: 5.5.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9bf38528e..59668eb2e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.5.0" + ".": "5.5.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index a1468adc7..dfe614af4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 5.5.1 (2025-06-17) + +Full Changelog: [v5.5.0...v5.5.1](https://github.com/openai/openai-node/compare/v5.5.0...v5.5.1) + +### Chores + +* **ci:** enable for pull requests ([e1cf00c](https://github.com/openai/openai-node/commit/e1cf00cf2a2ce832d759f3253f10826d3c16338e)) + ## 5.5.0 (2025-06-16) Full Changelog: [v5.4.0...v5.5.0](https://github.com/openai/openai-node/compare/v5.4.0...v5.5.0) diff --git a/jsr.json b/jsr.json index 3c60db04f..6f6ae50c4 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.5.0", + "version": "5.5.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 360116934..83d0981a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.5.0", + "version": "5.5.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 6e85b9937..880604599 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.5.0'; // x-release-please-version +export const VERSION = '5.5.1'; // x-release-please-version From 059e83ddc09223ba717f2687107b9ca4d3c72135 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:21:36 -0700 Subject: [PATCH 495/509] Merge pull request #1550 from openai/release-please--branches--master--changes--next--components--openai release: 5.6.0 --- .release-please-manifest.json | 2 +- .stats.yml | 4 +- CHANGELOG.md | 19 +++++++ README.md | 7 ++- jsr.json | 2 +- package.json | 2 +- src/client.ts | 1 + src/resources/responses/responses.ts | 49 +++++++++---------- src/version.ts | 2 +- .../api-resources/responses/responses.test.ts | 38 +------------- 10 files changed, 54 insertions(+), 72 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 59668eb2e..d49c9e283 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.5.1" + ".": "5.6.0" } diff --git a/.stats.yml b/.stats.yml index 7e42b77a2..f8abf5bab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-9e41d2d5471d2c28bff0d616f4476f5b0e6c541ef4cb51bdaaef5fdf5e13c8b2.yml -openapi_spec_hash: 86f765e18d00e32cf2ce9db7ab84d946 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f411a68f272b8be0ab0c266043da33228687b9b2d76896724e3cef797de9563d.yml +openapi_spec_hash: 89bf866ea95ecfb3d76c8833237047d6 config_hash: dc5515e257676a27cb1ace1784aa92b3 diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe614af4..69faf741c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## 5.6.0 (2025-06-20) + +Full Changelog: [v5.5.1...v5.6.0](https://github.com/openai/openai-node/compare/v5.5.1...v5.6.0) + +### Features + +* **api:** make model and inputs not required to create response ([52211c0](https://github.com/openai/openai-node/commit/52211c0e67c2926b27f4adee1f626066d90b6a2e)) + + +### Bug Fixes + +* **client:** explicitly copy fetch in withOptions ([0efacae](https://github.com/openai/openai-node/commit/0efacaeb8eb0bfbad6bd6bc29fc57f00916411c0)) + + +### Chores + +* **readme:** update badges ([6898954](https://github.com/openai/openai-node/commit/689895400adf38e85810ba8b63dc16ed56839ddd)) +* **readme:** use better example snippet for undocumented params ([668611f](https://github.com/openai/openai-node/commit/668611f4331ffa375257f3bc138c54d6ee965cd6)) + ## 5.5.1 (2025-06-17) Full Changelog: [v5.5.0...v5.5.1](https://github.com/openai/openai-node/compare/v5.5.0...v5.5.1) diff --git a/README.md b/README.md index 77a98746c..e3d918d36 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenAI TypeScript and JavaScript API Library -[![NPM version](https://img.shields.io/npm/v/openai.svg)](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) +[![NPM version]()](https://npmjs.org/package/openai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/openai) [![JSR Version](https://jsr.io/badges/@openai/openai)](https://jsr.io/@openai/openai) This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript. @@ -474,9 +474,8 @@ parameter. This library doesn't validate at runtime that the request matches the send will be sent as-is. ```ts -client.foo.create({ - foo: 'my_param', - bar: 12, +client.chat.completions.create({ + // ... // @ts-expect-error baz is not yet public baz: 'undocumented option', }); diff --git a/jsr.json b/jsr.json index 6f6ae50c4..9ab74ece3 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.5.1", + "version": "5.6.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 83d0981a4..d124e6854 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.5.1", + "version": "5.6.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index f33e13ead..d551854d7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -364,6 +364,7 @@ export class OpenAI { timeout: this.timeout, logger: this.logger, logLevel: this.logLevel, + fetch: this.fetch, fetchOptions: this.fetchOptions, apiKey: this.apiKey, organization: this.organization, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 1cb0788e0..69c5d8cbe 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -73,10 +73,7 @@ export class Responses extends APIResource { * * @example * ```ts - * const response = await client.responses.create({ - * input: 'string', - * model: 'gpt-4o', - * }); + * const response = await client.responses.create(); * ``` */ create(body: ResponseCreateParamsNonStreaming, options?: RequestOptions): APIPromise; @@ -4592,28 +4589,6 @@ export namespace WebSearchTool { export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming; export interface ResponseCreateParamsBase { - /** - * Text, image, or file inputs to the model, used to generate a response. - * - * Learn more: - * - * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) - * - [Image inputs](https://platform.openai.com/docs/guides/images) - * - [File inputs](https://platform.openai.com/docs/guides/pdf-files) - * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) - * - [Function calling](https://platform.openai.com/docs/guides/function-calling) - */ - input: string | ResponseInput; - - /** - * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a - * wide range of models with different capabilities, performance characteristics, - * and price points. Refer to the - * [model guide](https://platform.openai.com/docs/models) to browse and compare - * available models. - */ - model: Shared.ResponsesModel; - /** * Whether to run the model response in the background. * [Learn more](https://platform.openai.com/docs/guides/background). @@ -4639,6 +4614,19 @@ export interface ResponseCreateParamsBase { */ include?: Array | null; + /** + * Text, image, or file inputs to the model, used to generate a response. + * + * Learn more: + * + * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text) + * - [Image inputs](https://platform.openai.com/docs/guides/images) + * - [File inputs](https://platform.openai.com/docs/guides/pdf-files) + * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state) + * - [Function calling](https://platform.openai.com/docs/guides/function-calling) + */ + input?: string | ResponseInput; + /** * A system (or developer) message inserted into the model's context. * @@ -4665,6 +4653,15 @@ export interface ResponseCreateParamsBase { */ metadata?: Shared.Metadata | null; + /** + * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI offers a + * wide range of models with different capabilities, performance characteristics, + * and price points. Refer to the + * [model guide](https://platform.openai.com/docs/models) to browse and compare + * available models. + */ + model?: Shared.ResponsesModel; + /** * Whether to allow the model to run tool calls in parallel. */ diff --git a/src/version.ts b/src/version.ts index 880604599..a0cba220f 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.5.1'; // x-release-please-version +export const VERSION = '5.6.0'; // x-release-please-version diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index afe5a293a..4c33de115 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -8,8 +8,8 @@ const client = new OpenAI({ }); describe('resource responses', () => { - test('create: only required params', async () => { - const responsePromise = client.responses.create({ input: 'string', model: 'gpt-4o' }); + test('create', async () => { + const responsePromise = client.responses.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -19,40 +19,6 @@ describe('resource responses', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { - const response = await client.responses.create({ - input: 'string', - model: 'gpt-4o', - background: true, - include: ['file_search_call.results'], - instructions: 'instructions', - max_output_tokens: 0, - metadata: { foo: 'string' }, - parallel_tool_calls: true, - previous_response_id: 'previous_response_id', - prompt: { id: 'id', variables: { foo: 'string' }, version: 'version' }, - reasoning: { effort: 'low', generate_summary: 'auto', summary: 'auto' }, - service_tier: 'auto', - store: true, - stream: false, - temperature: 1, - text: { format: { type: 'text' } }, - tool_choice: 'none', - tools: [ - { - name: 'name', - parameters: { foo: 'bar' }, - strict: true, - type: 'function', - description: 'description', - }, - ], - top_p: 1, - truncation: 'auto', - user: 'user-1234', - }); - }); - test('retrieve', async () => { const responsePromise = client.responses.retrieve('resp_677efb5139a88190b512bc3fef8e535d'); const rawResponse = await responsePromise.asResponse(); From f2100e89334753e7f580f7f20f48b43eb8ba2fe3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:18:04 +0000 Subject: [PATCH 496/509] feat(api): update api shapes for usage and code interpreter --- .stats.yml | 6 +- api.md | 2 +- src/resources/audio/speech.ts | 8 +- src/resources/audio/transcriptions.ts | 141 ++++++++++++++++++ src/resources/beta/realtime/realtime.ts | 12 +- src/resources/beta/realtime/sessions.ts | 17 +-- .../fine-tuning/checkpoints/checkpoints.ts | 2 - .../fine-tuning/checkpoints/index.ts | 1 - .../fine-tuning/checkpoints/permissions.ts | 88 ++++++----- src/resources/responses/responses.ts | 116 +++++++------- tests/api-resources/audio/speech.test.ts | 1 + 11 files changed, 285 insertions(+), 109 deletions(-) diff --git a/.stats.yml b/.stats.yml index f8abf5bab..1e0182cf2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f411a68f272b8be0ab0c266043da33228687b9b2d76896724e3cef797de9563d.yml -openapi_spec_hash: 89bf866ea95ecfb3d76c8833237047d6 -config_hash: dc5515e257676a27cb1ace1784aa92b3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ef4ecb19eb61e24c49d77fef769ee243e5279bc0bdbaee8d0f8dba4da8722559.yml +openapi_spec_hash: 1b8a9767c9f04e6865b06c41948cdc24 +config_hash: fd2af1d5eff0995bb7dc02ac9a34851d diff --git a/api.md b/api.md index 284ecf469..4e2de3252 100644 --- a/api.md +++ b/api.md @@ -259,7 +259,7 @@ Types: Methods: - client.fineTuning.checkpoints.permissions.create(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage -- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponsesPage +- client.fineTuning.checkpoints.permissions.retrieve(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse - client.fineTuning.checkpoints.permissions.delete(permissionID, { ...params }) -> PermissionDeleteResponse ## Alpha diff --git a/src/resources/audio/speech.ts b/src/resources/audio/speech.ts index 41d890ccf..6bb092863 100644 --- a/src/resources/audio/speech.ts +++ b/src/resources/audio/speech.ts @@ -79,9 +79,15 @@ export interface SpeechCreateParams { /** * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is - * the default. Does not work with `gpt-4o-mini-tts`. + * the default. */ speed?: number; + + /** + * The format to stream the audio in. Supported formats are `sse` and `audio`. + * `sse` is not supported for `tts-1` or `tts-1-hd`. + */ + stream_format?: 'sse' | 'audio'; } export declare namespace Speech { diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 33622bb84..1a3e22af7 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -78,6 +78,11 @@ export interface Transcription { * to the `include` array. */ logprobs?: Array; + + /** + * Token usage statistics for the request. + */ + usage?: Transcription.Tokens | Transcription.Duration; } export namespace Transcription { @@ -97,6 +102,68 @@ export namespace Transcription { */ logprob?: number; } + + /** + * Usage statistics for models billed by token usage. + */ + export interface Tokens { + /** + * Number of input tokens billed for this request. + */ + input_tokens: number; + + /** + * Number of output tokens generated. + */ + output_tokens: number; + + /** + * Total number of tokens used (input + output). + */ + total_tokens: number; + + /** + * The type of the usage object. Always `tokens` for this variant. + */ + type: 'tokens'; + + /** + * Details about the input tokens billed for this request. + */ + input_token_details?: Tokens.InputTokenDetails; + } + + export namespace Tokens { + /** + * Details about the input tokens billed for this request. + */ + export interface InputTokenDetails { + /** + * Number of audio tokens billed for this request. + */ + audio_tokens?: number; + + /** + * Number of text tokens billed for this request. + */ + text_tokens?: number; + } + } + + /** + * Usage statistics for models billed by audio input duration. + */ + export interface Duration { + /** + * Duration of the input audio in seconds. + */ + duration: number; + + /** + * The type of the usage object. Always `duration` for this variant. + */ + type: 'duration'; + } } export type TranscriptionInclude = 'logprobs'; @@ -232,6 +299,11 @@ export interface TranscriptionTextDoneEvent { * with the `include[]` parameter set to `logprobs`. */ logprobs?: Array; + + /** + * Usage statistics for models billed by token usage. + */ + usage?: TranscriptionTextDoneEvent.Usage; } export namespace TranscriptionTextDoneEvent { @@ -251,6 +323,53 @@ export namespace TranscriptionTextDoneEvent { */ logprob?: number; } + + /** + * Usage statistics for models billed by token usage. + */ + export interface Usage { + /** + * Number of input tokens billed for this request. + */ + input_tokens: number; + + /** + * Number of output tokens generated. + */ + output_tokens: number; + + /** + * Total number of tokens used (input + output). + */ + total_tokens: number; + + /** + * The type of the usage object. Always `tokens` for this variant. + */ + type: 'tokens'; + + /** + * Details about the input tokens billed for this request. + */ + input_token_details?: Usage.InputTokenDetails; + } + + export namespace Usage { + /** + * Details about the input tokens billed for this request. + */ + export interface InputTokenDetails { + /** + * Number of audio tokens billed for this request. + */ + audio_tokens?: number; + + /** + * Number of text tokens billed for this request. + */ + text_tokens?: number; + } + } } /** @@ -278,12 +397,34 @@ export interface TranscriptionVerbose { */ segments?: Array; + /** + * Usage statistics for models billed by audio input duration. + */ + usage?: TranscriptionVerbose.Usage; + /** * Extracted words and their corresponding timestamps. */ words?: Array; } +export namespace TranscriptionVerbose { + /** + * Usage statistics for models billed by audio input duration. + */ + export interface Usage { + /** + * Duration of the input audio in seconds. + */ + duration: number; + + /** + * The type of the usage object. Always `duration` for this variant. + */ + type: 'duration'; + } +} + export interface TranscriptionWord { /** * End time of the word in seconds. diff --git a/src/resources/beta/realtime/realtime.ts b/src/resources/beta/realtime/realtime.ts index 5f38aae3a..c7e7712ec 100644 --- a/src/resources/beta/realtime/realtime.ts +++ b/src/resources/beta/realtime/realtime.ts @@ -279,9 +279,9 @@ export interface ConversationItemDeletedEvent { * the Response events. * * Realtime API models accept audio natively, and thus input transcription is a - * separate process run on a separate ASR (Automatic Speech Recognition) model, - * currently always `whisper-1`. Thus the transcript may diverge somewhat from the - * model's interpretation, and should be treated as a rough guide. + * separate process run on a separate ASR (Automatic Speech Recognition) model. The + * transcript may diverge somewhat from the model's interpretation, and should be + * treated as a rough guide. */ export interface ConversationItemInputAudioTranscriptionCompletedEvent { /** @@ -2248,19 +2248,19 @@ export namespace SessionUpdateEvent { /** * Configuration for the ephemeral token expiration. */ - expires_at?: ClientSecret.ExpiresAt; + expires_after?: ClientSecret.ExpiresAfter; } export namespace ClientSecret { /** * Configuration for the ephemeral token expiration. */ - export interface ExpiresAt { + export interface ExpiresAfter { /** * The anchor point for the ephemeral token expiration. Only `created_at` is * currently supported. */ - anchor?: 'created_at'; + anchor: 'created_at'; /** * The number of seconds from the anchor point to the expiration. Select a value diff --git a/src/resources/beta/realtime/sessions.ts b/src/resources/beta/realtime/sessions.ts index d39d2d202..b3a4eda8d 100644 --- a/src/resources/beta/realtime/sessions.ts +++ b/src/resources/beta/realtime/sessions.ts @@ -356,8 +356,8 @@ export interface SessionCreateResponse { * 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 and should be treated as rough guidance rather than the + * representation understood by the model. */ input_audio_transcription?: SessionCreateResponse.InputAudioTranscription; @@ -476,13 +476,12 @@ export namespace SessionCreateResponse { * 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 and should be treated as rough guidance rather than the + * representation understood by the model. */ export interface InputAudioTranscription { /** - * The model to use for transcription, `whisper-1` is the only currently supported - * model. + * The model to use for transcription. */ model?: string; } @@ -721,19 +720,19 @@ export namespace SessionCreateParams { /** * Configuration for the ephemeral token expiration. */ - expires_at?: ClientSecret.ExpiresAt; + expires_after?: ClientSecret.ExpiresAfter; } export namespace ClientSecret { /** * Configuration for the ephemeral token expiration. */ - export interface ExpiresAt { + export interface ExpiresAfter { /** * The anchor point for the ephemeral token expiration. Only `created_at` is * currently supported. */ - anchor?: 'created_at'; + anchor: 'created_at'; /** * The number of seconds from the anchor point to the expiration. Select a value diff --git a/src/resources/fine-tuning/checkpoints/checkpoints.ts b/src/resources/fine-tuning/checkpoints/checkpoints.ts index 124c7faaf..da055b0e4 100644 --- a/src/resources/fine-tuning/checkpoints/checkpoints.ts +++ b/src/resources/fine-tuning/checkpoints/checkpoints.ts @@ -10,7 +10,6 @@ import { PermissionDeleteResponse, PermissionRetrieveParams, PermissionRetrieveResponse, - PermissionRetrieveResponsesPage, Permissions, } from './permissions'; @@ -27,7 +26,6 @@ export declare namespace Checkpoints { type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, - type PermissionRetrieveResponsesPage as PermissionRetrieveResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, type PermissionDeleteParams as PermissionDeleteParams, diff --git a/src/resources/fine-tuning/checkpoints/index.ts b/src/resources/fine-tuning/checkpoints/index.ts index 0457329bc..7e04fc667 100644 --- a/src/resources/fine-tuning/checkpoints/index.ts +++ b/src/resources/fine-tuning/checkpoints/index.ts @@ -10,5 +10,4 @@ export { type PermissionRetrieveParams, type PermissionDeleteParams, type PermissionCreateResponsesPage, - type PermissionRetrieveResponsesPage, } from './permissions'; diff --git a/src/resources/fine-tuning/checkpoints/permissions.ts b/src/resources/fine-tuning/checkpoints/permissions.ts index 75b89090e..9217f324c 100644 --- a/src/resources/fine-tuning/checkpoints/permissions.ts +++ b/src/resources/fine-tuning/checkpoints/permissions.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../../core/resource'; import { APIPromise } from '../../../core/api-promise'; -import { CursorPage, type CursorPageParams, Page, PagePromise } from '../../../core/pagination'; +import { Page, PagePromise } from '../../../core/pagination'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; @@ -44,24 +44,21 @@ export class Permissions extends APIResource { * * @example * ```ts - * // Automatically fetches more pages as needed. - * for await (const permissionRetrieveResponse of client.fineTuning.checkpoints.permissions.retrieve( - * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', - * )) { - * // ... - * } + * const permission = + * await client.fineTuning.checkpoints.permissions.retrieve( + * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F', + * ); * ``` */ retrieve( fineTunedModelCheckpoint: string, query: PermissionRetrieveParams | null | undefined = {}, options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList( - path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, - CursorPage, - { query, ...options }, - ); + ): APIPromise { + return this._client.get(path`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, { + query, + ...options, + }); } /** @@ -98,8 +95,6 @@ export class Permissions extends APIResource { // Note: no pagination actually occurs yet, this is for forwards-compatibility. export type PermissionCreateResponsesPage = Page; -export type PermissionRetrieveResponsesPage = CursorPage; - /** * The `checkpoint.permission` object represents a permission for a fine-tuned * model checkpoint. @@ -126,30 +121,44 @@ export interface PermissionCreateResponse { project_id: string; } -/** - * The `checkpoint.permission` object represents a permission for a fine-tuned - * model checkpoint. - */ export interface PermissionRetrieveResponse { - /** - * The permission identifier, which can be referenced in the API endpoints. - */ - id: string; + data: Array; - /** - * The Unix timestamp (in seconds) for when the permission was created. - */ - created_at: number; + has_more: boolean; - /** - * The object type, which is always "checkpoint.permission". - */ - object: 'checkpoint.permission'; + object: 'list'; + first_id?: string | null; + + last_id?: string | null; +} + +export namespace PermissionRetrieveResponse { /** - * The project identifier that the permission is for. + * The `checkpoint.permission` object represents a permission for a fine-tuned + * model checkpoint. */ - project_id: string; + export interface Data { + /** + * 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 { @@ -176,7 +185,17 @@ export interface PermissionCreateParams { project_ids: Array; } -export interface PermissionRetrieveParams extends CursorPageParams { +export interface PermissionRetrieveParams { + /** + * Identifier for the last permission ID from the previous pagination request. + */ + after?: string; + + /** + * Number of permissions to retrieve. + */ + limit?: number; + /** * The order in which to retrieve permissions. */ @@ -201,7 +220,6 @@ export declare namespace Permissions { type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, - type PermissionRetrieveResponsesPage as PermissionRetrieveResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, type PermissionDeleteParams as PermissionDeleteParams, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 69c5d8cbe..0044e82eb 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -623,21 +623,27 @@ export interface ResponseAudioTranscriptDoneEvent { } /** - * Emitted when a partial code snippet is added by the code interpreter. + * Emitted when a partial code snippet is streamed by the code interpreter. */ export interface ResponseCodeInterpreterCallCodeDeltaEvent { /** - * The partial code snippet added by the code interpreter. + * The partial code snippet being streamed by the code interpreter. */ delta: string; /** - * The index of the output item that the code interpreter call is in progress. + * The unique identifier of the code interpreter tool call item. + */ + item_id: string; + + /** + * The index of the output item in the response for which the code is being + * streamed. */ output_index: number; /** - * The sequence number of this event. + * The sequence number of this event, used to order streaming events. */ sequence_number: number; @@ -648,7 +654,7 @@ export interface ResponseCodeInterpreterCallCodeDeltaEvent { } /** - * Emitted when code snippet output is finalized by the code interpreter. + * Emitted when the code snippet is finalized by the code interpreter. */ export interface ResponseCodeInterpreterCallCodeDoneEvent { /** @@ -657,12 +663,17 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent { code: string; /** - * The index of the output item that the code interpreter call is in progress. + * The unique identifier of the code interpreter tool call item. + */ + item_id: string; + + /** + * The index of the output item in the response for which the code is finalized. */ output_index: number; /** - * The sequence number of this event. + * The sequence number of this event, used to order streaming events. */ sequence_number: number; @@ -677,17 +688,18 @@ export interface ResponseCodeInterpreterCallCodeDoneEvent { */ export interface ResponseCodeInterpreterCallCompletedEvent { /** - * A tool call to run code. + * The unique identifier of the code interpreter tool call item. */ - code_interpreter_call: ResponseCodeInterpreterToolCall; + item_id: string; /** - * The index of the output item that the code interpreter call is in progress. + * The index of the output item in the response for which the code interpreter call + * is completed. */ output_index: number; /** - * The sequence number of this event. + * The sequence number of this event, used to order streaming events. */ sequence_number: number; @@ -702,17 +714,18 @@ export interface ResponseCodeInterpreterCallCompletedEvent { */ export interface ResponseCodeInterpreterCallInProgressEvent { /** - * A tool call to run code. + * The unique identifier of the code interpreter tool call item. */ - code_interpreter_call: ResponseCodeInterpreterToolCall; + item_id: string; /** - * The index of the output item that the code interpreter call is in progress. + * The index of the output item in the response for which the code interpreter call + * is in progress. */ output_index: number; /** - * The sequence number of this event. + * The sequence number of this event, used to order streaming events. */ sequence_number: number; @@ -727,17 +740,18 @@ export interface ResponseCodeInterpreterCallInProgressEvent { */ export interface ResponseCodeInterpreterCallInterpretingEvent { /** - * A tool call to run code. + * The unique identifier of the code interpreter tool call item. */ - code_interpreter_call: ResponseCodeInterpreterToolCall; + item_id: string; /** - * The index of the output item that the code interpreter call is in progress. + * The index of the output item in the response for which the code interpreter is + * interpreting code. */ output_index: number; /** - * The sequence number of this event. + * The sequence number of this event, used to order streaming events. */ sequence_number: number; @@ -757,71 +771,61 @@ export interface ResponseCodeInterpreterToolCall { id: string; /** - * The code to run. + * The code to run, or null if not available. */ - code: string; + code: string | null; /** - * The results of the code interpreter tool call. + * The ID of the container used to run the code. */ - results: Array; + container_id: string; /** - * The status of the code interpreter tool call. + * The outputs generated by the code interpreter, such as logs or images. Can be + * null if no outputs are available. */ - status: 'in_progress' | 'interpreting' | 'completed'; + outputs: Array | null; /** - * The type of the code interpreter tool call. Always `code_interpreter_call`. + * The status of the code interpreter tool call. */ - type: 'code_interpreter_call'; + status: 'in_progress' | 'completed' | 'incomplete' | 'interpreting' | 'failed'; /** - * The ID of the container used to run the code. + * The type of the code interpreter tool call. Always `code_interpreter_call`. */ - container_id?: string; + type: 'code_interpreter_call'; } export namespace ResponseCodeInterpreterToolCall { /** - * The output of a code interpreter tool call that is text. + * The logs output from the code interpreter. */ export interface Logs { /** - * The logs of the code interpreter tool call. + * The logs output from the code interpreter. */ logs: string; /** - * The type of the code interpreter text output. Always `logs`. + * The type of the output. Always 'logs'. */ type: 'logs'; } /** - * The output of a code interpreter tool call that is a file. + * The image output from the code interpreter. */ - export interface Files { - files: Array; - + export interface Image { /** - * The type of the code interpreter file output. Always `files`. + * The type of the output. Always 'image'. */ - type: 'files'; - } + type: 'image'; - export namespace Files { - export interface File { - /** - * The ID of the file. - */ - file_id: string; - - /** - * The MIME type of the file. - */ - mime_type: string; - } + /** + * The URL of the image output from the code interpreter. + */ + url: string; } } @@ -3327,6 +3331,11 @@ export namespace ResponseOutputText { */ file_id: string; + /** + * The filename of the file cited. + */ + filename: string; + /** * The index of the file in the list of files. */ @@ -3387,6 +3396,11 @@ export namespace ResponseOutputText { */ file_id: string; + /** + * The filename of the container file cited. + */ + filename: string; + /** * The index of the first character of the container file citation in the message. */ diff --git a/tests/api-resources/audio/speech.test.ts b/tests/api-resources/audio/speech.test.ts index 191c6a313..63d945ea4 100644 --- a/tests/api-resources/audio/speech.test.ts +++ b/tests/api-resources/audio/speech.test.ts @@ -17,6 +17,7 @@ describe('resource speech', () => { instructions: 'instructions', response_format: 'mp3', speed: 0.25, + stream_format: 'sse', }); }); }); From 9ee48aa7c783bcc58d346e122f388a836f745e54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 18:18:39 +0000 Subject: [PATCH 497/509] release: 5.7.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d49c9e283..68f9449d5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.6.0" + ".": "5.7.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 69faf741c..3ec8b483e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 5.7.0 (2025-06-23) + +Full Changelog: [v5.6.0...v5.7.0](https://github.com/openai/openai-node/compare/v5.6.0...v5.7.0) + +### Features + +* **api:** update api shapes for usage and code interpreter ([f2100e8](https://github.com/openai/openai-node/commit/f2100e89334753e7f580f7f20f48b43eb8ba2fe3)) + ## 5.6.0 (2025-06-20) Full Changelog: [v5.5.1...v5.6.0](https://github.com/openai/openai-node/compare/v5.5.1...v5.6.0) diff --git a/jsr.json b/jsr.json index 9ab74ece3..83eda605f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.6.0", + "version": "5.7.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index d124e6854..94babf897 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.6.0", + "version": "5.7.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index a0cba220f..3d3704645 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.6.0'; // x-release-please-version +export const VERSION = '5.7.0'; // x-release-please-version From 7865910c7d66a14dac70ea119e109975d9169414 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 19:18:36 +0000 Subject: [PATCH 498/509] refactor(types): replace Record with mapped types --- src/resources/chat/completions/completions.ts | 2 +- src/resources/completions.ts | 4 +-- src/resources/evals/evals.ts | 18 ++++++------ src/resources/evals/runs/output-items.ts | 8 +++--- src/resources/evals/runs/runs.ts | 28 +++++++++---------- src/resources/fine-tuning/alpha/graders.ts | 6 ++-- src/resources/fine-tuning/jobs/jobs.ts | 2 +- src/resources/responses/responses.ts | 16 +++++------ src/resources/shared.ts | 6 ++-- src/resources/vector-stores/file-batches.ts | 2 +- src/resources/vector-stores/files.ts | 6 ++-- src/resources/vector-stores/vector-stores.ts | 2 +- 12 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index a88e27e98..d62247b6b 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -1331,7 +1331,7 @@ export interface ChatCompletionCreateParamsBase { * increase likelihood of selection; values like -100 or 100 should result in a ban * or exclusive selection of the relevant token. */ - logit_bias?: Record | null; + logit_bias?: { [key: string]: number } | null; /** * Whether to return log probabilities of the output tokens or not. If true, diff --git a/src/resources/completions.ts b/src/resources/completions.ts index 042e51693..b15c3b5ad 100644 --- a/src/resources/completions.ts +++ b/src/resources/completions.ts @@ -103,7 +103,7 @@ export namespace CompletionChoice { tokens?: Array; - top_logprobs?: Array>; + top_logprobs?: Array<{ [key: string]: number }>; } } @@ -246,7 +246,7 @@ export interface CompletionCreateParamsBase { * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token * from being generated. */ - logit_bias?: Record | null; + logit_bias?: { [key: string]: number } | null; /** * Include the log probabilities on the `logprobs` most likely output tokens, as diff --git a/src/resources/evals/evals.ts b/src/resources/evals/evals.ts index cc563c78f..4af307fc7 100644 --- a/src/resources/evals/evals.ts +++ b/src/resources/evals/evals.ts @@ -89,7 +89,7 @@ export interface EvalCustomDataSourceConfig { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `custom`. @@ -105,7 +105,7 @@ export interface EvalStoredCompletionsDataSourceConfig { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `stored_completions`. @@ -195,7 +195,7 @@ export namespace EvalCreateResponse { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `logs`. @@ -316,7 +316,7 @@ export namespace EvalRetrieveResponse { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `logs`. @@ -437,7 +437,7 @@ export namespace EvalUpdateResponse { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `logs`. @@ -558,7 +558,7 @@ export namespace EvalListResponse { * The json schema for the run data source items. Learn how to build JSON schemas * [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of data source. Always `logs`. @@ -665,7 +665,7 @@ export namespace EvalCreateParams { /** * The json schema for each row in the data source. */ - item_schema: Record; + item_schema: { [key: string]: unknown }; /** * The type of data source. Always `custom`. @@ -692,7 +692,7 @@ export namespace EvalCreateParams { /** * Metadata filters for the logs data source. */ - metadata?: Record; + metadata?: { [key: string]: unknown }; } /** @@ -707,7 +707,7 @@ export namespace EvalCreateParams { /** * Metadata filters for the stored completions data source. */ - metadata?: Record; + metadata?: { [key: string]: unknown }; } /** diff --git a/src/resources/evals/runs/output-items.ts b/src/resources/evals/runs/output-items.ts index e7c33f27e..1aded2f91 100644 --- a/src/resources/evals/runs/output-items.ts +++ b/src/resources/evals/runs/output-items.ts @@ -56,7 +56,7 @@ export interface OutputItemRetrieveResponse { /** * Details of the input data source item. */ - datasource_item: Record; + datasource_item: { [key: string]: unknown }; /** * The identifier for the data source item. @@ -76,7 +76,7 @@ export interface OutputItemRetrieveResponse { /** * A list of results from the evaluation run. */ - results: Array>; + results: Array<{ [key: string]: unknown }>; /** * The identifier of the evaluation run associated with this output item. @@ -222,7 +222,7 @@ export interface OutputItemListResponse { /** * Details of the input data source item. */ - datasource_item: Record; + datasource_item: { [key: string]: unknown }; /** * The identifier for the data source item. @@ -242,7 +242,7 @@ export interface OutputItemListResponse { /** * A list of results from the evaluation run. */ - results: Array>; + results: Array<{ [key: string]: unknown }>; /** * The identifier of the evaluation run associated with this output item. diff --git a/src/resources/evals/runs/runs.ts b/src/resources/evals/runs/runs.ts index 5df206cb9..417b69515 100644 --- a/src/resources/evals/runs/runs.ts +++ b/src/resources/evals/runs/runs.ts @@ -125,9 +125,9 @@ export namespace CreateEvalCompletionsRunDataSource { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -330,9 +330,9 @@ export namespace CreateEvalJSONLRunDataSource { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -493,9 +493,9 @@ export namespace RunCreateResponse { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -940,9 +940,9 @@ export namespace RunRetrieveResponse { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -1384,9 +1384,9 @@ export namespace RunListResponse { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -1839,9 +1839,9 @@ export namespace RunCancelResponse { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } @@ -2233,9 +2233,9 @@ export namespace RunCreateParams { export namespace FileContent { export interface Content { - item: Record; + item: { [key: string]: unknown }; - sample?: Record; + sample?: { [key: string]: unknown }; } } diff --git a/src/resources/fine-tuning/alpha/graders.ts b/src/resources/fine-tuning/alpha/graders.ts index 17b53ba3b..273c7117e 100644 --- a/src/resources/fine-tuning/alpha/graders.ts +++ b/src/resources/fine-tuning/alpha/graders.ts @@ -52,11 +52,11 @@ export class Graders extends APIResource { export interface GraderRunResponse { metadata: GraderRunResponse.Metadata; - model_grader_token_usage_per_model: Record; + model_grader_token_usage_per_model: { [key: string]: unknown }; reward: number; - sub_rewards: Record; + sub_rewards: { [key: string]: unknown }; } export namespace GraderRunResponse { @@ -69,7 +69,7 @@ export namespace GraderRunResponse { sampled_model_name: string | null; - scores: Record; + scores: { [key: string]: unknown }; token_usage: number | null; diff --git a/src/resources/fine-tuning/jobs/jobs.ts b/src/resources/fine-tuning/jobs/jobs.ts index 7e8f672e5..91935a496 100644 --- a/src/resources/fine-tuning/jobs/jobs.ts +++ b/src/resources/fine-tuning/jobs/jobs.ts @@ -624,7 +624,7 @@ export interface JobListParams extends CursorPageParams { * Optional metadata filter. To filter, use the syntax `metadata[k]=v`. * Alternatively, set `metadata=null` to indicate no metadata. */ - metadata?: Record | null; + metadata?: { [key: string]: string } | null; } export interface JobListEventsParams extends CursorPageParams {} diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 0044e82eb..4e076aed4 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -312,7 +312,7 @@ export interface FunctionTool { /** * A JSON schema object describing the parameters of the function. */ - parameters: Record | null; + parameters: { [key: string]: unknown } | null; /** * Whether to enforce strict parameter validation. Default `true`. @@ -1491,7 +1491,7 @@ export namespace ResponseFileSearchToolCall { * length of 64 characters. Values are strings with a maximum length of 512 * characters, booleans, or numbers. */ - attributes?: Record | null; + attributes?: { [key: string]: string | number | boolean } | null; /** * The unique ID of the file. @@ -1551,7 +1551,7 @@ export interface ResponseFormatTextJSONSchemaConfig { * The schema for the response format, described as a JSON Schema object. Learn how * to build JSON schemas [here](https://json-schema.org/). */ - schema: Record; + schema: { [key: string]: unknown }; /** * The type of response format being defined. Always `json_schema`. @@ -2209,7 +2209,7 @@ export namespace ResponseInputItem { /** * Environment variables to set for the command. */ - env: Record; + env: { [key: string]: string }; /** * The type of the local shell action. Always `exec`. @@ -2571,7 +2571,7 @@ export namespace ResponseItem { /** * Environment variables to set for the command. */ - env: Record; + env: { [key: string]: string }; /** * The type of the local shell action. Always `exec`. @@ -3046,7 +3046,7 @@ export namespace ResponseOutputItem { /** * Environment variables to set for the command. */ - env: Record; + env: { [key: string]: string }; /** * The type of the local shell action. Always `exec`. @@ -3514,7 +3514,7 @@ export interface ResponsePrompt { * substitution values can either be strings, or other Response input types like * images or files. */ - variables?: Record | null; + variables?: { [key: string]: string | ResponseInputText | ResponseInputImage | ResponseInputFile } | null; /** * Optional version of the prompt template. @@ -4309,7 +4309,7 @@ export namespace Tool { * Optional HTTP headers to send to the MCP server. Use for authentication or other * purposes. */ - headers?: Record | null; + headers?: { [key: string]: string } | null; /** * Specify which of the MCP server's tools require approval. diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 32f87a5f8..468f21ade 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -165,7 +165,7 @@ export interface FunctionDefinition { * * Omitting `parameters` defines a function with an empty parameter list. */ -export type FunctionParameters = Record; +export type FunctionParameters = { [key: string]: unknown }; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful @@ -175,7 +175,7 @@ export type FunctionParameters = Record; * 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 type Metadata = { [key: string]: string }; /** * **o-series models only** @@ -271,7 +271,7 @@ export namespace ResponseFormatJSONSchema { * The schema for the response format, described as a JSON Schema object. Learn how * to build JSON schemas [here](https://json-schema.org/). */ - schema?: Record; + schema?: { [key: string]: unknown }; /** * Whether to enable strict schema adherence when generating the output. If set to diff --git a/src/resources/vector-stores/file-batches.ts b/src/resources/vector-stores/file-batches.ts index 5b5fddeb7..75b69b62f 100644 --- a/src/resources/vector-stores/file-batches.ts +++ b/src/resources/vector-stores/file-batches.ts @@ -269,7 +269,7 @@ export interface FileBatchCreateParams { * length of 64 characters. Values are strings with a maximum length of 512 * characters, booleans, or numbers. */ - attributes?: Record | null; + attributes?: { [key: string]: string | number | boolean } | null; /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` diff --git a/src/resources/vector-stores/files.ts b/src/resources/vector-stores/files.ts index d896352c8..d0cad22c4 100644 --- a/src/resources/vector-stores/files.ts +++ b/src/resources/vector-stores/files.ts @@ -249,7 +249,7 @@ export interface VectorStoreFile { * length of 64 characters. Values are strings with a maximum length of 512 * characters, booleans, or numbers. */ - attributes?: Record | null; + attributes?: { [key: string]: string | number | boolean } | null; /** * The strategy used to chunk the file. @@ -310,7 +310,7 @@ export interface FileCreateParams { * length of 64 characters. Values are strings with a maximum length of 512 * characters, booleans, or numbers. */ - attributes?: Record | null; + attributes?: { [key: string]: string | number | boolean } | null; /** * The chunking strategy used to chunk the file(s). If not set, will use the `auto` @@ -339,7 +339,7 @@ export interface FileUpdateParams { * strings with a maximum length of 64 characters. Values are strings with a * maximum length of 512 characters, booleans, or numbers. */ - attributes: Record | null; + attributes: { [key: string]: string | number | boolean } | null; } export interface FileListParams extends CursorPageParams { diff --git a/src/resources/vector-stores/vector-stores.ts b/src/resources/vector-stores/vector-stores.ts index de08d0494..fc81d007e 100644 --- a/src/resources/vector-stores/vector-stores.ts +++ b/src/resources/vector-stores/vector-stores.ts @@ -319,7 +319,7 @@ export interface VectorStoreSearchResponse { * length of 64 characters. Values are strings with a maximum length of 512 * characters, booleans, or numbers. */ - attributes: Record | null; + attributes: { [key: string]: string | number | boolean } | null; /** * Content chunks from the file. From 6cc5e968183c2b74360f1fc87b239fecaedfa2dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 20:28:08 +0000 Subject: [PATCH 499/509] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 1e0182cf2..f1e39057c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ef4ecb19eb61e24c49d77fef769ee243e5279bc0bdbaee8d0f8dba4da8722559.yml openapi_spec_hash: 1b8a9767c9f04e6865b06c41948cdc24 -config_hash: fd2af1d5eff0995bb7dc02ac9a34851d +config_hash: cae2d1f187b5b9f8dfa00daa807da42a From aed2587294922415aeaece0b9a6911c3e1577c51 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 14:04:35 +0000 Subject: [PATCH 500/509] =?UTF-8?q?fix(ci):=20release-doctor=20=E2=80=94?= =?UTF-8?q?=20report=20correct=20token=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish-jsr.yml | 4 ++-- .github/workflows/publish-npm.yml | 4 ++-- bin/check-release-environment | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-jsr.yml b/.github/workflows/publish-jsr.yml index e74673c1f..6e989c765 100644 --- a/.github/workflows/publish-jsr.yml +++ b/.github/workflows/publish-jsr.yml @@ -1,5 +1,5 @@ -# workflow for re-running publishing to JSR in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml +# This workflow publishes the package to JSR. +# You can run this workflow manually by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-jsr.yml name: Publish JSR on: workflow_dispatch: diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 0662a79c5..fe143837b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,5 +1,5 @@ -# workflow for re-running publishing to NPM in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml +# This workflow publishes the package to NPM. +# You can run this workflow manually by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml name: Publish NPM on: workflow_dispatch: diff --git a/bin/check-release-environment b/bin/check-release-environment index dbfd546bf..bcf856d18 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -7,7 +7,7 @@ if [ -z "${STAINLESS_API_KEY}" ]; then fi if [ -z "${NPM_TOKEN}" ]; then - errors+=("The OPENAI_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") + errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi lenErrors=${#errors[@]} From f2b4f66226ad514d702f8acbb4820ae90b4fd40e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:50:59 +0000 Subject: [PATCH 501/509] feat(api): webhook and deep research support --- .stats.yml | 6 +- README.md | 77 ++ api.md | 26 + src/client.ts | 17 + src/core/error.ts | 6 + src/index.ts | 1 + src/resources/chat/completions/completions.ts | 92 ++- src/resources/images.ts | 22 + src/resources/index.ts | 1 + src/resources/responses/responses.ts | 4 +- src/resources/shared.ts | 8 + src/resources/webhooks.ts | 767 ++++++++++++++++++ .../responses/input-items.test.ts | 8 +- .../api-resources/responses/responses.test.ts | 2 +- tests/api-resources/webhooks.test.ts | 203 +++++ 15 files changed, 1188 insertions(+), 52 deletions(-) create mode 100644 src/resources/webhooks.ts create mode 100644 tests/api-resources/webhooks.test.ts diff --git a/.stats.yml b/.stats.yml index f1e39057c..ebbf3ee29 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ef4ecb19eb61e24c49d77fef769ee243e5279bc0bdbaee8d0f8dba4da8722559.yml -openapi_spec_hash: 1b8a9767c9f04e6865b06c41948cdc24 -config_hash: cae2d1f187b5b9f8dfa00daa807da42a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-cca460eaf5cc13e9d6e5293eb97aac53d66dc1385c691f74b768c97d165b6e8b.yml +openapi_spec_hash: 9ec43d443b3dd58ca5aa87eb0a7eb49f +config_hash: e74d6791681e3af1b548748ff47a22c2 diff --git a/README.md b/README.md index e3d918d36..aff898be2 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,83 @@ await client.files.create({ }); ``` +## Webhook Verification + +Verifying webhook signatures is _optional but encouraged_. + +### Parsing webhook payloads + +For most use cases, you will likely want to verify the webhook and parse the payload at the same time. To achieve this, we provide the method `client.webhooks.unwrap()`, which parses a webhook request and verifies that it was sent by OpenAI. This method will throw an error if the signature is invalid. + +Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). The `.unwrap()` method will parse this JSON for you into an event object after verifying the webhook was sent from OpenAI. + +```ts +import { headers } from 'next/headers'; +import OpenAI from 'openai'; + +const client = new OpenAI({ + webhookSecret: process.env.OPENAI_WEBHOOK_SECRET, // env var used by default; explicit here. +}); + +export async function webhook(request: Request) { + const headersList = headers(); + const body = await request.text(); + + try { + const event = client.webhooks.unwrap(body, headersList); + + switch (event.type) { + case 'response.completed': + console.log('Response completed:', event.data); + break; + case 'response.failed': + console.log('Response failed:', event.data); + break; + default: + console.log('Unhandled event type:', event.type); + } + + return Response.json({ message: 'ok' }); + } catch (error) { + console.error('Invalid webhook signature:', error); + return new Response('Invalid signature', { status: 400 }); + } +} +``` + +### Verifying webhook payloads directly + +In some cases, you may want to verify the webhook separately from parsing the payload. If you prefer to handle these steps separately, we provide the method `client.webhooks.verifySignature()` to _only verify_ the signature of a webhook request. Like `.unwrap()`, this method will throw an error if the signature is invalid. + +Note that the `body` parameter must be the raw JSON string sent from the server (do not parse it first). You will then need to parse the body after verifying the signature. + +```ts +import { headers } from 'next/headers'; +import OpenAI from 'openai'; + +const client = new OpenAI({ + webhookSecret: process.env.OPENAI_WEBHOOK_SECRET, // env var used by default; explicit here. +}); + +export async function webhook(request: Request) { + const headersList = headers(); + const body = await request.text(); + + try { + client.webhooks.verifySignature(body, headersList); + + // Parse the body after verification + const event = JSON.parse(body); + console.log('Verified event:', event); + + return Response.json({ message: 'ok' }); + } catch (error) { + console.error('Invalid webhook signature:', error); + return new Response('Invalid signature', { status: 400 }); + } +} +``` + ## Handling errors When the library is unable to connect to the API, diff --git a/api.md b/api.md index 4e2de3252..17360e897 100644 --- a/api.md +++ b/api.md @@ -351,6 +351,31 @@ Methods: - client.vectorStores.files.upload(vectorStoreId, file, options?) -> Promise<VectorStoreFile> - client.vectorStores.files.uploadAndPoll(vectorStoreId, file, options?) -> Promise<VectorStoreFile> +# Webhooks + +Types: + +- BatchCancelledWebhookEvent +- BatchCompletedWebhookEvent +- BatchExpiredWebhookEvent +- BatchFailedWebhookEvent +- EvalRunCanceledWebhookEvent +- EvalRunFailedWebhookEvent +- EvalRunSucceededWebhookEvent +- FineTuningJobCancelledWebhookEvent +- FineTuningJobFailedWebhookEvent +- FineTuningJobSucceededWebhookEvent +- ResponseCancelledWebhookEvent +- ResponseCompletedWebhookEvent +- ResponseFailedWebhookEvent +- ResponseIncompleteWebhookEvent +- UnwrapWebhookEvent + +Methods: + +- client.webhooks.unwrap(payload, headers, secret?, tolerance?) -> UnwrapWebhookEvent +- client.webhooks.verifySignature(payload, headers, secret?, tolerance?) -> void + # Beta ## Realtime @@ -701,6 +726,7 @@ Types: - ResponseWebSearchCallSearchingEvent - Tool - ToolChoiceFunction +- ToolChoiceMcp - ToolChoiceOptions - ToolChoiceTypes - WebSearchTool diff --git a/src/client.ts b/src/client.ts index d551854d7..385ada9d0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -74,6 +74,7 @@ import { ModerationTextInput, Moderations, } from './resources/moderations'; +import { Webhooks } from './resources/webhooks'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; import { Chat } from './resources/chat/chat'; @@ -196,6 +197,11 @@ export interface ClientOptions { */ project?: string | null | undefined; + /** + * Defaults to process.env['OPENAI_WEBHOOK_SECRET']. + */ + webhookSecret?: string | null | undefined; + /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * @@ -276,6 +282,7 @@ export class OpenAI { apiKey: string; organization: string | null; project: string | null; + webhookSecret: string | null; baseURL: string; maxRetries: number; @@ -295,6 +302,7 @@ export class OpenAI { * @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? undefined] * @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null] * @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null] + * @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null] * @param {string} [opts.baseURL=process.env['OPENAI_BASE_URL'] ?? https://api.openai.com/v1] - Override the default base URL for the API. * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. @@ -309,6 +317,7 @@ export class OpenAI { apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, + webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, ...opts }: ClientOptions = {}) { if (apiKey === undefined) { @@ -321,6 +330,7 @@ export class OpenAI { apiKey, organization, project, + webhookSecret, ...opts, baseURL: baseURL || `https://api.openai.com/v1`, }; @@ -351,6 +361,7 @@ export class OpenAI { this.apiKey = apiKey; this.organization = organization; this.project = project; + this.webhookSecret = webhookSecret; } /** @@ -369,6 +380,7 @@ export class OpenAI { apiKey: this.apiKey, organization: this.organization, project: this.project, + webhookSecret: this.webhookSecret, ...options, }); } @@ -900,6 +912,7 @@ export class OpenAI { static InternalServerError = Errors.InternalServerError; static PermissionDeniedError = Errors.PermissionDeniedError; static UnprocessableEntityError = Errors.UnprocessableEntityError; + static InvalidWebhookSignatureError = Errors.InvalidWebhookSignatureError; static toFile = Uploads.toFile; @@ -914,6 +927,7 @@ export class OpenAI { 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); batches: API.Batches = new API.Batches(this); uploads: API.Uploads = new API.Uploads(this); @@ -932,6 +946,7 @@ OpenAI.Models = Models; OpenAI.FineTuning = FineTuning; OpenAI.Graders = Graders; OpenAI.VectorStores = VectorStores; +OpenAI.Webhooks = Webhooks; OpenAI.Beta = Beta; OpenAI.Batches = Batches; OpenAI.Uploads = UploadsAPIUploads; @@ -1070,6 +1085,8 @@ export declare namespace OpenAI { type VectorStoreSearchParams as VectorStoreSearchParams, }; + export { Webhooks as Webhooks }; + export { Beta as Beta }; export { diff --git a/src/core/error.ts b/src/core/error.ts index c18cc0e33..723a15dd1 100644 --- a/src/core/error.ts +++ b/src/core/error.ts @@ -152,3 +152,9 @@ export class ContentFilterFinishReasonError extends OpenAIError { super(`Could not parse response content as the request was rejected by the content filter`); } } + +export class InvalidWebhookSignatureError extends Error { + constructor(message: string) { + super(message); + } +} diff --git a/src/index.ts b/src/index.ts index 69deeec37..7ae9b1b4e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ export { InternalServerError, PermissionDeniedError, UnprocessableEntityError, + InvalidWebhookSignatureError, } from './core/error'; export { AzureOpenAI } from './azure'; diff --git a/src/resources/chat/completions/completions.ts b/src/resources/chat/completions/completions.ts index d62247b6b..887f0be5d 100644 --- a/src/resources/chat/completions/completions.ts +++ b/src/resources/chat/completions/completions.ts @@ -273,25 +273,25 @@ export interface ChatCompletion { object: 'chat.completion'; /** - * Specifies the latency tier to use for processing the request. This parameter is - * relevant for customers subscribed to the scale tier service: + * Specifies the processing type used for serving the request. * - * - If set to 'auto', and the Project is Scale tier enabled, the system will - * 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 guarantee. - * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarantee. - * - If set to 'flex', the request will be processed with the Flex Processing - * service tier. - * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - If set to 'auto', then the request will be processed with the service tier + * configured in the Project settings. Unless otherwise configured, the Project + * will use 'default'. + * - If set to 'default', then the requset will be processed with the standard + * pricing and performance for the selected model. + * - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or + * 'priority', then the request will be processed with the corresponding service + * tier. [Contact sales](https://openai.com/contact-sales) to learn more about + * Priority processing. * - When not set, the default behavior is 'auto'. * - * When this parameter is set, the response body will include the `service_tier` - * utilized. + * When the `service_tier` parameter is set, the response body will include the + * `service_tier` value based on the processing mode actually used to serve the + * request. This response value may be different from the value set in the + * parameter. */ - service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -524,25 +524,25 @@ export interface ChatCompletionChunk { object: 'chat.completion.chunk'; /** - * Specifies the latency tier to use for processing the request. This parameter is - * relevant for customers subscribed to the scale tier service: + * Specifies the processing type used for serving the request. * - * - If set to 'auto', and the Project is Scale tier enabled, the system will - * 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 guarantee. - * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarantee. - * - If set to 'flex', the request will be processed with the Flex Processing - * service tier. - * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - If set to 'auto', then the request will be processed with the service tier + * configured in the Project settings. Unless otherwise configured, the Project + * will use 'default'. + * - If set to 'default', then the requset will be processed with the standard + * pricing and performance for the selected model. + * - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or + * 'priority', then the request will be processed with the corresponding service + * tier. [Contact sales](https://openai.com/contact-sales) to learn more about + * Priority processing. * - When not set, the default behavior is 'auto'. * - * When this parameter is set, the response body will include the `service_tier` - * utilized. + * When the `service_tier` parameter is set, the response body will include the + * `service_tier` value based on the processing mode actually used to serve the + * request. This response value may be different from the value set in the + * parameter. */ - service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null; /** * This fingerprint represents the backend configuration that the model runs with. @@ -1446,25 +1446,25 @@ export interface ChatCompletionCreateParamsBase { seed?: number | null; /** - * Specifies the latency tier to use for processing the request. This parameter is - * relevant for customers subscribed to the scale tier service: + * Specifies the processing type used for serving the request. * - * - If set to 'auto', and the Project is Scale tier enabled, the system will - * 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 guarantee. - * - If set to 'default', the request will be processed using the default service - * tier with a lower uptime SLA and no latency guarantee. - * - If set to 'flex', the request will be processed with the Flex Processing - * service tier. - * [Learn more](https://platform.openai.com/docs/guides/flex-processing). + * - If set to 'auto', then the request will be processed with the service tier + * configured in the Project settings. Unless otherwise configured, the Project + * will use 'default'. + * - If set to 'default', then the requset will be processed with the standard + * pricing and performance for the selected model. + * - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or + * 'priority', then the request will be processed with the corresponding service + * tier. [Contact sales](https://openai.com/contact-sales) to learn more about + * Priority processing. * - When not set, the default behavior is 'auto'. * - * When this parameter is set, the response body will include the `service_tier` - * utilized. + * When the `service_tier` parameter is set, the response body will include the + * `service_tier` value based on the processing mode actually used to serve the + * request. This response value may be different from the value set in the + * parameter. */ - service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null; /** * Not supported with latest reasoning models `o3` and `o4-mini`. @@ -1478,6 +1478,8 @@ export interface ChatCompletionCreateParamsBase { * Whether or not to store the output of this chat completion request for use in * our [model distillation](https://platform.openai.com/docs/guides/distillation) * or [evals](https://platform.openai.com/docs/guides/evals) products. + * + * Supports text and image inputs. Note: image inputs over 10MB will be dropped. */ store?: boolean | null; diff --git a/src/resources/images.ts b/src/resources/images.ts index 23b7d1507..4d7adbd41 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -94,11 +94,33 @@ export interface ImagesResponse { */ created: number; + /** + * The background parameter used for the image generation. Either `transparent` or + * `opaque`. + */ + background?: 'transparent' | 'opaque'; + /** * The list of generated images. */ data?: Array; + /** + * The output format of the image generation. Either `png`, `webp`, or `jpeg`. + */ + output_format?: 'png' | 'webp' | 'jpeg'; + + /** + * The quality of the image generated. Either `low`, `medium`, or `high`. + */ + quality?: 'low' | 'medium' | 'high'; + + /** + * The size of the image generated. Either `1024x1024`, `1024x1536`, or + * `1536x1024`. + */ + size?: '1024x1024' | '1024x1536' | '1536x1024'; + /** * For `gpt-image-1` only, the token usage information for the image generation. */ diff --git a/src/resources/index.ts b/src/resources/index.ts index d64befac9..e494fcfcb 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -105,3 +105,4 @@ export { type VectorStoresPage, type VectorStoreSearchResponsesPage, } from './vector-stores/vector-stores'; +export { Webhooks } from './webhooks'; diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 4e076aed4..44fcb5f2b 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -498,7 +498,7 @@ export interface Response { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null; /** * The status of the response generation. One of `completed`, `failed`, @@ -4721,7 +4721,7 @@ export interface ResponseCreateParamsBase { * When this parameter is set, the response body will include the `service_tier` * utilized. */ - service_tier?: 'auto' | 'default' | 'flex' | 'scale' | null; + service_tier?: 'auto' | 'default' | 'flex' | 'scale' | 'priority' | null; /** * Whether to store the generated model response for later retrieval via API. diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 468f21ade..1f4f73305 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -7,6 +7,10 @@ export type AllModels = | 'o1-pro-2025-03-19' | 'o3-pro' | 'o3-pro-2025-06-10' + | 'o3-deep-research' + | 'o3-deep-research-2025-06-26' + | 'o4-mini-deep-research' + | 'o4-mini-deep-research-2025-06-26' | 'computer-use-preview' | 'computer-use-preview-2025-03-11'; @@ -301,5 +305,9 @@ export type ResponsesModel = | 'o1-pro-2025-03-19' | 'o3-pro' | 'o3-pro-2025-06-10' + | 'o3-deep-research' + | 'o3-deep-research-2025-06-26' + | 'o4-mini-deep-research' + | 'o4-mini-deep-research-2025-06-26' | 'computer-use-preview' | 'computer-use-preview-2025-03-11'; diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts new file mode 100644 index 000000000..adf9e9da4 --- /dev/null +++ b/src/resources/webhooks.ts @@ -0,0 +1,767 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { InvalidWebhookSignatureError } from '../error'; +import { APIResource } from '../core/resource'; +import { buildHeaders, HeadersLike } from '../internal/headers'; + +export class Webhooks extends APIResource { + /** + * Validates that the given payload was sent by OpenAI and parses the payload. + */ + async unwrap( + payload: string, + headers: HeadersLike, + secret: string | undefined | null = this._client.webhookSecret, + tolerance: number = 300, + ): Promise { + await this.verifySignature(payload, headers, secret, tolerance); + + return JSON.parse(payload) as UnwrapWebhookEvent; + } + + private validateSecret(secret: string | null | undefined): asserts secret is string { + if (typeof secret !== 'string' || secret.length === 0) { + throw new Error( + `The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function`, + ); + } + } + + private getRequiredHeader(headers: Headers, name: string): string { + if (!headers) { + throw new Error(`Headers are required`); + } + + const value = headers.get(name); + + if (value === null || value === undefined) { + throw new Error(`Missing required header: ${name}`); + } + + return value; + } + + /** + * Validates whether or not the webhook payload was sent by OpenAI. + * + * An error will be raised if the webhook payload was not sent by OpenAI. + * + * @param payload - The webhook payload + * @param headers - The webhook headers + * @param secret - The webhook secret (optional, will use client secret if not provided) + * @param tolerance - Maximum age of the webhook in seconds (default: 300 = 5 minutes) + */ + async verifySignature( + payload: string, + headers: HeadersLike, + secret: string | undefined | null = this._client.webhookSecret, + tolerance: number = 300, + ): Promise { + if ( + typeof crypto === 'undefined' || + typeof crypto.subtle.importKey !== 'function' || + typeof crypto.subtle.verify !== 'function' + ) { + throw new Error('Webhook signature verification is only supported when the `crypto` global is defined'); + } + + this.validateSecret(secret); + + const headersObj = buildHeaders([headers]).values; + const signatureHeader = this.getRequiredHeader(headersObj, 'webhook-signature'); + const timestamp = this.getRequiredHeader(headersObj, 'webhook-timestamp'); + const webhookId = this.getRequiredHeader(headersObj, 'webhook-id'); + + // Validate timestamp to prevent replay attacks + const timestampSeconds = parseInt(timestamp, 10); + if (isNaN(timestampSeconds)) { + throw new InvalidWebhookSignatureError('Invalid webhook timestamp format'); + } + + const nowSeconds = Math.floor(Date.now() / 1000); + + if (nowSeconds - timestampSeconds > tolerance) { + throw new InvalidWebhookSignatureError('Webhook timestamp is too old'); + } + + if (timestampSeconds > nowSeconds + tolerance) { + throw new InvalidWebhookSignatureError('Webhook timestamp is too new'); + } + + // Extract signatures from v1, format + // The signature header can have multiple values, separated by spaces. + // Each value is in the format v1,. We should accept if any match. + const signatures = signatureHeader + .split(' ') + .map((part) => (part.startsWith('v1,') ? part.substring(3) : part)); + + // Decode the secret if it starts with whsec_ + const decodedSecret = + secret.startsWith('whsec_') ? + Buffer.from(secret.replace('whsec_', ''), 'base64') + : Buffer.from(secret, 'utf-8'); + + // Create the signed payload: {webhook_id}.{timestamp}.{payload} + const signedPayload = webhookId ? `${webhookId}.${timestamp}.${payload}` : `${timestamp}.${payload}`; + + // Import the secret as a cryptographic key for HMAC + const key = await crypto.subtle.importKey( + 'raw', + decodedSecret, + { name: 'HMAC', hash: 'SHA-256' }, + false, + ['verify'], + ); + + // Check if any signature matches using timing-safe WebCrypto verify + for (const signature of signatures) { + try { + const signatureBytes = Buffer.from(signature, 'base64'); + const isValid = await crypto.subtle.verify( + 'HMAC', + key, + signatureBytes, + new TextEncoder().encode(signedPayload), + ); + + if (isValid) { + return; // Valid signature found + } + } catch { + // Invalid base64 or signature format, continue to next signature + continue; + } + } + + throw new InvalidWebhookSignatureError( + 'The given webhook signature does not match the expected signature', + ); + } +} + +/** + * Sent when a batch API request has been cancelled. + */ +export interface BatchCancelledWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the batch API request was cancelled. + */ + created_at: number; + + /** + * Event data payload. + */ + data: BatchCancelledWebhookEvent.Data; + + /** + * The type of the event. Always `batch.cancelled`. + */ + type: 'batch.cancelled'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace BatchCancelledWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the batch API request. + */ + id: string; + } +} + +/** + * Sent when a batch API request has been completed. + */ +export interface BatchCompletedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the batch API request was completed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: BatchCompletedWebhookEvent.Data; + + /** + * The type of the event. Always `batch.completed`. + */ + type: 'batch.completed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace BatchCompletedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the batch API request. + */ + id: string; + } +} + +/** + * Sent when a batch API request has expired. + */ +export interface BatchExpiredWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the batch API request expired. + */ + created_at: number; + + /** + * Event data payload. + */ + data: BatchExpiredWebhookEvent.Data; + + /** + * The type of the event. Always `batch.expired`. + */ + type: 'batch.expired'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace BatchExpiredWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the batch API request. + */ + id: string; + } +} + +/** + * Sent when a batch API request has failed. + */ +export interface BatchFailedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the batch API request failed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: BatchFailedWebhookEvent.Data; + + /** + * The type of the event. Always `batch.failed`. + */ + type: 'batch.failed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace BatchFailedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the batch API request. + */ + id: string; + } +} + +/** + * Sent when an eval run has been canceled. + */ +export interface EvalRunCanceledWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the eval run was canceled. + */ + created_at: number; + + /** + * Event data payload. + */ + data: EvalRunCanceledWebhookEvent.Data; + + /** + * The type of the event. Always `eval.run.canceled`. + */ + type: 'eval.run.canceled'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace EvalRunCanceledWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the eval run. + */ + id: string; + } +} + +/** + * Sent when an eval run has failed. + */ +export interface EvalRunFailedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the eval run failed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: EvalRunFailedWebhookEvent.Data; + + /** + * The type of the event. Always `eval.run.failed`. + */ + type: 'eval.run.failed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace EvalRunFailedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the eval run. + */ + id: string; + } +} + +/** + * Sent when an eval run has succeeded. + */ +export interface EvalRunSucceededWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the eval run succeeded. + */ + created_at: number; + + /** + * Event data payload. + */ + data: EvalRunSucceededWebhookEvent.Data; + + /** + * The type of the event. Always `eval.run.succeeded`. + */ + type: 'eval.run.succeeded'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace EvalRunSucceededWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the eval run. + */ + id: string; + } +} + +/** + * Sent when a fine-tuning job has been cancelled. + */ +export interface FineTuningJobCancelledWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the fine-tuning job was cancelled. + */ + created_at: number; + + /** + * Event data payload. + */ + data: FineTuningJobCancelledWebhookEvent.Data; + + /** + * The type of the event. Always `fine_tuning.job.cancelled`. + */ + type: 'fine_tuning.job.cancelled'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace FineTuningJobCancelledWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the fine-tuning job. + */ + id: string; + } +} + +/** + * Sent when a fine-tuning job has failed. + */ +export interface FineTuningJobFailedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the fine-tuning job failed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: FineTuningJobFailedWebhookEvent.Data; + + /** + * The type of the event. Always `fine_tuning.job.failed`. + */ + type: 'fine_tuning.job.failed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace FineTuningJobFailedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the fine-tuning job. + */ + id: string; + } +} + +/** + * Sent when a fine-tuning job has succeeded. + */ +export interface FineTuningJobSucceededWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the fine-tuning job succeeded. + */ + created_at: number; + + /** + * Event data payload. + */ + data: FineTuningJobSucceededWebhookEvent.Data; + + /** + * The type of the event. Always `fine_tuning.job.succeeded`. + */ + type: 'fine_tuning.job.succeeded'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace FineTuningJobSucceededWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the fine-tuning job. + */ + id: string; + } +} + +/** + * Sent when a background response has been cancelled. + */ +export interface ResponseCancelledWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the model response was cancelled. + */ + created_at: number; + + /** + * Event data payload. + */ + data: ResponseCancelledWebhookEvent.Data; + + /** + * The type of the event. Always `response.cancelled`. + */ + type: 'response.cancelled'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace ResponseCancelledWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the model response. + */ + id: string; + } +} + +/** + * Sent when a background response has been completed. + */ +export interface ResponseCompletedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the model response was completed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: ResponseCompletedWebhookEvent.Data; + + /** + * The type of the event. Always `response.completed`. + */ + type: 'response.completed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace ResponseCompletedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the model response. + */ + id: string; + } +} + +/** + * Sent when a background response has failed. + */ +export interface ResponseFailedWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the model response failed. + */ + created_at: number; + + /** + * Event data payload. + */ + data: ResponseFailedWebhookEvent.Data; + + /** + * The type of the event. Always `response.failed`. + */ + type: 'response.failed'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace ResponseFailedWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the model response. + */ + id: string; + } +} + +/** + * Sent when a background response has been interrupted. + */ +export interface ResponseIncompleteWebhookEvent { + /** + * The unique ID of the event. + */ + id: string; + + /** + * The Unix timestamp (in seconds) of when the model response was interrupted. + */ + created_at: number; + + /** + * Event data payload. + */ + data: ResponseIncompleteWebhookEvent.Data; + + /** + * The type of the event. Always `response.incomplete`. + */ + type: 'response.incomplete'; + + /** + * The object of the event. Always `event`. + */ + object?: 'event'; +} + +export namespace ResponseIncompleteWebhookEvent { + /** + * Event data payload. + */ + export interface Data { + /** + * The unique ID of the model response. + */ + id: string; + } +} + +/** + * Sent when a batch API request has been cancelled. + */ +export type UnwrapWebhookEvent = + | BatchCancelledWebhookEvent + | BatchCompletedWebhookEvent + | BatchExpiredWebhookEvent + | BatchFailedWebhookEvent + | EvalRunCanceledWebhookEvent + | EvalRunFailedWebhookEvent + | EvalRunSucceededWebhookEvent + | FineTuningJobCancelledWebhookEvent + | FineTuningJobFailedWebhookEvent + | FineTuningJobSucceededWebhookEvent + | ResponseCancelledWebhookEvent + | ResponseCompletedWebhookEvent + | ResponseFailedWebhookEvent + | ResponseIncompleteWebhookEvent; + +export declare namespace Webhooks { + export { + type BatchCancelledWebhookEvent as BatchCancelledWebhookEvent, + type BatchCompletedWebhookEvent as BatchCompletedWebhookEvent, + type BatchExpiredWebhookEvent as BatchExpiredWebhookEvent, + type BatchFailedWebhookEvent as BatchFailedWebhookEvent, + type EvalRunCanceledWebhookEvent as EvalRunCanceledWebhookEvent, + type EvalRunFailedWebhookEvent as EvalRunFailedWebhookEvent, + type EvalRunSucceededWebhookEvent as EvalRunSucceededWebhookEvent, + type FineTuningJobCancelledWebhookEvent as FineTuningJobCancelledWebhookEvent, + type FineTuningJobFailedWebhookEvent as FineTuningJobFailedWebhookEvent, + type FineTuningJobSucceededWebhookEvent as FineTuningJobSucceededWebhookEvent, + type ResponseCancelledWebhookEvent as ResponseCancelledWebhookEvent, + type ResponseCompletedWebhookEvent as ResponseCompletedWebhookEvent, + type ResponseFailedWebhookEvent as ResponseFailedWebhookEvent, + type ResponseIncompleteWebhookEvent as ResponseIncompleteWebhookEvent, + type UnwrapWebhookEvent as UnwrapWebhookEvent, + }; +} diff --git a/tests/api-resources/responses/input-items.test.ts b/tests/api-resources/responses/input-items.test.ts index a96128939..168794215 100644 --- a/tests/api-resources/responses/input-items.test.ts +++ b/tests/api-resources/responses/input-items.test.ts @@ -24,7 +24,13 @@ describe('resource inputItems', () => { await expect( client.responses.inputItems.list( 'response_id', - { after: 'after', before: 'before', include: ['file_search_call.results'], limit: 0, order: 'asc' }, + { + after: 'after', + before: 'before', + include: ['code_interpreter_call.outputs'], + limit: 0, + order: 'asc', + }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 4c33de115..48582a1b4 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -35,7 +35,7 @@ describe('resource responses', () => { await expect( client.responses.retrieve( 'resp_677efb5139a88190b512bc3fef8e535d', - { include: ['file_search_call.results'], starting_after: 0, stream: false }, + { include: ['code_interpreter_call.outputs'], starting_after: 0, stream: false }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(OpenAI.NotFoundError); diff --git a/tests/api-resources/webhooks.test.ts b/tests/api-resources/webhooks.test.ts new file mode 100644 index 000000000..f6169f0bf --- /dev/null +++ b/tests/api-resources/webhooks.test.ts @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import OpenAI from 'openai'; + +const client = new OpenAI({ + apiKey: 'My API Key', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010/', +}); + +describe('resource webhooks', () => { + // all this data is taken from a real webhook event + const payload = `{"id": "evt_685c059ae3a481909bdc86819b066fb6", "object": "event", "created_at": 1750861210, "type": "response.completed", "data": {"id": "resp_123"}}`; + const webhookSignature = 'v1,gUAg4R2hWouRZqRQG4uJypNS8YK885G838+EHb4nKBY='; + const testTimestamp = 1750861210; + const webhookTimestamp = testTimestamp.toString(); + const webhookId = 'wh_685c059ae39c8190af8c71ed1022a24d'; + const headers = new Headers({ + 'webhook-signature': webhookSignature, + 'webhook-timestamp': webhookTimestamp, + 'webhook-id': webhookId, + }); + const secret = 'whsec_RdvaYFYUXuIFuEbvZHwMfYFhUf7aMYjYcmM24+Aj40c='; + + // Mock time to match our test timestamp + const mockNow = testTimestamp * 1000; // Convert to milliseconds + + beforeEach(() => { + jest.spyOn(global.Date, 'now').mockImplementation(() => mockNow); + }); + + afterEach(() => { + // restore the spy created with spyOn + jest.restoreAllMocks(); + }); + + describe('unwrap', () => { + it('deserializes the payload object', async () => { + const unwrapped = await client.webhooks.unwrap(payload, headers, secret); + + expect(unwrapped).toEqual({ + id: 'evt_685c059ae3a481909bdc86819b066fb6', + object: 'event', + created_at: 1750861210, + type: 'response.completed', + data: { id: 'resp_123' }, + }); + }); + }); + + describe('verifySignature', () => { + it('should pass for valid signature', async () => { + await client.webhooks.verifySignature(payload, headers, secret); + }); + + it('should throw an error for invalid secret format', async () => { + await expect( + client.webhooks.verifySignature(payload, headers, null as any), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function"`, + ); + }); + + it('should throw for invalid signature', async () => { + await expect( + client.webhooks.verifySignature(payload, headers, Buffer.from('foo').toString('base64')), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"The given webhook signature does not match the expected signature"`, + ); + }); + + it('should throw for missing webhook-signature header', async () => { + const incompleteHeaders = new Headers({ + 'webhook-timestamp': webhookTimestamp, + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, incompleteHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Missing required header: webhook-signature"`); + }); + + it('should throw for missing webhook-timestamp header', async () => { + const incompleteHeaders = new Headers({ + 'webhook-signature': webhookSignature, + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, incompleteHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Missing required header: webhook-timestamp"`); + }); + + it('should throw for missing webhook-id header', async () => { + const incompleteHeaders = new Headers({ + 'webhook-signature': webhookSignature, + 'webhook-timestamp': webhookTimestamp, + }); + + await expect( + client.webhooks.verifySignature(payload, incompleteHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Missing required header: webhook-id"`); + }); + + it('should throw if payload is not a string', async () => { + await expect( + client.webhooks.verifySignature({ payload: 'not a string' } as any, headers, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"The given webhook signature does not match the expected signature"`, + ); + }); + + it('should throw for timestamp too old', async () => { + // Create a timestamp that is older than 5 minutes from our mocked "now" time + const oldTimestamp = (testTimestamp - 400).toString(); // 6 minutes 40 seconds ago + const oldHeaders = new Headers({ + 'webhook-signature': 'v1,dummy_signature', + 'webhook-timestamp': oldTimestamp, + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, oldHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Webhook timestamp is too old"`); + }); + + it('should throw for timestamp too new', async () => { + // Create a timestamp that is in the future beyond tolerance + const futureTimestamp = (testTimestamp + 400).toString(); // 6 minutes 40 seconds in the future + const futureHeaders = new Headers({ + 'webhook-signature': 'v1,dummy_signature', + 'webhook-timestamp': futureTimestamp, + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, futureHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Webhook timestamp is too new"`); + }); + + it('should throw for invalid timestamp format', async () => { + const invalidHeaders = new Headers({ + 'webhook-signature': webhookSignature, + 'webhook-timestamp': 'not-a-number', + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, invalidHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Invalid webhook timestamp format"`); + }); + + it('should pass with custom tolerance', async () => { + // Create a timestamp that would normally be too old with default tolerance + const oldTimestamp = (testTimestamp - 400).toString(); // 6 minutes 40 seconds ago + const oldHeaders = new Headers({ + 'webhook-signature': 'v1,dummy_signature', + 'webhook-timestamp': oldTimestamp, + 'webhook-id': webhookId, + }); + + // Should fail with default tolerance + await expect( + client.webhooks.verifySignature(payload, oldHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot(`"Webhook timestamp is too old"`); + + // Should still fail with custom tolerance of 10 minutes because signature won't match + await expect( + client.webhooks.verifySignature(payload, oldHeaders, secret, 600), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"The given webhook signature does not match the expected signature"`, + ); + }); + + it('should pass for multiple signatures when one is valid', async () => { + // Test multiple signatures: one invalid, one valid + const multipleSignatures = `v1,invalid_signature ${webhookSignature}`; + const multipleHeaders = new Headers({ + 'webhook-signature': multipleSignatures, + 'webhook-timestamp': webhookTimestamp, + 'webhook-id': webhookId, + }); + + // Should not throw when at least one signature is valid + await client.webhooks.verifySignature(payload, multipleHeaders, secret); + }); + + it('should throw for multiple signatures when all are invalid', async () => { + // Test multiple invalid signatures + const multipleInvalidSignatures = 'v1,invalid_signature1 v1,invalid_signature2'; + const multipleHeaders = new Headers({ + 'webhook-signature': multipleInvalidSignatures, + 'webhook-timestamp': webhookTimestamp, + 'webhook-id': webhookId, + }); + + await expect( + client.webhooks.verifySignature(payload, multipleHeaders, secret), + ).rejects.toThrowErrorMatchingInlineSnapshot( + `"The given webhook signature does not match the expected signature"`, + ); + }); + }); +}); From 8c4303b3bb0974ee81706f60b338921b218c5802 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 16:52:07 +0000 Subject: [PATCH 502/509] release: 5.8.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 68f9449d5..ff202757a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.7.0" + ".": "5.8.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ec8b483e..0761b1b82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 5.8.0 (2025-06-26) + +Full Changelog: [v5.7.0...v5.8.0](https://github.com/openai/openai-node/compare/v5.7.0...v5.8.0) + +### Features + +* **api:** webhook and deep research support ([f2b4f66](https://github.com/openai/openai-node/commit/f2b4f66226ad514d702f8acbb4820ae90b4fd40e)) + + +### Bug Fixes + +* **ci:** release-doctor — report correct token name ([aed2587](https://github.com/openai/openai-node/commit/aed2587294922415aeaece0b9a6911c3e1577c51)) + + +### Refactors + +* **types:** replace Record with mapped types ([7865910](https://github.com/openai/openai-node/commit/7865910c7d66a14dac70ea119e109975d9169414)) + ## 5.7.0 (2025-06-23) Full Changelog: [v5.6.0...v5.7.0](https://github.com/openai/openai-node/compare/v5.6.0...v5.7.0) diff --git a/jsr.json b/jsr.json index 83eda605f..da72d6202 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.7.0", + "version": "5.8.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 94babf897..e05474aa4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.7.0", + "version": "5.8.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index 3d3704645..acc2084a8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.7.0'; // x-release-please-version +export const VERSION = '5.8.0'; // x-release-please-version From 586d5daf5babc9f12793201f1e1e4c79829151f0 Mon Sep 17 00:00:00 2001 From: David Meadows Date: Thu, 26 Jun 2025 13:42:27 -0400 Subject: [PATCH 503/509] chore(docs): update README to include links to docs on Webhooks --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index aff898be2..9864a4829 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,8 @@ await client.files.create({ Verifying webhook signatures is _optional but encouraged_. +For more information about webhooks, see [the API docs](https://platform.openai.com/docs/guides/webhooks). + ### Parsing webhook payloads For most use cases, you will likely want to verify the webhook and parse the payload at the same time. To achieve this, we provide the method `client.webhooks.unwrap()`, which parses a webhook request and verifies that it was sent by OpenAI. This method will throw an error if the signature is invalid. From 0ee396a2a0e03c794c7cfa3c9f1beb848fd77f1d Mon Sep 17 00:00:00 2001 From: Robert Craigie Date: Thu, 26 Jun 2025 13:45:22 -0400 Subject: [PATCH 504/509] chore(webhooks): make private methods really private --- src/resources/webhooks.ts | 52 +++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/resources/webhooks.ts b/src/resources/webhooks.ts index adf9e9da4..fa337478b 100644 --- a/src/resources/webhooks.ts +++ b/src/resources/webhooks.ts @@ -19,28 +19,6 @@ export class Webhooks extends APIResource { return JSON.parse(payload) as UnwrapWebhookEvent; } - private validateSecret(secret: string | null | undefined): asserts secret is string { - if (typeof secret !== 'string' || secret.length === 0) { - throw new Error( - `The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function`, - ); - } - } - - private getRequiredHeader(headers: Headers, name: string): string { - if (!headers) { - throw new Error(`Headers are required`); - } - - const value = headers.get(name); - - if (value === null || value === undefined) { - throw new Error(`Missing required header: ${name}`); - } - - return value; - } - /** * Validates whether or not the webhook payload was sent by OpenAI. * @@ -65,12 +43,12 @@ export class Webhooks extends APIResource { throw new Error('Webhook signature verification is only supported when the `crypto` global is defined'); } - this.validateSecret(secret); + this.#validateSecret(secret); const headersObj = buildHeaders([headers]).values; - const signatureHeader = this.getRequiredHeader(headersObj, 'webhook-signature'); - const timestamp = this.getRequiredHeader(headersObj, 'webhook-timestamp'); - const webhookId = this.getRequiredHeader(headersObj, 'webhook-id'); + const signatureHeader = this.#getRequiredHeader(headersObj, 'webhook-signature'); + const timestamp = this.#getRequiredHeader(headersObj, 'webhook-timestamp'); + const webhookId = this.#getRequiredHeader(headersObj, 'webhook-id'); // Validate timestamp to prevent replay attacks const timestampSeconds = parseInt(timestamp, 10); @@ -137,6 +115,28 @@ export class Webhooks extends APIResource { 'The given webhook signature does not match the expected signature', ); } + + #validateSecret(secret: string | null | undefined): asserts secret is string { + if (typeof secret !== 'string' || secret.length === 0) { + throw new Error( + `The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function`, + ); + } + } + + #getRequiredHeader(headers: Headers, name: string): string { + if (!headers) { + throw new Error(`Headers are required`); + } + + const value = headers.get(name); + + if (value === null || value === undefined) { + throw new Error(`Missing required header: ${name}`); + } + + return value; + } } /** From d55bb64f8022c1e861b4b4d1c23ad4cc0e80e536 Mon Sep 17 00:00:00 2001 From: David Meadows Date: Thu, 26 Jun 2025 14:38:38 -0400 Subject: [PATCH 505/509] fix(client): ensure addOutputText is called on responses.retrieve --- src/resources/responses/responses.ts | 16 ++++++++++++---- tests/api-resources/responses/responses.test.ts | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 44fcb5f2b..01a525456 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -132,10 +132,18 @@ export class Responses extends APIResource { query: ResponseRetrieveParams | undefined = {}, options?: RequestOptions, ): APIPromise | APIPromise> { - return this._client.get(path`/responses/${responseID}`, { - query, - ...options, - stream: query?.stream ?? false, + return ( + this._client.get(path`/responses/${responseID}`, { + query, + ...options, + stream: query?.stream ?? false, + }) as APIPromise | APIPromise> + )._thenUnwrap((rsp) => { + if ('object' in rsp && rsp.object === 'response') { + addOutputText(rsp as Response); + } + + return rsp; }) as APIPromise | APIPromise>; } diff --git a/tests/api-resources/responses/responses.test.ts b/tests/api-resources/responses/responses.test.ts index 48582a1b4..f234a15bb 100644 --- a/tests/api-resources/responses/responses.test.ts +++ b/tests/api-resources/responses/responses.test.ts @@ -17,6 +17,9 @@ describe('resource responses', () => { const dataAndResponse = await responsePromise.withResponse(); expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); + + expect(response).toHaveProperty('output_text'); + expect(typeof response.output_text).toBe('string'); }); test('retrieve', async () => { @@ -28,6 +31,9 @@ describe('resource responses', () => { const dataAndResponse = await responsePromise.withResponse(); expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); + + expect(response).toHaveProperty('output_text'); + expect(typeof response.output_text).toBe('string'); }); test('retrieve: request options and params are passed correctly', async () => { From 19669545157dc0339f4c88855bd1ae9acaaac53d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 19:32:52 +0000 Subject: [PATCH 506/509] chore(api): remove unsupported property --- .stats.yml | 4 +-- src/resources/responses/responses.ts | 52 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ebbf3ee29..07aa52577 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 111 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-cca460eaf5cc13e9d6e5293eb97aac53d66dc1385c691f74b768c97d165b6e8b.yml -openapi_spec_hash: 9ec43d443b3dd58ca5aa87eb0a7eb49f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-a473967d1766dc155994d932fbc4a5bcbd1c140a37c20d0a4065e1bf0640536d.yml +openapi_spec_hash: 67cdc62b0d6c8b1de29b7dc54b265749 config_hash: e74d6791681e3af1b548748ff47a22c2 diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 01a525456..adf2aafb1 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -1739,6 +1739,58 @@ export interface ResponseFunctionWebSearch { type: 'web_search_call'; } +export namespace ResponseFunctionWebSearch { + /** + * Action type "search" - Performs a web search query. + */ + export interface Search { + /** + * The search query. + */ + query: string; + + /** + * The action type. + */ + type: 'search'; + } + + /** + * Action type "open_page" - Opens a specific URL from search results. + */ + export interface OpenPage { + /** + * The action type. + */ + type: 'open_page'; + + /** + * The URL opened by the model. + */ + url: string; + } + + /** + * Action type "find": Searches for a pattern within a loaded page. + */ + export interface Find { + /** + * The pattern or text to search for within the page. + */ + pattern: string; + + /** + * The action type. + */ + type: 'find'; + + /** + * The URL of the page searched for the pattern. + */ + url: string; + } +} + /** * Emitted when an image generation tool call has completed and the final image is * available. From 480131b865e025849699cab425a8a7ecc5f49420 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 19:33:22 +0000 Subject: [PATCH 507/509] release: 5.8.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ff202757a..51cd60763 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.8.0" + ".": "5.8.1" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0761b1b82..c0d29dbd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 5.8.1 (2025-06-26) + +Full Changelog: [v5.8.0...v5.8.1](https://github.com/openai/openai-node/compare/v5.8.0...v5.8.1) + +### Bug Fixes + +* **client:** ensure addOutputText is called on responses.retrieve ([d55bb64](https://github.com/openai/openai-node/commit/d55bb64f8022c1e861b4b4d1c23ad4cc0e80e536)) + + +### Chores + +* **api:** remove unsupported property ([1966954](https://github.com/openai/openai-node/commit/19669545157dc0339f4c88855bd1ae9acaaac53d)) +* **docs:** update README to include links to docs on Webhooks ([586d5da](https://github.com/openai/openai-node/commit/586d5daf5babc9f12793201f1e1e4c79829151f0)) +* **webhooks:** make private methods really private ([0ee396a](https://github.com/openai/openai-node/commit/0ee396a2a0e03c794c7cfa3c9f1beb848fd77f1d)) + ## 5.8.0 (2025-06-26) Full Changelog: [v5.7.0...v5.8.0](https://github.com/openai/openai-node/compare/v5.7.0...v5.8.0) diff --git a/jsr.json b/jsr.json index da72d6202..f8f173ded 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.8.0", + "version": "5.8.1", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index e05474aa4..7c2710c2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.8.0", + "version": "5.8.1", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index acc2084a8..efcc698ed 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.8.0'; // x-release-please-version +export const VERSION = '5.8.1'; // x-release-please-version From b1dc75c7fd2c94460278f8bb1e10f9696ee9e8ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 26 Jun 2025 23:18:16 +0000 Subject: [PATCH 508/509] fix(client): get fetchOptions type more reliably --- src/internal/types.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/internal/types.ts b/src/internal/types.ts index d7928cd35..b668dfc0f 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -7,7 +7,7 @@ export type KeysEnum = { [P in keyof Required]: true }; export type FinalizedRequestInit = RequestInit & { headers: Headers }; -type NotAny = [unknown] extends [T] ? never : T; +type NotAny = [0] extends [1 & T] ? never : T; /** * Some environments overload the global fetch function, and Parameters only gets the last signature. @@ -64,13 +64,15 @@ type OverloadedParameters = * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition */ /** @ts-ignore For users with \@types/node */ -type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with undici */ -type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users with \@types/bun */ type BunRequestInit = globalThis.FetchRequestInit; -/** @ts-ignore For users with node-fetch */ -type NodeFetchRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with node-fetch@2 */ +type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; +/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ +type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; /** @ts-ignore For users who use Deno */ type FetchRequestInit = NonNullable[1]>; /* eslint-enable */ @@ -79,7 +81,8 @@ type RequestInits = | NotAny | NotAny | NotAny - | NotAny + | NotAny + | NotAny | NotAny | NotAny; From 1a20cac26189a8e37abc7b94422b8f04c0020a8d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 05:08:30 +0000 Subject: [PATCH 509/509] release: 5.8.2 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ jsr.json | 2 +- package.json | 2 +- src/version.ts | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 51cd60763..eb5ddb6a1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "5.8.1" + ".": "5.8.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c0d29dbd4..607f0f2ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 5.8.2 (2025-06-27) + +Full Changelog: [v5.8.1...v5.8.2](https://github.com/openai/openai-node/compare/v5.8.1...v5.8.2) + +### Bug Fixes + +* **client:** get fetchOptions type more reliably ([b3c959d](https://github.com/openai/openai-node/commit/b3c959d22d1002a85772385476f9a5098c8e1514)) + ## 5.8.1 (2025-06-26) Full Changelog: [v5.8.0...v5.8.1](https://github.com/openai/openai-node/compare/v5.8.0...v5.8.1) diff --git a/jsr.json b/jsr.json index f8f173ded..16be8305e 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "5.8.1", + "version": "5.8.2", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index 7c2710c2b..232dce668 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "5.8.1", + "version": "5.8.2", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/src/version.ts b/src/version.ts index efcc698ed..4aa7a1fa2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '5.8.1'; // x-release-please-version +export const VERSION = '5.8.2'; // x-release-please-version