openai/openai-dotnet

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
OpenAI_2.4.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/Generated/ChatClient.cs

206lines · modecode

1// <auto-generated/>
2
3#nullable disable
4
5using System;
6using System.ClientModel;
7using System.ClientModel.Primitives;
8using System.Collections.Generic;
9using System.Diagnostics.CodeAnalysis;
10using System.Threading;
11using System.Threading.Tasks;
12using OpenAI;
13
14namespace OpenAI.Chat
15{
16 public partial class ChatClient
17 {
18 private readonly Uri _endpoint;
19
20 protected ChatClient()
21 {
22 }
23
24 public ClientPipeline Pipeline { get; }
25
26 [Experimental("OPENAI001")]
27 public virtual CollectionResult GetChatCompletions(string after, int? limit, string order, IDictionary<string, string> metadata, string model, RequestOptions options)
28 {
29 return new ChatClientGetChatCompletionsCollectionResult(
30 this,
31 after,
32 limit,
33 order,
34 metadata,
35 model,
36 options);
37 }
38
39 [Experimental("OPENAI001")]
40 public virtual AsyncCollectionResult GetChatCompletionsAsync(string after, int? limit, string order, IDictionary<string, string> metadata, string model, RequestOptions options)
41 {
42 return new ChatClientGetChatCompletionsAsyncCollectionResult(
43 this,
44 after,
45 limit,
46 order,
47 metadata,
48 model,
49 options);
50 }
51
52 [Experimental("OPENAI001")]
53 public virtual CollectionResult<ChatCompletion> GetChatCompletions(ChatCompletionCollectionOptions options = default, CancellationToken cancellationToken = default)
54 {
55 return new ChatClientGetChatCompletionsCollectionResultOfT(
56 this,
57 options?.AfterId,
58 options?.PageSizeLimit,
59 options?.Order?.ToString(),
60 options?.Metadata,
61 options?.Model,
62 cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
63 }
64
65 [Experimental("OPENAI001")]
66 public virtual AsyncCollectionResult<ChatCompletion> GetChatCompletionsAsync(ChatCompletionCollectionOptions options = default, CancellationToken cancellationToken = default)
67 {
68 return new ChatClientGetChatCompletionsAsyncCollectionResultOfT(
69 this,
70 options?.AfterId,
71 options?.PageSizeLimit,
72 options?.Order?.ToString(),
73 options?.Metadata,
74 options?.Model,
75 cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
76 }
77
78 public virtual ClientResult CompleteChat(BinaryContent content, RequestOptions options = null)
79 {
80 Argument.AssertNotNull(content, nameof(content));
81
82 using PipelineMessage message = CreateCompleteChatRequest(content, options);
83 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
84 }
85
86 public virtual async Task<ClientResult> CompleteChatAsync(BinaryContent content, RequestOptions options = null)
87 {
88 Argument.AssertNotNull(content, nameof(content));
89
90 using PipelineMessage message = CreateCompleteChatRequest(content, options);
91 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
92 }
93
94 [Experimental("OPENAI001")]
95 public virtual ClientResult GetChatCompletion(string completionId, RequestOptions options)
96 {
97 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
98
99 using PipelineMessage message = CreateGetChatCompletionRequest(completionId, options);
100 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
101 }
102
103 [Experimental("OPENAI001")]
104 public virtual async Task<ClientResult> GetChatCompletionAsync(string completionId, RequestOptions options)
105 {
106 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
107
108 using PipelineMessage message = CreateGetChatCompletionRequest(completionId, options);
109 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
110 }
111
112 [Experimental("OPENAI001")]
113 public virtual ClientResult UpdateChatCompletion(string completionId, BinaryContent content, RequestOptions options = null)
114 {
115 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
116 Argument.AssertNotNull(content, nameof(content));
117
118 using PipelineMessage message = CreateUpdateChatCompletionRequest(completionId, content, options);
119 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
120 }
121
122 [Experimental("OPENAI001")]
123 public virtual async Task<ClientResult> UpdateChatCompletionAsync(string completionId, BinaryContent content, RequestOptions options = null)
124 {
125 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
126 Argument.AssertNotNull(content, nameof(content));
127
128 using PipelineMessage message = CreateUpdateChatCompletionRequest(completionId, content, options);
129 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
130 }
131
132 [Experimental("OPENAI001")]
133 public virtual ClientResult DeleteChatCompletion(string completionId, RequestOptions options)
134 {
135 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
136
137 using PipelineMessage message = CreateDeleteChatCompletionRequest(completionId, options);
138 return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
139 }
140
141 [Experimental("OPENAI001")]
142 public virtual async Task<ClientResult> DeleteChatCompletionAsync(string completionId, RequestOptions options)
143 {
144 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
145
146 using PipelineMessage message = CreateDeleteChatCompletionRequest(completionId, options);
147 return ClientResult.FromResponse(await Pipeline.ProcessMessageAsync(message, options).ConfigureAwait(false));
148 }
149
150 [Experimental("OPENAI001")]
151 public virtual CollectionResult GetChatCompletionMessages(string completionId, string after, int? limit, string order, RequestOptions options)
152 {
153 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
154
155 return new ChatClientGetChatCompletionMessagesCollectionResult(
156 this,
157 completionId,
158 after,
159 limit,
160 order,
161 options);
162 }
163
164 [Experimental("OPENAI001")]
165 public virtual AsyncCollectionResult GetChatCompletionMessagesAsync(string completionId, string after, int? limit, string order, RequestOptions options)
166 {
167 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
168
169 return new ChatClientGetChatCompletionMessagesAsyncCollectionResult(
170 this,
171 completionId,
172 after,
173 limit,
174 order,
175 options);
176 }
177
178 [Experimental("OPENAI001")]
179 public virtual CollectionResult<ChatCompletionMessageListDatum> GetChatCompletionMessages(string completionId, ChatCompletionMessageCollectionOptions options = default, CancellationToken cancellationToken = default)
180 {
181 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
182
183 return new ChatClientGetChatCompletionMessagesCollectionResultOfT(
184 this,
185 completionId,
186 options?.AfterId,
187 options?.PageSizeLimit,
188 options?.Order?.ToString(),
189 cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
190 }
191
192 [Experimental("OPENAI001")]
193 public virtual AsyncCollectionResult<ChatCompletionMessageListDatum> GetChatCompletionMessagesAsync(string completionId, ChatCompletionMessageCollectionOptions options = default, CancellationToken cancellationToken = default)
194 {
195 Argument.AssertNotNullOrEmpty(completionId, nameof(completionId));
196
197 return new ChatClientGetChatCompletionMessagesAsyncCollectionResultOfT(
198 this,
199 completionId,
200 options?.AfterId,
201 options?.PageSizeLimit,
202 options?.Order?.ToString(),
203 cancellationToken.CanBeCanceled ? new RequestOptions { CancellationToken = cancellationToken } : null);
204 }
205 }
206}
207