diff --git a/.stats.yml b/.stats.yml
index 0998368a4..68789976b 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-17ddd746c775ca4d4fbe64e5621ac30756ef09c061ff6313190b6ec162222d4c.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-71e58a77027c67e003fdd1b1ac8ac11557d8bfabc7666d1a827c6b1ca8ab98b5.yml
diff --git a/api.md b/api.md
index 5c3f552d8..75cb4d5e1 100644
--- a/api.md
+++ b/api.md
@@ -114,20 +114,26 @@ Types:
Types:
- Transcription
+- TranscriptionSegment
+- TranscriptionVerbose
+- TranscriptionWord
+- TranscriptionCreateResponse
Methods:
-- client.audio.transcriptions.create({ ...params }) -> Transcription
+- client.audio.transcriptions.create({ ...params }) -> TranscriptionCreateResponse
## Translations
Types:
- Translation
+- TranslationVerbose
+- TranslationCreateResponse
Methods:
-- client.audio.translations.create({ ...params }) -> Translation
+- client.audio.translations.create({ ...params }) -> TranslationCreateResponse
## Speech
diff --git a/src/resources/audio/audio.ts b/src/resources/audio/audio.ts
index a8b35d986..9c2c2b982 100644
--- a/src/resources/audio/audio.ts
+++ b/src/resources/audio/audio.ts
@@ -25,9 +25,15 @@ export namespace Audio {
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 import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
export import Translations = TranslationsAPI.Translations;
export import Translation = TranslationsAPI.Translation;
+ export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
+ export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
export import Speech = SpeechAPI.Speech;
export import SpeechModel = SpeechAPI.SpeechModel;
diff --git a/src/resources/audio/index.ts b/src/resources/audio/index.ts
index e8836470c..952c05b03 100644
--- a/src/resources/audio/index.ts
+++ b/src/resources/audio/index.ts
@@ -2,5 +2,19 @@
export { AudioModel, AudioResponseFormat, Audio } from './audio';
export { SpeechModel, SpeechCreateParams, Speech } from './speech';
-export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions';
-export { Translation, TranslationCreateParams, Translations } from './translations';
+export {
+ Transcription,
+ TranscriptionSegment,
+ TranscriptionVerbose,
+ TranscriptionWord,
+ TranscriptionCreateResponse,
+ TranscriptionCreateParams,
+ Transcriptions,
+} from './transcriptions';
+export {
+ Translation,
+ TranslationVerbose,
+ TranslationCreateResponse,
+ TranslationCreateParams,
+ Translations,
+} from './translations';
diff --git a/src/resources/audio/transcriptions.ts b/src/resources/audio/transcriptions.ts
index 1ee6921cd..e68e2dba7 100644
--- a/src/resources/audio/transcriptions.ts
+++ b/src/resources/audio/transcriptions.ts
@@ -9,7 +9,10 @@ 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('/audio/transcriptions', Core.multipartFormRequestOptions({ body, ...options }));
}
}
@@ -25,6 +28,115 @@ export interface Transcription {
text: string;
}
+export interface TranscriptionSegment {
+ /**
+ * 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;
+}
+
+/**
+ * Represents a verbose json transcription response returned by model, based on the
+ * provided input.
+ */
+export interface TranscriptionVerbose {
+ /**
+ * 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 interface TranscriptionWord {
+ /**
+ * 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;
+}
+
+/**
+ * Represents a transcription response returned by model, based on the provided
+ * input.
+ */
+export type TranscriptionCreateResponse = Transcription | TranscriptionVerbose;
+
export interface TranscriptionCreateParams {
/**
* The audio file object (not file name) to transcribe, in one of these formats:
@@ -80,5 +192,9 @@ export interface TranscriptionCreateParams {
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 import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams;
}
diff --git a/src/resources/audio/translations.ts b/src/resources/audio/translations.ts
index 6df718112..dd70df12a 100644
--- a/src/resources/audio/translations.ts
+++ b/src/resources/audio/translations.ts
@@ -4,12 +4,16 @@ import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as TranslationsAPI from './translations';
import * as AudioAPI from './audio';
+import * as TranscriptionsAPI from './transcriptions';
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('/audio/translations', Core.multipartFormRequestOptions({ body, ...options }));
}
}
@@ -18,6 +22,30 @@ export interface Translation {
text: string;
}
+export interface TranslationVerbose {
+ /**
+ * 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 type TranslationCreateResponse = Translation | TranslationVerbose;
+
export interface TranslationCreateParams {
/**
* The audio file object (not file name) translate, in one of these formats: flac,
@@ -57,5 +85,7 @@ export interface TranslationCreateParams {
export namespace Translations {
export import Translation = TranslationsAPI.Translation;
+ export import TranslationVerbose = TranslationsAPI.TranslationVerbose;
+ export import TranslationCreateResponse = TranslationsAPI.TranslationCreateResponse;
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams;
}