1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2
  3from __future__ import annotations
  4
  5from ..._compat import cached_property
  6from .jobs.jobs import (
  7    Jobs,
  8    AsyncJobs,
  9    JobsWithRawResponse,
 10    AsyncJobsWithRawResponse,
 11    JobsWithStreamingResponse,
 12    AsyncJobsWithStreamingResponse,
 13)
 14from ..._resource import SyncAPIResource, AsyncAPIResource
 15from .alpha.alpha import (
 16    Alpha,
 17    AsyncAlpha,
 18    AlphaWithRawResponse,
 19    AsyncAlphaWithRawResponse,
 20    AlphaWithStreamingResponse,
 21    AsyncAlphaWithStreamingResponse,
 22)
 23from .checkpoints.checkpoints import (
 24    Checkpoints,
 25    AsyncCheckpoints,
 26    CheckpointsWithRawResponse,
 27    AsyncCheckpointsWithRawResponse,
 28    CheckpointsWithStreamingResponse,
 29    AsyncCheckpointsWithStreamingResponse,
 30)
 31
 32__all__ = ["FineTuning", "AsyncFineTuning"]
 33
 34
 35class FineTuning(SyncAPIResource):
 36    @cached_property
 37    def jobs(self) -> Jobs:
 38        return Jobs(self._client)
 39
 40    @cached_property
 41    def checkpoints(self) -> Checkpoints:
 42        return Checkpoints(self._client)
 43
 44    @cached_property
 45    def alpha(self) -> Alpha:
 46        return Alpha(self._client)
 47
 48    @cached_property
 49    def with_raw_response(self) -> FineTuningWithRawResponse:
 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 FineTuningWithRawResponse(self)
 57
 58    @cached_property
 59    def with_streaming_response(self) -> FineTuningWithStreamingResponse:
 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 FineTuningWithStreamingResponse(self)
 66
 67
 68class AsyncFineTuning(AsyncAPIResource):
 69    @cached_property
 70    def jobs(self) -> AsyncJobs:
 71        return AsyncJobs(self._client)
 72
 73    @cached_property
 74    def checkpoints(self) -> AsyncCheckpoints:
 75        return AsyncCheckpoints(self._client)
 76
 77    @cached_property
 78    def alpha(self) -> AsyncAlpha:
 79        return AsyncAlpha(self._client)
 80
 81    @cached_property
 82    def with_raw_response(self) -> AsyncFineTuningWithRawResponse:
 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 AsyncFineTuningWithRawResponse(self)
 90
 91    @cached_property
 92    def with_streaming_response(self) -> AsyncFineTuningWithStreamingResponse:
 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 AsyncFineTuningWithStreamingResponse(self)
 99
100
101class FineTuningWithRawResponse:
102    def __init__(self, fine_tuning: FineTuning) -> None:
103        self._fine_tuning = fine_tuning
104
105    @cached_property
106    def jobs(self) -> JobsWithRawResponse:
107        return JobsWithRawResponse(self._fine_tuning.jobs)
108
109    @cached_property
110    def checkpoints(self) -> CheckpointsWithRawResponse:
111        return CheckpointsWithRawResponse(self._fine_tuning.checkpoints)
112
113    @cached_property
114    def alpha(self) -> AlphaWithRawResponse:
115        return AlphaWithRawResponse(self._fine_tuning.alpha)
116
117
118class AsyncFineTuningWithRawResponse:
119    def __init__(self, fine_tuning: AsyncFineTuning) -> None:
120        self._fine_tuning = fine_tuning
121
122    @cached_property
123    def jobs(self) -> AsyncJobsWithRawResponse:
124        return AsyncJobsWithRawResponse(self._fine_tuning.jobs)
125
126    @cached_property
127    def checkpoints(self) -> AsyncCheckpointsWithRawResponse:
128        return AsyncCheckpointsWithRawResponse(self._fine_tuning.checkpoints)
129
130    @cached_property
131    def alpha(self) -> AsyncAlphaWithRawResponse:
132        return AsyncAlphaWithRawResponse(self._fine_tuning.alpha)
133
134
135class FineTuningWithStreamingResponse:
136    def __init__(self, fine_tuning: FineTuning) -> None:
137        self._fine_tuning = fine_tuning
138
139    @cached_property
140    def jobs(self) -> JobsWithStreamingResponse:
141        return JobsWithStreamingResponse(self._fine_tuning.jobs)
142
143    @cached_property
144    def checkpoints(self) -> CheckpointsWithStreamingResponse:
145        return CheckpointsWithStreamingResponse(self._fine_tuning.checkpoints)
146
147    @cached_property
148    def alpha(self) -> AlphaWithStreamingResponse:
149        return AlphaWithStreamingResponse(self._fine_tuning.alpha)
150
151
152class AsyncFineTuningWithStreamingResponse:
153    def __init__(self, fine_tuning: AsyncFineTuning) -> None:
154        self._fine_tuning = fine_tuning
155
156    @cached_property
157    def jobs(self) -> AsyncJobsWithStreamingResponse:
158        return AsyncJobsWithStreamingResponse(self._fine_tuning.jobs)
159
160    @cached_property
161    def checkpoints(self) -> AsyncCheckpointsWithStreamingResponse:
162        return AsyncCheckpointsWithStreamingResponse(self._fine_tuning.checkpoints)
163
164    @cached_property
165    def alpha(self) -> AsyncAlphaWithStreamingResponse:
166        return AsyncAlphaWithStreamingResponse(self._fine_tuning.alpha)