openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.2.0-beta.2

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Custom/Assistants/AssistantClient.Protocol.cs

582lines · modecode

1using System;
2using System.ClientModel;
3using System.ClientModel.Primitives;
4using System.ComponentModel;
5using System.Threading.Tasks;
6
7namespace OpenAI.Assistants;
8
9[CodeGenSuppress("ListAssistantsAsync", typeof(int?), typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
10[CodeGenSuppress("ListAssistants", typeof(int?), typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
11public partial class AssistantClient
12{
13 /// <summary>
14 /// [Protocol Method] Create an assistant with a model and instructions.
15 /// </summary>
16 /// <param name="content"> The content to send as the body of the request. </param>
17 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
18 /// <exception cref="ArgumentNullException"> <paramref name="content"/> is null. </exception>
19 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
20 /// <returns> The response returned from the service. </returns>
21 [EditorBrowsable(EditorBrowsableState.Never)]
22 public virtual async Task<ClientResult> CreateAssistantAsync(BinaryContent content, RequestOptions options = null)
23 {
24 Argument.AssertNotNull(content, nameof(content));
25
26 using PipelineMessage message = CreateCreateAssistantRequest(content, options);
27 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
28 }
29
30 /// <summary>
31 /// [Protocol Method] Create an assistant with a model and instructions.
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 [EditorBrowsable(EditorBrowsableState.Never)]
39 public virtual ClientResult CreateAssistant(BinaryContent content, RequestOptions options = null)
40 {
41 Argument.AssertNotNull(content, nameof(content));
42
43 using PipelineMessage message = CreateCreateAssistantRequest(content, options);
44 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
45 }
46
47 /// <summary>
48 /// [Protocol Method] Returns a paginated collection of assistants.
49 /// </summary>
50 /// <param name="limit">
51 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
52 /// default is 20.
53 /// </param>
54 /// <param name="order">
55 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
56 /// for descending order. Allowed values: "asc" | "desc"
57 /// </param>
58 /// <param name="after">
59 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
60 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
61 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
62 /// </param>
63 /// <param name="before">
64 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
65 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
66 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
67 /// </param>
68 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
69 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
70 /// <returns> A collection of service responses, each holding a page of values. </returns>
71 [EditorBrowsable(EditorBrowsableState.Never)]
72 public virtual AsyncCollectionResult GetAssistantsAsync(int? limit, string order, string after, string before, RequestOptions options)
73 {
74 return new AsyncAssistantCollectionResult(this, Pipeline, options, limit, order, after, before);
75 }
76
77 /// <summary>
78 /// [Protocol Method] Returns a paginated collection of assistants.
79 /// </summary>
80 /// <param name="limit">
81 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
82 /// default is 20.
83 /// </param>
84 /// <param name="order">
85 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
86 /// for descending order. Allowed values: "asc" | "desc"
87 /// </param>
88 /// <param name="after">
89 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
90 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
91 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
92 /// </param>
93 /// <param name="before">
94 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
95 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
96 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
97 /// </param>
98 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
99 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
100 /// <returns> A collection of service responses, each holding a page of values. </returns>
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public virtual CollectionResult GetAssistants(int? limit, string order, string after, string before, RequestOptions options)
103 {
104 return new AssistantCollectionResult(this, Pipeline, options, limit, order, after, before);
105 }
106
107 /// <summary>
108 /// [Protocol Method] Retrieves an assistant.
109 /// </summary>
110 /// <param name="assistantId"> The ID of the assistant to retrieve. </param>
111 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
112 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> is null. </exception>
113 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
114 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
115 /// <returns> The response returned from the service. </returns>
116 [EditorBrowsable(EditorBrowsableState.Never)]
117 public virtual async Task<ClientResult> GetAssistantAsync(string assistantId, RequestOptions options)
118 {
119 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
120
121 using PipelineMessage message = CreateGetAssistantRequest(assistantId, options);
122 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
123 }
124
125 /// <summary>
126 /// [Protocol Method] Retrieves an assistant.
127 /// </summary>
128 /// <param name="assistantId"> The ID of the assistant to retrieve. </param>
129 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
130 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> is null. </exception>
131 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
132 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
133 /// <returns> The response returned from the service. </returns>
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public virtual ClientResult GetAssistant(string assistantId, RequestOptions options)
136 {
137 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
138
139 using PipelineMessage message = CreateGetAssistantRequest(assistantId, options);
140 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
141 }
142
143 /// <summary>
144 /// [Protocol Method] Modifies an assistant.
145 /// </summary>
146 /// <param name="assistantId"> The ID of the assistant to modify. </param>
147 /// <param name="content"> The content to send as the body of the request. </param>
148 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
149 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> or <paramref name="content"/> is null. </exception>
150 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
151 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
152 /// <returns> The response returned from the service. </returns>
153 [EditorBrowsable(EditorBrowsableState.Never)]
154 public virtual async Task<ClientResult> ModifyAssistantAsync(string assistantId, BinaryContent content, RequestOptions options = null)
155 {
156 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
157 Argument.AssertNotNull(content, nameof(content));
158
159 using PipelineMessage message = CreateModifyAssistantRequest(assistantId, content, options);
160 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
161 }
162
163 /// <summary>
164 /// [Protocol Method] Modifies an assistant.
165 /// </summary>
166 /// <param name="assistantId"> The ID of the assistant to modify. </param>
167 /// <param name="content"> The content to send as the body of the request. </param>
168 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
169 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> or <paramref name="content"/> is null. </exception>
170 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
171 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
172 /// <returns> The response returned from the service. </returns>
173 [EditorBrowsable(EditorBrowsableState.Never)]
174 public virtual ClientResult ModifyAssistant(string assistantId, BinaryContent content, RequestOptions options = null)
175 {
176 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
177 Argument.AssertNotNull(content, nameof(content));
178
179 using PipelineMessage message = CreateModifyAssistantRequest(assistantId, content, options);
180 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
181 }
182
183 /// <summary>
184 /// [Protocol Method] Delete an assistant.
185 /// </summary>
186 /// <param name="assistantId"> The ID of the assistant to delete. </param>
187 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
188 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> is null. </exception>
189 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
190 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
191 /// <returns> The response returned from the service. </returns>
192 [EditorBrowsable(EditorBrowsableState.Never)]
193 public virtual async Task<ClientResult> DeleteAssistantAsync(string assistantId, RequestOptions options)
194 {
195 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
196
197 using PipelineMessage message = CreateDeleteAssistantRequest(assistantId, options);
198 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
199 }
200
201 /// <summary>
202 /// [Protocol Method] Delete an assistant.
203 /// </summary>
204 /// <param name="assistantId"> The ID of the assistant to delete. </param>
205 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
206 /// <exception cref="ArgumentNullException"> <paramref name="assistantId"/> is null. </exception>
207 /// <exception cref="ArgumentException"> <paramref name="assistantId"/> is an empty string, and was expected to be non-empty. </exception>
208 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
209 /// <returns> The response returned from the service. </returns>
210 [EditorBrowsable(EditorBrowsableState.Never)]
211 public virtual ClientResult DeleteAssistant(string assistantId, RequestOptions options)
212 {
213 Argument.AssertNotNullOrEmpty(assistantId, nameof(assistantId));
214
215 using PipelineMessage message = CreateDeleteAssistantRequest(assistantId, options);
216 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
217 }
218
219 /// <inheritdoc cref="InternalAssistantMessageClient.CreateMessageAsync"/>
220 [EditorBrowsable(EditorBrowsableState.Never)]
221 public virtual Task<ClientResult> CreateMessageAsync(string threadId, BinaryContent content, RequestOptions options = null)
222 => _messageSubClient.CreateMessageAsync(threadId, content, options);
223
224 /// <inheritdoc cref="InternalAssistantMessageClient.CreateMessage"/>
225 [EditorBrowsable(EditorBrowsableState.Never)]
226 public virtual ClientResult CreateMessage(string threadId, BinaryContent content, RequestOptions options = null)
227 => _messageSubClient.CreateMessage(threadId, content, options);
228
229 /// <summary>
230 /// [Protocol Method] Returns a paginated collection of messages for a given thread.
231 /// </summary>
232 /// <param name="threadId"> The ID of the [thread](/docs/api-reference/threads) the messages belong to. </param>
233 /// <param name="limit">
234 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
235 /// default is 20.
236 /// </param>
237 /// <param name="order">
238 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
239 /// for descending order. Allowed values: "asc" | "desc"
240 /// </param>
241 /// <param name="after">
242 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
243 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
244 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
245 /// </param>
246 /// <param name="before">
247 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
248 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
249 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
250 /// </param>
251 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
252 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
253 /// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
254 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
255 /// <returns> A collection of service responses, each holding a page of values. </returns>
256 [EditorBrowsable(EditorBrowsableState.Never)]
257 public virtual AsyncCollectionResult GetMessagesAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
258 {
259 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
260
261 return new AsyncMessageCollectionResult(_messageSubClient, options, threadId, limit, order, after, before);
262 }
263
264 /// <summary>
265 /// [Protocol Method] Returns a paginated collection of messages for a given thread.
266 /// </summary>
267 /// <param name="threadId"> The ID of the [thread](/docs/api-reference/threads) the messages belong to. </param>
268 /// <param name="limit">
269 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
270 /// default is 20.
271 /// </param>
272 /// <param name="order">
273 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
274 /// for descending order. Allowed values: "asc" | "desc"
275 /// </param>
276 /// <param name="after">
277 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
278 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
279 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
280 /// </param>
281 /// <param name="before">
282 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
283 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
284 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
285 /// </param>
286 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
287 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
288 /// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
289 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
290 /// <returns> A collection of service responses, each holding a page of values. </returns>
291 [EditorBrowsable(EditorBrowsableState.Never)]
292 public virtual CollectionResult GetMessages(string threadId, int? limit, string order, string after, string before, RequestOptions options)
293 {
294 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
295
296 return new MessageCollectionResult(_messageSubClient, options, threadId, limit, order, after, before);
297 }
298
299 /// <inheritdoc cref="InternalAssistantMessageClient.GetMessageAsync"/>
300 [EditorBrowsable(EditorBrowsableState.Never)]
301 public virtual Task<ClientResult> GetMessageAsync(string threadId, string messageId, RequestOptions options)
302 => _messageSubClient.GetMessageAsync(threadId, messageId, options);
303
304 /// <inheritdoc cref="InternalAssistantMessageClient.GetMessage"/>
305 [EditorBrowsable(EditorBrowsableState.Never)]
306 public virtual ClientResult GetMessage(string threadId, string messageId, RequestOptions options)
307 => _messageSubClient.GetMessage(threadId, messageId, options);
308
309 /// <inheritdoc cref="InternalAssistantMessageClient.ModifyMessageAsync"/>
310 [EditorBrowsable(EditorBrowsableState.Never)]
311 public virtual Task<ClientResult> ModifyMessageAsync(string threadId, string messageId, BinaryContent content, RequestOptions options = null)
312 => _messageSubClient.ModifyMessageAsync(threadId, messageId, content, options);
313
314 /// <inheritdoc cref="InternalAssistantMessageClient.ModifyMessage"/>
315 [EditorBrowsable(EditorBrowsableState.Never)]
316 public virtual ClientResult ModifyMessage(string threadId, string messageId, BinaryContent content, RequestOptions options = null)
317 => _messageSubClient.ModifyMessage(threadId, messageId, content, options);
318
319 /// <inheritdoc cref="InternalAssistantMessageClient.DeleteMessageAsync"/>
320 [EditorBrowsable(EditorBrowsableState.Never)]
321 public virtual Task<ClientResult> DeleteMessageAsync(string threadId, string messageId, RequestOptions options)
322 => _messageSubClient.DeleteMessageAsync(threadId, messageId, options);
323
324 /// <inheritdoc cref="InternalAssistantMessageClient.DeleteMessage"/>
325 [EditorBrowsable(EditorBrowsableState.Never)]
326 public virtual ClientResult DeleteMessage(string threadId, string messageId, RequestOptions options)
327 => _messageSubClient.DeleteMessage(threadId, messageId, options);
328
329 /// <inheritdoc cref="InternalAssistantRunClient.CreateThreadAndRunAsync"/>
330 [EditorBrowsable(EditorBrowsableState.Never)]
331 public virtual Task<ClientResult> CreateThreadAndRunAsync(BinaryContent content, RequestOptions options = null)
332 => _runSubClient.CreateThreadAndRunAsync(content, options);
333
334 /// <inheritdoc cref="InternalAssistantRunClient.CreateThreadAndRun"/>
335 [EditorBrowsable(EditorBrowsableState.Never)]
336 public virtual ClientResult CreateThreadAndRun(BinaryContent content, RequestOptions options = null)
337 => _runSubClient.CreateThreadAndRun(content, options = null);
338
339 /// <inheritdoc cref="InternalAssistantRunClient.CreateRunAsync"/>
340 [EditorBrowsable(EditorBrowsableState.Never)]
341 public virtual Task<ClientResult> CreateRunAsync(string threadId, BinaryContent content, RequestOptions options = null)
342 => _runSubClient.CreateRunAsync(threadId, content, options);
343
344 /// <inheritdoc cref="InternalAssistantRunClient.CreateRun"/>
345 [EditorBrowsable(EditorBrowsableState.Never)]
346 public virtual ClientResult CreateRun(string threadId, BinaryContent content, RequestOptions options = null)
347 => _runSubClient.CreateRun(threadId, content, options);
348
349 /// <summary>
350 /// [Protocol Method] Returns a paginated collection of runs belonging to a thread.
351 /// </summary>
352 /// <param name="threadId"> The ID of the thread the run belongs to. </param>
353 /// <param name="limit">
354 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
355 /// default is 20.
356 /// </param>
357 /// <param name="order">
358 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
359 /// for descending order. Allowed values: "asc" | "desc"
360 /// </param>
361 /// <param name="after">
362 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
363 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
364 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
365 /// </param>
366 /// <param name="before">
367 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
368 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
369 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
370 /// </param>
371 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
372 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
373 /// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
374 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
375 /// <returns> A collection of service responses, each holding a page of values. </returns>
376 [EditorBrowsable(EditorBrowsableState.Never)]
377 public virtual AsyncCollectionResult GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
378 {
379 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
380
381 return new AsyncRunCollectionResult(_runSubClient, options, threadId, limit, order, after, before);
382 }
383
384 /// <summary>
385 /// [Protocol Method] Returns a paginated collection of runs belonging to a thread.
386 /// </summary>
387 /// <param name="threadId"> The ID of the thread the run belongs to. </param>
388 /// <param name="limit">
389 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
390 /// default is 20.
391 /// </param>
392 /// <param name="order">
393 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
394 /// for descending order. Allowed values: "asc" | "desc"
395 /// </param>
396 /// <param name="after">
397 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
398 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
399 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
400 /// </param>
401 /// <param name="before">
402 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
403 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
404 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
405 /// </param>
406 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
407 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
408 /// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
409 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
410 /// <returns> A collection of service responses, each holding a page of values. </returns>
411 [EditorBrowsable(EditorBrowsableState.Never)]
412 public virtual CollectionResult GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options)
413 {
414 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
415
416 return new RunCollectionResult(_runSubClient, options, threadId, limit, order, after, before);
417 }
418
419 /// <inheritdoc cref="InternalAssistantRunClient.GetRunAsync"/>
420 [EditorBrowsable(EditorBrowsableState.Never)]
421 public virtual Task<ClientResult> GetRunAsync(string threadId, string runId, RequestOptions options)
422 => _runSubClient.GetRunAsync(threadId, runId, options);
423
424 /// <inheritdoc cref="InternalAssistantRunClient.GetRun"/>
425 [EditorBrowsable(EditorBrowsableState.Never)]
426 public virtual ClientResult GetRun(string threadId, string runId, RequestOptions options)
427 => _runSubClient.GetRun(threadId, runId, options);
428
429 /// <inheritdoc cref="InternalAssistantRunClient.ModifyRunAsync"/>
430 [EditorBrowsable(EditorBrowsableState.Never)]
431 public virtual Task<ClientResult> ModifyRunAsync(string threadId, string runId, BinaryContent content, RequestOptions options = null)
432 => _runSubClient.ModifyRunAsync(threadId, runId, content, options);
433
434 /// <inheritdoc cref="InternalAssistantRunClient.ModifyRun"/>
435 [EditorBrowsable(EditorBrowsableState.Never)]
436 public virtual ClientResult ModifyRun(string threadId, string runId, BinaryContent content, RequestOptions options = null)
437 => _runSubClient.ModifyRun(threadId, runId, content, options);
438
439 /// <inheritdoc cref="InternalAssistantRunClient.CancelRunAsync"/>
440 [EditorBrowsable(EditorBrowsableState.Never)]
441 public virtual Task<ClientResult> CancelRunAsync(string threadId, string runId, RequestOptions options)
442 => _runSubClient.CancelRunAsync(threadId, runId, options);
443
444 /// <inheritdoc cref="InternalAssistantRunClient.CancelRun"/>
445 [EditorBrowsable(EditorBrowsableState.Never)]
446 public virtual ClientResult CancelRun(string threadId, string runId, RequestOptions options)
447 => _runSubClient.CancelRun(threadId, runId, options);
448
449 /// <inheritdoc cref="InternalAssistantRunClient.SubmitToolOutputsToRunAsync"/>
450 [EditorBrowsable(EditorBrowsableState.Never)]
451 public virtual Task<ClientResult> SubmitToolOutputsToRunAsync(string threadId, string runId, BinaryContent content, RequestOptions options = null)
452 => _runSubClient.SubmitToolOutputsToRunAsync(threadId, runId, content, options);
453
454 /// <inheritdoc cref="InternalAssistantRunClient.SubmitToolOutputsToRun"/>
455 [EditorBrowsable(EditorBrowsableState.Never)]
456 public virtual ClientResult SubmitToolOutputsToRun(string threadId, string runId, BinaryContent content, RequestOptions options = null)
457 => _runSubClient.SubmitToolOutputsToRun(threadId, runId, content, options);
458
459 /// <summary>
460 /// [Protocol Method] Returns a paginated collection of run steps belonging to a run.
461 /// </summary>
462 /// <param name="threadId"> The ID of the thread the run and run steps belong to. </param>
463 /// <param name="runId"> The ID of the run the run steps belong to. </param>
464 /// <param name="limit">
465 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
466 /// default is 20.
467 /// </param>
468 /// <param name="order">
469 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
470 /// for descending order. Allowed values: "asc" | "desc"
471 /// </param>
472 /// <param name="after">
473 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
474 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
475 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
476 /// </param>
477 /// <param name="before">
478 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
479 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
480 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
481 /// </param>
482 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
483 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> or <paramref name="runId"/> is null. </exception>
484 /// <exception cref="ArgumentException"> <paramref name="threadId"/> or <paramref name="runId"/> is an empty string, and was expected to be non-empty. </exception>
485 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
486 /// <returns> A collection of service responses, each holding a page of values. </returns>
487 [EditorBrowsable(EditorBrowsableState.Never)]
488 public virtual AsyncCollectionResult GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
489 {
490 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
491 Argument.AssertNotNullOrEmpty(runId, nameof(runId));
492
493 return new AsyncRunStepCollectionResult(_runSubClient, options, threadId, runId, limit, order, after, before);
494 }
495
496 /// <summary>
497 /// [Protocol Method] Returns a paginated collection of run steps belonging to a run.
498 /// </summary>
499 /// <param name="threadId"> The ID of the thread the run and run steps belong to. </param>
500 /// <param name="runId"> The ID of the run the run steps belong to. </param>
501 /// <param name="limit">
502 /// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
503 /// default is 20.
504 /// </param>
505 /// <param name="order">
506 /// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
507 /// for descending order. Allowed values: "asc" | "desc"
508 /// </param>
509 /// <param name="after">
510 /// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
511 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
512 /// subsequent call can include after=obj_foo in order to fetch the next page of the list.
513 /// </param>
514 /// <param name="before">
515 /// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
516 /// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
517 /// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
518 /// </param>
519 /// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
520 /// <exception cref="ArgumentNullException"> <paramref name="threadId"/> or <paramref name="runId"/> is null. </exception>
521 /// <exception cref="ArgumentException"> <paramref name="threadId"/> or <paramref name="runId"/> is an empty string, and was expected to be non-empty. </exception>
522 /// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
523 /// <returns> A collection of service responses, each holding a page of values. </returns>
524 [EditorBrowsable(EditorBrowsableState.Never)]
525 public virtual CollectionResult GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
526 {
527 Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
528 Argument.AssertNotNullOrEmpty(runId, nameof(runId));
529
530 return new RunStepCollectionResult(_runSubClient, options, threadId, runId, limit, order, after, before);
531 }
532
533 /// <inheritdoc cref="InternalAssistantRunClient.GetRunStepAsync"/>
534 [EditorBrowsable(EditorBrowsableState.Never)]
535 public virtual Task<ClientResult> GetRunStepAsync(string threadId, string runId, string stepId, RequestOptions options)
536 => _runSubClient.GetRunStepAsync(threadId, runId, stepId, options);
537
538 /// <inheritdoc cref="InternalAssistantRunClient.GetRunStep"/>
539 [EditorBrowsable(EditorBrowsableState.Never)]
540 public virtual ClientResult GetRunStep(string threadId, string runId, string stepId, RequestOptions options)
541 => _runSubClient.GetRunStep(threadId, runId, stepId, options);
542
543 /// <inheritdoc cref="InternalAssistantThreadClient.CreateThreadAsync"/>
544 [EditorBrowsable(EditorBrowsableState.Never)]
545 public virtual Task<ClientResult> CreateThreadAsync(BinaryContent content, RequestOptions options = null)
546 => _threadSubClient.CreateThreadAsync(content, options);
547
548 /// <inheritdoc cref="InternalAssistantThreadClient.CreateThread"/>
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public virtual ClientResult CreateThread(BinaryContent content, RequestOptions options = null)
551 => _threadSubClient.CreateThread(content, options);
552
553 /// <inheritdoc cref="InternalAssistantThreadClient.GetThreadAsync"/>
554 [EditorBrowsable(EditorBrowsableState.Never)]
555 public virtual Task<ClientResult> GetThreadAsync(string threadId, RequestOptions options)
556 => _threadSubClient.GetThreadAsync(threadId, options);
557
558 /// <inheritdoc cref="InternalAssistantThreadClient.GetThread"/>
559 [EditorBrowsable(EditorBrowsableState.Never)]
560 public virtual ClientResult GetThread(string threadId, RequestOptions options)
561 => _threadSubClient.GetThread(threadId, options);
562
563 /// <inheritdoc cref="InternalAssistantThreadClient.ModifyThreadAsync"/>
564 [EditorBrowsable(EditorBrowsableState.Never)]
565 public virtual Task<ClientResult> ModifyThreadAsync(string threadId, BinaryContent content, RequestOptions options = null)
566 => _threadSubClient.ModifyThreadAsync(threadId, content, options);
567
568 /// <inheritdoc cref="InternalAssistantThreadClient.ModifyThread"/>
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public virtual ClientResult ModifyThread(string threadId, BinaryContent content, RequestOptions options = null)
571 => _threadSubClient.ModifyThread(threadId, content, options);
572
573 /// <inheritdoc cref="InternalAssistantThreadClient.DeleteThreadAsync"/>
574 [EditorBrowsable(EditorBrowsableState.Never)]
575 public virtual Task<ClientResult> DeleteThreadAsync(string threadId, RequestOptions options)
576 => _threadSubClient.DeleteThreadAsync(threadId, options);
577
578 /// <inheritdoc cref="InternalAssistantThreadClient.DeleteThread"/>
579 [EditorBrowsable(EditorBrowsableState.Never)]
580 public virtual ClientResult DeleteThread(string threadId, RequestOptions options)
581 => _threadSubClient.DeleteThread(threadId, options);
582}
583