fine_tuning.py 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. from __future__ import annotations
  3. from ..._compat import cached_property
  4. from .jobs.jobs import (
  5. Jobs,
  6. AsyncJobs,
  7. JobsWithRawResponse,
  8. AsyncJobsWithRawResponse,
  9. JobsWithStreamingResponse,
  10. AsyncJobsWithStreamingResponse,
  11. )
  12. from ..._resource import SyncAPIResource, AsyncAPIResource
  13. from .alpha.alpha import (
  14. Alpha,
  15. AsyncAlpha,
  16. AlphaWithRawResponse,
  17. AsyncAlphaWithRawResponse,
  18. AlphaWithStreamingResponse,
  19. AsyncAlphaWithStreamingResponse,
  20. )
  21. from .checkpoints.checkpoints import (
  22. Checkpoints,
  23. AsyncCheckpoints,
  24. CheckpointsWithRawResponse,
  25. AsyncCheckpointsWithRawResponse,
  26. CheckpointsWithStreamingResponse,
  27. AsyncCheckpointsWithStreamingResponse,
  28. )
  29. __all__ = ["FineTuning", "AsyncFineTuning"]
  30. class FineTuning(SyncAPIResource):
  31. @cached_property
  32. def jobs(self) -> Jobs:
  33. return Jobs(self._client)
  34. @cached_property
  35. def checkpoints(self) -> Checkpoints:
  36. return Checkpoints(self._client)
  37. @cached_property
  38. def alpha(self) -> Alpha:
  39. return Alpha(self._client)
  40. @cached_property
  41. def with_raw_response(self) -> FineTuningWithRawResponse:
  42. """
  43. This property can be used as a prefix for any HTTP method call to return
  44. the raw response object instead of the parsed content.
  45. For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
  46. """
  47. return FineTuningWithRawResponse(self)
  48. @cached_property
  49. def with_streaming_response(self) -> FineTuningWithStreamingResponse:
  50. """
  51. An alternative to `.with_raw_response` that doesn't eagerly read the response body.
  52. For more information, see https://www.github.com/openai/openai-python#with_streaming_response
  53. """
  54. return FineTuningWithStreamingResponse(self)
  55. class AsyncFineTuning(AsyncAPIResource):
  56. @cached_property
  57. def jobs(self) -> AsyncJobs:
  58. return AsyncJobs(self._client)
  59. @cached_property
  60. def checkpoints(self) -> AsyncCheckpoints:
  61. return AsyncCheckpoints(self._client)
  62. @cached_property
  63. def alpha(self) -> AsyncAlpha:
  64. return AsyncAlpha(self._client)
  65. @cached_property
  66. def with_raw_response(self) -> AsyncFineTuningWithRawResponse:
  67. """
  68. This property can be used as a prefix for any HTTP method call to return
  69. the raw response object instead of the parsed content.
  70. For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
  71. """
  72. return AsyncFineTuningWithRawResponse(self)
  73. @cached_property
  74. def with_streaming_response(self) -> AsyncFineTuningWithStreamingResponse:
  75. """
  76. An alternative to `.with_raw_response` that doesn't eagerly read the response body.
  77. For more information, see https://www.github.com/openai/openai-python#with_streaming_response
  78. """
  79. return AsyncFineTuningWithStreamingResponse(self)
  80. class FineTuningWithRawResponse:
  81. def __init__(self, fine_tuning: FineTuning) -> None:
  82. self._fine_tuning = fine_tuning
  83. @cached_property
  84. def jobs(self) -> JobsWithRawResponse:
  85. return JobsWithRawResponse(self._fine_tuning.jobs)
  86. @cached_property
  87. def checkpoints(self) -> CheckpointsWithRawResponse:
  88. return CheckpointsWithRawResponse(self._fine_tuning.checkpoints)
  89. @cached_property
  90. def alpha(self) -> AlphaWithRawResponse:
  91. return AlphaWithRawResponse(self._fine_tuning.alpha)
  92. class AsyncFineTuningWithRawResponse:
  93. def __init__(self, fine_tuning: AsyncFineTuning) -> None:
  94. self._fine_tuning = fine_tuning
  95. @cached_property
  96. def jobs(self) -> AsyncJobsWithRawResponse:
  97. return AsyncJobsWithRawResponse(self._fine_tuning.jobs)
  98. @cached_property
  99. def checkpoints(self) -> AsyncCheckpointsWithRawResponse:
  100. return AsyncCheckpointsWithRawResponse(self._fine_tuning.checkpoints)
  101. @cached_property
  102. def alpha(self) -> AsyncAlphaWithRawResponse:
  103. return AsyncAlphaWithRawResponse(self._fine_tuning.alpha)
  104. class FineTuningWithStreamingResponse:
  105. def __init__(self, fine_tuning: FineTuning) -> None:
  106. self._fine_tuning = fine_tuning
  107. @cached_property
  108. def jobs(self) -> JobsWithStreamingResponse:
  109. return JobsWithStreamingResponse(self._fine_tuning.jobs)
  110. @cached_property
  111. def checkpoints(self) -> CheckpointsWithStreamingResponse:
  112. return CheckpointsWithStreamingResponse(self._fine_tuning.checkpoints)
  113. @cached_property
  114. def alpha(self) -> AlphaWithStreamingResponse:
  115. return AlphaWithStreamingResponse(self._fine_tuning.alpha)
  116. class AsyncFineTuningWithStreamingResponse:
  117. def __init__(self, fine_tuning: AsyncFineTuning) -> None:
  118. self._fine_tuning = fine_tuning
  119. @cached_property
  120. def jobs(self) -> AsyncJobsWithStreamingResponse:
  121. return AsyncJobsWithStreamingResponse(self._fine_tuning.jobs)
  122. @cached_property
  123. def checkpoints(self) -> AsyncCheckpointsWithStreamingResponse:
  124. return AsyncCheckpointsWithStreamingResponse(self._fine_tuning.checkpoints)
  125. @cached_property
  126. def alpha(self) -> AsyncAlphaWithStreamingResponse:
  127. return AsyncAlphaWithStreamingResponse(self._fine_tuning.alpha)