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