From 00c93cd0c6f2b0186a9895ec138a0724b424b895 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 12:02:33 +0000 Subject: [PATCH] fix(audio): correct response_format translations type (#1097) --- .stats.yml | 2 +- api.md | 1 + src/index.ts | 1 + src/resources/audio/audio.ts | 7 +++++++ src/resources/audio/index.ts | 2 +- src/resources/audio/transcriptions.ts | 6 +++--- src/resources/audio/translations.ts | 6 +++--- src/resources/index.ts | 2 +- tests/api-resources/audio/translations.test.ts | 2 +- 9 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0151c5a10..e8bca3c6d 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-de1981b64ac229493473670d618500c6362c195f1057eb7de00bd1bc9184fbd5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-073331021d48db6af646a3552ab0c682efe31b7fb4e59a109ed1ba539f9b89c5.yml diff --git a/api.md b/api.md index 22aeb23e1..522de043c 100644 --- a/api.md +++ b/api.md @@ -107,6 +107,7 @@ Methods: Types: - AudioModel +- AudioResponseFormat ## Transcriptions diff --git a/src/index.ts b/src/index.ts index 9d8427d94..ddb6c0833 100644 --- a/src/index.ts +++ b/src/index.ts @@ -298,6 +298,7 @@ export namespace OpenAI { 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; diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts index 1f0269d03..a8b35d986 100644 --- a/src/resources/audio/audio.ts +++ b/src/resources/audio/audio.ts @@ -14,8 +14,15 @@ export class Audio extends APIResource { export type AudioModel = 'whisper-1'; +/** + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. + */ +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 TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams; diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts index a7f935964..e8836470c 100644 --- a/src/resources/audio/index.ts +++ b/src/resources/audio/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AudioModel, Audio } from './audio'; +export { AudioModel, AudioResponseFormat, Audio } from './audio'; export { SpeechModel, SpeechCreateParams, Speech } from './speech'; export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions'; export { Translation, TranslationCreateParams, Translations } from './translations'; diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts index 5c30d6c59..1ee6921cd 100644 --- a/src/resources/audio/transcriptions.ts +++ b/src/resources/audio/transcriptions.ts @@ -54,10 +54,10 @@ export interface TranscriptionCreateParams { prompt?: string; /** - * The format of the transcript output, in one of these options: `json`, `text`, - * `srt`, `verbose_json`, or `vtt`. + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. */ - response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; + response_format?: AudioAPI.AudioResponseFormat; /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts index dedc15b65..6df718112 100644 --- a/src/resources/audio/translations.ts +++ b/src/resources/audio/translations.ts @@ -40,10 +40,10 @@ export interface TranslationCreateParams { prompt?: string; /** - * The format of the transcript output, in one of these options: `json`, `text`, - * `srt`, `verbose_json`, or `vtt`. + * The format of the output, in one of these options: `json`, `text`, `srt`, + * `verbose_json`, or `vtt`. */ - response_format?: string; + response_format?: AudioAPI.AudioResponseFormat; /** * The sampling temperature, between 0 and 1. Higher values like 0.8 will make the diff --git a/src/resources/index.ts b/src/resources/index.ts index 68bd88a31..87203ab39 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -2,7 +2,7 @@ export * from './chat/index'; export * from './shared'; -export { AudioModel, Audio } from './audio/audio'; +export { AudioModel, AudioResponseFormat, Audio } from './audio/audio'; export { Batch, BatchError, diff --git a/tests/api-resources/audio/translations.test.ts b/tests/api-resources/audio/translations.test.ts index 8264a5818..7966ff49a 100644 --- a/tests/api-resources/audio/translations.test.ts +++ b/tests/api-resources/audio/translations.test.ts @@ -28,7 +28,7 @@ describe('resource translations', () => { file: await toFile(Buffer.from('# my file contents'), 'README.md'), model: 'whisper-1', prompt: 'prompt', - response_format: 'response_format', + response_format: 'json', temperature: 0, }); });