1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2
  3from __future__ import annotations
  4
  5from .speech import (
  6    Speech,
  7    AsyncSpeech,
  8    SpeechWithRawResponse,
  9    AsyncSpeechWithRawResponse,
 10    SpeechWithStreamingResponse,
 11    AsyncSpeechWithStreamingResponse,
 12)
 13from ..._compat import cached_property
 14from ..._resource import SyncAPIResource, AsyncAPIResource
 15from .translations import (
 16    Translations,
 17    AsyncTranslations,
 18    TranslationsWithRawResponse,
 19    AsyncTranslationsWithRawResponse,
 20    TranslationsWithStreamingResponse,
 21    AsyncTranslationsWithStreamingResponse,
 22)
 23from .transcriptions import (
 24    Transcriptions,
 25    AsyncTranscriptions,
 26    TranscriptionsWithRawResponse,
 27    AsyncTranscriptionsWithRawResponse,
 28    TranscriptionsWithStreamingResponse,
 29    AsyncTranscriptionsWithStreamingResponse,
 30)
 31
 32__all__ = ["Audio", "AsyncAudio"]
 33
 34
 35class Audio(SyncAPIResource):
 36    @cached_property
 37    def transcriptions(self) -> Transcriptions:
 38        return Transcriptions(self._client)
 39
 40    @cached_property
 41    def translations(self) -> Translations:
 42        return Translations(self._client)
 43
 44    @cached_property
 45    def speech(self) -> Speech:
 46        return Speech(self._client)
 47
 48    @cached_property
 49    def with_raw_response(self) -> AudioWithRawResponse:
 50        """
 51        This property can be used as a prefix for any HTTP method call to return
 52        the raw response object instead of the parsed content.
 53
 54        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
 55        """
 56        return AudioWithRawResponse(self)
 57
 58    @cached_property
 59    def with_streaming_response(self) -> AudioWithStreamingResponse:
 60        """
 61        An alternative to `.with_raw_response` that doesn't eagerly read the response body.
 62
 63        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
 64        """
 65        return AudioWithStreamingResponse(self)
 66
 67
 68class AsyncAudio(AsyncAPIResource):
 69    @cached_property
 70    def transcriptions(self) -> AsyncTranscriptions:
 71        return AsyncTranscriptions(self._client)
 72
 73    @cached_property
 74    def translations(self) -> AsyncTranslations:
 75        return AsyncTranslations(self._client)
 76
 77    @cached_property
 78    def speech(self) -> AsyncSpeech:
 79        return AsyncSpeech(self._client)
 80
 81    @cached_property
 82    def with_raw_response(self) -> AsyncAudioWithRawResponse:
 83        """
 84        This property can be used as a prefix for any HTTP method call to return
 85        the raw response object instead of the parsed content.
 86
 87        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
 88        """
 89        return AsyncAudioWithRawResponse(self)
 90
 91    @cached_property
 92    def with_streaming_response(self) -> AsyncAudioWithStreamingResponse:
 93        """
 94        An alternative to `.with_raw_response` that doesn't eagerly read the response body.
 95
 96        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
 97        """
 98        return AsyncAudioWithStreamingResponse(self)
 99
100
101class AudioWithRawResponse:
102    def __init__(self, audio: Audio) -> None:
103        self._audio = audio
104
105    @cached_property
106    def transcriptions(self) -> TranscriptionsWithRawResponse:
107        return TranscriptionsWithRawResponse(self._audio.transcriptions)
108
109    @cached_property
110    def translations(self) -> TranslationsWithRawResponse:
111        return TranslationsWithRawResponse(self._audio.translations)
112
113    @cached_property
114    def speech(self) -> SpeechWithRawResponse:
115        return SpeechWithRawResponse(self._audio.speech)
116
117
118class AsyncAudioWithRawResponse:
119    def __init__(self, audio: AsyncAudio) -> None:
120        self._audio = audio
121
122    @cached_property
123    def transcriptions(self) -> AsyncTranscriptionsWithRawResponse:
124        return AsyncTranscriptionsWithRawResponse(self._audio.transcriptions)
125
126    @cached_property
127    def translations(self) -> AsyncTranslationsWithRawResponse:
128        return AsyncTranslationsWithRawResponse(self._audio.translations)
129
130    @cached_property
131    def speech(self) -> AsyncSpeechWithRawResponse:
132        return AsyncSpeechWithRawResponse(self._audio.speech)
133
134
135class AudioWithStreamingResponse:
136    def __init__(self, audio: Audio) -> None:
137        self._audio = audio
138
139    @cached_property
140    def transcriptions(self) -> TranscriptionsWithStreamingResponse:
141        return TranscriptionsWithStreamingResponse(self._audio.transcriptions)
142
143    @cached_property
144    def translations(self) -> TranslationsWithStreamingResponse:
145        return TranslationsWithStreamingResponse(self._audio.translations)
146
147    @cached_property
148    def speech(self) -> SpeechWithStreamingResponse:
149        return SpeechWithStreamingResponse(self._audio.speech)
150
151
152class AsyncAudioWithStreamingResponse:
153    def __init__(self, audio: AsyncAudio) -> None:
154        self._audio = audio
155
156    @cached_property
157    def transcriptions(self) -> AsyncTranscriptionsWithStreamingResponse:
158        return AsyncTranscriptionsWithStreamingResponse(self._audio.transcriptions)
159
160    @cached_property
161    def translations(self) -> AsyncTranslationsWithStreamingResponse:
162        return AsyncTranslationsWithStreamingResponse(self._audio.translations)
163
164    @cached_property
165    def speech(self) -> AsyncSpeechWithStreamingResponse:
166        return AsyncSpeechWithStreamingResponse(self._audio.speech)