openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/modify-responsesclient-default-model

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Evals/EvaluationClient.Protocol.cs

237lines · modecode

1using Microsoft.TypeSpec.Generator.Customizations;
2using System.ClientModel;
3using System.ClientModel.Primitives;
4using System.Threading.Tasks;
5
6namespace OpenAI.Evals;
7
8[CodeGenSuppress("GetEvals", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
9[CodeGenSuppress("GetEvalsAsync", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
10[CodeGenSuppress("CreateEval", typeof(BinaryContent), typeof(RequestOptions))]
11[CodeGenSuppress("CreateEvalAsync", typeof(BinaryContent), typeof(RequestOptions))]
12[CodeGenSuppress("GetEval", typeof(string), typeof(RequestOptions))]
13[CodeGenSuppress("GetEvalAsync", typeof(string), typeof(RequestOptions))]
14[CodeGenSuppress("UpdateEval", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
15[CodeGenSuppress("UpdateEvalAsync", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
16[CodeGenSuppress("DeleteEval", typeof(string), typeof(RequestOptions))]
17[CodeGenSuppress("DeleteEvalAsync", typeof(string), typeof(RequestOptions))]
18[CodeGenSuppress("GetEvalRuns", typeof(string), typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
19[CodeGenSuppress("GetEvalRunsAsync", typeof(string), typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
20[CodeGenSuppress("CreateEvalRun", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
21[CodeGenSuppress("CreateEvalRunAsync", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
22[CodeGenSuppress("GetEvalRun", typeof(string), typeof(string), typeof(RequestOptions))]
23[CodeGenSuppress("GetEvalRunAsync", typeof(string), typeof(string), typeof(RequestOptions))]
24[CodeGenSuppress("CancelEvalRun", typeof(string), typeof(string), typeof(RequestOptions))]
25[CodeGenSuppress("CancelEvalRunAsync", typeof(string), typeof(string), typeof(RequestOptions))]
26[CodeGenSuppress("DeleteEvalRun", typeof(string), typeof(string), typeof(RequestOptions))]
27[CodeGenSuppress("DeleteEvalRunAsync", typeof(string), typeof(string), typeof(RequestOptions))]
28[CodeGenSuppress("GetEvalRunOutputItems", typeof(string), typeof(string), typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
29[CodeGenSuppress("GetEvalRunOutputItemsAsync", typeof(string), typeof(string), typeof(string), typeof(int?), typeof(string), typeof(string), typeof(RequestOptions))]
30[CodeGenSuppress("GetEvalRunOutputItem", typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
31[CodeGenSuppress("GetEvalRunOutputItemAsync", typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
32public partial class EvaluationClient
33{
34 public virtual ClientResult GetEvaluations(int? limit, string orderBy, string order, string after, RequestOptions options)
35 {
36 using PipelineMessage message = CreateGetEvalsRequest(after, limit, order, orderBy, options);
37 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
38 }
39
40 public virtual async Task<ClientResult> GetEvaluationsAsync(int? limit, string orderBy, string order, string after, RequestOptions options)
41 {
42 using PipelineMessage message = CreateGetEvalsRequest(after, limit, order, orderBy, options);
43 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
44 }
45
46 public virtual ClientResult CreateEvaluation(BinaryContent content, RequestOptions options = null)
47 {
48 Argument.AssertNotNull(content, nameof(content));
49
50 using PipelineMessage message = CreateCreateEvalRequest(content, options);
51 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
52 }
53
54 public virtual async Task<ClientResult> CreateEvaluationAsync(BinaryContent content, RequestOptions options = null)
55 {
56 Argument.AssertNotNull(content, nameof(content));
57
58 using PipelineMessage message = CreateCreateEvalRequest(content, options);
59 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
60 }
61
62 public virtual ClientResult GetEvaluation(string evaluationId, RequestOptions options)
63 {
64 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
65
66 using PipelineMessage message = CreateGetEvalRequest(evaluationId, options);
67 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
68 }
69
70 public virtual async Task<ClientResult> GetEvaluationAsync(string evaluationId, RequestOptions options)
71 {
72 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
73
74 using PipelineMessage message = CreateGetEvalRequest(evaluationId, options);
75 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
76 }
77
78 public virtual ClientResult UpdateEvaluation(string evaluationId, BinaryContent content, RequestOptions options = null)
79 {
80 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
81 Argument.AssertNotNull(content, nameof(content));
82
83 using PipelineMessage message = CreateUpdateEvalRequest(evaluationId, content, options);
84 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
85 }
86
87 public virtual async Task<ClientResult> UpdateEvaluationAsync(string evaluationId, BinaryContent content, RequestOptions options = null)
88 {
89 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
90 Argument.AssertNotNull(content, nameof(content));
91
92 using PipelineMessage message = CreateUpdateEvalRequest(evaluationId, content, options);
93 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
94 }
95
96 public virtual ClientResult DeleteEvaluation(string evaluationId, RequestOptions options)
97 {
98 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
99
100 using PipelineMessage message = CreateDeleteEvalRequest(evaluationId, options);
101 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
102 }
103
104 public virtual async Task<ClientResult> DeleteEvaluationAsync(string evaluationId, RequestOptions options)
105 {
106 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
107
108 using PipelineMessage message = CreateDeleteEvalRequest(evaluationId, options);
109 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
110 }
111
112 public virtual ClientResult GetEvaluationRuns(string evaluationId, int? limit, string order, string after, string evaluationRunStatus, RequestOptions options)
113 {
114 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
115
116 using PipelineMessage message = CreateGetEvalRunsRequest(evaluationId, after, limit, order, evaluationRunStatus, options);
117 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
118 }
119
120 public virtual async Task<ClientResult> GetEvaluationRunsAsync(string evaluationId, int? limit, string order, string after, string evaluationRunStatus, RequestOptions options)
121 {
122 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
123
124 using PipelineMessage message = CreateGetEvalRunsRequest(evaluationId, after, limit, order, evaluationRunStatus, options);
125 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
126 }
127
128 public virtual ClientResult CreateEvaluationRun(string evaluationId, BinaryContent content, RequestOptions options = null)
129 {
130 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
131 Argument.AssertNotNull(content, nameof(content));
132
133 using PipelineMessage message = CreateCreateEvalRunRequest(evaluationId, content, options);
134 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
135 }
136
137 public virtual async Task<ClientResult> CreateEvaluationRunAsync(string evaluationId, BinaryContent content, RequestOptions options = null)
138 {
139 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
140 Argument.AssertNotNull(content, nameof(content));
141
142 using PipelineMessage message = CreateCreateEvalRunRequest(evaluationId, content, options);
143 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
144 }
145
146 public virtual ClientResult GetEvaluationRun(string evaluationId, string evaluationRunId, RequestOptions options)
147 {
148 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
149 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
150
151 using PipelineMessage message = CreateGetEvalRunRequest(evaluationId, evaluationRunId, options);
152 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
153 }
154
155 public virtual async Task<ClientResult> GetEvaluationRunAsync(string evaluationId, string evaluationRunId, RequestOptions options)
156 {
157 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
158 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
159
160 using PipelineMessage message = CreateGetEvalRunRequest(evaluationId, evaluationRunId, options);
161 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
162 }
163
164 public virtual ClientResult CancelEvaluationRun(string evaluationId, string evaluationRunId, RequestOptions options)
165 {
166 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
167 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
168
169 using PipelineMessage message = CreateCancelEvalRunRequest(evaluationId, evaluationRunId, options);
170 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
171 }
172
173 public virtual async Task<ClientResult> CancelEvaluationRunAsync(string evaluationId, string evaluationRunId, RequestOptions options)
174 {
175 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
176 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
177
178 using PipelineMessage message = CreateCancelEvalRunRequest(evaluationId, evaluationRunId, options);
179 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
180 }
181
182 public virtual ClientResult DeleteEvaluationRun(string evaluationId, string evaluationRunId, RequestOptions options)
183 {
184 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
185 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
186
187 using PipelineMessage message = CreateDeleteEvalRunRequest(evaluationId, evaluationRunId, options);
188 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
189 }
190
191 public virtual async Task<ClientResult> DeleteEvaluationRunAsync(string evaluationId, string evaluationRunId, RequestOptions options)
192 {
193 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
194 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
195
196 using PipelineMessage message = CreateDeleteEvalRunRequest(evaluationId, evaluationRunId, options);
197 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
198 }
199
200 public virtual ClientResult GetEvaluationRunOutputItems(string evaluationId, string evaluationRunId, int? limit, string order, string after, string outputItemStatus, RequestOptions options)
201 {
202 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
203 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
204
205 using PipelineMessage message = CreateGetEvalRunOutputItemsRequest(evaluationId, evaluationRunId, after, limit, outputItemStatus, order, options);
206 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
207 }
208
209 public virtual async Task<ClientResult> GetEvaluationRunOutputItemsAsync(string evaluationId, string evaluationRunId, int? limit, string order, string after, string outputItemStatus, RequestOptions options)
210 {
211 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
212 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
213
214 using PipelineMessage message = CreateGetEvalRunOutputItemsRequest(evaluationId, evaluationRunId, after, limit, outputItemStatus, order, options);
215 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
216 }
217
218 public virtual ClientResult GetEvaluationRunOutputItem(string evaluationId, string evaluationRunId, string outputItemId, RequestOptions options)
219 {
220 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
221 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
222 Argument.AssertNotNull(outputItemId, nameof(outputItemId));
223
224 using PipelineMessage message = CreateGetEvalRunOutputItemRequest(evaluationId, evaluationRunId, outputItemId, options);
225 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
226 }
227
228 public virtual async Task<ClientResult> GetEvaluationRunOutputItemAsync(string evaluationId, string evaluationRunId, string outputItemId, RequestOptions options)
229 {
230 Argument.AssertNotNull(evaluationId, nameof(evaluationId));
231 Argument.AssertNotNull(evaluationRunId, nameof(evaluationRunId));
232 Argument.AssertNotNull(outputItemId, nameof(outputItemId));
233
234 using PipelineMessage message = CreateGetEvalRunOutputItemRequest(evaluationId, evaluationRunId, outputItemId, options);
235 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
236 }
237}
238