openai/openai-dotnet

Public

mirrored from https://github.com/openai/openai-dotnetAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.0.0-beta.12

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Custom/FineTuning/FineTuningClient.Protocol.cs

263lines · modeblame

58f93c8dShivangiReja2 years ago1using System;
9f9f2936Jose Arriaga Maldonado2 years ago2using System.ClientModel;
3using System.ClientModel.Primitives;
57732927ShivangiReja1 years ago4using System.Collections.Generic;
9f9f2936Jose Arriaga Maldonado2 years ago5using System.Threading.Tasks;
6
7namespace 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))]
21public 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>
38public virtual async Task<ClientResult> CreateJobAsync(BinaryContent content, RequestOptions options = null)
39{
40Argument.AssertNotNull(content, nameof(content));
41
42using PipelineMessage message = CreateCreateFineTuningJobRequest(content, options);
43return 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>
61public virtual ClientResult CreateJob(BinaryContent content, RequestOptions options = null)
62{
63Argument.AssertNotNull(content, nameof(content));
64
65using PipelineMessage message = CreateCreateFineTuningJobRequest(content, options);
66return 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>
2ab1a942Jose Arriaga Maldonado1 years ago80public virtual AsyncCollectionResult GetJobsAsync(string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago81{
2ab1a942Jose Arriaga Maldonado1 years ago82return new AsyncFineTuningJobCollectionResult(this, _pipeline, options, limit, after);
9f9f2936Jose Arriaga Maldonado2 years ago83}
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>
2ab1a942Jose Arriaga Maldonado1 years ago96public virtual CollectionResult GetJobs(string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago97{
2ab1a942Jose Arriaga Maldonado1 years ago98return new FineTuningJobCollectionResult(this, _pipeline, options, limit, after);
9f9f2936Jose Arriaga Maldonado2 years ago99}
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>
115public virtual async Task<ClientResult> GetJobAsync(string jobId, RequestOptions options)
116{
117Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
118
119using PipelineMessage message = CreateRetrieveFineTuningJobRequest(jobId, options);
120return 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>
137public virtual ClientResult GetJob(string jobId, RequestOptions options)
138{
139Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
140
141using PipelineMessage message = CreateRetrieveFineTuningJobRequest(jobId, options);
142return 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>
157public virtual async Task<ClientResult> CancelJobAsync(string jobId, RequestOptions options)
158{
159Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
160
161using PipelineMessage message = CreateCancelFineTuningJobRequest(jobId, options);
162return 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>
177public virtual ClientResult CancelJob(string jobId, RequestOptions options)
178{
179Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
180
181using PipelineMessage message = CreateCancelFineTuningJobRequest(jobId, options);
182return 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>
2ab1a942Jose Arriaga Maldonado1 years ago199public virtual AsyncCollectionResult GetJobEventsAsync(string jobId, string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago200{
201Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
202
2ab1a942Jose Arriaga Maldonado1 years ago203return new AsyncFineTuningJobEventCollectionResult(this, _pipeline, options, jobId, limit, after);
9f9f2936Jose Arriaga Maldonado2 years ago204}
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>
2ab1a942Jose Arriaga Maldonado1 years ago220public virtual CollectionResult GetJobEvents(string jobId, string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago221{
222Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
223
2ab1a942Jose Arriaga Maldonado1 years ago224return new FineTuningJobEventCollectionResult(this, _pipeline, options, jobId, limit, after);
9f9f2936Jose Arriaga Maldonado2 years ago225}
226
227/// <summary>
228/// [Protocol Method] List the checkpoints for a fine-tuning job.
229/// </summary>
57732927ShivangiReja1 years ago230/// <param name="jobId"> The ID of the fine-tuning job to get checkpoints for. </param>
9f9f2936Jose Arriaga Maldonado2 years ago231/// <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>
57732927ShivangiReja1 years ago234/// <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>
9f9f2936Jose Arriaga Maldonado2 years ago236/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
237/// <returns> The response returned from the service. </returns>
2ab1a942Jose Arriaga Maldonado1 years ago238public virtual AsyncCollectionResult GetJobCheckpointsAsync(string jobId, string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago239{
57732927ShivangiReja1 years ago240Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
9f9f2936Jose Arriaga Maldonado2 years ago241
2ab1a942Jose Arriaga Maldonado1 years ago242return new AsyncFineTuningJobCheckpointCollectionResult(this, _pipeline, options, jobId, limit, after);
243
9f9f2936Jose Arriaga Maldonado2 years ago244}
245
246/// <summary>
247/// [Protocol Method] List the checkpoints for a fine-tuning job.
248/// </summary>
57732927ShivangiReja1 years ago249/// <param name="jobId"> The ID of the fine-tuning job to get checkpoints for. </param>
9f9f2936Jose Arriaga Maldonado2 years ago250/// <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>
57732927ShivangiReja1 years ago253/// <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>
9f9f2936Jose Arriaga Maldonado2 years ago255/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
256/// <returns> The response returned from the service. </returns>
2ab1a942Jose Arriaga Maldonado1 years ago257public virtual CollectionResult GetJobCheckpoints(string jobId, string after, int? limit, RequestOptions options)
9f9f2936Jose Arriaga Maldonado2 years ago258{
57732927ShivangiReja1 years ago259Argument.AssertNotNullOrEmpty(jobId, nameof(jobId));
9f9f2936Jose Arriaga Maldonado2 years ago260
2ab1a942Jose Arriaga Maldonado1 years ago261return new FineTuningJobCheckpointCollectionResult(this, _pipeline, options, jobId, limit, after);
9f9f2936Jose Arriaga Maldonado2 years ago262}
263}