From 7154e35221cb906b853c0271ec4badeeef7c825b Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 11 Jun 2024 18:32:48 +0000
Subject: [PATCH] feat(api): Fix audio transcription response formats
---
api.md | 6 +-
src/resources/audio/audio.ts | 2 -
src/resources/audio/index.ts | 14 +--
src/resources/audio/transcriptions.ts | 121 +-------------------------
src/resources/audio/translations.ts | 91 +------------------
5 files changed, 6 insertions(+), 228 deletions(-)
diff --git a/api.md b/api.md
index ef9ec29..8c61de6 100644
--- a/api.md
+++ b/api.md
@@ -60,22 +60,20 @@ Methods:
Types:
- Transcription
-- TranscriptionCreateResponse
Methods:
-- client.audio.transcriptions.create({ ...params }) -> TranscriptionCreateResponse
+- client.audio.transcriptions.create({ ...params }) -> Transcription
## Translations
Types:
- Translation
-- TranslationCreateResponse
Methods:
-- client.audio.translations.create({ ...params }) -> TranslationCreateResponse
+- client.audio.translations.create({ ...params }) -> Translation
# Models
diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts
index de125d9..97dfbe9 100644
--- a/src/resources/audio/audio.ts
+++ b/src/resources/audio/audio.ts
@@ -12,10 +12,8 @@ export class Audio extends APIResource {
export namespace Audio {
export import Transcriptions = TranscriptionsAPI.Transcriptions;
export import Transcription = TranscriptionsAPI.Transcription;
- export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
export import Translations = TranslationsAPI.Translations;
export import Translation = TranslationsAPI.Translation;
- export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
}
diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts
index ee00487..1a2695d 100644
--- a/src/resources/audio/index.ts
+++ b/src/resources/audio/index.ts
@@ -1,15 +1,5 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
export { Audio } from './audio';
-export {
- Transcription,
- TranscriptionCreateResponse,
- TranscriptionCreateParams,
- Transcriptions,
-} from './transcriptions';
-export {
- Translation,
- TranslationCreateResponse,
- TranslationCreateParams,
- Translations,
-} from './translations';
+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 1672954..c773099 100644
--- a/src/resources/audio/transcriptions.ts
+++ b/src/resources/audio/transcriptions.ts
@@ -9,10 +9,7 @@ export class Transcriptions extends APIResource {
/**
* Transcribes audio into the input language.
*/
- create(
- body: TranscriptionCreateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
+ create(body: TranscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.post(
'/openai/v1/audio/transcriptions',
multipartFormRequestOptions({ body, ...options }),
@@ -31,121 +28,6 @@ export interface Transcription {
text: string;
}
-/**
- * Represents a transcription response returned by model, based on the provided
- * input.
- */
-export type TranscriptionCreateResponse =
- | Transcription
- | TranscriptionCreateResponse.CreateTranscriptionResponseVerboseJson;
-
-export namespace TranscriptionCreateResponse {
- /**
- * Represents a verbose json transcription response returned by model, based on the
- * provided input.
- */
- export interface CreateTranscriptionResponseVerboseJson {
- /**
- * The duration of the input audio.
- */
- duration: string;
-
- /**
- * The language of the input audio.
- */
- language: string;
-
- /**
- * The transcribed text.
- */
- text: string;
-
- /**
- * Segments of the transcribed text and their corresponding details.
- */
- segments?: Array;
-
- /**
- * Extracted words and their corresponding timestamps.
- */
- words?: Array;
- }
-
- export namespace CreateTranscriptionResponseVerboseJson {
- export interface Segment {
- /**
- * Unique identifier of the segment.
- */
- id: number;
-
- /**
- * Average logprob of the segment. If the value is lower than -1, consider the
- * logprobs failed.
- */
- avg_logprob: number;
-
- /**
- * Compression ratio of the segment. If the value is greater than 2.4, consider the
- * compression failed.
- */
- compression_ratio: number;
-
- /**
- * End time of the segment in seconds.
- */
- end: number;
-
- /**
- * Probability of no speech in the segment. If the value is higher than 1.0 and the
- * `avg_logprob` is below -1, consider this segment silent.
- */
- no_speech_prob: number;
-
- /**
- * Seek offset of the segment.
- */
- seek: number;
-
- /**
- * Start time of the segment in seconds.
- */
- start: number;
-
- /**
- * Temperature parameter used for generating the segment.
- */
- temperature: number;
-
- /**
- * Text content of the segment.
- */
- text: string;
-
- /**
- * Array of token IDs for the text content.
- */
- tokens: Array;
- }
-
- export interface Word {
- /**
- * End time of the word in seconds.
- */
- end: number;
-
- /**
- * Start time of the word in seconds.
- */
- start: number;
-
- /**
- * The text content of the word.
- */
- word: string;
- }
- }
-}
-
export interface TranscriptionCreateParams {
/**
* The audio file object (not file name) to transcribe, in one of these formats:
@@ -199,6 +81,5 @@ export interface TranscriptionCreateParams {
export namespace Transcriptions {
export import Transcription = TranscriptionsAPI.Transcription;
- export import TranscriptionCreateResponse = TranscriptionsAPI.TranscriptionCreateResponse;
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
}
diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts
index 179a7f2..0bd53d6 100644
--- a/src/resources/audio/translations.ts
+++ b/src/resources/audio/translations.ts
@@ -9,10 +9,7 @@ export class Translations extends APIResource {
/**
* Translates audio into English.
*/
- create(
- body: TranslationCreateParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
+ create(body: TranslationCreateParams, options?: Core.RequestOptions): Core.APIPromise {
return this._client.post(
'/openai/v1/audio/translations',
multipartFormRequestOptions({ body, ...options }),
@@ -24,91 +21,6 @@ export interface Translation {
text: string;
}
-export type TranslationCreateResponse =
- | Translation
- | TranslationCreateResponse.CreateTranslationResponseVerboseJson;
-
-export namespace TranslationCreateResponse {
- export interface CreateTranslationResponseVerboseJson {
- /**
- * The duration of the input audio.
- */
- duration: string;
-
- /**
- * The language of the output translation (always `english`).
- */
- language: string;
-
- /**
- * The translated text.
- */
- text: string;
-
- /**
- * Segments of the translated text and their corresponding details.
- */
- segments?: Array;
- }
-
- export namespace CreateTranslationResponseVerboseJson {
- export interface Segment {
- /**
- * Unique identifier of the segment.
- */
- id: number;
-
- /**
- * Average logprob of the segment. If the value is lower than -1, consider the
- * logprobs failed.
- */
- avg_logprob: number;
-
- /**
- * Compression ratio of the segment. If the value is greater than 2.4, consider the
- * compression failed.
- */
- compression_ratio: number;
-
- /**
- * End time of the segment in seconds.
- */
- end: number;
-
- /**
- * Probability of no speech in the segment. If the value is higher than 1.0 and the
- * `avg_logprob` is below -1, consider this segment silent.
- */
- no_speech_prob: number;
-
- /**
- * Seek offset of the segment.
- */
- seek: number;
-
- /**
- * Start time of the segment in seconds.
- */
- start: number;
-
- /**
- * Temperature parameter used for generating the segment.
- */
- temperature: number;
-
- /**
- * Text content of the segment.
- */
- text: string;
-
- /**
- * Array of token IDs for the text content.
- */
- tokens: Array;
- }
- }
-}
-
export interface TranslationCreateParams {
/**
* The audio file object (not file name) translate, in one of these formats: flac,
@@ -146,6 +58,5 @@ export interface TranslationCreateParams {
export namespace Translations {
export import Translation = TranslationsAPI.Translation;
- export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
}