diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CancelARun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CancelARun.g.cs
index 707a2ec9..4224dac5 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CancelARun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CancelARun.g.cs
@@ -56,6 +56,29 @@ partial void ProcessCancelARunResponseContent(
string runId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CancelARunAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Cancels a run that is `in_progress`.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CancelARunAsResponseAsync(
+ string threadId,
+ string runId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -86,6 +109,7 @@ partial void ProcessCancelARunResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}/cancel",
baseUri: HttpClient.BaseAddress);
@@ -160,6 +184,8 @@ partial void ProcessCancelARunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -170,6 +196,11 @@ partial void ProcessCancelARunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -187,6 +218,8 @@ partial void ProcessCancelARunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -196,8 +229,7 @@ partial void ProcessCancelARunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -206,6 +238,11 @@ partial void ProcessCancelARunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -222,14 +259,15 @@ partial void ProcessCancelARunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -269,6 +307,8 @@ partial void ProcessCancelARunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -289,6 +329,8 @@ partial void ProcessCancelARunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -313,9 +355,13 @@ partial void ProcessCancelARunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -343,9 +389,13 @@ partial void ProcessCancelARunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateMessage.g.cs
index 1c127ca7..322dd18f 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateMessage.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateMessage.g.cs
@@ -54,6 +54,31 @@ partial void ProcessCreateMessageResponseContent(
public async global::System.Threading.Tasks.Task CreateMessageAsync(
string threadId,
+ global::tryAGI.OpenAI.CreateMessageRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateMessageAsResponseAsync(
+ threadId: threadId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create a message.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateMessageAsResponseAsync(
+ string threadId,
+
global::tryAGI.OpenAI.CreateMessageRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -89,6 +114,7 @@ partial void ProcessCreateMessageResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/messages",
baseUri: HttpClient.BaseAddress);
@@ -169,6 +195,8 @@ partial void ProcessCreateMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -179,6 +207,11 @@ partial void ProcessCreateMessageResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -196,6 +229,8 @@ partial void ProcessCreateMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -205,8 +240,7 @@ partial void ProcessCreateMessageResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -215,6 +249,11 @@ partial void ProcessCreateMessageResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -231,14 +270,15 @@ partial void ProcessCreateMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -278,6 +318,8 @@ partial void ProcessCreateMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -298,6 +340,8 @@ partial void ProcessCreateMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -322,9 +366,13 @@ partial void ProcessCreateMessageResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -352,9 +400,13 @@ partial void ProcessCreateMessageResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateRun.g.cs
index 9dddb925..544789fa 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateRun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateRun.g.cs
@@ -57,6 +57,34 @@ partial void ProcessCreateRunResponseContent(
public async global::System.Threading.Tasks.Task CreateRunAsync(
string threadId,
+ global::tryAGI.OpenAI.CreateRunRequest request,
+ global::System.Collections.Generic.IList? include = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateRunAsResponseAsync(
+ threadId: threadId,
+
+ request: request,
+ include: include,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create a run.
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateRunAsResponseAsync(
+ string threadId,
+
global::tryAGI.OpenAI.CreateRunRequest request,
global::System.Collections.Generic.IList? include = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
@@ -90,15 +118,16 @@ partial void ProcessCreateRunResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
- .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
+ .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -178,6 +207,8 @@ partial void ProcessCreateRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -188,6 +219,11 @@ partial void ProcessCreateRunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -205,6 +241,8 @@ partial void ProcessCreateRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -214,8 +252,7 @@ partial void ProcessCreateRunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -224,6 +261,11 @@ partial void ProcessCreateRunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -240,14 +282,15 @@ partial void ProcessCreateRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -287,6 +330,8 @@ partial void ProcessCreateRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -307,6 +352,8 @@ partial void ProcessCreateRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -331,9 +378,13 @@ partial void ProcessCreateRunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -361,9 +412,13 @@ partial void ProcessCreateRunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThread.g.cs
index 6b1b1f08..b1082bb7 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThread.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThread.g.cs
@@ -50,6 +50,28 @@ partial void ProcessCreateThreadResponseContent(
///
public async global::System.Threading.Tasks.Task CreateThreadAsync(
+ global::tryAGI.OpenAI.CreateThreadRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateThreadAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create a thread.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateThreadAsResponseAsync(
+
global::tryAGI.OpenAI.CreateThreadRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -84,6 +106,7 @@ partial void ProcessCreateThreadResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/threads",
baseUri: HttpClient.BaseAddress);
@@ -163,6 +186,8 @@ partial void ProcessCreateThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -173,6 +198,11 @@ partial void ProcessCreateThreadResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -190,6 +220,8 @@ partial void ProcessCreateThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -199,8 +231,7 @@ partial void ProcessCreateThreadResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -209,6 +240,11 @@ partial void ProcessCreateThreadResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -225,14 +261,15 @@ partial void ProcessCreateThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -272,6 +309,8 @@ partial void ProcessCreateThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -292,6 +331,8 @@ partial void ProcessCreateThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -316,9 +357,13 @@ partial void ProcessCreateThreadResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -346,9 +391,13 @@ partial void ProcessCreateThreadResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThreadAndRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThreadAndRun.g.cs
index c3f3be90..3529d08f 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThreadAndRun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.CreateThreadAndRun.g.cs
@@ -50,6 +50,28 @@ partial void ProcessCreateThreadAndRunResponseContent(
///
public async global::System.Threading.Tasks.Task CreateThreadAndRunAsync(
+ global::tryAGI.OpenAI.CreateThreadAndRunRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateThreadAndRunAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Create a thread and run it in one request.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateThreadAndRunAsResponseAsync(
+
global::tryAGI.OpenAI.CreateThreadAndRunRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -80,10 +102,11 @@ partial void ProcessCreateThreadAndRunResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/threads/runs",
baseUri: HttpClient.BaseAddress);
@@ -163,6 +186,8 @@ partial void ProcessCreateThreadAndRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -173,6 +198,11 @@ partial void ProcessCreateThreadAndRunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -190,6 +220,8 @@ partial void ProcessCreateThreadAndRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -199,8 +231,7 @@ partial void ProcessCreateThreadAndRunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -209,6 +240,11 @@ partial void ProcessCreateThreadAndRunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -225,14 +261,15 @@ partial void ProcessCreateThreadAndRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -272,6 +309,8 @@ partial void ProcessCreateThreadAndRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -292,6 +331,8 @@ partial void ProcessCreateThreadAndRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -316,9 +357,13 @@ partial void ProcessCreateThreadAndRunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -346,9 +391,13 @@ partial void ProcessCreateThreadAndRunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteMessage.g.cs
index a60095a1..099bf741 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteMessage.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteMessage.g.cs
@@ -56,6 +56,29 @@ partial void ProcessDeleteMessageResponseContent(
string messageId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteMessageAsResponseAsync(
+ threadId: threadId,
+ messageId: messageId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Deletes a message.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeleteMessageAsResponseAsync(
+ string threadId,
+ string messageId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -86,6 +109,7 @@ partial void ProcessDeleteMessageResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/messages/{messageId}",
baseUri: HttpClient.BaseAddress);
@@ -160,6 +184,8 @@ partial void ProcessDeleteMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -170,6 +196,11 @@ partial void ProcessDeleteMessageResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -187,6 +218,8 @@ partial void ProcessDeleteMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -196,8 +229,7 @@ partial void ProcessDeleteMessageResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -206,6 +238,11 @@ partial void ProcessDeleteMessageResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -222,14 +259,15 @@ partial void ProcessDeleteMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -269,6 +307,8 @@ partial void ProcessDeleteMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -289,6 +329,8 @@ partial void ProcessDeleteMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -313,9 +355,13 @@ partial void ProcessDeleteMessageResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.DeleteMessageResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.DeleteMessageResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -343,9 +389,13 @@ partial void ProcessDeleteMessageResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.DeleteMessageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.DeleteMessageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteThread.g.cs
index 96197c55..f4c13001 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteThread.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.DeleteThread.g.cs
@@ -52,6 +52,26 @@ partial void ProcessDeleteThreadResponseContent(
string threadId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteThreadAsResponseAsync(
+ threadId: threadId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Delete a thread.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeleteThreadAsResponseAsync(
+ string threadId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -81,6 +101,7 @@ partial void ProcessDeleteThreadResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}",
baseUri: HttpClient.BaseAddress);
@@ -154,6 +175,8 @@ partial void ProcessDeleteThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -164,6 +187,11 @@ partial void ProcessDeleteThreadResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -181,6 +209,8 @@ partial void ProcessDeleteThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -190,8 +220,7 @@ partial void ProcessDeleteThreadResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -200,6 +229,11 @@ partial void ProcessDeleteThreadResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -216,14 +250,15 @@ partial void ProcessDeleteThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -263,6 +298,8 @@ partial void ProcessDeleteThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -283,6 +320,8 @@ partial void ProcessDeleteThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -307,9 +346,13 @@ partial void ProcessDeleteThreadResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.DeleteThreadResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.DeleteThreadResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -337,9 +380,13 @@ partial void ProcessDeleteThreadResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.DeleteThreadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.DeleteThreadResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListMessages.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListMessages.g.cs
index b8f67808..c9d577ff 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListMessages.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListMessages.g.cs
@@ -76,6 +76,45 @@ partial void ProcessListMessagesResponseContent(
string? runId = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListMessagesAsResponseAsync(
+ threadId: threadId,
+ limit: limit,
+ order: order,
+ after: after,
+ before: before,
+ runId: runId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Returns a list of messages for a given thread.
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ /// Default Value: desc
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListMessagesAsResponseAsync(
+ string threadId,
+ int? limit = default,
+ global::tryAGI.OpenAI.ListMessagesOrder? order = default,
+ string? after = default,
+ string? before = default,
+ string? runId = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -110,15 +149,16 @@ partial void ProcessListMessagesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/messages",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("order", order?.ToValueString())
.AddOptionalParameter("after", after)
.AddOptionalParameter("before", before)
- .AddOptionalParameter("run_id", runId)
+ .AddOptionalParameter("run_id", runId)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -195,6 +235,8 @@ partial void ProcessListMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -205,6 +247,11 @@ partial void ProcessListMessagesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -222,6 +269,8 @@ partial void ProcessListMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -231,8 +280,7 @@ partial void ProcessListMessagesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -241,6 +289,11 @@ partial void ProcessListMessagesResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -257,14 +310,15 @@ partial void ProcessListMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -304,6 +358,8 @@ partial void ProcessListMessagesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -324,6 +380,8 @@ partial void ProcessListMessagesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -348,9 +406,13 @@ partial void ProcessListMessagesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListMessagesResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListMessagesResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -378,9 +440,13 @@ partial void ProcessListMessagesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListMessagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListMessagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRunSteps.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRunSteps.g.cs
index 69af8ef4..d5b410a4 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRunSteps.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRunSteps.g.cs
@@ -80,6 +80,48 @@ partial void ProcessListRunStepsResponseContent(
global::System.Collections.Generic.IList? include = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListRunStepsAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+ limit: limit,
+ order: order,
+ after: after,
+ before: before,
+ include: include,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Returns a list of run steps belonging to a run.
+ ///
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ /// Default Value: desc
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListRunStepsAsResponseAsync(
+ string threadId,
+ string runId,
+ int? limit = default,
+ global::tryAGI.OpenAI.ListRunStepsOrder? order = default,
+ string? after = default,
+ string? before = default,
+ global::System.Collections.Generic.IList? include = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -115,15 +157,16 @@ partial void ProcessListRunStepsResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}/steps",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("order", order?.ToValueString())
.AddOptionalParameter("after", after)
.AddOptionalParameter("before", before)
- .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
+ .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -201,6 +244,8 @@ partial void ProcessListRunStepsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -211,6 +256,11 @@ partial void ProcessListRunStepsResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -228,6 +278,8 @@ partial void ProcessListRunStepsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -237,8 +289,7 @@ partial void ProcessListRunStepsResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -247,6 +298,11 @@ partial void ProcessListRunStepsResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -263,14 +319,15 @@ partial void ProcessListRunStepsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -310,6 +367,8 @@ partial void ProcessListRunStepsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -330,6 +389,8 @@ partial void ProcessListRunStepsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -354,9 +415,13 @@ partial void ProcessListRunStepsResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListRunStepsResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListRunStepsResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -384,9 +449,13 @@ partial void ProcessListRunStepsResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListRunStepsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListRunStepsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRuns.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRuns.g.cs
index c37cb956..6c10d19d 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRuns.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ListRuns.g.cs
@@ -72,6 +72,42 @@ partial void ProcessListRunsResponseContent(
string? before = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListRunsAsResponseAsync(
+ threadId: threadId,
+ limit: limit,
+ order: order,
+ after: after,
+ before: before,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Returns a list of runs belonging to a thread.
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ /// Default Value: desc
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListRunsAsResponseAsync(
+ string threadId,
+ int? limit = default,
+ global::tryAGI.OpenAI.ListRunsOrder? order = default,
+ string? after = default,
+ string? before = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -105,14 +141,15 @@ partial void ProcessListRunsResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("order", order?.ToValueString())
.AddOptionalParameter("after", after)
- .AddOptionalParameter("before", before)
+ .AddOptionalParameter("before", before)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -188,6 +225,8 @@ partial void ProcessListRunsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -198,6 +237,11 @@ partial void ProcessListRunsResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -215,6 +259,8 @@ partial void ProcessListRunsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -224,8 +270,7 @@ partial void ProcessListRunsResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -234,6 +279,11 @@ partial void ProcessListRunsResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -250,14 +300,15 @@ partial void ProcessListRunsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -297,6 +348,8 @@ partial void ProcessListRunsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -317,6 +370,8 @@ partial void ProcessListRunsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -341,9 +396,13 @@ partial void ProcessListRunsResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListRunsResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListRunsResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -371,9 +430,13 @@ partial void ProcessListRunsResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListRunsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListRunsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyMessage.g.cs
index 626d8596..b64446fd 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyMessage.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyMessage.g.cs
@@ -58,6 +58,34 @@ partial void ProcessModifyMessageResponseContent(
string threadId,
string messageId,
+ global::tryAGI.OpenAI.ModifyMessageRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ModifyMessageAsResponseAsync(
+ threadId: threadId,
+ messageId: messageId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Modifies a message.
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ModifyMessageAsResponseAsync(
+ string threadId,
+ string messageId,
+
global::tryAGI.OpenAI.ModifyMessageRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -94,6 +122,7 @@ partial void ProcessModifyMessageResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/messages/{messageId}",
baseUri: HttpClient.BaseAddress);
@@ -175,6 +204,8 @@ partial void ProcessModifyMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -185,6 +216,11 @@ partial void ProcessModifyMessageResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -202,6 +238,8 @@ partial void ProcessModifyMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -211,8 +249,7 @@ partial void ProcessModifyMessageResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -221,6 +258,11 @@ partial void ProcessModifyMessageResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -237,14 +279,15 @@ partial void ProcessModifyMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -284,6 +327,8 @@ partial void ProcessModifyMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -304,6 +349,8 @@ partial void ProcessModifyMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -328,9 +375,13 @@ partial void ProcessModifyMessageResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -358,9 +409,13 @@ partial void ProcessModifyMessageResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyRun.g.cs
index 769ce9c3..6eef535e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyRun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyRun.g.cs
@@ -58,6 +58,34 @@ partial void ProcessModifyRunResponseContent(
string threadId,
string runId,
+ global::tryAGI.OpenAI.ModifyRunRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ModifyRunAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Modifies a run.
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ModifyRunAsResponseAsync(
+ string threadId,
+ string runId,
+
global::tryAGI.OpenAI.ModifyRunRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -94,6 +122,7 @@ partial void ProcessModifyRunResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}",
baseUri: HttpClient.BaseAddress);
@@ -175,6 +204,8 @@ partial void ProcessModifyRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -185,6 +216,11 @@ partial void ProcessModifyRunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -202,6 +238,8 @@ partial void ProcessModifyRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -211,8 +249,7 @@ partial void ProcessModifyRunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -221,6 +258,11 @@ partial void ProcessModifyRunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -237,14 +279,15 @@ partial void ProcessModifyRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -284,6 +327,8 @@ partial void ProcessModifyRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -304,6 +349,8 @@ partial void ProcessModifyRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -328,9 +375,13 @@ partial void ProcessModifyRunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -358,9 +409,13 @@ partial void ProcessModifyRunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyThread.g.cs
index 053aeb01..101720fa 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyThread.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.ModifyThread.g.cs
@@ -54,6 +54,31 @@ partial void ProcessModifyThreadResponseContent(
public async global::System.Threading.Tasks.Task ModifyThreadAsync(
string threadId,
+ global::tryAGI.OpenAI.ModifyThreadRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ModifyThreadAsResponseAsync(
+ threadId: threadId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Modifies a thread.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ModifyThreadAsResponseAsync(
+ string threadId,
+
global::tryAGI.OpenAI.ModifyThreadRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -89,6 +114,7 @@ partial void ProcessModifyThreadResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}",
baseUri: HttpClient.BaseAddress);
@@ -169,6 +195,8 @@ partial void ProcessModifyThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -179,6 +207,11 @@ partial void ProcessModifyThreadResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -196,6 +229,8 @@ partial void ProcessModifyThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -205,8 +240,7 @@ partial void ProcessModifyThreadResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -215,6 +249,11 @@ partial void ProcessModifyThreadResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -231,14 +270,15 @@ partial void ProcessModifyThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -278,6 +318,8 @@ partial void ProcessModifyThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -298,6 +340,8 @@ partial void ProcessModifyThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -322,9 +366,13 @@ partial void ProcessModifyThreadResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -352,9 +400,13 @@ partial void ProcessModifyThreadResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveMessage.g.cs
index 24047aa8..7bcd72ac 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveMessage.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveMessage.g.cs
@@ -56,6 +56,29 @@ partial void ProcessRetrieveMessageResponseContent(
string messageId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveMessageAsResponseAsync(
+ threadId: threadId,
+ messageId: messageId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieve a message.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveMessageAsResponseAsync(
+ string threadId,
+ string messageId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -86,6 +109,7 @@ partial void ProcessRetrieveMessageResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/messages/{messageId}",
baseUri: HttpClient.BaseAddress);
@@ -160,6 +184,8 @@ partial void ProcessRetrieveMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -170,6 +196,11 @@ partial void ProcessRetrieveMessageResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -187,6 +218,8 @@ partial void ProcessRetrieveMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -196,8 +229,7 @@ partial void ProcessRetrieveMessageResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -206,6 +238,11 @@ partial void ProcessRetrieveMessageResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -222,14 +259,15 @@ partial void ProcessRetrieveMessageResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -269,6 +307,8 @@ partial void ProcessRetrieveMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -289,6 +329,8 @@ partial void ProcessRetrieveMessageResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -313,9 +355,13 @@ partial void ProcessRetrieveMessageResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.MessageObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -343,9 +389,13 @@ partial void ProcessRetrieveMessageResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.MessageObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRun.g.cs
index f6fcbe97..1a803cdd 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRun.g.cs
@@ -56,6 +56,29 @@ partial void ProcessRetrieveRunResponseContent(
string runId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveRunAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieves a run.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveRunAsResponseAsync(
+ string threadId,
+ string runId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -86,6 +109,7 @@ partial void ProcessRetrieveRunResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}",
baseUri: HttpClient.BaseAddress);
@@ -160,6 +184,8 @@ partial void ProcessRetrieveRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -170,6 +196,11 @@ partial void ProcessRetrieveRunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -187,6 +218,8 @@ partial void ProcessRetrieveRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -196,8 +229,7 @@ partial void ProcessRetrieveRunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -206,6 +238,11 @@ partial void ProcessRetrieveRunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -222,14 +259,15 @@ partial void ProcessRetrieveRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -269,6 +307,8 @@ partial void ProcessRetrieveRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -289,6 +329,8 @@ partial void ProcessRetrieveRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -313,9 +355,13 @@ partial void ProcessRetrieveRunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -343,9 +389,13 @@ partial void ProcessRetrieveRunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRunStep.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRunStep.g.cs
index fa27e519..5e6d49bc 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRunStep.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveRunStep.g.cs
@@ -64,6 +64,35 @@ partial void ProcessRetrieveRunStepResponseContent(
global::System.Collections.Generic.IList? include = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveRunStepAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+ stepId: stepId,
+ include: include,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieves a run step.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveRunStepAsResponseAsync(
+ string threadId,
+ string runId,
+ string stepId,
+ global::System.Collections.Generic.IList? include = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -96,11 +125,12 @@ partial void ProcessRetrieveRunStepResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}/steps/{stepId}",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
- .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
+ .AddOptionalParameter("include[]", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -175,6 +205,8 @@ partial void ProcessRetrieveRunStepResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -185,6 +217,11 @@ partial void ProcessRetrieveRunStepResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -202,6 +239,8 @@ partial void ProcessRetrieveRunStepResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -211,8 +250,7 @@ partial void ProcessRetrieveRunStepResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -221,6 +259,11 @@ partial void ProcessRetrieveRunStepResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -237,14 +280,15 @@ partial void ProcessRetrieveRunStepResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -284,6 +328,8 @@ partial void ProcessRetrieveRunStepResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -304,6 +350,8 @@ partial void ProcessRetrieveRunStepResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -328,9 +376,13 @@ partial void ProcessRetrieveRunStepResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunStepObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunStepObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -358,9 +410,13 @@ partial void ProcessRetrieveRunStepResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunStepObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunStepObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveThread.g.cs
index 49f5084a..fa3f4d24 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveThread.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.RetrieveThread.g.cs
@@ -52,6 +52,26 @@ partial void ProcessRetrieveThreadResponseContent(
string threadId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveThreadAsResponseAsync(
+ threadId: threadId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieves a thread.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveThreadAsResponseAsync(
+ string threadId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -81,6 +101,7 @@ partial void ProcessRetrieveThreadResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}",
baseUri: HttpClient.BaseAddress);
@@ -154,6 +175,8 @@ partial void ProcessRetrieveThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -164,6 +187,11 @@ partial void ProcessRetrieveThreadResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -181,6 +209,8 @@ partial void ProcessRetrieveThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -190,8 +220,7 @@ partial void ProcessRetrieveThreadResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -200,6 +229,11 @@ partial void ProcessRetrieveThreadResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -216,14 +250,15 @@ partial void ProcessRetrieveThreadResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -263,6 +298,8 @@ partial void ProcessRetrieveThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -283,6 +320,8 @@ partial void ProcessRetrieveThreadResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -307,9 +346,13 @@ partial void ProcessRetrieveThreadResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ThreadObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -337,9 +380,13 @@ partial void ProcessRetrieveThreadResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ThreadObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.SubmitToolOutputsToRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.SubmitToolOutputsToRun.g.cs
index 102fce37..c04baeb5 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.SubmitToolOutputsToRun.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.SubmitToolOutputsToRun.g.cs
@@ -58,6 +58,34 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
string threadId,
string runId,
+ global::tryAGI.OpenAI.SubmitToolOutputsRunRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await SubmitToolOutputsToRunAsResponseAsync(
+ threadId: threadId,
+ runId: runId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.
+ ///
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> SubmitToolOutputsToRunAsResponseAsync(
+ string threadId,
+ string runId,
+
global::tryAGI.OpenAI.SubmitToolOutputsRunRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -90,10 +118,11 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/threads/{threadId}/runs/{runId}/submit_tool_outputs",
baseUri: HttpClient.BaseAddress);
@@ -175,6 +204,8 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -185,6 +216,11 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -202,6 +238,8 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -211,8 +249,7 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -221,6 +258,11 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -237,14 +279,15 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -284,6 +327,8 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -304,6 +349,8 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -328,9 +375,13 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.RunObject.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -358,9 +409,13 @@ partial void ProcessSubmitToolOutputsToRunResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.RunObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.g.cs
index e0a13425..87175ba0 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AssistantsClient.g.cs
@@ -73,10 +73,10 @@ public AssistantsClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public AssistantsClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::tryAGI.OpenAI.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateSpeech.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateSpeech.g.cs
index e30db089..1709cadd 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateSpeech.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateSpeech.g.cs
@@ -80,6 +80,7 @@ partial void ProcessCreateSpeechResponse(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/speech",
baseUri: HttpClient.BaseAddress);
@@ -159,6 +160,8 @@ partial void ProcessCreateSpeechResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -169,6 +172,11 @@ partial void ProcessCreateSpeechResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -186,6 +194,8 @@ partial void ProcessCreateSpeechResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -195,8 +205,7 @@ partial void ProcessCreateSpeechResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -205,6 +214,11 @@ partial void ProcessCreateSpeechResponse(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -221,14 +235,15 @@ partial void ProcessCreateSpeechResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -268,6 +283,8 @@ partial void ProcessCreateSpeechResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -288,6 +305,8 @@ partial void ProcessCreateSpeechResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscription.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscription.g.cs
index 22a8e2a5..b6dde679 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscription.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscription.g.cs
@@ -52,6 +52,30 @@ partial void ProcessCreateTranscriptionResponseContent(
///
public async global::System.Threading.Tasks.Task> CreateTranscriptionAsync(
+ global::tryAGI.OpenAI.CreateTranscriptionRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateTranscriptionAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Transcribes audio into the input language.
+ /// Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
+ /// format, or a stream of transcript events.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task>> CreateTranscriptionAsResponseAsync(
+
global::tryAGI.OpenAI.CreateTranscriptionRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -98,10 +122,11 @@ partial void ProcessCreateTranscriptionResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/transcriptions",
baseUri: HttpClient.BaseAddress);
@@ -134,6 +159,7 @@ partial void ProcessCreateTranscriptionResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}
+
var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
var __contentFile = new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty());
__contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
@@ -172,80 +198,94 @@ request.Filename is null
{
__contentFile.Headers.ContentDisposition.FileNameStar = null;
}
+
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
name: "\"model\"");
+
if (request.Language != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
name: "\"language\"");
- }
+
+ }
if (request.Prompt != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
name: "\"prompt\"");
- }
+
+ }
if (request.ResponseFormat != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
name: "\"response_format\"");
- }
+
+ }
if (request.Temperature != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
name: "\"temperature\"");
- }
+
+ }
if (request.Include != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Include, x => x.ToValueString()))}]"),
name: "\"include\"");
- }
+
+ }
if (request.TimestampGranularities != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"),
name: "\"timestamp_granularities\"");
- }
+
+ }
if (request.Stream != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Stream, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
name: "\"stream\"");
- }
+
+ }
if (request.ChunkingStrategy != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.ChunkingStrategy.ToString() ?? string.Empty),
name: "\"chunking_strategy\"");
- }
+
+ }
if (request.KnownSpeakerNames != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerNames, x => x))}]"),
name: "\"known_speaker_names\"");
- }
+
+ }
if (request.KnownSpeakerReferences != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerReferences, x => x))}]"),
name: "\"known_speaker_references\"");
+
}
+
__httpRequest.Content = __httpRequestContent;
+
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
@@ -287,6 +327,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -297,6 +339,11 @@ request.Filename is null
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -314,6 +361,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -323,8 +372,7 @@ request.Filename is null
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -333,6 +381,11 @@ request.Filename is null
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -349,14 +402,15 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -396,6 +450,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -416,6 +472,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -440,9 +498,13 @@ request.Filename is null
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -470,9 +532,13 @@ request.Filename is null
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -599,5 +665,1124 @@ request.Filename is null
requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
+
+ ///
+ /// Transcribes audio into the input language.
+ /// Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
+ /// format, or a stream of transcript events.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.
+ /// Example: gpt-4o-transcribe
+ ///
+ ///
+ /// The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.
+ ///
+ ///
+ /// An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.
+ /// Default Value: json
+ ///
+ ///
+ /// The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
+ /// Default Value: 0
+ ///
+ ///
+ /// Additional information to include in the transcription response.
+ /// `logprobs` will return the log probabilities of the tokens in the
+ /// response to understand the model's confidence in the transcription.
+ /// `logprobs` only works with response_format set to `json` and only with
+ /// the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
+ /// This option is not available for `gpt-4o-transcribe-diarize`.
+ /// Default Value: [segment]
+ ///
+ ///
+ ///
+ /// Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.
+ ///
+ ///
+ /// Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateTranscriptionAsync(
+ global::System.IO.Stream file,
+ string filename,
+ global::tryAGI.OpenAI.AnyOf model,
+ string? language = default,
+ string? prompt = default,
+ global::tryAGI.OpenAI.AudioResponseFormat? responseFormat = default,
+ double? temperature = default,
+ global::System.Collections.Generic.IList? include = default,
+ global::System.Collections.Generic.IList? timestampGranularities = default,
+ global::tryAGI.OpenAI.AnyOf? chunkingStrategy = default,
+ global::System.Collections.Generic.IList? knownSpeakerNames = default,
+ global::System.Collections.Generic.IList? knownSpeakerReferences = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ file = file ?? throw new global::System.ArgumentNullException(nameof(file));
+ var request = new global::tryAGI.OpenAI.CreateTranscriptionRequest
+ {
+ File = global::System.Array.Empty(),
+ Filename = filename,
+ Model = model,
+ Language = language,
+ Prompt = prompt,
+ ResponseFormat = responseFormat,
+ Temperature = temperature,
+ Include = include,
+ TimestampGranularities = timestampGranularities,
+ Stream = false,
+ ChunkingStrategy = chunkingStrategy,
+ KnownSpeakerNames = knownSpeakerNames,
+ KnownSpeakerReferences = knownSpeakerReferences,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateTranscriptionArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateTranscriptionSecurityRequirements,
+ operationName: "CreateTranscriptionAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/transcriptions",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ var __contentFile = new global::System.Net.Http.StreamContent(file);
+ __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Filename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentFile,
+ name: "\"file\"",
+ fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty);
+ if (__contentFile.Headers.ContentDisposition != null)
+ {
+ __contentFile.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
+ name: "\"model\"");
+
+ if (request.Language != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
+ name: "\"language\"");
+
+ }
+ if (request.Prompt != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
+ name: "\"prompt\"");
+
+ }
+ if (request.ResponseFormat != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
+ name: "\"response_format\"");
+
+ }
+ if (request.Temperature != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
+ name: "\"temperature\"");
+
+ }
+ if (request.Include != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Include, x => x.ToValueString()))}]"),
+ name: "\"include\"");
+
+ }
+ if (request.TimestampGranularities != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"),
+ name: "\"timestamp_granularities\"");
+
+ }
+ if (request.Stream != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Stream, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
+ name: "\"stream\"");
+
+ }
+ if (request.ChunkingStrategy != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.ChunkingStrategy.ToString() ?? string.Empty),
+ name: "\"chunking_strategy\"");
+
+ }
+ if (request.KnownSpeakerNames != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerNames, x => x))}]"),
+ name: "\"known_speaker_names\"");
+
+ }
+ if (request.KnownSpeakerReferences != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerReferences, x => x))}]"),
+ name: "\"known_speaker_references\"");
+
+ }
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTranscriptionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTranscriptionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateTranscriptionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Transcribes audio into the input language.
+ /// Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
+ /// format, or a stream of transcript events.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.
+ /// Example: gpt-4o-transcribe
+ ///
+ ///
+ /// The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.
+ ///
+ ///
+ /// An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.
+ /// Default Value: json
+ ///
+ ///
+ /// The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
+ /// Default Value: 0
+ ///
+ ///
+ /// Additional information to include in the transcription response.
+ /// `logprobs` will return the log probabilities of the tokens in the
+ /// response to understand the model's confidence in the transcription.
+ /// `logprobs` only works with response_format set to `json` and only with
+ /// the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
+ /// This option is not available for `gpt-4o-transcribe-diarize`.
+ /// Default Value: [segment]
+ ///
+ ///
+ ///
+ /// Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.
+ ///
+ ///
+ /// Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task>> CreateTranscriptionAsResponseAsync(
+ global::System.IO.Stream file,
+ string filename,
+ global::tryAGI.OpenAI.AnyOf model,
+ string? language = default,
+ string? prompt = default,
+ global::tryAGI.OpenAI.AudioResponseFormat? responseFormat = default,
+ double? temperature = default,
+ global::System.Collections.Generic.IList? include = default,
+ global::System.Collections.Generic.IList? timestampGranularities = default,
+ global::tryAGI.OpenAI.AnyOf? chunkingStrategy = default,
+ global::System.Collections.Generic.IList? knownSpeakerNames = default,
+ global::System.Collections.Generic.IList? knownSpeakerReferences = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ file = file ?? throw new global::System.ArgumentNullException(nameof(file));
+ var request = new global::tryAGI.OpenAI.CreateTranscriptionRequest
+ {
+ File = global::System.Array.Empty(),
+ Filename = filename,
+ Model = model,
+ Language = language,
+ Prompt = prompt,
+ ResponseFormat = responseFormat,
+ Temperature = temperature,
+ Include = include,
+ TimestampGranularities = timestampGranularities,
+ Stream = false,
+ ChunkingStrategy = chunkingStrategy,
+ KnownSpeakerNames = knownSpeakerNames,
+ KnownSpeakerReferences = knownSpeakerReferences,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateTranscriptionArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateTranscriptionSecurityRequirements,
+ operationName: "CreateTranscriptionAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/transcriptions",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ var __contentFile = new global::System.Net.Http.StreamContent(file);
+ __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Filename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentFile,
+ name: "\"file\"",
+ fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty);
+ if (__contentFile.Headers.ContentDisposition != null)
+ {
+ __contentFile.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
+ name: "\"model\"");
+
+ if (request.Language != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
+ name: "\"language\"");
+
+ }
+ if (request.Prompt != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
+ name: "\"prompt\"");
+
+ }
+ if (request.ResponseFormat != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
+ name: "\"response_format\"");
+
+ }
+ if (request.Temperature != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
+ name: "\"temperature\"");
+
+ }
+ if (request.Include != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Include, x => x.ToValueString()))}]"),
+ name: "\"include\"");
+
+ }
+ if (request.TimestampGranularities != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"),
+ name: "\"timestamp_granularities\"");
+
+ }
+ if (request.Stream != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Stream, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
+ name: "\"stream\"");
+
+ }
+ if (request.ChunkingStrategy != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.ChunkingStrategy.ToString() ?? string.Empty),
+ name: "\"chunking_strategy\"");
+
+ }
+ if (request.KnownSpeakerNames != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerNames, x => x))}]"),
+ name: "\"known_speaker_names\"");
+
+ }
+ if (request.KnownSpeakerReferences != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerReferences, x => x))}]"),
+ name: "\"known_speaker_references\"");
+
+ }
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTranscriptionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTranscriptionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscription",
+ methodName: "CreateTranscriptionAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateTranscriptionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ var __value = await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscriptionAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscriptionAsStream.g.cs
index 08ff2cef..bbb06717 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscriptionAsStream.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranscriptionAsStream.g.cs
@@ -93,10 +93,11 @@ partial void ProcessCreateTranscriptionAsStreamResponse(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/transcriptions",
baseUri: HttpClient.BaseAddress);
@@ -129,6 +130,7 @@ partial void ProcessCreateTranscriptionAsStreamResponse(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}
+
var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
var __contentFile = new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty());
__contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
@@ -167,80 +169,94 @@ request.Filename is null
{
__contentFile.Headers.ContentDisposition.FileNameStar = null;
}
+
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
name: "\"model\"");
+
if (request.Language != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
name: "\"language\"");
- }
+
+ }
if (request.Prompt != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
name: "\"prompt\"");
- }
+
+ }
if (request.ResponseFormat != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
name: "\"response_format\"");
- }
+
+ }
if (request.Temperature != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
name: "\"temperature\"");
- }
+
+ }
if (request.Include != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Include, x => x.ToValueString()))}]"),
name: "\"include\"");
- }
+
+ }
if (request.TimestampGranularities != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"),
name: "\"timestamp_granularities\"");
- }
+
+ }
if (request.Stream != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Stream, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
name: "\"stream\"");
- }
+
+ }
if (request.ChunkingStrategy != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.ChunkingStrategy.ToString() ?? string.Empty),
name: "\"chunking_strategy\"");
- }
+
+ }
if (request.KnownSpeakerNames != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerNames, x => x))}]"),
name: "\"known_speaker_names\"");
- }
+
+ }
if (request.KnownSpeakerReferences != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerReferences, x => x))}]"),
name: "\"known_speaker_references\"");
+
}
+
__httpRequest.Content = __httpRequestContent;
+
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
@@ -282,6 +298,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -292,6 +310,11 @@ request.Filename is null
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -309,6 +332,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -318,8 +343,7 @@ request.Filename is null
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -328,6 +352,11 @@ request.Filename is null
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -344,14 +373,15 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -391,6 +421,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -411,6 +443,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -577,5 +611,539 @@ request.Filename is null
yield return __response;
}
}
+
+ ///
+ /// Transcribes audio into the input language.
+ /// Returns a transcription object in `json`, `diarized_json`, or `verbose_json`
+ /// format, or a stream of transcript events.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.
+ /// Example: gpt-4o-transcribe
+ ///
+ ///
+ /// The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.
+ ///
+ ///
+ /// An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.
+ /// Default Value: json
+ ///
+ ///
+ /// The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
+ /// Default Value: 0
+ ///
+ ///
+ /// Additional information to include in the transcription response.
+ /// `logprobs` will return the log probabilities of the tokens in the
+ /// response to understand the model's confidence in the transcription.
+ /// `logprobs` only works with response_format set to `json` and only with
+ /// the models `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `gpt-4o-mini-transcribe-2025-12-15`. This field is not supported when using `gpt-4o-transcribe-diarize`.
+ ///
+ ///
+ /// The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.
+ /// This option is not available for `gpt-4o-transcribe-diarize`.
+ /// Default Value: [segment]
+ ///
+ ///
+ ///
+ /// Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.
+ ///
+ ///
+ /// Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Collections.Generic.IAsyncEnumerable CreateTranscriptionAsStreamAsync(
+ global::System.IO.Stream file,
+ string filename,
+ global::tryAGI.OpenAI.AnyOf model,
+ string? language = default,
+ string? prompt = default,
+ global::tryAGI.OpenAI.AudioResponseFormat? responseFormat = default,
+ double? temperature = default,
+ global::System.Collections.Generic.IList? include = default,
+ global::System.Collections.Generic.IList? timestampGranularities = default,
+ global::tryAGI.OpenAI.AnyOf? chunkingStrategy = default,
+ global::System.Collections.Generic.IList? knownSpeakerNames = default,
+ global::System.Collections.Generic.IList? knownSpeakerReferences = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ file = file ?? throw new global::System.ArgumentNullException(nameof(file));
+ var request = new global::tryAGI.OpenAI.CreateTranscriptionRequest
+ {
+ File = global::System.Array.Empty(),
+ Filename = filename,
+ Model = model,
+ Language = language,
+ Prompt = prompt,
+ ResponseFormat = responseFormat,
+ Temperature = temperature,
+ Include = include,
+ TimestampGranularities = timestampGranularities,
+ Stream = true,
+ ChunkingStrategy = chunkingStrategy,
+ KnownSpeakerNames = knownSpeakerNames,
+ KnownSpeakerReferences = knownSpeakerReferences,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateTranscriptionAsStreamArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateTranscriptionAsStreamSecurityRequirements,
+ operationName: "CreateTranscriptionAsStreamAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/transcriptions",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ var __contentFile = new global::System.Net.Http.StreamContent(file);
+ __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Filename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentFile,
+ name: "\"file\"",
+ fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty);
+ if (__contentFile.Headers.ContentDisposition != null)
+ {
+ __contentFile.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
+ name: "\"model\"");
+
+ if (request.Language != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
+ name: "\"language\"");
+
+ }
+ if (request.Prompt != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
+ name: "\"prompt\"");
+
+ }
+ if (request.ResponseFormat != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
+ name: "\"response_format\"");
+
+ }
+ if (request.Temperature != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
+ name: "\"temperature\"");
+
+ }
+ if (request.Include != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.Include, x => x.ToValueString()))}]"),
+ name: "\"include\"");
+
+ }
+ if (request.TimestampGranularities != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.TimestampGranularities, x => x.ToValueString()))}]"),
+ name: "\"timestamp_granularities\"");
+
+ }
+ if (request.Stream != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Stream, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()),
+ name: "\"stream\"");
+
+ }
+ if (request.ChunkingStrategy != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.ChunkingStrategy.ToString() ?? string.Empty),
+ name: "\"chunking_strategy\"");
+
+ }
+ if (request.KnownSpeakerNames != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerNames, x => x))}]"),
+ name: "\"known_speaker_names\"");
+
+ }
+ if (request.KnownSpeakerReferences != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent($"[{string.Join(",", global::System.Linq.Enumerable.Select(request.KnownSpeakerReferences, x => x))}]"),
+ name: "\"known_speaker_references\"");
+
+ }
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTranscriptionAsStreamRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscriptionAsStream",
+ methodName: "CreateTranscriptionAsStreamAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscriptionAsStream",
+ methodName: "CreateTranscriptionAsStreamAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscriptionAsStream",
+ methodName: "CreateTranscriptionAsStreamAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTranscriptionAsStreamResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscriptionAsStream",
+ methodName: "CreateTranscriptionAsStreamAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranscriptionAsStream",
+ methodName: "CreateTranscriptionAsStreamAsync",
+ pathTemplate: "\"/audio/transcriptions\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ }
+ catch (global::System.Net.Http.HttpRequestException __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ using var __stream = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ await foreach (var __sseEvent in global::System.Net.ServerSentEvents.SseParser
+ .Create(__stream).EnumerateAsync(__effectiveCancellationToken))
+ {
+ var __content = __sseEvent.Data;
+ if (__content == "[DONE]")
+ {
+ yield break;
+ }
+
+ var __streamedResponse = global::tryAGI.OpenAI.CreateTranscriptionResponseStreamEvent.FromJson(__content, JsonSerializerContext) ??
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: $"Response deserialization failed for \"{__content}\" ",
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+
+ yield return __streamedResponse;
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranslation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranslation.g.cs
index 028992f2..380a8b3a 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranslation.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateTranslation.g.cs
@@ -50,6 +50,28 @@ partial void ProcessCreateTranslationResponseContent(
///
public async global::System.Threading.Tasks.Task> CreateTranslationAsync(
+ global::tryAGI.OpenAI.CreateTranslationRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateTranslationAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Translates audio into English.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task>> CreateTranslationAsResponseAsync(
+
global::tryAGI.OpenAI.CreateTranslationRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -80,10 +102,11 @@ partial void ProcessCreateTranslationResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/translations",
baseUri: HttpClient.BaseAddress);
@@ -116,6 +139,7 @@ partial void ProcessCreateTranslationResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}
+
var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
var __contentFile = new global::System.Net.Http.ByteArrayContent(request.File ?? global::System.Array.Empty());
__contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
@@ -154,31 +178,38 @@ request.Filename is null
{
__contentFile.Headers.ContentDisposition.FileNameStar = null;
}
+
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
name: "\"model\"");
+
if (request.Prompt != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
name: "\"prompt\"");
- }
+
+ }
if (request.ResponseFormat != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
name: "\"response_format\"");
- }
+
+ }
if (request.Temperature != default)
{
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
name: "\"temperature\"");
+
}
+
__httpRequest.Content = __httpRequestContent;
+
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
@@ -220,6 +251,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -230,6 +263,11 @@ request.Filename is null
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -247,6 +285,8 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -256,8 +296,7 @@ request.Filename is null
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -266,6 +305,11 @@ request.Filename is null
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -282,14 +326,15 @@ request.Filename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -329,6 +374,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -349,6 +396,8 @@ request.Filename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -373,9 +422,13 @@ request.Filename is null
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -403,9 +456,13 @@ request.Filename is null
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -495,5 +552,938 @@ request.Filename is null
requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
+
+ ///
+ /// Translates audio into English.
+ ///
+ ///
+ /// The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.
+ /// Example: whisper-1
+ ///
+ ///
+ /// An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should be in English.
+ ///
+ ///
+ /// The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.
+ /// Default Value: json
+ ///
+ ///
+ /// The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
+ /// Default Value: 0
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateTranslationAsync(
+ global::System.IO.Stream file,
+ string filename,
+ global::tryAGI.OpenAI.AnyOf model,
+ string? prompt = default,
+ global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat? responseFormat = default,
+ double? temperature = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ file = file ?? throw new global::System.ArgumentNullException(nameof(file));
+ var request = new global::tryAGI.OpenAI.CreateTranslationRequest
+ {
+ File = global::System.Array.Empty(),
+ Filename = filename,
+ Model = model,
+ Prompt = prompt,
+ ResponseFormat = responseFormat,
+ Temperature = temperature,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateTranslationArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateTranslationSecurityRequirements,
+ operationName: "CreateTranslationAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/translations",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ var __contentFile = new global::System.Net.Http.StreamContent(file);
+ __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Filename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentFile,
+ name: "\"file\"",
+ fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty);
+ if (__contentFile.Headers.ContentDisposition != null)
+ {
+ __contentFile.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
+ name: "\"model\"");
+
+ if (request.Prompt != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
+ name: "\"prompt\"");
+
+ }
+ if (request.ResponseFormat != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
+ name: "\"response_format\"");
+
+ }
+ if (request.Temperature != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
+ name: "\"temperature\"");
+
+ }
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTranslationRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTranslationResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateTranslationResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Translates audio into English.
+ ///
+ ///
+ /// The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
+ ///
+ ///
+ /// ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.
+ /// Example: whisper-1
+ ///
+ ///
+ /// An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text#prompting) should be in English.
+ ///
+ ///
+ /// The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.
+ /// Default Value: json
+ ///
+ ///
+ /// The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
+ /// Default Value: 0
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task>> CreateTranslationAsResponseAsync(
+ global::System.IO.Stream file,
+ string filename,
+ global::tryAGI.OpenAI.AnyOf model,
+ string? prompt = default,
+ global::tryAGI.OpenAI.CreateTranslationRequestResponseFormat? responseFormat = default,
+ double? temperature = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ file = file ?? throw new global::System.ArgumentNullException(nameof(file));
+ var request = new global::tryAGI.OpenAI.CreateTranslationRequest
+ {
+ File = global::System.Array.Empty(),
+ Filename = filename,
+ Model = model,
+ Prompt = prompt,
+ ResponseFormat = responseFormat,
+ Temperature = temperature,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateTranslationArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateTranslationSecurityRequirements,
+ operationName: "CreateTranslationAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/translations",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ var __contentFile = new global::System.Net.Http.StreamContent(file);
+ __contentFile.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Filename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Filename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentFile,
+ name: "\"file\"",
+ fileName: request.Filename != null ? $"\"{request.Filename}\"" : string.Empty);
+ if (__contentFile.Headers.ContentDisposition != null)
+ {
+ __contentFile.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty),
+ name: "\"model\"");
+
+ if (request.Prompt != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty),
+ name: "\"prompt\"");
+
+ }
+ if (request.ResponseFormat != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent((request.ResponseFormat).HasValue ? (request.ResponseFormat).GetValueOrDefault().ToValueString() : string.Empty),
+ name: "\"response_format\"");
+
+ }
+ if (request.Temperature != default)
+ {
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.Temperature, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty),
+ name: "\"temperature\"");
+
+ }
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateTranslationRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateTranslationResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateTranslation",
+ methodName: "CreateTranslationAsync",
+ pathTemplate: "\"/audio/translations\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateTranslationResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::tryAGI.OpenAI.OneOf.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ var __value = await global::tryAGI.OpenAI.OneOf.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse>(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoice.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoice.g.cs
index 6a4c1727..8716b9ae 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoice.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoice.g.cs
@@ -52,6 +52,30 @@ partial void ProcessCreateVoiceResponseContent(
///
public async global::System.Threading.Tasks.Task CreateVoiceAsync(
+ global::tryAGI.OpenAI.CreateVoiceRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateVoiceAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Creates a custom voice.
+ /// Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateVoiceAsResponseAsync(
+
global::tryAGI.OpenAI.CreateVoiceRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -82,10 +106,11 @@ partial void ProcessCreateVoiceResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/voices",
baseUri: HttpClient.BaseAddress);
@@ -118,10 +143,12 @@ partial void ProcessCreateVoiceResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}
+
var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
name: "\"name\"");
+
var __contentAudioSample = new global::System.Net.Http.ByteArrayContent(request.AudioSample ?? global::System.Array.Empty());
__contentAudioSample.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
request.AudioSamplename is null
@@ -159,10 +186,13 @@ request.AudioSamplename is null
{
__contentAudioSample.Headers.ContentDisposition.FileNameStar = null;
}
+
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Consent ?? string.Empty),
name: "\"consent\"");
+
__httpRequest.Content = __httpRequestContent;
+
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
@@ -204,6 +234,8 @@ request.AudioSamplename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -214,6 +246,11 @@ request.AudioSamplename is null
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -231,6 +268,8 @@ request.AudioSamplename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -240,8 +279,7 @@ request.AudioSamplename is null
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -250,6 +288,11 @@ request.AudioSamplename is null
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -266,14 +309,15 @@ request.AudioSamplename is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -313,6 +357,8 @@ request.AudioSamplename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -333,6 +379,8 @@ request.AudioSamplename is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -357,9 +405,13 @@ request.AudioSamplename is null
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -387,9 +439,13 @@ request.AudioSamplename is null
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -472,5 +528,882 @@ request.AudioSamplename is null
requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
+
+ ///
+ /// Creates a custom voice.
+ /// Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// The name of the new voice.
+ ///
+ ///
+ /// The sample audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The sample audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The consent recording ID (for example, `cons_1234`).
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task CreateVoiceAsync(
+ string name,
+ global::System.IO.Stream audioSample,
+ string audioSamplename,
+ string consent,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ audioSample = audioSample ?? throw new global::System.ArgumentNullException(nameof(audioSample));
+ var request = new global::tryAGI.OpenAI.CreateVoiceRequest
+ {
+ Name = name,
+ AudioSample = global::System.Array.Empty(),
+ AudioSamplename = audioSamplename,
+ Consent = consent,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateVoiceArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateVoiceSecurityRequirements,
+ operationName: "CreateVoiceAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/voices",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
+ name: "\"name\"");
+
+ var __contentAudioSample = new global::System.Net.Http.StreamContent(audioSample);
+ __contentAudioSample.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.AudioSamplename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.AudioSamplename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentAudioSample,
+ name: "\"audio_sample\"",
+ fileName: request.AudioSamplename != null ? $"\"{request.AudioSamplename}\"" : string.Empty);
+ if (__contentAudioSample.Headers.ContentDisposition != null)
+ {
+ __contentAudioSample.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Consent ?? string.Empty),
+ name: "\"consent\"");
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateVoiceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateVoiceResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateVoiceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::tryAGI.OpenAI.VoiceResource.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::tryAGI.OpenAI.VoiceResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Creates a custom voice.
+ /// Create a custom voice you can use for audio output (for example, in Text-to-Speech and the Realtime API). This requires an audio sample and a previously uploaded consent recording.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// The name of the new voice.
+ ///
+ ///
+ /// The sample audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The sample audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The consent recording ID (for example, `cons_1234`).
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateVoiceAsResponseAsync(
+ string name,
+ global::System.IO.Stream audioSample,
+ string audioSamplename,
+ string consent,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ audioSample = audioSample ?? throw new global::System.ArgumentNullException(nameof(audioSample));
+ var request = new global::tryAGI.OpenAI.CreateVoiceRequest
+ {
+ Name = name,
+ AudioSample = global::System.Array.Empty(),
+ AudioSamplename = audioSamplename,
+ Consent = consent,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateVoiceArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateVoiceSecurityRequirements,
+ operationName: "CreateVoiceAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/voices",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
+ name: "\"name\"");
+
+ var __contentAudioSample = new global::System.Net.Http.StreamContent(audioSample);
+ __contentAudioSample.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.AudioSamplename is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.AudioSamplename) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentAudioSample,
+ name: "\"audio_sample\"",
+ fileName: request.AudioSamplename != null ? $"\"{request.AudioSamplename}\"" : string.Empty);
+ if (__contentAudioSample.Headers.ContentDisposition != null)
+ {
+ __contentAudioSample.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Consent ?? string.Empty),
+ name: "\"consent\"");
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateVoiceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateVoiceResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoice",
+ methodName: "CreateVoiceAsync",
+ pathTemplate: "\"/audio/voices\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateVoiceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::tryAGI.OpenAI.VoiceResource.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ var __value = await global::tryAGI.OpenAI.VoiceResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoiceConsent.g.cs
index b31f861a..65f1d593 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoiceConsent.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.CreateVoiceConsent.g.cs
@@ -52,6 +52,30 @@ partial void ProcessCreateVoiceConsentResponseContent(
///
public async global::System.Threading.Tasks.Task CreateVoiceConsentAsync(
+ global::tryAGI.OpenAI.CreateVoiceConsentRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateVoiceConsentAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Upload a voice consent recording.
+ /// Upload a consent recording that authorizes creation of a custom voice.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateVoiceConsentAsResponseAsync(
+
global::tryAGI.OpenAI.CreateVoiceConsentRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -82,10 +106,11 @@ partial void ProcessCreateVoiceConsentResponseContent(
var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
- supportsRetry: true);
+ supportsRetry: false);
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/voice_consents",
baseUri: HttpClient.BaseAddress);
@@ -118,10 +143,12 @@ partial void ProcessCreateVoiceConsentResponseContent(
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}
+
var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
name: "\"name\"");
+
var __contentRecording = new global::System.Net.Http.ByteArrayContent(request.Recording ?? global::System.Array.Empty());
__contentRecording.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
request.Recordingname is null
@@ -159,10 +186,13 @@ request.Recordingname is null
{
__contentRecording.Headers.ContentDisposition.FileNameStar = null;
}
+
__httpRequestContent.Add(
content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
name: "\"language\"");
+
__httpRequest.Content = __httpRequestContent;
+
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
request: __httpRequest,
clientHeaders: Options.Headers,
@@ -204,6 +234,8 @@ request.Recordingname is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -214,6 +246,11 @@ request.Recordingname is null
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -231,6 +268,8 @@ request.Recordingname is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -240,8 +279,7 @@ request.Recordingname is null
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -250,6 +288,11 @@ request.Recordingname is null
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -266,14 +309,15 @@ request.Recordingname is null
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -313,6 +357,8 @@ request.Recordingname is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -333,6 +379,8 @@ request.Recordingname is null
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -357,9 +405,13 @@ request.Recordingname is null
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -387,9 +439,13 @@ request.Recordingname is null
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -472,5 +528,882 @@ request.Recordingname is null
requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
+
+ ///
+ /// Upload a voice consent recording.
+ /// Upload a consent recording that authorizes creation of a custom voice.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// The label to use for this consent recording.
+ ///
+ ///
+ /// The consent audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The consent audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The BCP 47 language tag for the consent phrase (for example, `en-US`).
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task CreateVoiceConsentAsync(
+ string name,
+ global::System.IO.Stream recording,
+ string recordingname,
+ string language,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ recording = recording ?? throw new global::System.ArgumentNullException(nameof(recording));
+ var request = new global::tryAGI.OpenAI.CreateVoiceConsentRequest
+ {
+ Name = name,
+ Recording = global::System.Array.Empty(),
+ Recordingname = recordingname,
+ Language = language,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateVoiceConsentArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateVoiceConsentSecurityRequirements,
+ operationName: "CreateVoiceConsentAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/voice_consents",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
+ name: "\"name\"");
+
+ var __contentRecording = new global::System.Net.Http.StreamContent(recording);
+ __contentRecording.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Recordingname is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Recordingname) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentRecording,
+ name: "\"recording\"",
+ fileName: request.Recordingname != null ? $"\"{request.Recordingname}\"" : string.Empty);
+ if (__contentRecording.Headers.ContentDisposition != null)
+ {
+ __contentRecording.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
+ name: "\"language\"");
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateVoiceConsentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateVoiceConsentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateVoiceConsentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return
+ await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
+ ///
+ /// Upload a voice consent recording.
+ /// Upload a consent recording that authorizes creation of a custom voice.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices) for requirements and best practices. Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// The label to use for this consent recording.
+ ///
+ ///
+ /// The consent audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The consent audio recording file. Maximum size is 10 MiB.
+ /// Supported MIME types:
+ /// `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`, `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
+ ///
+ ///
+ /// The BCP 47 language tag for the consent phrase (for example, `en-US`).
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateVoiceConsentAsResponseAsync(
+ string name,
+ global::System.IO.Stream recording,
+ string recordingname,
+ string language,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+
+ recording = recording ?? throw new global::System.ArgumentNullException(nameof(recording));
+ var request = new global::tryAGI.OpenAI.CreateVoiceConsentRequest
+ {
+ Name = name,
+ Recording = global::System.Array.Empty(),
+ Recordingname = recordingname,
+ Language = language,
+ };
+ PrepareArguments(
+ client: HttpClient);
+ PrepareCreateVoiceConsentArguments(
+ httpClient: HttpClient,
+ request: request);
+
+
+ var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations(
+ availableAuthorizations: Authorizations,
+ securityRequirements: s_CreateVoiceConsentSecurityRequirements,
+ operationName: "CreateVoiceConsentAsync");
+
+ using var __timeoutCancellationTokenSource = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: false);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+
+ var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
+ path: "/audio/voice_consents",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+#if NET6_0_OR_GREATER
+ __httpRequest.Version = global::System.Net.HttpVersion.Version11;
+ __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
+#endif
+
+ foreach (var __authorization in __authorizations)
+ {
+ if (__authorization.Type == "Http" ||
+ __authorization.Type == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
+ {
+ __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
+ scheme: __authorization.Name,
+ parameter: __authorization.Value);
+ }
+ else if (__authorization.Type == "ApiKey" &&
+ __authorization.Location == "Header")
+ {
+ __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
+ }
+ }
+
+ var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent();
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty),
+ name: "\"name\"");
+
+ var __contentRecording = new global::System.Net.Http.StreamContent(recording);
+ __contentRecording.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(
+ request.Recordingname is null
+ ? "application/octet-stream"
+ : (global::System.IO.Path.GetExtension(request.Recordingname) ?? string.Empty).ToLowerInvariant() switch
+ {
+ ".aac" => "audio/aac",
+ ".flac" => "audio/flac",
+ ".gif" => "image/gif",
+ ".jpeg" => "image/jpeg",
+ ".jpg" => "image/jpeg",
+ ".json" => "application/json",
+ ".m4a" => "audio/mp4",
+ ".mp3" => "audio/mpeg",
+ ".mp4" => "video/mp4",
+ ".mpeg" => "audio/mpeg",
+ ".mpga" => "audio/mpeg",
+ ".oga" => "audio/ogg",
+ ".ogg" => "audio/ogg",
+ ".opus" => "audio/ogg",
+ ".pdf" => "application/pdf",
+ ".png" => "image/png",
+ ".txt" => "text/plain",
+ ".wav" => "audio/wav",
+ ".weba" => "audio/webm",
+ ".webm" => "video/webm",
+ ".webp" => "image/webp",
+ _ => "application/octet-stream",
+ });
+ __httpRequestContent.Add(
+ content: __contentRecording,
+ name: "\"recording\"",
+ fileName: request.Recordingname != null ? $"\"{request.Recordingname}\"" : string.Empty);
+ if (__contentRecording.Headers.ContentDisposition != null)
+ {
+ __contentRecording.Headers.ContentDisposition.FileNameStar = null;
+ }
+
+ __httpRequestContent.Add(
+ content: new global::System.Net.Http.StringContent(request.Language ?? string.Empty),
+ name: "\"language\"");
+
+ __httpRequest.Content = __httpRequestContent;
+
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
+
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateVoiceConsentRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
+
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
+ {
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
+ {
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ }
+ catch (global::System.Net.Http.HttpRequestException __exception)
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ retryDelay: __retryDelay,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ break;
+ }
+
+ if (__response == null)
+ {
+ throw new global::System.InvalidOperationException("No response received.");
+ }
+
+ using (__response)
+ {
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateVoiceConsentResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+ else
+ {
+ await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateVoiceConsent",
+ methodName: "CreateVoiceConsentAsync",
+ pathTemplate: "\"/audio/voice_consents\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ }
+
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessCreateVoiceConsentResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ var __value = global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ using var __content = await __response.Content.ReadAsStreamAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ var __value = await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
+ }
+ catch (global::System.Exception __ex)
+ {
+ string? __content = null;
+ try
+ {
+ __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+ }
+ catch (global::System.Exception)
+ {
+ }
+
+ throw new global::tryAGI.OpenAI.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+
+ }
+ }
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.DeleteVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.DeleteVoiceConsent.g.cs
index 7f96fb48..fe6d598c 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.DeleteVoiceConsent.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.DeleteVoiceConsent.g.cs
@@ -54,6 +54,28 @@ partial void ProcessDeleteVoiceConsentResponseContent(
string consentId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteVoiceConsentAsResponseAsync(
+ consentId: consentId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Deletes a voice consent recording.
+ /// Delete a consent recording that was uploaded for creating custom voices.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeleteVoiceConsentAsResponseAsync(
+ string consentId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -83,6 +105,7 @@ partial void ProcessDeleteVoiceConsentResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/audio/voice_consents/{consentId}",
baseUri: HttpClient.BaseAddress);
@@ -156,6 +179,8 @@ partial void ProcessDeleteVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -166,6 +191,11 @@ partial void ProcessDeleteVoiceConsentResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -183,6 +213,8 @@ partial void ProcessDeleteVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -192,8 +224,7 @@ partial void ProcessDeleteVoiceConsentResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -202,6 +233,11 @@ partial void ProcessDeleteVoiceConsentResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -218,14 +254,15 @@ partial void ProcessDeleteVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -265,6 +302,8 @@ partial void ProcessDeleteVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -285,6 +324,8 @@ partial void ProcessDeleteVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -309,9 +350,13 @@ partial void ProcessDeleteVoiceConsentResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceConsentDeletedResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceConsentDeletedResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -339,9 +384,13 @@ partial void ProcessDeleteVoiceConsentResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceConsentDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceConsentDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.ListVoiceConsents.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.ListVoiceConsents.g.cs
index ee5ca36d..0fd4c2fe 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.ListVoiceConsents.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.ListVoiceConsents.g.cs
@@ -60,6 +60,33 @@ partial void ProcessListVoiceConsentsResponseContent(
int? limit = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListVoiceConsentsAsResponseAsync(
+ after: after,
+ limit: limit,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Returns a list of voice consent recordings.
+ /// List consent recordings available to your organization for creating custom voices.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListVoiceConsentsAsResponseAsync(
+ string? after = default,
+ int? limit = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -90,12 +117,13 @@ partial void ProcessListVoiceConsentsResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/audio/voice_consents",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("after", after)
- .AddOptionalParameter("limit", limit?.ToString())
+ .AddOptionalParameter("limit", limit?.ToString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -168,6 +196,8 @@ partial void ProcessListVoiceConsentsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -178,6 +208,11 @@ partial void ProcessListVoiceConsentsResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -195,6 +230,8 @@ partial void ProcessListVoiceConsentsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -204,8 +241,7 @@ partial void ProcessListVoiceConsentsResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -214,6 +250,11 @@ partial void ProcessListVoiceConsentsResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -230,14 +271,15 @@ partial void ProcessListVoiceConsentsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -277,6 +319,8 @@ partial void ProcessListVoiceConsentsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -297,6 +341,8 @@ partial void ProcessListVoiceConsentsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -321,9 +367,13 @@ partial void ProcessListVoiceConsentsResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceConsentListResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceConsentListResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -351,9 +401,13 @@ partial void ProcessListVoiceConsentsResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceConsentListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceConsentListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.RetrieveVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.RetrieveVoiceConsent.g.cs
index 3ee25d92..b6ec0e3e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.RetrieveVoiceConsent.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.RetrieveVoiceConsent.g.cs
@@ -54,6 +54,28 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
string consentId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveVoiceConsentAsResponseAsync(
+ consentId: consentId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieves a voice consent recording.
+ /// Retrieve consent recording metadata used for creating custom voices.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveVoiceConsentAsResponseAsync(
+ string consentId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -83,6 +105,7 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/audio/voice_consents/{consentId}",
baseUri: HttpClient.BaseAddress);
@@ -156,6 +179,8 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -166,6 +191,11 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -183,6 +213,8 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -192,8 +224,7 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -202,6 +233,11 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -218,14 +254,15 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -265,6 +302,8 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -285,6 +324,8 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -309,9 +350,13 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -339,9 +384,13 @@ partial void ProcessRetrieveVoiceConsentResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.UpdateVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.UpdateVoiceConsent.g.cs
index 6903d569..541f28c0 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.UpdateVoiceConsent.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.UpdateVoiceConsent.g.cs
@@ -56,6 +56,33 @@ partial void ProcessUpdateVoiceConsentResponseContent(
public async global::System.Threading.Tasks.Task UpdateVoiceConsentAsync(
string consentId,
+ global::tryAGI.OpenAI.UpdateVoiceConsentRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await UpdateVoiceConsentAsResponseAsync(
+ consentId: consentId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Updates a voice consent recording (metadata only).
+ /// Update consent recording metadata used for creating custom voices. This endpoint updates metadata only and does not replace the underlying audio.
+ /// See the [custom voices guide](/docs/guides/text-to-speech#custom-voices). Custom voices are limited to eligible customers.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> UpdateVoiceConsentAsResponseAsync(
+ string consentId,
+
global::tryAGI.OpenAI.UpdateVoiceConsentRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -91,6 +118,7 @@ partial void ProcessUpdateVoiceConsentResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/audio/voice_consents/{consentId}",
baseUri: HttpClient.BaseAddress);
@@ -171,6 +199,8 @@ partial void ProcessUpdateVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -181,6 +211,11 @@ partial void ProcessUpdateVoiceConsentResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -198,6 +233,8 @@ partial void ProcessUpdateVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -207,8 +244,7 @@ partial void ProcessUpdateVoiceConsentResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -217,6 +253,11 @@ partial void ProcessUpdateVoiceConsentResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -233,14 +274,15 @@ partial void ProcessUpdateVoiceConsentResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -280,6 +322,8 @@ partial void ProcessUpdateVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -300,6 +344,8 @@ partial void ProcessUpdateVoiceConsentResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -324,9 +370,13 @@ partial void ProcessUpdateVoiceConsentResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.VoiceConsentResource.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -354,9 +404,13 @@ partial void ProcessUpdateVoiceConsentResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.VoiceConsentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.g.cs
index 63539030..f38d0962 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AudioClient.g.cs
@@ -73,10 +73,10 @@ public AudioClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public AudioClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::tryAGI.OpenAI.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.ListAuditLogs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.ListAuditLogs.g.cs
index f888f482..3c5420b3 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.ListAuditLogs.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.ListAuditLogs.g.cs
@@ -86,6 +86,52 @@ partial void ProcessListAuditLogsResponseContent(
string? before = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListAuditLogsAsResponseAsync(
+ effectiveAt: effectiveAt,
+ projectIds: projectIds,
+ eventTypes: eventTypes,
+ actorIds: actorIds,
+ actorEmails: actorEmails,
+ resourceIds: resourceIds,
+ limit: limit,
+ after: after,
+ before: before,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List user actions and configuration changes within this organization.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListAuditLogsAsResponseAsync(
+ global::tryAGI.OpenAI.ListAuditLogsEffectiveAt? effectiveAt = default,
+ global::System.Collections.Generic.IList? projectIds = default,
+ global::System.Collections.Generic.IList? eventTypes = default,
+ global::System.Collections.Generic.IList? actorIds = default,
+ global::System.Collections.Generic.IList? actorEmails = default,
+ global::System.Collections.Generic.IList? resourceIds = default,
+ int? limit = default,
+ string? after = default,
+ string? before = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -123,9 +169,10 @@ partial void ProcessListAuditLogsResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/organization/audit_logs",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("gt", effectiveAt?.Gt?.ToString())
.AddOptionalParameter("gte", effectiveAt?.Gte?.ToString())
@@ -138,7 +185,7 @@ partial void ProcessListAuditLogsResponseContent(
.AddOptionalParameter("resource_ids[]", resourceIds, delimiter: ",", explode: true)
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("after", after)
- .AddOptionalParameter("before", before)
+ .AddOptionalParameter("before", before)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -218,6 +265,8 @@ partial void ProcessListAuditLogsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -228,6 +277,11 @@ partial void ProcessListAuditLogsResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -245,6 +299,8 @@ partial void ProcessListAuditLogsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -254,8 +310,7 @@ partial void ProcessListAuditLogsResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -264,6 +319,11 @@ partial void ProcessListAuditLogsResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -280,14 +340,15 @@ partial void ProcessListAuditLogsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -327,6 +388,8 @@ partial void ProcessListAuditLogsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -347,6 +410,8 @@ partial void ProcessListAuditLogsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -371,9 +436,13 @@ partial void ProcessListAuditLogsResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListAuditLogsResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListAuditLogsResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -401,9 +470,13 @@ partial void ProcessListAuditLogsResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListAuditLogsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListAuditLogsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.g.cs
index c39dac18..4e1b955b 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AuditLogsClient.g.cs
@@ -73,10 +73,10 @@ public AuditLogsClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public AuditLogsClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::tryAGI.OpenAI.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AutoSDKHttpResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AutoSDKHttpResponse.g.cs
index debd2d48..4a37617e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AutoSDKHttpResponse.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.AutoSDKHttpResponse.g.cs
@@ -14,9 +14,24 @@ public partial class AutoSDKHttpResponse
public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary> headers)
+ : this(
+ statusCode: statusCode,
+ headers: headers,
+ requestUri: null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AutoSDKHttpResponse(
+ global::System.Net.HttpStatusCode statusCode,
+ global::System.Collections.Generic.Dictionary> headers,
+ global::System.Uri? requestUri)
{
StatusCode = statusCode;
Headers = headers ?? throw new global::System.ArgumentNullException(nameof(headers));
+ RequestUri = requestUri;
}
///
@@ -27,6 +42,10 @@ public AutoSDKHttpResponse(
/// Gets the response headers.
///
public global::System.Collections.Generic.Dictionary> Headers { get; }
+ ///
+ /// Gets the final request URI associated with the response.
+ ///
+ public global::System.Uri? RequestUri { get; }
internal static global::System.Collections.Generic.Dictionary> CreateHeaders(
global::System.Net.Http.HttpResponseMessage response)
@@ -73,7 +92,23 @@ public AutoSDKHttpResponse(
global::System.Net.HttpStatusCode statusCode,
global::System.Collections.Generic.Dictionary> headers,
T body)
- : base(statusCode, headers)
+ : this(
+ statusCode: statusCode,
+ headers: headers,
+ requestUri: null,
+ body: body)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AutoSDKHttpResponse(
+ global::System.Net.HttpStatusCode statusCode,
+ global::System.Collections.Generic.Dictionary> headers,
+ global::System.Uri? requestUri,
+ T body)
+ : base(statusCode, headers, requestUri)
{
Body = body;
}
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CancelBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CancelBatch.g.cs
index d38f2c5c..faddc562 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CancelBatch.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CancelBatch.g.cs
@@ -52,6 +52,26 @@ partial void ProcessCancelBatchResponseContent(
string batchId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CancelBatchAsResponseAsync(
+ batchId: batchId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CancelBatchAsResponseAsync(
+ string batchId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -81,6 +101,7 @@ partial void ProcessCancelBatchResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/batches/{batchId}/cancel",
baseUri: HttpClient.BaseAddress);
@@ -154,6 +175,8 @@ partial void ProcessCancelBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -164,6 +187,11 @@ partial void ProcessCancelBatchResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -181,6 +209,8 @@ partial void ProcessCancelBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -190,8 +220,7 @@ partial void ProcessCancelBatchResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -200,6 +229,11 @@ partial void ProcessCancelBatchResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -216,14 +250,15 @@ partial void ProcessCancelBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -263,6 +298,8 @@ partial void ProcessCancelBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -283,6 +320,8 @@ partial void ProcessCancelBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -307,9 +346,13 @@ partial void ProcessCancelBatchResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -337,9 +380,13 @@ partial void ProcessCancelBatchResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CreateBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CreateBatch.g.cs
index cb3c7752..7bed7a76 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CreateBatch.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.CreateBatch.g.cs
@@ -50,6 +50,28 @@ partial void ProcessCreateBatchResponseContent(
///
public async global::System.Threading.Tasks.Task CreateBatchAsync(
+ global::tryAGI.OpenAI.CreateBatchRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateBatchAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Creates and executes a batch from an uploaded file of requests
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateBatchAsResponseAsync(
+
global::tryAGI.OpenAI.CreateBatchRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -84,6 +106,7 @@ partial void ProcessCreateBatchResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/batches",
baseUri: HttpClient.BaseAddress);
@@ -163,6 +186,8 @@ partial void ProcessCreateBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -173,6 +198,11 @@ partial void ProcessCreateBatchResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -190,6 +220,8 @@ partial void ProcessCreateBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -199,8 +231,7 @@ partial void ProcessCreateBatchResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -209,6 +240,11 @@ partial void ProcessCreateBatchResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -225,14 +261,15 @@ partial void ProcessCreateBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -272,6 +309,8 @@ partial void ProcessCreateBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -292,6 +331,8 @@ partial void ProcessCreateBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -316,9 +357,13 @@ partial void ProcessCreateBatchResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -346,9 +391,13 @@ partial void ProcessCreateBatchResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.ListBatches.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.ListBatches.g.cs
index 8771de87..92d87cde 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.ListBatches.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.ListBatches.g.cs
@@ -58,6 +58,31 @@ partial void ProcessListBatchesResponseContent(
int? limit = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListBatchesAsResponseAsync(
+ after: after,
+ limit: limit,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List your organization's batches.
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListBatchesAsResponseAsync(
+ string? after = default,
+ int? limit = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -88,12 +113,13 @@ partial void ProcessListBatchesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/batches",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("after", after)
- .AddOptionalParameter("limit", limit?.ToString())
+ .AddOptionalParameter("limit", limit?.ToString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -166,6 +192,8 @@ partial void ProcessListBatchesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -176,6 +204,11 @@ partial void ProcessListBatchesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -193,6 +226,8 @@ partial void ProcessListBatchesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -202,8 +237,7 @@ partial void ProcessListBatchesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -212,6 +246,11 @@ partial void ProcessListBatchesResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -228,14 +267,15 @@ partial void ProcessListBatchesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -275,6 +315,8 @@ partial void ProcessListBatchesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -295,6 +337,8 @@ partial void ProcessListBatchesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -319,9 +363,13 @@ partial void ProcessListBatchesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListBatchesResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListBatchesResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -349,9 +397,13 @@ partial void ProcessListBatchesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListBatchesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListBatchesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.RetrieveBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.RetrieveBatch.g.cs
index c16deab6..4f599bb1 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.RetrieveBatch.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.RetrieveBatch.g.cs
@@ -52,6 +52,26 @@ partial void ProcessRetrieveBatchResponseContent(
string batchId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await RetrieveBatchAsResponseAsync(
+ batchId: batchId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Retrieves a batch.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> RetrieveBatchAsResponseAsync(
+ string batchId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -81,6 +101,7 @@ partial void ProcessRetrieveBatchResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/batches/{batchId}",
baseUri: HttpClient.BaseAddress);
@@ -154,6 +175,8 @@ partial void ProcessRetrieveBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -164,6 +187,11 @@ partial void ProcessRetrieveBatchResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -181,6 +209,8 @@ partial void ProcessRetrieveBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -190,8 +220,7 @@ partial void ProcessRetrieveBatchResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -200,6 +229,11 @@ partial void ProcessRetrieveBatchResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -216,14 +250,15 @@ partial void ProcessRetrieveBatchResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -263,6 +298,8 @@ partial void ProcessRetrieveBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -283,6 +320,8 @@ partial void ProcessRetrieveBatchResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -307,9 +346,13 @@ partial void ProcessRetrieveBatchResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Batch.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -337,9 +380,13 @@ partial void ProcessRetrieveBatchResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Batch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.g.cs
index d6a561b7..def6b4db 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.BatchClient.g.cs
@@ -73,10 +73,10 @@ public BatchClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public BatchClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::tryAGI.OpenAI.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForOrganization.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForOrganization.g.cs
index 33b1ea01..435abc66 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForOrganization.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForOrganization.g.cs
@@ -51,6 +51,29 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
///
public async global::System.Threading.Tasks.Task ActivateCertificatesForOrganizationAsync(
+ global::tryAGI.OpenAI.ToggleCertificatesRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ActivateCertificatesForOrganizationAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Activate certificates at the organization level.
+ /// You can atomically and idempotently activate up to 10 certificates at a time.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ActivateCertificatesForOrganizationAsResponseAsync(
+
global::tryAGI.OpenAI.ToggleCertificatesRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -85,6 +108,7 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/organization/certificates/activate",
baseUri: HttpClient.BaseAddress);
@@ -164,6 +188,8 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +200,11 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +222,8 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -200,8 +233,7 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +242,11 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +263,15 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +311,8 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +333,8 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -317,9 +359,13 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OrganizationCertificateActivationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OrganizationCertificateActivationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -347,9 +393,13 @@ partial void ProcessActivateCertificatesForOrganizationResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OrganizationCertificateActivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OrganizationCertificateActivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForProject.g.cs
index 26e57569..a495cf53 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForProject.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ActivateCertificatesForProject.g.cs
@@ -55,6 +55,32 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
public async global::System.Threading.Tasks.Task ActivateCertificatesForProjectAsync(
string projectId,
+ global::tryAGI.OpenAI.ToggleCertificatesRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ActivateCertificatesForProjectAsResponseAsync(
+ projectId: projectId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Activate certificates at the project level.
+ /// You can atomically and idempotently activate up to 10 certificates at a time.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ActivateCertificatesForProjectAsResponseAsync(
+ string projectId,
+
global::tryAGI.OpenAI.ToggleCertificatesRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -90,6 +116,7 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/projects/{projectId}/certificates/activate",
baseUri: HttpClient.BaseAddress);
@@ -170,6 +197,8 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -180,6 +209,11 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -197,6 +231,8 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -206,8 +242,7 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -216,6 +251,11 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -232,14 +272,15 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -279,6 +320,8 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -299,6 +342,8 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -323,9 +368,13 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OrganizationProjectCertificateActivationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OrganizationProjectCertificateActivationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -353,9 +402,13 @@ partial void ProcessActivateCertificatesForProjectResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OrganizationProjectCertificateActivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OrganizationProjectCertificateActivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForOrganization.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForOrganization.g.cs
index d0b343be..2bd63e93 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForOrganization.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForOrganization.g.cs
@@ -51,6 +51,29 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
///
public async global::System.Threading.Tasks.Task DeactivateCertificatesForOrganizationAsync(
+ global::tryAGI.OpenAI.ToggleCertificatesRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeactivateCertificatesForOrganizationAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Deactivate certificates at the organization level.
+ /// You can atomically and idempotently deactivate up to 10 certificates at a time.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeactivateCertificatesForOrganizationAsResponseAsync(
+
global::tryAGI.OpenAI.ToggleCertificatesRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -85,6 +108,7 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/organization/certificates/deactivate",
baseUri: HttpClient.BaseAddress);
@@ -164,6 +188,8 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +200,11 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +222,8 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -200,8 +233,7 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +242,11 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +263,15 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +311,8 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +333,8 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -317,9 +359,13 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OrganizationCertificateDeactivationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OrganizationCertificateDeactivationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -347,9 +393,13 @@ partial void ProcessDeactivateCertificatesForOrganizationResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OrganizationCertificateDeactivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OrganizationCertificateDeactivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForProject.g.cs
index d6179126..444579cd 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForProject.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeactivateCertificatesForProject.g.cs
@@ -55,6 +55,32 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
public async global::System.Threading.Tasks.Task DeactivateCertificatesForProjectAsync(
string projectId,
+ global::tryAGI.OpenAI.ToggleCertificatesRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeactivateCertificatesForProjectAsResponseAsync(
+ projectId: projectId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Deactivate certificates at the project level. You can atomically and
+ /// idempotently deactivate up to 10 certificates at a time.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeactivateCertificatesForProjectAsResponseAsync(
+ string projectId,
+
global::tryAGI.OpenAI.ToggleCertificatesRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -90,6 +116,7 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/projects/{projectId}/certificates/deactivate",
baseUri: HttpClient.BaseAddress);
@@ -170,6 +197,8 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -180,6 +209,11 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -197,6 +231,8 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -206,8 +242,7 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -216,6 +251,11 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -232,14 +272,15 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -279,6 +320,8 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -299,6 +342,8 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -323,9 +368,13 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.OrganizationProjectCertificateDeactivationResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.OrganizationProjectCertificateDeactivationResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -353,9 +402,13 @@ partial void ProcessDeactivateCertificatesForProjectResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.OrganizationProjectCertificateDeactivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.OrganizationProjectCertificateDeactivationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeleteCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeleteCertificate.g.cs
index 5f1b016c..c88983d7 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeleteCertificate.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.DeleteCertificate.g.cs
@@ -53,6 +53,27 @@ partial void ProcessDeleteCertificateResponseContent(
string certificateId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteCertificateAsResponseAsync(
+ certificateId: certificateId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Delete a certificate from the organization.
+ /// The certificate must be inactive for the organization and all projects.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeleteCertificateAsResponseAsync(
+ string certificateId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -82,6 +103,7 @@ partial void ProcessDeleteCertificateResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/certificates/{certificateId}",
baseUri: HttpClient.BaseAddress);
@@ -155,6 +177,8 @@ partial void ProcessDeleteCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -165,6 +189,11 @@ partial void ProcessDeleteCertificateResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -182,6 +211,8 @@ partial void ProcessDeleteCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -191,8 +222,7 @@ partial void ProcessDeleteCertificateResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -201,6 +231,11 @@ partial void ProcessDeleteCertificateResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -217,14 +252,15 @@ partial void ProcessDeleteCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -264,6 +300,8 @@ partial void ProcessDeleteCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -284,6 +322,8 @@ partial void ProcessDeleteCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -308,9 +348,13 @@ partial void ProcessDeleteCertificateResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.DeleteCertificateResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.DeleteCertificateResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -338,9 +382,13 @@ partial void ProcessDeleteCertificateResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.DeleteCertificateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.DeleteCertificateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.GetCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.GetCertificate.g.cs
index c44fb7bb..2b21bd0e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.GetCertificate.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.GetCertificate.g.cs
@@ -57,6 +57,30 @@ partial void ProcessGetCertificateResponseContent(
global::System.Collections.Generic.IList? include = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await GetCertificateAsResponseAsync(
+ certificateId: certificateId,
+ include: include,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Get a certificate that has been uploaded to the organization.
+ /// You can get a certificate regardless of whether it is active or not.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> GetCertificateAsResponseAsync(
+ string certificateId,
+ global::System.Collections.Generic.IList? include = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -87,11 +111,12 @@ partial void ProcessGetCertificateResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/certificates/{certificateId}",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
- .AddOptionalParameter("include", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
+ .AddOptionalParameter("include", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -164,6 +189,8 @@ partial void ProcessGetCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +201,11 @@ partial void ProcessGetCertificateResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +223,8 @@ partial void ProcessGetCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -200,8 +234,7 @@ partial void ProcessGetCertificateResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +243,11 @@ partial void ProcessGetCertificateResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +264,15 @@ partial void ProcessGetCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +312,8 @@ partial void ProcessGetCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +334,8 @@ partial void ProcessGetCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -317,9 +360,13 @@ partial void ProcessGetCertificateResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -347,9 +394,13 @@ partial void ProcessGetCertificateResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListOrganizationCertificates.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListOrganizationCertificates.g.cs
index fbce29cb..7740c63d 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListOrganizationCertificates.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListOrganizationCertificates.g.cs
@@ -64,6 +64,36 @@ partial void ProcessListOrganizationCertificatesResponseContent(
global::tryAGI.OpenAI.ListOrganizationCertificatesOrder? order = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListOrganizationCertificatesAsResponseAsync(
+ limit: limit,
+ after: after,
+ order: order,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List uploaded certificates for this organization.
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ ///
+ /// Default Value: desc
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListOrganizationCertificatesAsResponseAsync(
+ int? limit = default,
+ string? after = default,
+ global::tryAGI.OpenAI.ListOrganizationCertificatesOrder? order = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -95,13 +125,14 @@ partial void ProcessListOrganizationCertificatesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/organization/certificates",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("after", after)
- .AddOptionalParameter("order", order?.ToValueString())
+ .AddOptionalParameter("order", order?.ToValueString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -175,6 +206,8 @@ partial void ProcessListOrganizationCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -185,6 +218,11 @@ partial void ProcessListOrganizationCertificatesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -202,6 +240,8 @@ partial void ProcessListOrganizationCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -211,8 +251,7 @@ partial void ProcessListOrganizationCertificatesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -221,6 +260,11 @@ partial void ProcessListOrganizationCertificatesResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -237,14 +281,15 @@ partial void ProcessListOrganizationCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -284,6 +329,8 @@ partial void ProcessListOrganizationCertificatesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -304,6 +351,8 @@ partial void ProcessListOrganizationCertificatesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -328,9 +377,13 @@ partial void ProcessListOrganizationCertificatesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListCertificatesResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListCertificatesResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -358,9 +411,13 @@ partial void ProcessListOrganizationCertificatesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListCertificatesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListCertificatesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListProjectCertificates.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListProjectCertificates.g.cs
index 0fa3fa77..f1104aac 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListProjectCertificates.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ListProjectCertificates.g.cs
@@ -68,6 +68,39 @@ partial void ProcessListProjectCertificatesResponseContent(
global::tryAGI.OpenAI.ListProjectCertificatesOrder? order = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListProjectCertificatesAsResponseAsync(
+ projectId: projectId,
+ limit: limit,
+ after: after,
+ order: order,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List certificates for this project.
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ ///
+ /// Default Value: desc
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListProjectCertificatesAsResponseAsync(
+ string projectId,
+ int? limit = default,
+ string? after = default,
+ global::tryAGI.OpenAI.ListProjectCertificatesOrder? order = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -100,13 +133,14 @@ partial void ProcessListProjectCertificatesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/projects/{projectId}/certificates",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("after", after)
- .AddOptionalParameter("order", order?.ToValueString())
+ .AddOptionalParameter("order", order?.ToValueString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -181,6 +215,8 @@ partial void ProcessListProjectCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -191,6 +227,11 @@ partial void ProcessListProjectCertificatesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -208,6 +249,8 @@ partial void ProcessListProjectCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -217,8 +260,7 @@ partial void ProcessListProjectCertificatesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -227,6 +269,11 @@ partial void ProcessListProjectCertificatesResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -243,14 +290,15 @@ partial void ProcessListProjectCertificatesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -290,6 +338,8 @@ partial void ProcessListProjectCertificatesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -310,6 +360,8 @@ partial void ProcessListProjectCertificatesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -334,9 +386,13 @@ partial void ProcessListProjectCertificatesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ListProjectCertificatesResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ListProjectCertificatesResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -364,9 +420,13 @@ partial void ProcessListProjectCertificatesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ListProjectCertificatesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ListProjectCertificatesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ModifyCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ModifyCertificate.g.cs
index b3fdf919..91b01383 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ModifyCertificate.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.ModifyCertificate.g.cs
@@ -54,6 +54,31 @@ partial void ProcessModifyCertificateResponseContent(
public async global::System.Threading.Tasks.Task ModifyCertificateAsync(
string certificateId,
+ global::tryAGI.OpenAI.ModifyCertificateRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ModifyCertificateAsResponseAsync(
+ certificateId: certificateId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Modify a certificate. Note that only the name can be modified.
+ ///
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ModifyCertificateAsResponseAsync(
+ string certificateId,
+
global::tryAGI.OpenAI.ModifyCertificateRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -89,6 +114,7 @@ partial void ProcessModifyCertificateResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/organization/certificates/{certificateId}",
baseUri: HttpClient.BaseAddress);
@@ -169,6 +195,8 @@ partial void ProcessModifyCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -179,6 +207,11 @@ partial void ProcessModifyCertificateResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -196,6 +229,8 @@ partial void ProcessModifyCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -205,8 +240,7 @@ partial void ProcessModifyCertificateResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -215,6 +249,11 @@ partial void ProcessModifyCertificateResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -231,14 +270,15 @@ partial void ProcessModifyCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -278,6 +318,8 @@ partial void ProcessModifyCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -298,6 +340,8 @@ partial void ProcessModifyCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -322,9 +366,13 @@ partial void ProcessModifyCertificateResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -352,9 +400,13 @@ partial void ProcessModifyCertificateResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.UploadCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.UploadCertificate.g.cs
index 0aa75bc0..799a98ae 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.UploadCertificate.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.UploadCertificate.g.cs
@@ -51,6 +51,29 @@ partial void ProcessUploadCertificateResponseContent(
///
public async global::System.Threading.Tasks.Task UploadCertificateAsync(
+ global::tryAGI.OpenAI.UploadCertificateRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await UploadCertificateAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Upload a certificate to the organization. This does **not** automatically activate the certificate.
+ /// Organizations can upload up to 50 certificates.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> UploadCertificateAsResponseAsync(
+
global::tryAGI.OpenAI.UploadCertificateRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -85,6 +108,7 @@ partial void ProcessUploadCertificateResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/organization/certificates",
baseUri: HttpClient.BaseAddress);
@@ -164,6 +188,8 @@ partial void ProcessUploadCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -174,6 +200,11 @@ partial void ProcessUploadCertificateResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -191,6 +222,8 @@ partial void ProcessUploadCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -200,8 +233,7 @@ partial void ProcessUploadCertificateResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -210,6 +242,11 @@ partial void ProcessUploadCertificateResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -226,14 +263,15 @@ partial void ProcessUploadCertificateResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -273,6 +311,8 @@ partial void ProcessUploadCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -293,6 +333,8 @@ partial void ProcessUploadCertificateResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -317,9 +359,13 @@ partial void ProcessUploadCertificateResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.Certificate.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -347,9 +393,13 @@ partial void ProcessUploadCertificateResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.Certificate.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.g.cs
index c53008f1..94f2bf5e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CertificatesClient.g.cs
@@ -72,10 +72,10 @@ public CertificatesClient(
/// Client-wide request defaults such as headers, query parameters, retries, and timeout.
/// Dispose the HttpClient when the instance is disposed. True by default.
public CertificatesClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- global::tryAGI.OpenAI.AutoSDKClientOptions? options = null,
+ global::System.Net.Http.HttpClient? httpClient,
+ global::System.Uri? baseUri,
+ global::System.Collections.Generic.List? authorizations,
+ global::tryAGI.OpenAI.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletion.g.cs
index c7e4c435..d081d0eb 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletion.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletion.g.cs
@@ -63,6 +63,41 @@ partial void ProcessCreateChatCompletionResponseContent(
///
public async global::System.Threading.Tasks.Task CreateChatCompletionAsync(
+ global::tryAGI.OpenAI.CreateChatCompletionRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await CreateChatCompletionAsResponseAsync(
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// **Starting a new project?** We recommend trying [Responses](/docs/api-reference/responses)
+ /// to take advantage of the latest OpenAI platform features. Compare
+ /// [Chat Completions with Responses](/docs/guides/responses-vs-chat-completions?api-mode=responses).
+ /// ---
+ /// Creates a model response for the given chat conversation. Learn more in the
+ /// [text generation](/docs/guides/text-generation), [vision](/docs/guides/vision),
+ /// and [audio](/docs/guides/audio) guides.
+ /// Parameter support can differ depending on the model used to generate the
+ /// response, particularly for newer reasoning models. Parameters that are only
+ /// supported for reasoning models are noted below. For the current state of
+ /// unsupported parameters in reasoning models,
+ /// [refer to the reasoning guide](/docs/guides/reasoning).
+ /// Returns a chat completion object, or a streamed sequence of chat completion
+ /// chunk objects if the request is streamed.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> CreateChatCompletionAsResponseAsync(
+
global::tryAGI.OpenAI.CreateChatCompletionRequest request,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -95,6 +130,7 @@ partial void ProcessCreateChatCompletionResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/chat/completions",
baseUri: HttpClient.BaseAddress);
@@ -174,6 +210,8 @@ partial void ProcessCreateChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -184,6 +222,11 @@ partial void ProcessCreateChatCompletionResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -201,6 +244,8 @@ partial void ProcessCreateChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -210,8 +255,7 @@ partial void ProcessCreateChatCompletionResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -220,6 +264,11 @@ partial void ProcessCreateChatCompletionResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -236,14 +285,15 @@ partial void ProcessCreateChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -283,6 +333,8 @@ partial void ProcessCreateChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -303,6 +355,8 @@ partial void ProcessCreateChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -327,9 +381,13 @@ partial void ProcessCreateChatCompletionResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -357,9 +415,13 @@ partial void ProcessCreateChatCompletionResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletionAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletionAsStream.g.cs
index 7541f694..bc9d3512 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletionAsStream.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.CreateChatCompletionAsStream.g.cs
@@ -90,6 +90,7 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/chat/completions",
baseUri: HttpClient.BaseAddress);
@@ -169,6 +170,8 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -179,6 +182,11 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -196,6 +204,8 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -205,8 +215,7 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -215,6 +224,11 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -231,14 +245,15 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -278,6 +293,8 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -298,6 +315,8 @@ partial void ProcessCreateChatCompletionAsStreamResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.DeleteChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.DeleteChatCompletion.g.cs
index 7a0abb19..eeb098cd 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.DeleteChatCompletion.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.DeleteChatCompletion.g.cs
@@ -53,6 +53,27 @@ partial void ProcessDeleteChatCompletionResponseContent(
string completionId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await DeleteChatCompletionAsResponseAsync(
+ completionId: completionId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Delete a stored chat completion. Only Chat Completions that have been
+ /// created with the `store` parameter set to `true` can be deleted.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> DeleteChatCompletionAsResponseAsync(
+ string completionId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -82,6 +103,7 @@ partial void ProcessDeleteChatCompletionResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/chat/completions/{completionId}",
baseUri: HttpClient.BaseAddress);
@@ -155,6 +177,8 @@ partial void ProcessDeleteChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -165,6 +189,11 @@ partial void ProcessDeleteChatCompletionResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -182,6 +211,8 @@ partial void ProcessDeleteChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -191,8 +222,7 @@ partial void ProcessDeleteChatCompletionResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -201,6 +231,11 @@ partial void ProcessDeleteChatCompletionResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -217,14 +252,15 @@ partial void ProcessDeleteChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -264,6 +300,8 @@ partial void ProcessDeleteChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -284,6 +322,8 @@ partial void ProcessDeleteChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -308,9 +348,13 @@ partial void ProcessDeleteChatCompletionResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ChatCompletionDeleted.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ChatCompletionDeleted.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -338,9 +382,13 @@ partial void ProcessDeleteChatCompletionResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ChatCompletionDeleted.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ChatCompletionDeleted.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatCompletion.g.cs
index 774dd9dc..7bea553e 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatCompletion.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatCompletion.g.cs
@@ -53,6 +53,27 @@ partial void ProcessGetChatCompletionResponseContent(
string completionId,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await GetChatCompletionAsResponseAsync(
+ completionId: completionId,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Get a stored chat completion. Only Chat Completions that have been created
+ /// with the `store` parameter set to `true` will be returned.
+ ///
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> GetChatCompletionAsResponseAsync(
+ string completionId,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -82,6 +103,7 @@ partial void ProcessGetChatCompletionResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/chat/completions/{completionId}",
baseUri: HttpClient.BaseAddress);
@@ -155,6 +177,8 @@ partial void ProcessGetChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -165,6 +189,11 @@ partial void ProcessGetChatCompletionResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -182,6 +211,8 @@ partial void ProcessGetChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -191,8 +222,7 @@ partial void ProcessGetChatCompletionResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -201,6 +231,11 @@ partial void ProcessGetChatCompletionResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -217,14 +252,15 @@ partial void ProcessGetChatCompletionResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -264,6 +300,8 @@ partial void ProcessGetChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -284,6 +322,8 @@ partial void ProcessGetChatCompletionResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -308,9 +348,13 @@ partial void ProcessGetChatCompletionResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -338,9 +382,13 @@ partial void ProcessGetChatCompletionResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.CreateChatCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatMessages.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatMessages.g.cs
index b8ed568b..3f9c7ad7 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatMessages.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.GetChatMessages.g.cs
@@ -70,6 +70,41 @@ partial void ProcessGetChatMessagesResponseContent(
global::tryAGI.OpenAI.GetChatCompletionMessagesOrder? order = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await GetChatMessagesAsResponseAsync(
+ completionId: completionId,
+ after: after,
+ limit: limit,
+ order: order,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// Get the messages in a stored chat completion. Only Chat Completions that
+ /// have been created with the `store` parameter set to `true` will be
+ /// returned.
+ ///
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ /// Default Value: asc
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> GetChatMessagesAsResponseAsync(
+ string completionId,
+ string? after = default,
+ int? limit = default,
+ global::tryAGI.OpenAI.GetChatCompletionMessagesOrder? order = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -102,13 +137,14 @@ partial void ProcessGetChatMessagesResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: $"/chat/completions/{completionId}/messages",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("after", after)
.AddOptionalParameter("limit", limit?.ToString())
- .AddOptionalParameter("order", order?.ToValueString())
+ .AddOptionalParameter("order", order?.ToValueString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -183,6 +219,8 @@ partial void ProcessGetChatMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -193,6 +231,11 @@ partial void ProcessGetChatMessagesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -210,6 +253,8 @@ partial void ProcessGetChatMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -219,8 +264,7 @@ partial void ProcessGetChatMessagesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -229,6 +273,11 @@ partial void ProcessGetChatMessagesResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -245,14 +294,15 @@ partial void ProcessGetChatMessagesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -292,6 +342,8 @@ partial void ProcessGetChatMessagesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -312,6 +364,8 @@ partial void ProcessGetChatMessagesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -336,9 +390,13 @@ partial void ProcessGetChatMessagesResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ChatCompletionMessageList.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ChatCompletionMessageList.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -366,9 +424,13 @@ partial void ProcessGetChatMessagesResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ChatCompletionMessageList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ChatCompletionMessageList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.ListChatCompletions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.ListChatCompletions.g.cs
index 733e3ce6..10ed43da 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.ListChatCompletions.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.ListChatCompletions.g.cs
@@ -73,6 +73,43 @@ partial void ProcessListChatCompletionsResponseContent(
global::tryAGI.OpenAI.ListChatCompletionsOrder? order = default,
global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await ListChatCompletionsAsResponseAsync(
+ model: model,
+ metadata: metadata,
+ after: after,
+ limit: limit,
+ order: order,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///
+ /// List stored Chat Completions. Only Chat Completions that have been stored
+ /// with the `store` parameter set to `true` will be returned.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Default Value: 20
+ ///
+ ///
+ /// Default Value: asc
+ ///
+ /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
+ /// The token to cancel the operation with
+ ///
+ public async global::System.Threading.Tasks.Task> ListChatCompletionsAsResponseAsync(
+ string? model = default,
+ global::System.Collections.Generic.Dictionary? metadata = default,
+ string? after = default,
+ int? limit = default,
+ global::tryAGI.OpenAI.ListChatCompletionsOrder? order = default,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
@@ -106,15 +143,16 @@ partial void ProcessListChatCompletionsResponseContent(
global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{
+
var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder(
path: "/chat/completions",
- baseUri: HttpClient.BaseAddress);
+ baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("model", model)
.AddOptionalParameter("metadata", metadata?.ToString())
.AddOptionalParameter("after", after)
.AddOptionalParameter("limit", limit?.ToString())
- .AddOptionalParameter("order", order?.ToValueString())
+ .AddOptionalParameter("order", order?.ToValueString())
;
var __path = __pathBuilder.ToString();
__path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters(
@@ -190,6 +228,8 @@ partial void ProcessListChatCompletionsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
@@ -200,6 +240,11 @@ partial void ProcessListChatCompletionsResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: null,
+ attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
@@ -217,6 +262,8 @@ partial void ProcessListChatCompletionsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
+ retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
+ retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
@@ -226,8 +273,7 @@ partial void ProcessListChatCompletionsResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -236,6 +282,11 @@ partial void ProcessListChatCompletionsResponseContent(
__attempt < __maxAttempts &&
global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
+ var __retryDelay = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ response: __response,
+ attempt: __attempt);
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext(
@@ -252,14 +303,15 @@ partial void ProcessListChatCompletionsResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
+ retryDelay: __retryDelay,
+ retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- clientOptions: Options,
- requestOptions: requestOptions,
+ retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
@@ -299,6 +351,8 @@ partial void ProcessListChatCompletionsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
@@ -319,6 +373,8 @@ partial void ProcessListChatCompletionsResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
+ retryDelay: null,
+ retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
@@ -343,9 +399,13 @@ partial void ProcessListChatCompletionsResponseContent(
{
__response.EnsureSuccessStatusCode();
- return
- global::tryAGI.OpenAI.ChatCompletionList.FromJson(__content, JsonSerializerContext) ??
+ var __value = global::tryAGI.OpenAI.ChatCompletionList.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
@@ -373,9 +433,13 @@ partial void ProcessListChatCompletionsResponseContent(
#endif
).ConfigureAwait(false);
- return
- await global::tryAGI.OpenAI.ChatCompletionList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ var __value = await global::tryAGI.OpenAI.ChatCompletionList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
+ return new global::tryAGI.OpenAI.AutoSDKHttpResponse(
+ statusCode: __response.StatusCode,
+ headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response),
+ requestUri: __response.RequestMessage?.RequestUri,
+ body: __value);
}
catch (global::System.Exception __ex)
{
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.UpdateChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.UpdateChatCompletion.g.cs
index 2023f66e..0f5b5db1 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.UpdateChatCompletion.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.UpdateChatCompletion.g.cs
@@ -56,6 +56,33 @@ partial void ProcessUpdateChatCompletionResponseContent(
public async global::System.Threading.Tasks.Task UpdateChatCompletionAsync(
string completionId,
+ global::tryAGI.OpenAI.UpdateChatCompletionRequest request,
+ global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default,
+ global::System.Threading.CancellationToken cancellationToken = default)
+ {
+ var __response = await UpdateChatCompletionAsResponseAsync(
+ completionId: completionId,
+
+ request: request,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken
+ ).ConfigureAwait(false);
+
+ return __response.Body;
+ }
+ ///