openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
fe4d6cf1ccfea48fa5c2baf67103495ac9b459dd

Branches

Tags

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

Clone

HTTPS

Download ZIP

OpenAI/src/Generated/BatchClient.cs

62lines · modecode

1// <auto-generated/>
2
3#nullable disable
4
5using System;
6using System.ClientModel;
7using System.ClientModel.Primitives;
8using System.Diagnostics.CodeAnalysis;
9using System.Threading;
10using System.Threading.Tasks;
11using OpenAI;
12
13namespace OpenAI.Batch
14{
15 [Experimental("OPENAI001")]
16 public partial class BatchClient
17 {
18 private readonly Uri _endpoint;
19
20 protected BatchClient()
21 {
22 }
23
24 public ClientPipeline Pipeline { get; }
25
26 public virtual CollectionResult GetBatches(string after, int? limit, RequestOptions options)
27 {
28 return new BatchClientGetBatchesCollectionResult(this, after, limit, options);
29 }
30
31 public virtual AsyncCollectionResult GetBatchesAsync(string after, int? limit, RequestOptions options)
32 {
33 return new BatchClientGetBatchesAsyncCollectionResult(this, after, limit, options);
34 }
35
36 public virtual CollectionResult<BatchJob> GetBatches(BatchCollectionOptions options = default, CancellationToken cancellationToken = default)
37 {
38 return new BatchClientGetBatchesCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions());
39 }
40
41 public virtual AsyncCollectionResult<BatchJob> GetBatchesAsync(BatchCollectionOptions options = default, CancellationToken cancellationToken = default)
42 {
43 return new BatchClientGetBatchesAsyncCollectionResultOfT(this, options?.AfterId, options?.PageSizeLimit, cancellationToken.ToRequestOptions());
44 }
45
46 public virtual ClientResult GetBatch(string batchId, RequestOptions options)
47 {
48 Argument.AssertNotNullOrEmpty(batchId, nameof(batchId));
49
50 using PipelineMessage message = CreateGetBatchRequest(batchId, options);
51 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
52 }
53
54 public virtual async Task<ClientResult> GetBatchAsync(string batchId, RequestOptions options)
55 {
56 Argument.AssertNotNullOrEmpty(batchId, nameof(batchId));
57
58 using PipelineMessage message = CreateGetBatchRequest(batchId, options);
59 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
60 }
61 }
62}
63