-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add transcription and translation endpoints
- Loading branch information
1 parent
41691e1
commit 5a422c4
Showing
15 changed files
with
296 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
configured_endpoints: 4 | ||
configured_endpoints: 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,7 @@ If you’d like to use the repository from source, you can either install from g | |
To install via git: | ||
|
||
```bash | ||
npm install --save git+ssh://[email protected]:groq/groq-typescript.git | ||
# or | ||
yarn add git+ssh://[email protected]:groq/groq-typescript.git | ||
npm install git+ssh://[email protected]:groq/groq-typescript.git | ||
``` | ||
|
||
Alternatively, to link a local copy of the repo: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
import { APIResource } from 'groq-sdk/resource'; | ||
import * as AudioAPI from 'groq-sdk/resources/audio/audio'; | ||
import * as TranscriptionsAPI from 'groq-sdk/resources/audio/transcriptions'; | ||
import * as TranslationsAPI from 'groq-sdk/resources/audio/translations'; | ||
|
||
export class Audio extends APIResource { | ||
transcriptions: TranscriptionsAPI.Transcriptions = new TranscriptionsAPI.Transcriptions(this._client); | ||
translations: TranslationsAPI.Translations = new TranslationsAPI.Translations(this._client); | ||
} | ||
|
||
export interface Translation { | ||
text: string; | ||
} | ||
|
||
export namespace Audio { | ||
export import Translation = AudioAPI.Translation; | ||
export import Transcriptions = TranscriptionsAPI.Transcriptions; | ||
export import Transcription = TranscriptionsAPI.Transcription; | ||
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams; | ||
export import Translations = TranslationsAPI.Translations; | ||
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
export { Transcription, TranscriptionCreateParams, Transcriptions } from './transcriptions'; | ||
export { Translation, Audio } from './audio'; | ||
export { TranslationCreateParams, Translations } from './translations'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
import * as Core from 'groq-sdk/core'; | ||
import { APIResource } from 'groq-sdk/resource'; | ||
import * as TranscriptionsAPI from 'groq-sdk/resources/audio/transcriptions'; | ||
import { type Uploadable, multipartFormRequestOptions } from 'groq-sdk/core'; | ||
|
||
export class Transcriptions extends APIResource { | ||
/** | ||
* Transcribes audio into the input language. | ||
*/ | ||
create(body: TranscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise<Transcription> { | ||
return this._client.post( | ||
'/openai/v1/audio/transcriptions', | ||
multipartFormRequestOptions({ body, ...options }), | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Represents a transcription response returned by model, based on the provided | ||
* input. | ||
*/ | ||
export interface Transcription { | ||
/** | ||
* The transcribed text. | ||
*/ | ||
text: string; | ||
} | ||
|
||
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: Uploadable; | ||
|
||
/** | ||
* ID of the model to use. Only `whisper-large-v3` is currently available. | ||
*/ | ||
model: (string & {}) | 'whisper-large-v3'; | ||
|
||
/** | ||
* 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. | ||
*/ | ||
language?: string; | ||
|
||
/** | ||
* An optional text to guide the model's style or continue a previous audio | ||
* segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the | ||
* audio language. | ||
*/ | ||
prompt?: string; | ||
|
||
/** | ||
* The format of the transcript output, in one of these options: `json`, `text`, | ||
* `srt`, `verbose_json`, or `vtt`. | ||
*/ | ||
response_format?: 'json' | 'text' | 'srt' | 'verbose_json' | 'vtt'; | ||
|
||
/** | ||
* 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 | ||
* deterministic. If set to 0, the model will use | ||
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to | ||
* automatically increase the temperature until certain thresholds are hit. | ||
*/ | ||
temperature?: number; | ||
|
||
/** | ||
* The timestamp granularities to populate for this transcription. | ||
* `response_format` must be set `verbose_json` to use timestamp granularities. | ||
* Either or both of these options are supported: `word`, or `segment`. Note: There | ||
* is no additional latency for segment timestamps, but generating word timestamps | ||
* incurs additional latency. | ||
*/ | ||
timestamp_granularities?: Array<'word' | 'segment'>; | ||
} | ||
|
||
export namespace Transcriptions { | ||
export import Transcription = TranscriptionsAPI.Transcription; | ||
export import TranscriptionCreateParams = TranscriptionsAPI.TranscriptionCreateParams; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// File generated from our OpenAPI spec by Stainless. | ||
|
||
import * as Core from 'groq-sdk/core'; | ||
import { APIResource } from 'groq-sdk/resource'; | ||
import * as TranslationsAPI from 'groq-sdk/resources/audio/translations'; | ||
import * as AudioAPI from 'groq-sdk/resources/audio/audio'; | ||
import { type Uploadable, multipartFormRequestOptions } from 'groq-sdk/core'; | ||
|
||
export class Translations extends APIResource { | ||
/** | ||
* Translates audio into English. | ||
*/ | ||
create( | ||
body: TranslationCreateParams, | ||
options?: Core.RequestOptions, | ||
): Core.APIPromise<AudioAPI.Translation> { | ||
return this._client.post( | ||
'/openai/v1/audio/translations', | ||
multipartFormRequestOptions({ body, ...options }), | ||
); | ||
} | ||
} | ||
|
||
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: Uploadable; | ||
|
||
/** | ||
* ID of the model to use. Only `whisper-large-v3` is currently available. | ||
*/ | ||
model: (string & {}) | 'whisper-large-v3'; | ||
|
||
/** | ||
* An optional text to guide the model's style or continue a previous audio | ||
* segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in | ||
* English. | ||
*/ | ||
prompt?: string; | ||
|
||
/** | ||
* The format of the transcript output, in one of these options: `json`, `text`, | ||
* `srt`, `verbose_json`, or `vtt`. | ||
*/ | ||
response_format?: string; | ||
|
||
/** | ||
* 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 | ||
* deterministic. If set to 0, the model will use | ||
* [log probability](https://en.wikipedia.org/wiki/Log_probability) to | ||
* automatically increase the temperature until certain thresholds are hit. | ||
*/ | ||
temperature?: number; | ||
} | ||
|
||
export namespace Translations { | ||
export import TranslationCreateParams = TranslationsAPI.TranslationCreateParams; | ||
} |
Oops, something went wrong.