openai/openai-dotnet
Publicmirrored from https://github.com/openai/openai-dotnetAvailable
src/Custom/FineTuning/FineTuningClient.Protocol.cs
263lines · modecode
| 1 | using System; |
| 2 | using System.ClientModel; |
| 3 | using System.ClientModel.Primitives; |
| 4 | using System.Collections.Generic; |
| 5 | using System.Threading.Tasks; |
| 6 | |
| 7 | namespace OpenAI.FineTuning; |
| 8 | |
| 9 | [CodeGenSuppress("CreateFineTuningJobAsync", typeof(BinaryContent), typeof(RequestOptions))] |
| 10 | [CodeGenSuppress("CreateFineTuningJob", typeof(BinaryContent), typeof(RequestOptions))] |
| 11 | [CodeGenSuppress("GetPaginatedFineTuningJobsAsync", typeof(string), typeof(int?), typeof(RequestOptions))] |
| 12 | [CodeGenSuppress("GetPaginatedFineTuningJobs", typeof(string), typeof(int?), typeof(RequestOptions))] |
| 13 | [CodeGenSuppress("RetrieveFineTuningJobAsync", typeof(string), typeof(RequestOptions))] |
| 14 | [CodeGenSuppress("RetrieveFineTuningJob", typeof(string), typeof(RequestOptions))] |
| 15 | [CodeGenSuppress("CancelFineTuningJobAsync", typeof(string), typeof(RequestOptions))] |
| 16 | [CodeGenSuppress("CancelFineTuningJob", typeof(string), typeof(RequestOptions))] |
| 17 | [CodeGenSuppress("GetFineTuningEventsAsync", typeof(string), typeof(string), typeof(int?), typeof(RequestOptions))] |
| 18 | [CodeGenSuppress("GetFineTuningEvents", typeof(string), typeof(string), typeof(int?), typeof(RequestOptions))] |
| 19 | [CodeGenSuppress("GetFineTuningJobCheckpointsAsync", typeof(string), typeof(string), typeof(int?), typeof(RequestOptions))] |
| 20 | [CodeGenSuppress("GetFineTuningJobCheckpoints", typeof(string), typeof(string), typeof(int?), typeof(RequestOptions))] |
| 21 | public partial class FineTuningClient |
| 22 | { |
| 23 | // CUSTOM: |
| 24 | // - Renamed. |
| 25 | // - Edited doc comment. |
| 26 | /// <summary> |
| 27 | /// [Protocol Method] Creates a fine-tuning job which begins the process of creating a new model from a given dataset. |
| 28 | /// |
| 29 | /// Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. |
| 30 | /// |
| 31 | /// [Learn more about fine-tuning](/docs/guides/fine-tuning) |
| 32 | /// </summary> |
| 33 | /// <param name="content"> The content to send as the body of the request. </param> |
| 34 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 35 | /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 36 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 37 | /// <returns> The response returned from the service. </returns> |
| 38 | public virtual async Task<ClientResult> CreateJobAsync(BinaryContent content, RequestOptions options = null) |
| 39 | { |
| 40 | Argument.AssertNotNull(content, nameof(content)); |
| 41 | |
| 42 | using PipelineMessage message = CreateCreateFineTuningJobRequest(content, options); |
| 43 | return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 44 | } |
| 45 | |
| 46 | // CUSTOM: |
| 47 | // - Renamed. |
| 48 | // - Edited doc comment. |
| 49 | /// <summary> |
| 50 | /// [Protocol Method] Creates a fine-tuning job which begins the process of creating a new model from a given dataset. |
| 51 | /// |
| 52 | /// Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. |
| 53 | /// |
| 54 | /// [Learn more about fine-tuning](/docs/guides/fine-tuning) |
| 55 | /// </summary> |
| 56 | /// <param name="content"> The content to send as the body of the request. </param> |
| 57 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 58 | /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception> |
| 59 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 60 | /// <returns> The response returned from the service. </returns> |
| 61 | public virtual ClientResult CreateJob(BinaryContent content, RequestOptions options = null) |
| 62 | { |
| 63 | Argument.AssertNotNull(content, nameof(content)); |
| 64 | |
| 65 | using PipelineMessage message = CreateCreateFineTuningJobRequest(content, options); |
| 66 | return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); |
| 67 | } |
| 68 | |
| 69 | // CUSTOM: |
| 70 | // - Renamed. |
| 71 | // - Edited doc comment. |
| 72 | /// <summary> |
| 73 | /// [Protocol Method] List your organization's fine-tuning jobs |
| 74 | /// </summary> |
| 75 | /// <param name="after"> Identifier for the last job from the previous pagination request. </param> |
| 76 | /// <param name="limit"> Number of fine-tuning jobs to retrieve. </param> |
| 77 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 78 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 79 | /// <returns> The response returned from the service. </returns> |
| 80 | public virtual AsyncCollectionResult GetJobsAsync(string after, int? limit, RequestOptions options) |
| 81 | { |
| 82 | return new AsyncFineTuningJobCollectionResult(this, _pipeline, options, limit, after); |
| 83 | } |
| 84 | |
| 85 | // CUSTOM: |
| 86 | // - Renamed. |
| 87 | // - Edited doc comment. |
| 88 | /// <summary> |
| 89 | /// [Protocol Method] List your organization's fine-tuning jobs |
| 90 | /// </summary> |
| 91 | /// <param name="after"> Identifier for the last job from the previous pagination request. </param> |
| 92 | /// <param name="limit"> Number of fine-tuning jobs to retrieve. </param> |
| 93 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 94 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 95 | /// <returns> The response returned from the service. </returns> |
| 96 | public virtual CollectionResult GetJobs(string after, int? limit, RequestOptions options) |
| 97 | { |
| 98 | return new FineTuningJobCollectionResult(this, _pipeline, options, limit, after); |
| 99 | } |
| 100 | |
| 101 | // CUSTOM: |
| 102 | // - Renamed. |
| 103 | // - Edited doc comment. |
| 104 | /// <summary> |
| 105 | /// [Protocol Method] Get info about a fine-tuning job. |
| 106 | /// |
| 107 | /// [Learn more about fine-tuning](/docs/guides/fine-tuning) |
| 108 | /// </summary> |
| 109 | /// <param name="jobId"> The ID of the fine-tuning job. </param> |
| 110 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 111 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 112 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 113 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 114 | /// <returns> The response returned from the service. </returns> |
| 115 | public virtual async Task<ClientResult> GetJobAsync(string jobId, RequestOptions options) |
| 116 | { |
| 117 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 118 | |
| 119 | using PipelineMessage message = CreateRetrieveFineTuningJobRequest(jobId, options); |
| 120 | return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 121 | } |
| 122 | |
| 123 | // CUSTOM: |
| 124 | // - Renamed. |
| 125 | // - Edited doc comment. |
| 126 | /// <summary> |
| 127 | /// [Protocol Method] Get info about a fine-tuning job. |
| 128 | /// |
| 129 | /// [Learn more about fine-tuning](/docs/guides/fine-tuning) |
| 130 | /// </summary> |
| 131 | /// <param name="jobId"> The ID of the fine-tuning job. </param> |
| 132 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 133 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 134 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 135 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 136 | /// <returns> The response returned from the service. </returns> |
| 137 | public virtual ClientResult GetJob(string jobId, RequestOptions options) |
| 138 | { |
| 139 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 140 | |
| 141 | using PipelineMessage message = CreateRetrieveFineTuningJobRequest(jobId, options); |
| 142 | return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); |
| 143 | } |
| 144 | |
| 145 | // CUSTOM: |
| 146 | // - Renamed. |
| 147 | // - Edited doc comment. |
| 148 | /// <summary> |
| 149 | /// [Protocol Method] Immediately cancel a fine-tune job. |
| 150 | /// </summary> |
| 151 | /// <param name="jobId"> The ID of the fine-tuning job to cancel. </param> |
| 152 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 153 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 154 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 155 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 156 | /// <returns> The response returned from the service. </returns> |
| 157 | public virtual async Task<ClientResult> CancelJobAsync(string jobId, RequestOptions options) |
| 158 | { |
| 159 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 160 | |
| 161 | using PipelineMessage message = CreateCancelFineTuningJobRequest(jobId, options); |
| 162 | return ClientResult.FromResponse(await _pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false)); |
| 163 | } |
| 164 | |
| 165 | // CUSTOM: |
| 166 | // - Renamed. |
| 167 | // - Edited doc comment. |
| 168 | /// <summary> |
| 169 | /// [Protocol Method] Immediately cancel a fine-tune job. |
| 170 | /// </summary> |
| 171 | /// <param name="jobId"> The ID of the fine-tuning job to cancel. </param> |
| 172 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 173 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 174 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 175 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 176 | /// <returns> The response returned from the service. </returns> |
| 177 | public virtual ClientResult CancelJob(string jobId, RequestOptions options) |
| 178 | { |
| 179 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 180 | |
| 181 | using PipelineMessage message = CreateCancelFineTuningJobRequest(jobId, options); |
| 182 | return ClientResult.FromResponse(_pipeline.ProcessMessage(message, options)); |
| 183 | } |
| 184 | |
| 185 | // CUSTOM: |
| 186 | // - Renamed. |
| 187 | // - Edited doc comment. |
| 188 | /// <summary> |
| 189 | /// [Protocol Method] Get status updates for a fine-tuning job. |
| 190 | /// </summary> |
| 191 | /// <param name="jobId"> The ID of the fine-tuning job to get events for. </param> |
| 192 | /// <param name="after"> Identifier for the last event from the previous pagination request. </param> |
| 193 | /// <param name="limit"> Number of events to retrieve. </param> |
| 194 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 195 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 196 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 197 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 198 | /// <returns> The response returned from the service. </returns> |
| 199 | public virtual AsyncCollectionResult GetJobEventsAsync(string jobId, string after, int? limit, RequestOptions options) |
| 200 | { |
| 201 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 202 | |
| 203 | return new AsyncFineTuningJobEventCollectionResult(this, _pipeline, options, jobId, limit, after); |
| 204 | } |
| 205 | |
| 206 | // CUSTOM: |
| 207 | // - Renamed. |
| 208 | // - Edited doc comment. |
| 209 | /// <summary> |
| 210 | /// [Protocol Method] Get status updates for a fine-tuning job. |
| 211 | /// </summary> |
| 212 | /// <param name="jobId"> The ID of the fine-tuning job to get events for. </param> |
| 213 | /// <param name="after"> Identifier for the last event from the previous pagination request. </param> |
| 214 | /// <param name="limit"> Number of events to retrieve. </param> |
| 215 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 216 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 217 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 218 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 219 | /// <returns> The response returned from the service. </returns> |
| 220 | public virtual CollectionResult GetJobEvents(string jobId, string after, int? limit, RequestOptions options) |
| 221 | { |
| 222 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 223 | |
| 224 | return new FineTuningJobEventCollectionResult(this, _pipeline, options, jobId, limit, after); |
| 225 | } |
| 226 | |
| 227 | /// <summary> |
| 228 | /// [Protocol Method] List the checkpoints for a fine-tuning job. |
| 229 | /// </summary> |
| 230 | /// <param name="jobId"> The ID of the fine-tuning job to get checkpoints for. </param> |
| 231 | /// <param name="after"> Identifier for the last checkpoint ID from the previous pagination request. </param> |
| 232 | /// <param name="limit"> Number of checkpoints to retrieve. </param> |
| 233 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 234 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 235 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 236 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 237 | /// <returns> The response returned from the service. </returns> |
| 238 | public virtual AsyncCollectionResult GetJobCheckpointsAsync(string jobId, string after, int? limit, RequestOptions options) |
| 239 | { |
| 240 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 241 | |
| 242 | return new AsyncFineTuningJobCheckpointCollectionResult(this, _pipeline, options, jobId, limit, after); |
| 243 | |
| 244 | } |
| 245 | |
| 246 | /// <summary> |
| 247 | /// [Protocol Method] List the checkpoints for a fine-tuning job. |
| 248 | /// </summary> |
| 249 | /// <param name="jobId"> The ID of the fine-tuning job to get checkpoints for. </param> |
| 250 | /// <param name="after"> Identifier for the last checkpoint ID from the previous pagination request. </param> |
| 251 | /// <param name="limit"> Number of checkpoints to retrieve. </param> |
| 252 | /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param> |
| 253 | /// <exception cref="ArgumentNullException"> <paramref name="jobId"/> is null. </exception> |
| 254 | /// <exception cref="ArgumentException"> <paramref name="jobId"/> is an empty string, and was expected to be non-empty. </exception> |
| 255 | /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception> |
| 256 | /// <returns> The response returned from the service. </returns> |
| 257 | public virtual CollectionResult GetJobCheckpoints(string jobId, string after, int? limit, RequestOptions options) |
| 258 | { |
| 259 | Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); |
| 260 | |
| 261 | return new FineTuningJobCheckpointCollectionResult(this, _pipeline, options, jobId, limit, after); |
| 262 | } |
| 263 | } |
| 264 | |