audio.go

 1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 2
 3package openai
 4
 5import (
 6	"github.com/openai/openai-go/option"
 7)
 8
 9// AudioService contains methods and other services that help with interacting with
10// the openai API.
11//
12// Note, unlike clients, this service does not read variables from the environment
13// automatically. You should not instantiate this service directly, and instead use
14// the [NewAudioService] method instead.
15type AudioService struct {
16	Options        []option.RequestOption
17	Transcriptions AudioTranscriptionService
18	Translations   AudioTranslationService
19	Speech         AudioSpeechService
20}
21
22// NewAudioService generates a new service that applies the given options to each
23// request. These options are applied after the parent client's options (if there
24// is one), and before any request-specific options.
25func NewAudioService(opts ...option.RequestOption) (r AudioService) {
26	r = AudioService{}
27	r.Options = opts
28	r.Transcriptions = NewAudioTranscriptionService(opts...)
29	r.Translations = NewAudioTranslationService(opts...)
30	r.Speech = NewAudioSpeechService(opts...)
31	return
32}
33
34type AudioModel = string
35
36const (
37	AudioModelWhisper1            AudioModel = "whisper-1"
38	AudioModelGPT4oTranscribe     AudioModel = "gpt-4o-transcribe"
39	AudioModelGPT4oMiniTranscribe AudioModel = "gpt-4o-mini-transcribe"
40)
41
42// The format of the output, in one of these options: `json`, `text`, `srt`,
43// `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`,
44// the only supported format is `json`.
45type AudioResponseFormat string
46
47const (
48	AudioResponseFormatJSON        AudioResponseFormat = "json"
49	AudioResponseFormatText        AudioResponseFormat = "text"
50	AudioResponseFormatSRT         AudioResponseFormat = "srt"
51	AudioResponseFormatVerboseJSON AudioResponseFormat = "verbose_json"
52	AudioResponseFormatVTT         AudioResponseFormat = "vtt"
53)