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; + } + /// + /// Modify a stored chat completion. Only Chat Completions that have been
+ /// created with the `store` parameter set to `true` can be modified. Currently,
+ /// the only supported modification is to update the `metadata` field. + ///
+ /// + /// + /// 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> UpdateChatCompletionAsResponseAsync( + string completionId, + global::tryAGI.OpenAI.UpdateChatCompletionRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -91,6 +118,7 @@ partial void ProcessUpdateChatCompletionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/chat/completions/{completionId}", baseUri: HttpClient.BaseAddress); @@ -171,6 +199,8 @@ partial void ProcessUpdateChatCompletionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +211,11 @@ partial void ProcessUpdateChatCompletionResponseContent( } 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 ProcessUpdateChatCompletionResponseContent( 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 ProcessUpdateChatCompletionResponseContent( __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 ProcessUpdateChatCompletionResponseContent( __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 ProcessUpdateChatCompletionResponseContent( 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 ProcessUpdateChatCompletionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +344,8 @@ partial void ProcessUpdateChatCompletionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +370,13 @@ partial void ProcessUpdateChatCompletionResponseContent( { __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) { @@ -354,9 +404,13 @@ partial void ProcessUpdateChatCompletionResponseContent( #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.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.g.cs index d719b393..49a7ada6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ChatClient.g.cs @@ -73,10 +73,10 @@ public ChatClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ChatClient( - 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.CompletionsClient.CreateCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.CreateCompletion.g.cs index 07247761..a3274694 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.CreateCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.CreateCompletion.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateCompletionResponseContent( /// public async global::System.Threading.Tasks.Task CreateCompletionAsync( + global::tryAGI.OpenAI.CreateCompletionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateCompletionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a completion for the provided prompt and parameters.
+ /// Returns a completion object, or a sequence of completion 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> CreateCompletionAsResponseAsync( + global::tryAGI.OpenAI.CreateCompletionRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -81,10 +104,11 @@ partial void ProcessCreateCompletionResponseContent( 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: "/completions", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateCompletionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateCompletionResponseContent( } 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 ProcessCreateCompletionResponseContent( 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 ProcessCreateCompletionResponseContent( __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 ProcessCreateCompletionResponseContent( __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 ProcessCreateCompletionResponseContent( 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 ProcessCreateCompletionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateCompletionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessCreateCompletionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.CreateCompletionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.CreateCompletionResponse.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 ProcessCreateCompletionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.CreateCompletionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.CreateCompletionResponse.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.CompletionsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.g.cs index 79b421e8..8f89b537 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.CompletionsClient.g.cs @@ -73,10 +73,10 @@ public CompletionsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public CompletionsClient( - 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.ConversationsClient.CreateAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateAConversation.g.cs index 07703ac8..8112deeb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateAConversation.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateAConversationResponseContent( /// public async global::System.Threading.Tasks.Task CreateAConversationAsync( + global::tryAGI.OpenAI.CreateConversationBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateAConversationAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a conversation. + /// + /// + /// 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> CreateAConversationAsResponseAsync( + global::tryAGI.OpenAI.CreateConversationBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateAConversationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/conversations", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateAConversationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateAConversationResponseContent( } 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 ProcessCreateAConversationResponseContent( 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 ProcessCreateAConversationResponseContent( __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 ProcessCreateAConversationResponseContent( __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 ProcessCreateAConversationResponseContent( 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 ProcessCreateAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateAConversationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationResource.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 ProcessCreateAConversationResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationResource.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.ConversationsClient.CreateItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateItems.g.cs index 772003af..04858d56 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.CreateItems.g.cs @@ -59,6 +59,36 @@ partial void ProcessCreateItemsResponseContent( public async global::System.Threading.Tasks.Task CreateItemsAsync( string conversationId, + global::tryAGI.OpenAI.CreateConversationItemsRequest request, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateItemsAsResponseAsync( + conversationId: conversationId, + + request: request, + include: include, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create items in a conversation with the given ID. + /// + /// + /// Example: conv_123 + /// + /// + /// + /// 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> CreateItemsAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.CreateConversationItemsRequest request, global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, @@ -96,11 +126,12 @@ partial void ProcessCreateItemsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}/items", - 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( @@ -180,6 +211,8 @@ partial void ProcessCreateItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -190,6 +223,11 @@ partial void ProcessCreateItemsResponseContent( } 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, @@ -207,6 +245,8 @@ partial void ProcessCreateItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -216,8 +256,7 @@ partial void ProcessCreateItemsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -226,6 +265,11 @@ partial void ProcessCreateItemsResponseContent( __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( @@ -242,14 +286,15 @@ partial void ProcessCreateItemsResponseContent( 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; } @@ -289,6 +334,8 @@ partial void ProcessCreateItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -309,6 +356,8 @@ partial void ProcessCreateItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -333,9 +382,13 @@ partial void ProcessCreateItemsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationItemList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationItemList.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) { @@ -363,9 +416,13 @@ partial void ProcessCreateItemsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationItemList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationItemList.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.ConversationsClient.DeleteAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAConversation.g.cs index 3707db2f..fe8f0834 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAConversation.g.cs @@ -54,6 +54,28 @@ partial void ProcessDeleteAConversationResponseContent( string conversationId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAConversationAsResponseAsync( + conversationId: conversationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a conversation. Items in the conversation will not be deleted. + /// + /// + /// Example: conv_123 + /// + /// 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> DeleteAConversationAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessDeleteAConversationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteAConversationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteAConversationResponseContent( } 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 ProcessDeleteAConversationResponseContent( 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 ProcessDeleteAConversationResponseContent( __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 ProcessDeleteAConversationResponseContent( __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 ProcessDeleteAConversationResponseContent( 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 ProcessDeleteAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessDeleteAConversationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedConversationResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedConversationResource.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 ProcessDeleteAConversationResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedConversationResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedConversationResource.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.ConversationsClient.DeleteAnItem.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAnItem.g.cs index 2f793dff..2405fc6b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAnItem.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.DeleteAnItem.g.cs @@ -60,6 +60,33 @@ partial void ProcessDeleteAnItemResponseContent( string itemId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAnItemAsResponseAsync( + conversationId: conversationId, + itemId: itemId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an item from a conversation with the given IDs. + /// + /// + /// Example: conv_123 + /// + /// + /// Example: msg_abc + /// + /// 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> DeleteAnItemAsResponseAsync( + string conversationId, + string itemId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessDeleteAnItemResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}/items/{itemId}", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessDeleteAnItemResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessDeleteAnItemResponseContent( } 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 +226,8 @@ partial void ProcessDeleteAnItemResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessDeleteAnItemResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessDeleteAnItemResponseContent( __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 +267,15 @@ partial void ProcessDeleteAnItemResponseContent( 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 +315,8 @@ partial void ProcessDeleteAnItemResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessDeleteAnItemResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessDeleteAnItemResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationResource.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 +397,13 @@ partial void ProcessDeleteAnItemResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationResource.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.ConversationsClient.ListItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.ListItems.g.cs index 42155176..a52a8f86 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.ListItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.ListItems.g.cs @@ -72,6 +72,42 @@ partial void ProcessListItemsResponseContent( global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListItemsAsResponseAsync( + conversationId: conversationId, + limit: limit, + order: order, + after: after, + include: include, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List all items for a conversation with the given ID. + /// + /// + /// Example: conv_123 + /// + /// + /// 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> ListItemsAsResponseAsync( + string conversationId, + int? limit = default, + global::tryAGI.OpenAI.ListConversationItemsOrder? order = default, + string? after = default, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -105,14 +141,15 @@ partial void ProcessListItemsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}/items", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) - .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( @@ -188,6 +225,8 @@ partial void ProcessListItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -198,6 +237,11 @@ partial void ProcessListItemsResponseContent( } 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 ProcessListItemsResponseContent( 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 ProcessListItemsResponseContent( __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 ProcessListItemsResponseContent( __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 ProcessListItemsResponseContent( 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 ProcessListItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -317,6 +370,8 @@ partial void ProcessListItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -341,9 +396,13 @@ partial void ProcessListItemsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationItemList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationItemList.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 ProcessListItemsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationItemList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationItemList.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.ConversationsClient.RetrieveAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAConversation.g.cs index be351537..52ee63a5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAConversation.g.cs @@ -54,6 +54,28 @@ partial void ProcessRetrieveAConversationResponseContent( string conversationId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveAConversationAsResponseAsync( + conversationId: conversationId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a conversation + /// + /// + /// Example: conv_123 + /// + /// 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> RetrieveAConversationAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessRetrieveAConversationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessRetrieveAConversationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessRetrieveAConversationResponseContent( } 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 ProcessRetrieveAConversationResponseContent( 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 ProcessRetrieveAConversationResponseContent( __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 ProcessRetrieveAConversationResponseContent( __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 ProcessRetrieveAConversationResponseContent( 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 ProcessRetrieveAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessRetrieveAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessRetrieveAConversationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationResource.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 ProcessRetrieveAConversationResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationResource.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.ConversationsClient.RetrieveAnItem.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAnItem.g.cs index cd802f4a..c29ca840 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAnItem.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.RetrieveAnItem.g.cs @@ -64,6 +64,36 @@ partial void ProcessRetrieveAnItemResponseContent( global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveAnItemAsResponseAsync( + conversationId: conversationId, + itemId: itemId, + include: include, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a single item from a conversation with the given IDs. + /// + /// + /// Example: conv_123 + /// + /// + /// Example: msg_abc + /// + /// + /// 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> RetrieveAnItemAsResponseAsync( + string conversationId, + string itemId, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,11 +125,12 @@ partial void ProcessRetrieveAnItemResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}/items/{itemId}", - 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( @@ -173,6 +204,8 @@ partial void ProcessRetrieveAnItemResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +216,11 @@ partial void ProcessRetrieveAnItemResponseContent( } 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, @@ -200,6 +238,8 @@ partial void ProcessRetrieveAnItemResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +249,7 @@ partial void ProcessRetrieveAnItemResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +258,11 @@ partial void ProcessRetrieveAnItemResponseContent( __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( @@ -235,14 +279,15 @@ partial void ProcessRetrieveAnItemResponseContent( 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; } @@ -282,6 +327,8 @@ partial void ProcessRetrieveAnItemResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +349,8 @@ partial void ProcessRetrieveAnItemResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +375,13 @@ partial void ProcessRetrieveAnItemResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationItem.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationItem.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) { @@ -356,9 +409,13 @@ partial void ProcessRetrieveAnItemResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationItem.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationItem.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.ConversationsClient.UpdateAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.UpdateAConversation.g.cs index 2fc647a6..c85fa17b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.UpdateAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.UpdateAConversation.g.cs @@ -56,6 +56,33 @@ partial void ProcessUpdateAConversationResponseContent( public async global::System.Threading.Tasks.Task UpdateAConversationAsync( string conversationId, + global::tryAGI.OpenAI.UpdateConversationBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateAConversationAsResponseAsync( + conversationId: conversationId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update a conversation + /// + /// + /// Example: conv_123 + /// + /// + /// 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> UpdateAConversationAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.UpdateConversationBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -91,6 +118,7 @@ partial void ProcessUpdateAConversationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/conversations/{conversationId}", baseUri: HttpClient.BaseAddress); @@ -171,6 +199,8 @@ partial void ProcessUpdateAConversationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +211,11 @@ partial void ProcessUpdateAConversationResponseContent( } 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 ProcessUpdateAConversationResponseContent( 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 ProcessUpdateAConversationResponseContent( __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 ProcessUpdateAConversationResponseContent( __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 ProcessUpdateAConversationResponseContent( 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 ProcessUpdateAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +344,8 @@ partial void ProcessUpdateAConversationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +370,13 @@ partial void ProcessUpdateAConversationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ConversationResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ConversationResource.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 ProcessUpdateAConversationResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ConversationResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ConversationResource.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.ConversationsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.g.cs index facab2cd..a922d935 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ConversationsClient.g.cs @@ -73,10 +73,10 @@ public ConversationsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ConversationsClient( - 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.EmbeddingsClient.CreateEmbeddings.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.CreateEmbeddings.g.cs index ce4e1dbf..055fba71 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.CreateEmbeddings.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.CreateEmbeddings.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateEmbeddingsResponseContent( /// public async global::System.Threading.Tasks.Task CreateEmbeddingsAsync( + global::tryAGI.OpenAI.CreateEmbeddingRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateEmbeddingsAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates an embedding vector representing the input text. + /// + /// + /// 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> CreateEmbeddingsAsResponseAsync( + global::tryAGI.OpenAI.CreateEmbeddingRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateEmbeddingsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/embeddings", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateEmbeddingsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateEmbeddingsResponseContent( } 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 ProcessCreateEmbeddingsResponseContent( 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 ProcessCreateEmbeddingsResponseContent( __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 ProcessCreateEmbeddingsResponseContent( __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 ProcessCreateEmbeddingsResponseContent( 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 ProcessCreateEmbeddingsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateEmbeddingsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateEmbeddingsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.CreateEmbeddingResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.CreateEmbeddingResponse.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 ProcessCreateEmbeddingsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.CreateEmbeddingResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.CreateEmbeddingResponse.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.EmbeddingsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.g.cs index 63ebde2c..d2cf1a46 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EmbeddingsClient.g.cs @@ -73,10 +73,10 @@ public EmbeddingsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public EmbeddingsClient( - 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.EvalsClient.CancelEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CancelEvalRun.g.cs index e449b09e..37f446e7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CancelEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CancelEvalRun.g.cs @@ -56,6 +56,29 @@ partial void ProcessCancelEvalRunResponseContent( string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelEvalRunAsResponseAsync( + evalId: evalId, + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancel an ongoing evaluation 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> CancelEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessCancelEvalRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs/{runId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessCancelEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessCancelEvalRunResponseContent( } 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 ProcessCancelEvalRunResponseContent( 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 ProcessCancelEvalRunResponseContent( __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 ProcessCancelEvalRunResponseContent( __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 ProcessCancelEvalRunResponseContent( 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 ProcessCancelEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessCancelEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessCancelEvalRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRun.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRun.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 ProcessCancelEvalRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRun.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRun.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.EvalsClient.CreateEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEval.g.cs index 35001712..77370a5f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEval.g.cs @@ -54,6 +54,30 @@ partial void ProcessCreateEvalResponseContent( /// public async global::System.Threading.Tasks.Task CreateEvalAsync( + global::tryAGI.OpenAI.CreateEvalRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateEvalAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create the structure of an evaluation that can be used to test a model's performance.
+ /// An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.
+ /// For more information, see the [Evals guide](/docs/guides/evals). + ///
+ /// + /// 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> CreateEvalAsResponseAsync( + global::tryAGI.OpenAI.CreateEvalRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -88,6 +112,7 @@ partial void ProcessCreateEvalResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/evals", baseUri: HttpClient.BaseAddress); @@ -167,6 +192,8 @@ partial void ProcessCreateEvalResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -177,6 +204,11 @@ partial void ProcessCreateEvalResponseContent( } 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, @@ -194,6 +226,8 @@ partial void ProcessCreateEvalResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -203,8 +237,7 @@ partial void ProcessCreateEvalResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -213,6 +246,11 @@ partial void ProcessCreateEvalResponseContent( __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( @@ -229,14 +267,15 @@ partial void ProcessCreateEvalResponseContent( 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; } @@ -276,6 +315,8 @@ partial void ProcessCreateEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -296,6 +337,8 @@ partial void ProcessCreateEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -320,9 +363,13 @@ partial void ProcessCreateEvalResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Eval.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Eval.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) { @@ -350,9 +397,13 @@ partial void ProcessCreateEvalResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Eval.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Eval.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.EvalsClient.CreateEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEvalRun.g.cs index da856b2a..7f88e108 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.CreateEvalRun.g.cs @@ -54,6 +54,31 @@ partial void ProcessCreateEvalRunResponseContent( public async global::System.Threading.Tasks.Task CreateEvalRunAsync( string evalId, + global::tryAGI.OpenAI.CreateEvalRunRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateEvalRunAsResponseAsync( + evalId: evalId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. + /// + /// + /// + /// 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> CreateEvalRunAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.CreateEvalRunRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessCreateEvalRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessCreateEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessCreateEvalRunResponseContent( } 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 ProcessCreateEvalRunResponseContent( 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 ProcessCreateEvalRunResponseContent( __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 ProcessCreateEvalRunResponseContent( __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 ProcessCreateEvalRunResponseContent( 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 ProcessCreateEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessCreateEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Bad request (for example, missing eval object) @@ -360,9 +404,13 @@ partial void ProcessCreateEvalRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRun.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRun.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) { @@ -390,9 +438,13 @@ partial void ProcessCreateEvalRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRun.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRun.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.EvalsClient.DeleteAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteAnEval.g.cs index 96ac6d8b..08eacc3b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteAnEval.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteAnEvalResponseContent( string evalId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAnEvalAsResponseAsync( + evalId: evalId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an evaluation. + /// + /// + /// 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> DeleteAnEvalAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteAnEvalResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteAnEvalResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteAnEvalResponseContent( } 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 ProcessDeleteAnEvalResponseContent( 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 ProcessDeleteAnEvalResponseContent( __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 ProcessDeleteAnEvalResponseContent( __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 ProcessDeleteAnEvalResponseContent( 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 ProcessDeleteAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Evaluation not found. @@ -345,9 +384,13 @@ partial void ProcessDeleteAnEvalResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteEvalResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteEvalResponse.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) { @@ -375,9 +418,13 @@ partial void ProcessDeleteAnEvalResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteEvalResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteEvalResponse.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.EvalsClient.DeleteEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteEvalRun.g.cs index 1d44cf87..f349df82 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.DeleteEvalRun.g.cs @@ -56,6 +56,29 @@ partial void ProcessDeleteEvalRunResponseContent( string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteEvalRunAsResponseAsync( + evalId: evalId, + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an eval 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> DeleteEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessDeleteEvalRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs/{runId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessDeleteEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessDeleteEvalRunResponseContent( } 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 ProcessDeleteEvalRunResponseContent( 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 ProcessDeleteEvalRunResponseContent( __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 ProcessDeleteEvalRunResponseContent( __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 ProcessDeleteEvalRunResponseContent( 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 ProcessDeleteEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessDeleteEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Run not found @@ -351,9 +393,13 @@ partial void ProcessDeleteEvalRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteEvalRunResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteEvalRunResponse.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) { @@ -381,9 +427,13 @@ partial void ProcessDeleteEvalRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteEvalRunResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteEvalRunResponse.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.EvalsClient.GetAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEval.g.cs index d3bffae5..4625d40d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEval.g.cs @@ -52,6 +52,26 @@ partial void ProcessGetAnEvalResponseContent( string evalId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAnEvalAsResponseAsync( + evalId: evalId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get an evaluation by ID. + /// + /// + /// 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> GetAnEvalAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessGetAnEvalResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessGetAnEvalResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessGetAnEvalResponseContent( } 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 ProcessGetAnEvalResponseContent( 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 ProcessGetAnEvalResponseContent( __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 ProcessGetAnEvalResponseContent( __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 ProcessGetAnEvalResponseContent( 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 ProcessGetAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessGetAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessGetAnEvalResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Eval.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Eval.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 ProcessGetAnEvalResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Eval.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Eval.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.EvalsClient.GetAnEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEvalRun.g.cs index 20608bfc..18660b9e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnEvalRun.g.cs @@ -56,6 +56,29 @@ partial void ProcessGetAnEvalRunResponseContent( string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAnEvalRunAsResponseAsync( + evalId: evalId, + runId: runId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get an evaluation run by ID. + /// + /// + /// + /// 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> GetAnEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessGetAnEvalRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs/{runId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessGetAnEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessGetAnEvalRunResponseContent( } 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 ProcessGetAnEvalRunResponseContent( 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 ProcessGetAnEvalRunResponseContent( __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 ProcessGetAnEvalRunResponseContent( __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 ProcessGetAnEvalRunResponseContent( 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 ProcessGetAnEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessGetAnEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessGetAnEvalRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRun.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRun.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 ProcessGetAnEvalRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRun.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRun.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.EvalsClient.GetAnOutputItemOfAnEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnOutputItemOfAnEvalRun.g.cs index b9c6444c..55e23e62 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnOutputItemOfAnEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetAnOutputItemOfAnEvalRun.g.cs @@ -60,6 +60,32 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( string outputItemId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAnOutputItemOfAnEvalRunAsResponseAsync( + evalId: evalId, + runId: runId, + outputItemId: outputItemId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get an evaluation run output item by ID. + /// + /// + /// + /// + /// 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> GetAnOutputItemOfAnEvalRunAsResponseAsync( + string evalId, + string runId, + string outputItemId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,6 +117,7 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs/{runId}/output_items/{outputItemId}", baseUri: HttpClient.BaseAddress); @@ -166,6 +193,8 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +205,11 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( } 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 +227,8 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +238,7 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +247,11 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( __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 +268,15 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( 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 +316,8 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +338,8 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -319,9 +364,13 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRunOutputItem.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRunOutputItem.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 +398,13 @@ partial void ProcessGetAnOutputItemOfAnEvalRunResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRunOutputItem.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRunOutputItem.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.EvalsClient.GetEvalRunOutputItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRunOutputItems.g.cs index dec0acc1..21202793 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRunOutputItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRunOutputItems.g.cs @@ -76,6 +76,45 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( global::tryAGI.OpenAI.GetEvalRunOutputItemsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetEvalRunOutputItemsAsResponseAsync( + evalId: evalId, + runId: runId, + after: after, + limit: limit, + status: status, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a list of output items for an evaluation run. + /// + /// + /// + /// + /// + /// 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> GetEvalRunOutputItemsAsResponseAsync( + string evalId, + string runId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.GetEvalRunOutputItemsStatus? status = default, + global::tryAGI.OpenAI.GetEvalRunOutputItemsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -110,14 +149,15 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs/{runId}/output_items", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("status", status?.ToValueString()) - .AddOptionalParameter("order", order?.ToValueString()) + .AddOptionalParameter("order", order?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -194,6 +234,8 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -204,6 +246,11 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( } 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, @@ -221,6 +268,8 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -230,8 +279,7 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -240,6 +288,11 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( __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( @@ -256,14 +309,15 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( 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; } @@ -303,6 +357,8 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -323,6 +379,8 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -347,9 +405,13 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRunOutputItemList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRunOutputItemList.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) { @@ -377,9 +439,13 @@ partial void ProcessGetEvalRunOutputItemsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRunOutputItemList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRunOutputItemList.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.EvalsClient.GetEvalRuns.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRuns.g.cs index 50d0eed4..1d7cc1ce 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRuns.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.GetEvalRuns.g.cs @@ -72,6 +72,42 @@ partial void ProcessGetEvalRunsResponseContent( global::tryAGI.OpenAI.GetEvalRunsStatus? status = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetEvalRunsAsResponseAsync( + evalId: evalId, + after: after, + limit: limit, + order: order, + status: status, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a list of runs for an evaluation. + /// + /// + /// + /// + /// 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> GetEvalRunsAsResponseAsync( + string evalId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.GetEvalRunsOrder? order = default, + global::tryAGI.OpenAI.GetEvalRunsStatus? status = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -105,14 +141,15 @@ partial void ProcessGetEvalRunsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}/runs", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("status", status?.ToValueString()) + .AddOptionalParameter("status", status?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -188,6 +225,8 @@ partial void ProcessGetEvalRunsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -198,6 +237,11 @@ partial void ProcessGetEvalRunsResponseContent( } 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 ProcessGetEvalRunsResponseContent( 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 ProcessGetEvalRunsResponseContent( __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 ProcessGetEvalRunsResponseContent( __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 ProcessGetEvalRunsResponseContent( 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 ProcessGetEvalRunsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -317,6 +370,8 @@ partial void ProcessGetEvalRunsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -341,9 +396,13 @@ partial void ProcessGetEvalRunsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalRunList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalRunList.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 ProcessGetEvalRunsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalRunList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalRunList.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.EvalsClient.ListEvals.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.ListEvals.g.cs index 50e804dc..91b8aeac 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.ListEvals.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.ListEvals.g.cs @@ -70,6 +70,41 @@ partial void ProcessListEvalsResponseContent( global::tryAGI.OpenAI.ListEvalsOrderBy? orderBy = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListEvalsAsResponseAsync( + after: after, + limit: limit, + order: order, + orderBy: orderBy, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List evaluations for a project. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Default Value: asc + /// + /// + /// Default Value: created_at + /// + /// 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> ListEvalsAsResponseAsync( + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.ListEvalsOrder? order = default, + global::tryAGI.OpenAI.ListEvalsOrderBy? orderBy = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -102,14 +137,15 @@ partial void ProcessListEvalsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/evals", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("order_by", orderBy?.ToValueString()) + .AddOptionalParameter("order_by", orderBy?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -184,6 +220,8 @@ partial void ProcessListEvalsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -194,6 +232,11 @@ partial void ProcessListEvalsResponseContent( } 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, @@ -211,6 +254,8 @@ partial void ProcessListEvalsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -220,8 +265,7 @@ partial void ProcessListEvalsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -230,6 +274,11 @@ partial void ProcessListEvalsResponseContent( __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( @@ -246,14 +295,15 @@ partial void ProcessListEvalsResponseContent( 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; } @@ -293,6 +343,8 @@ partial void ProcessListEvalsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -313,6 +365,8 @@ partial void ProcessListEvalsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -337,9 +391,13 @@ partial void ProcessListEvalsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.EvalList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.EvalList.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) { @@ -367,9 +425,13 @@ partial void ProcessListEvalsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.EvalList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.EvalList.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.EvalsClient.UpdateAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.UpdateAnEval.g.cs index 0212b2f3..9f30c5ed 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.UpdateAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.UpdateAnEval.g.cs @@ -54,6 +54,31 @@ partial void ProcessUpdateAnEvalResponseContent( public async global::System.Threading.Tasks.Task UpdateAnEvalAsync( string evalId, + global::tryAGI.OpenAI.UpdateEvalRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateAnEvalAsResponseAsync( + evalId: evalId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update certain properties of an evaluation. + /// + /// + /// + /// 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> UpdateAnEvalAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.UpdateEvalRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessUpdateAnEvalResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/evals/{evalId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessUpdateAnEvalResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessUpdateAnEvalResponseContent( } 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 ProcessUpdateAnEvalResponseContent( 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 ProcessUpdateAnEvalResponseContent( __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 ProcessUpdateAnEvalResponseContent( __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 ProcessUpdateAnEvalResponseContent( 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 ProcessUpdateAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessUpdateAnEvalResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessUpdateAnEvalResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Eval.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Eval.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 ProcessUpdateAnEvalResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Eval.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Eval.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.EvalsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.g.cs index fe4cde64..34e6f445 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.EvalsClient.g.cs @@ -73,10 +73,10 @@ public EvalsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public EvalsClient( - 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.FilesClient.DeleteFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.DeleteFile.g.cs index f9ecda17..8f78627f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.DeleteFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.DeleteFile.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteFileResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteFileAsResponseAsync( + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a file and remove it from all vector stores. + /// + /// + /// 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> DeleteFileAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteFileResponseContent( } 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 ProcessDeleteFileResponseContent( 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 ProcessDeleteFileResponseContent( __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 ProcessDeleteFileResponseContent( __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 ProcessDeleteFileResponseContent( 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 ProcessDeleteFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteFileResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteFileResponse.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 ProcessDeleteFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteFileResponse.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.FilesClient.ListFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.ListFiles.g.cs index d2c6b8a0..d6de18e4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.ListFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.ListFiles.g.cs @@ -68,6 +68,39 @@ partial void ProcessListFilesResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListFilesAsResponseAsync( + purpose: purpose, + limit: limit, + order: order, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of files. + /// + /// + /// + /// Default Value: 10000 + /// + /// + /// 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> ListFilesAsResponseAsync( + string? purpose = default, + int? limit = default, + global::tryAGI.OpenAI.ListFilesOrder? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,14 +133,15 @@ partial void ProcessListFilesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/files", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("purpose", purpose) .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -182,6 +216,8 @@ partial void ProcessListFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +228,11 @@ partial void ProcessListFilesResponseContent( } 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, @@ -209,6 +250,8 @@ partial void ProcessListFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +261,7 @@ partial void ProcessListFilesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +270,11 @@ partial void ProcessListFilesResponseContent( __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( @@ -244,14 +291,15 @@ partial void ProcessListFilesResponseContent( 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; } @@ -291,6 +339,8 @@ partial void ProcessListFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +361,8 @@ partial void ProcessListFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +387,13 @@ partial void ProcessListFilesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListFilesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListFilesResponse.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) { @@ -365,9 +421,13 @@ partial void ProcessListFilesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListFilesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListFilesResponse.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.FilesClient.RetrieveFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFile.g.cs index aa003ba1..88e94b9f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFile.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveFileResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveFileAsResponseAsync( + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns information about a specific 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> RetrieveFileAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveFileResponseContent( } 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 ProcessRetrieveFileResponseContent( 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 ProcessRetrieveFileResponseContent( __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 ProcessRetrieveFileResponseContent( __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 ProcessRetrieveFileResponseContent( 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 ProcessRetrieveFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessRetrieveFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.OpenAIFile.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.OpenAIFile.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 ProcessRetrieveFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.OpenAIFile.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.OpenAIFile.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.FilesClient.RetrieveFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFileContent.g.cs index 81cc723f..8a0a17dc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.RetrieveFileContent.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveFileContentResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveFileContentAsResponseAsync( + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns the contents of the specified 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> RetrieveFileContentAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveFileContentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/files/{fileId}/content", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveFileContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveFileContentResponseContent( } 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 ProcessRetrieveFileContentResponseContent( 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 ProcessRetrieveFileContentResponseContent( __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 ProcessRetrieveFileContentResponseContent( __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 ProcessRetrieveFileContentResponseContent( 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 ProcessRetrieveFileContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveFileContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,7 +346,11 @@ partial void ProcessRetrieveFileContentResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -335,7 +378,11 @@ partial void ProcessRetrieveFileContentResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.UploadFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.UploadFile.g.cs index f06c6d30..50fa4693 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.UploadFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.UploadFile.g.cs @@ -72,6 +72,50 @@ partial void ProcessUploadFileResponseContent( /// public async global::System.Threading.Tasks.Task UploadFileAsync( + global::tryAGI.OpenAI.CreateFileRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UploadFileAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Upload a file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
+ /// + /// 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> UploadFileAsResponseAsync( + global::tryAGI.OpenAI.CreateFileRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -102,10 +146,11 @@ partial void ProcessUploadFileResponseContent( 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: "/files", baseUri: HttpClient.BaseAddress); @@ -138,6 +183,7 @@ partial void ProcessUploadFileResponseContent( __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( @@ -176,17 +222,22 @@ request.Filename is null { __contentFile.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Purpose.ToValueString()), name: "\"purpose\""); + if (request.ExpiresAfter != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.ExpiresAfter.ToJson(JsonSerializerContext)), name: "\"expires_after\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -228,6 +279,8 @@ request.Filename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -238,6 +291,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, @@ -255,6 +313,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) { @@ -264,8 +324,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; } @@ -274,6 +333,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( @@ -290,14 +354,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; } @@ -337,6 +402,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -357,6 +424,8 @@ request.Filename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -381,9 +450,13 @@ request.Filename is null { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.OpenAIFile.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.OpenAIFile.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) { @@ -411,9 +484,13 @@ request.Filename is null #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.OpenAIFile.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.OpenAIFile.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) { @@ -518,5 +595,936 @@ request.Filename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Upload a file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
+ /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The intended purpose of the uploaded file. One of:
+ /// - `assistants`: Used in the Assistants API
+ /// - `batch`: Used in the Batch API
+ /// - `fine-tune`: Used for fine-tuning
+ /// - `vision`: Images used for vision fine-tuning
+ /// - `user_data`: Flexible file type for any purpose
+ /// - `evals`: Used for eval data sets + /// + /// + /// The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually 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 UploadFileAsync( + global::System.IO.Stream file, + string filename, + global::tryAGI.OpenAI.CreateFileRequestPurpose purpose, + global::tryAGI.OpenAI.FileExpirationAfter? expiresAfter = 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.CreateFileRequest + { + File = global::System.Array.Empty(), + Filename = filename, + Purpose = purpose, + ExpiresAfter = expiresAfter, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadFileArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadFileSecurityRequirements, + operationName: "UploadFileAsync"); + + 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: "/files", + 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.Purpose.ToValueString()), + name: "\"purpose\""); + + if (request.ExpiresAfter != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ExpiresAfter.ToJson(JsonSerializerContext)), + name: "\"expires_after\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadFileRequest( + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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); + ProcessUploadFileResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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); + ProcessUploadFileResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::tryAGI.OpenAI.OpenAIFile.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.OpenAIFile.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 file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
+ /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The intended purpose of the uploaded file. One of:
+ /// - `assistants`: Used in the Assistants API
+ /// - `batch`: Used in the Batch API
+ /// - `fine-tune`: Used for fine-tuning
+ /// - `vision`: Images used for vision fine-tuning
+ /// - `user_data`: Flexible file type for any purpose
+ /// - `evals`: Used for eval data sets + /// + /// + /// The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually 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> UploadFileAsResponseAsync( + global::System.IO.Stream file, + string filename, + global::tryAGI.OpenAI.CreateFileRequestPurpose purpose, + global::tryAGI.OpenAI.FileExpirationAfter? expiresAfter = 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.CreateFileRequest + { + File = global::System.Array.Empty(), + Filename = filename, + Purpose = purpose, + ExpiresAfter = expiresAfter, + }; + PrepareArguments( + client: HttpClient); + PrepareUploadFileArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UploadFileSecurityRequirements, + operationName: "UploadFileAsync"); + + 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: "/files", + 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.Purpose.ToValueString()), + name: "\"purpose\""); + + if (request.ExpiresAfter != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.ExpiresAfter.ToJson(JsonSerializerContext)), + name: "\"expires_after\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUploadFileRequest( + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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); + ProcessUploadFileResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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: "UploadFile", + methodName: "UploadFileAsync", + pathTemplate: "\"/files\"", + 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); + ProcessUploadFileResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::tryAGI.OpenAI.OpenAIFile.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.OpenAIFile.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.FilesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.g.cs index afdd3baa..0dbcd02a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FilesClient.g.cs @@ -73,10 +73,10 @@ public FilesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public FilesClient( - 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.FineTuningClient.CancelFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CancelFineTuning.g.cs index f5ee39a2..242ff8d6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CancelFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CancelFineTuning.g.cs @@ -54,6 +54,28 @@ partial void ProcessCancelFineTuningResponseContent( string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelFineTuningAsResponseAsync( + fineTuningJobId: fineTuningJobId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Immediately cancel a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// 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> CancelFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessCancelFineTuningResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/cancel", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessCancelFineTuningResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessCancelFineTuningResponseContent( } 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 ProcessCancelFineTuningResponseContent( 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 ProcessCancelFineTuningResponseContent( __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 ProcessCancelFineTuningResponseContent( __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 ProcessCancelFineTuningResponseContent( 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 ProcessCancelFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessCancelFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessCancelFineTuningResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.FineTuningJob.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.FineTuningJob.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 ProcessCancelFineTuningResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.FineTuningJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.FineTuningJob.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.FineTuningClient.CreateCheckpointPermissions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateCheckpointPermissions.g.cs index f7d86715..5cb77427 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateCheckpointPermissions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateCheckpointPermissions.g.cs @@ -57,6 +57,34 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( public async global::System.Threading.Tasks.Task CreateCheckpointPermissionsAsync( string fineTunedModelCheckpoint, + global::tryAGI.OpenAI.CreateFineTuningCheckpointPermissionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateCheckpointPermissionsAsResponseAsync( + fineTunedModelCheckpoint: fineTunedModelCheckpoint, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
+ /// This enables organization owners to share fine-tuned models with other projects in their organization. + ///
+ /// + /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + /// + /// + /// 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> CreateCheckpointPermissionsAsResponseAsync( + string fineTunedModelCheckpoint, + global::tryAGI.OpenAI.CreateFineTuningCheckpointPermissionRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -92,6 +120,7 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/checkpoints/{fineTunedModelCheckpoint}/permissions", baseUri: HttpClient.BaseAddress); @@ -172,6 +201,8 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +213,11 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( } 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, @@ -199,6 +235,8 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +246,7 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +255,11 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( __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( @@ -234,14 +276,15 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( 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; } @@ -281,6 +324,8 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +346,8 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -325,9 +372,13 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.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) { @@ -355,9 +406,13 @@ partial void ProcessCreateCheckpointPermissionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.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.FineTuningClient.CreateFineTuningJob.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateFineTuningJob.g.cs index 4831a905..aca59d77 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateFineTuningJob.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.CreateFineTuningJob.g.cs @@ -54,6 +54,30 @@ partial void ProcessCreateFineTuningJobResponseContent( /// public async global::System.Threading.Tasks.Task CreateFineTuningJobAsync( + global::tryAGI.OpenAI.CreateFineTuningJobRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateFineTuningJobAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
+ /// Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
+ /// [Learn more about fine-tuning](/docs/guides/model-optimization) + ///
+ /// + /// 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> CreateFineTuningJobAsResponseAsync( + global::tryAGI.OpenAI.CreateFineTuningJobRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -88,6 +112,7 @@ partial void ProcessCreateFineTuningJobResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/fine_tuning/jobs", baseUri: HttpClient.BaseAddress); @@ -167,6 +192,8 @@ partial void ProcessCreateFineTuningJobResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -177,6 +204,11 @@ partial void ProcessCreateFineTuningJobResponseContent( } 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, @@ -194,6 +226,8 @@ partial void ProcessCreateFineTuningJobResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -203,8 +237,7 @@ partial void ProcessCreateFineTuningJobResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -213,6 +246,11 @@ partial void ProcessCreateFineTuningJobResponseContent( __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( @@ -229,14 +267,15 @@ partial void ProcessCreateFineTuningJobResponseContent( 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; } @@ -276,6 +315,8 @@ partial void ProcessCreateFineTuningJobResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -296,6 +337,8 @@ partial void ProcessCreateFineTuningJobResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -320,9 +363,13 @@ partial void ProcessCreateFineTuningJobResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.FineTuningJob.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.FineTuningJob.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) { @@ -350,9 +397,13 @@ partial void ProcessCreateFineTuningJobResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.FineTuningJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.FineTuningJob.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.FineTuningClient.DeleteCheckpointPermission.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.DeleteCheckpointPermission.g.cs index 5552fe0b..75ad42d0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.DeleteCheckpointPermission.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.DeleteCheckpointPermission.g.cs @@ -61,6 +61,34 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( string permissionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteCheckpointPermissionAsResponseAsync( + fineTunedModelCheckpoint: fineTunedModelCheckpoint, + permissionId: permissionId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
+ /// Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. + ///
+ /// + /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + /// + /// + /// Example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + /// + /// 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> DeleteCheckpointPermissionAsResponseAsync( + string fineTunedModelCheckpoint, + string permissionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,6 +119,7 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/checkpoints/{fineTunedModelCheckpoint}/permissions/{permissionId}", baseUri: HttpClient.BaseAddress); @@ -165,6 +194,8 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +206,11 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( } 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, @@ -192,6 +228,8 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +239,7 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +248,11 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( __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( @@ -227,14 +269,15 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( 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; } @@ -274,6 +317,8 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +339,8 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -318,9 +365,13 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteFineTuningCheckpointPermissionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteFineTuningCheckpointPermissionResponse.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) { @@ -348,9 +399,13 @@ partial void ProcessDeleteCheckpointPermissionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteFineTuningCheckpointPermissionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteFineTuningCheckpointPermissionResponse.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.FineTuningClient.ListCheckpointPermissions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListCheckpointPermissions.g.cs index 37e4633f..bc0313d4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListCheckpointPermissions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListCheckpointPermissions.g.cs @@ -75,6 +75,45 @@ partial void ProcessListCheckpointPermissionsResponseContent( global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListCheckpointPermissionsAsResponseAsync( + fineTunedModelCheckpoint: fineTunedModelCheckpoint, + projectId: projectId, + after: after, + limit: limit, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
+ /// Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. + ///
+ /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// + /// Default Value: 10 + /// + /// + /// Default Value: descending + /// + /// 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> ListCheckpointPermissionsAsResponseAsync( + string fineTunedModelCheckpoint, + string? projectId = default, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -108,14 +147,15 @@ partial void ProcessListCheckpointPermissionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/checkpoints/{fineTunedModelCheckpoint}/permissions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("project_id", projectId) .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( @@ -191,6 +231,8 @@ partial void ProcessListCheckpointPermissionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -201,6 +243,11 @@ partial void ProcessListCheckpointPermissionsResponseContent( } 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, @@ -218,6 +265,8 @@ partial void ProcessListCheckpointPermissionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -227,8 +276,7 @@ partial void ProcessListCheckpointPermissionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -237,6 +285,11 @@ partial void ProcessListCheckpointPermissionsResponseContent( __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( @@ -253,14 +306,15 @@ partial void ProcessListCheckpointPermissionsResponseContent( 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; } @@ -300,6 +354,8 @@ partial void ProcessListCheckpointPermissionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -320,6 +376,8 @@ partial void ProcessListCheckpointPermissionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -344,9 +402,13 @@ partial void ProcessListCheckpointPermissionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.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) { @@ -374,9 +436,13 @@ partial void ProcessListCheckpointPermissionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionResponse.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.FineTuningClient.ListFineTuningCheckpoints.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningCheckpoints.g.cs index 89a8bd4d..9430bf31 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningCheckpoints.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningCheckpoints.g.cs @@ -64,6 +64,36 @@ partial void ProcessListFineTuningCheckpointsResponseContent( int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListFineTuningCheckpointsAsResponseAsync( + fineTuningJobId: fineTuningJobId, + after: after, + limit: limit, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List checkpoints for a fine-tuning job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// Default Value: 10 + /// + /// 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> ListFineTuningCheckpointsAsResponseAsync( + string fineTuningJobId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,12 +125,13 @@ partial void ProcessListFineTuningCheckpointsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/checkpoints", - 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( @@ -174,6 +205,8 @@ partial void ProcessListFineTuningCheckpointsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +217,11 @@ partial void ProcessListFineTuningCheckpointsResponseContent( } 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 +239,8 @@ partial void ProcessListFineTuningCheckpointsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +250,7 @@ partial void ProcessListFineTuningCheckpointsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +259,11 @@ partial void ProcessListFineTuningCheckpointsResponseContent( __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 +280,15 @@ partial void ProcessListFineTuningCheckpointsResponseContent( 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 +328,8 @@ partial void ProcessListFineTuningCheckpointsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +350,8 @@ partial void ProcessListFineTuningCheckpointsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -327,9 +376,13 @@ partial void ProcessListFineTuningCheckpointsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListFineTuningJobCheckpointsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListFineTuningJobCheckpointsResponse.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 +410,13 @@ partial void ProcessListFineTuningCheckpointsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListFineTuningJobCheckpointsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListFineTuningJobCheckpointsResponse.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.FineTuningClient.ListFineTuningEvents.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningEvents.g.cs index e445de44..4cc44c04 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningEvents.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningEvents.g.cs @@ -64,6 +64,36 @@ partial void ProcessListFineTuningEventsResponseContent( int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListFineTuningEventsAsResponseAsync( + fineTuningJobId: fineTuningJobId, + after: after, + limit: limit, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get status updates for a fine-tuning job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// 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> ListFineTuningEventsAsResponseAsync( + string fineTuningJobId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,12 +125,13 @@ partial void ProcessListFineTuningEventsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/events", - 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( @@ -174,6 +205,8 @@ partial void ProcessListFineTuningEventsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +217,11 @@ partial void ProcessListFineTuningEventsResponseContent( } 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 +239,8 @@ partial void ProcessListFineTuningEventsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +250,7 @@ partial void ProcessListFineTuningEventsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +259,11 @@ partial void ProcessListFineTuningEventsResponseContent( __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 +280,15 @@ partial void ProcessListFineTuningEventsResponseContent( 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 +328,8 @@ partial void ProcessListFineTuningEventsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +350,8 @@ partial void ProcessListFineTuningEventsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -327,9 +376,13 @@ partial void ProcessListFineTuningEventsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListFineTuningJobEventsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListFineTuningJobEventsResponse.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 +410,13 @@ partial void ProcessListFineTuningEventsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListFineTuningJobEventsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListFineTuningJobEventsResponse.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.FineTuningClient.ListFineTuningJobs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningJobs.g.cs index 8586254e..5ebd0e52 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningJobs.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ListFineTuningJobs.g.cs @@ -62,6 +62,34 @@ partial void ProcessListFineTuningJobsResponseContent( global::System.Collections.Generic.Dictionary? metadata = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListFineTuningJobsAsResponseAsync( + after: after, + limit: limit, + metadata: metadata, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List your organization's fine-tuning jobs + /// + /// + /// + /// 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> ListFineTuningJobsAsResponseAsync( + string? after = default, + int? limit = default, + global::System.Collections.Generic.Dictionary? metadata = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,13 +121,14 @@ partial void ProcessListFineTuningJobsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/fine_tuning/jobs", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("metadata", metadata?.ToString()) + .AddOptionalParameter("metadata", metadata?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -173,6 +202,8 @@ partial void ProcessListFineTuningJobsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +214,11 @@ partial void ProcessListFineTuningJobsResponseContent( } 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, @@ -200,6 +236,8 @@ partial void ProcessListFineTuningJobsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +247,7 @@ partial void ProcessListFineTuningJobsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +256,11 @@ partial void ProcessListFineTuningJobsResponseContent( __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( @@ -235,14 +277,15 @@ partial void ProcessListFineTuningJobsResponseContent( 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; } @@ -282,6 +325,8 @@ partial void ProcessListFineTuningJobsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +347,8 @@ partial void ProcessListFineTuningJobsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +373,13 @@ partial void ProcessListFineTuningJobsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListPaginatedFineTuningJobsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListPaginatedFineTuningJobsResponse.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) { @@ -356,9 +407,13 @@ partial void ProcessListFineTuningJobsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListPaginatedFineTuningJobsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListPaginatedFineTuningJobsResponse.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.FineTuningClient.PauseFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.PauseFineTuning.g.cs index bd45b48a..770821cb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.PauseFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.PauseFineTuning.g.cs @@ -54,6 +54,28 @@ partial void ProcessPauseFineTuningResponseContent( string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PauseFineTuningAsResponseAsync( + fineTuningJobId: fineTuningJobId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Pause a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// 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> PauseFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessPauseFineTuningResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/pause", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessPauseFineTuningResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessPauseFineTuningResponseContent( } 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 ProcessPauseFineTuningResponseContent( 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 ProcessPauseFineTuningResponseContent( __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 ProcessPauseFineTuningResponseContent( __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 ProcessPauseFineTuningResponseContent( 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 ProcessPauseFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessPauseFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessPauseFineTuningResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.FineTuningJob.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.FineTuningJob.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 ProcessPauseFineTuningResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.FineTuningJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.FineTuningJob.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.FineTuningClient.ResumeFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ResumeFineTuning.g.cs index b61e3aa9..f68ff79a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ResumeFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ResumeFineTuning.g.cs @@ -54,6 +54,28 @@ partial void ProcessResumeFineTuningResponseContent( string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ResumeFineTuningAsResponseAsync( + fineTuningJobId: fineTuningJobId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Resume a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// 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> ResumeFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessResumeFineTuningResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}/resume", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessResumeFineTuningResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessResumeFineTuningResponseContent( } 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 ProcessResumeFineTuningResponseContent( 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 ProcessResumeFineTuningResponseContent( __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 ProcessResumeFineTuningResponseContent( __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 ProcessResumeFineTuningResponseContent( 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 ProcessResumeFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessResumeFineTuningResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessResumeFineTuningResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.FineTuningJob.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.FineTuningJob.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 ProcessResumeFineTuningResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.FineTuningJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.FineTuningJob.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.FineTuningClient.RetrieveFineTuningJob.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs index 75096c2e..8262b58f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RetrieveFineTuningJob.g.cs @@ -55,6 +55,29 @@ partial void ProcessRetrieveFineTuningJobResponseContent( string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveFineTuningJobAsResponseAsync( + fineTuningJobId: fineTuningJobId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get info about a fine-tuning job.
+ /// [Learn more about fine-tuning](/docs/guides/model-optimization) + ///
+ /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// 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> RetrieveFineTuningJobAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessRetrieveFineTuningJobResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/fine_tuning/jobs/{fineTuningJobId}", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessRetrieveFineTuningJobResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessRetrieveFineTuningJobResponseContent( } 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, @@ -184,6 +215,8 @@ partial void ProcessRetrieveFineTuningJobResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessRetrieveFineTuningJobResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessRetrieveFineTuningJobResponseContent( __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( @@ -219,14 +256,15 @@ partial void ProcessRetrieveFineTuningJobResponseContent( 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; } @@ -266,6 +304,8 @@ partial void ProcessRetrieveFineTuningJobResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessRetrieveFineTuningJobResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -310,9 +352,13 @@ partial void ProcessRetrieveFineTuningJobResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.FineTuningJob.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.FineTuningJob.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) { @@ -340,9 +386,13 @@ partial void ProcessRetrieveFineTuningJobResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.FineTuningJob.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.FineTuningJob.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.FineTuningClient.RunGrader.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RunGrader.g.cs index cfcd6770..d9e160b5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RunGrader.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.RunGrader.g.cs @@ -50,6 +50,28 @@ partial void ProcessRunGraderResponseContent( /// public async global::System.Threading.Tasks.Task RunGraderAsync( + global::tryAGI.OpenAI.RunGraderRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RunGraderAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Run a grader. + /// + /// + /// 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> RunGraderAsResponseAsync( + global::tryAGI.OpenAI.RunGraderRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessRunGraderResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/fine_tuning/alpha/graders/run", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessRunGraderResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessRunGraderResponseContent( } 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 ProcessRunGraderResponseContent( 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 ProcessRunGraderResponseContent( __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 ProcessRunGraderResponseContent( __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 ProcessRunGraderResponseContent( 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 ProcessRunGraderResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessRunGraderResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessRunGraderResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RunGraderResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RunGraderResponse.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 ProcessRunGraderResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RunGraderResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RunGraderResponse.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.FineTuningClient.ValidateGrader.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ValidateGrader.g.cs index 63f9d219..92c98bb0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ValidateGrader.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.ValidateGrader.g.cs @@ -50,6 +50,28 @@ partial void ProcessValidateGraderResponseContent( /// public async global::System.Threading.Tasks.Task ValidateGraderAsync( + global::tryAGI.OpenAI.ValidateGraderRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ValidateGraderAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Validate a grader. + /// + /// + /// 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> ValidateGraderAsResponseAsync( + global::tryAGI.OpenAI.ValidateGraderRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessValidateGraderResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/fine_tuning/alpha/graders/validate", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessValidateGraderResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessValidateGraderResponseContent( } 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 ProcessValidateGraderResponseContent( 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 ProcessValidateGraderResponseContent( __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 ProcessValidateGraderResponseContent( __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 ProcessValidateGraderResponseContent( 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 ProcessValidateGraderResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessValidateGraderResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessValidateGraderResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ValidateGraderResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ValidateGraderResponse.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 ProcessValidateGraderResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ValidateGraderResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ValidateGraderResponse.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.FineTuningClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.g.cs index 2a6b8113..a2b04771 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.FineTuningClient.g.cs @@ -73,10 +73,10 @@ public FineTuningClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public FineTuningClient( - 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.GroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs index ad3370be..5f8caae8 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs @@ -54,6 +54,31 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( public async global::System.Threading.Tasks.Task AssignOrganizationRoleToGroupAsync( string groupId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AssignOrganizationRoleToGroupAsResponseAsync( + groupId: groupId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Assigns an organization role to a group within the organization. + /// + /// + /// + /// 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> AssignOrganizationRoleToGroupAsResponseAsync( + string groupId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/roles", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( } 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 ProcessAssignOrganizationRoleToGroupResponseContent( 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 ProcessAssignOrganizationRoleToGroupResponseContent( __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 ProcessAssignOrganizationRoleToGroupResponseContent( __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 ProcessAssignOrganizationRoleToGroupResponseContent( 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 ProcessAssignOrganizationRoleToGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessAssignOrganizationRoleToGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupRoleAssignment.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupRoleAssignment.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 ProcessAssignOrganizationRoleToGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupRoleAssignment.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupRoleAssignment.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.GroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs index 758c5a4d..1c222304 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs @@ -64,6 +64,35 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( global::tryAGI.OpenAI.ListGroupRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListGroupOrganizationRoleAssignmentsAsResponseAsync( + groupId: groupId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the organization roles assigned to a group within the organization. + /// + /// + /// + /// + /// + /// 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> ListGroupOrganizationRoleAssignmentsAsResponseAsync( + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +125,14 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/roles", - 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( @@ -177,6 +207,8 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -187,6 +219,11 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( } 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, @@ -204,6 +241,8 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -213,8 +252,7 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -223,6 +261,11 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( __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( @@ -239,14 +282,15 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( 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; } @@ -286,6 +330,8 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -306,6 +352,8 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -330,9 +378,13 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleListResource.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) { @@ -360,9 +412,13 @@ partial void ProcessListGroupOrganizationRoleAssignmentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleListResource.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.GroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs index 2ce2a5f2..49f0a930 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs @@ -56,6 +56,29 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UnassignOrganizationRoleFromGroupAsResponseAsync( + groupId: groupId, + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Unassigns an organization role from a group within the organization. + /// + /// + /// + /// 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> UnassignOrganizationRoleFromGroupAsResponseAsync( + string groupId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( } 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 ProcessUnassignOrganizationRoleFromGroupResponseContent( 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 ProcessUnassignOrganizationRoleFromGroupResponseContent( __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 ProcessUnassignOrganizationRoleFromGroupResponseContent( __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 ProcessUnassignOrganizationRoleFromGroupResponseContent( 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 ProcessUnassignOrganizationRoleFromGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessUnassignOrganizationRoleFromGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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 ProcessUnassignOrganizationRoleFromGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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.GroupOrganizationRoleAssignmentsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.g.cs index cab675b2..25cceccb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupOrganizationRoleAssignmentsClient.g.cs @@ -72,10 +72,10 @@ public GroupOrganizationRoleAssignmentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public GroupOrganizationRoleAssignmentsClient( - 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.GroupUsersClient.AddGroupUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.AddGroupUser.g.cs index baa0dfea..c1cfac74 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.AddGroupUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.AddGroupUser.g.cs @@ -54,6 +54,31 @@ partial void ProcessAddGroupUserResponseContent( public async global::System.Threading.Tasks.Task AddGroupUserAsync( string groupId, + global::tryAGI.OpenAI.CreateGroupUserBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AddGroupUserAsResponseAsync( + groupId: groupId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Adds a user to a group. + /// + /// + /// + /// 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> AddGroupUserAsResponseAsync( + string groupId, + global::tryAGI.OpenAI.CreateGroupUserBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessAddGroupUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/users", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessAddGroupUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessAddGroupUserResponseContent( } 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 ProcessAddGroupUserResponseContent( 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 ProcessAddGroupUserResponseContent( __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 ProcessAddGroupUserResponseContent( __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 ProcessAddGroupUserResponseContent( 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 ProcessAddGroupUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessAddGroupUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessAddGroupUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupUserAssignment.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupUserAssignment.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 ProcessAddGroupUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupUserAssignment.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupUserAssignment.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.GroupUsersClient.ListGroupUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.ListGroupUsers.g.cs index cef40d6b..6e24571a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.ListGroupUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.ListGroupUsers.g.cs @@ -68,6 +68,39 @@ partial void ProcessListGroupUsersResponseContent( global::tryAGI.OpenAI.ListGroupUsersOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListGroupUsersAsResponseAsync( + groupId: groupId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the users assigned to a group. + /// + /// + /// + /// Default Value: 100 + /// + /// + /// + /// 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> ListGroupUsersAsResponseAsync( + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupUsersOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,13 +133,14 @@ partial void ProcessListGroupUsersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/users", - 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 ProcessListGroupUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -191,6 +227,11 @@ partial void ProcessListGroupUsersResponseContent( } 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 ProcessListGroupUsersResponseContent( 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 ProcessListGroupUsersResponseContent( __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 ProcessListGroupUsersResponseContent( __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 ProcessListGroupUsersResponseContent( 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 ProcessListGroupUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -310,6 +360,8 @@ partial void ProcessListGroupUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -334,9 +386,13 @@ partial void ProcessListGroupUsersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UserListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UserListResource.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 ProcessListGroupUsersResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UserListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UserListResource.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.GroupUsersClient.RemoveGroupUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.RemoveGroupUser.g.cs index 4386513d..5104d5ca 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.RemoveGroupUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.RemoveGroupUser.g.cs @@ -56,6 +56,29 @@ partial void ProcessRemoveGroupUserResponseContent( string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RemoveGroupUserAsResponseAsync( + groupId: groupId, + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Removes a user from a group. + /// + /// + /// + /// 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> RemoveGroupUserAsResponseAsync( + string groupId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessRemoveGroupUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessRemoveGroupUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessRemoveGroupUserResponseContent( } 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 ProcessRemoveGroupUserResponseContent( 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 ProcessRemoveGroupUserResponseContent( __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 ProcessRemoveGroupUserResponseContent( __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 ProcessRemoveGroupUserResponseContent( 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 ProcessRemoveGroupUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessRemoveGroupUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessRemoveGroupUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupUserDeletedResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupUserDeletedResource.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 ProcessRemoveGroupUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupUserDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupUserDeletedResource.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.GroupUsersClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.g.cs index 3290e45d..9878297e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupUsersClient.g.cs @@ -72,10 +72,10 @@ public GroupUsersClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public GroupUsersClient( - 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.GroupsClient.CreateGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.CreateGroup.g.cs index 229693f2..3c474b88 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.CreateGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.CreateGroup.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateGroupResponseContent( /// public async global::System.Threading.Tasks.Task CreateGroupAsync( + global::tryAGI.OpenAI.CreateGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateGroupAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a new group in the organization. + /// + /// + /// 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> CreateGroupAsResponseAsync( + global::tryAGI.OpenAI.CreateGroupBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/groups", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateGroupResponseContent( } 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 ProcessCreateGroupResponseContent( 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 ProcessCreateGroupResponseContent( __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 ProcessCreateGroupResponseContent( __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 ProcessCreateGroupResponseContent( 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 ProcessCreateGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupResponse.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 ProcessCreateGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupResponse.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.GroupsClient.DeleteGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.DeleteGroup.g.cs index 41d7e68b..569d37d5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.DeleteGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.DeleteGroup.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteGroupResponseContent( string groupId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteGroupAsResponseAsync( + groupId: groupId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a group from the organization. + /// + /// + /// 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> DeleteGroupAsResponseAsync( + string groupId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteGroupResponseContent( } 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 ProcessDeleteGroupResponseContent( 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 ProcessDeleteGroupResponseContent( __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 ProcessDeleteGroupResponseContent( __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 ProcessDeleteGroupResponseContent( 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 ProcessDeleteGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupDeletedResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupDeletedResource.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 ProcessDeleteGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupDeletedResource.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.GroupsClient.ListGroups.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.ListGroups.g.cs index 48f0ae30..9c84fdc3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.ListGroups.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.ListGroups.g.cs @@ -64,6 +64,36 @@ partial void ProcessListGroupsResponseContent( global::tryAGI.OpenAI.ListGroupsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListGroupsAsResponseAsync( + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists all groups in the organization. + /// + /// + /// Default Value: 100 + /// + /// + /// + /// 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> ListGroupsAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,13 +125,14 @@ partial void ProcessListGroupsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/groups", - 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 ProcessListGroupsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +218,11 @@ partial void ProcessListGroupsResponseContent( } 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 ProcessListGroupsResponseContent( 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 ProcessListGroupsResponseContent( __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 ProcessListGroupsResponseContent( __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 ProcessListGroupsResponseContent( 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 ProcessListGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +351,8 @@ partial void ProcessListGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +377,13 @@ partial void ProcessListGroupsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupListResource.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 ProcessListGroupsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupListResource.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.GroupsClient.UpdateGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.UpdateGroup.g.cs index 30cd988a..5839e01f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.UpdateGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.UpdateGroup.g.cs @@ -54,6 +54,31 @@ partial void ProcessUpdateGroupResponseContent( public async global::System.Threading.Tasks.Task UpdateGroupAsync( string groupId, + global::tryAGI.OpenAI.UpdateGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateGroupAsResponseAsync( + groupId: groupId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Updates a group's information. + /// + /// + /// + /// 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> UpdateGroupAsResponseAsync( + string groupId, + global::tryAGI.OpenAI.UpdateGroupBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessUpdateGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/groups/{groupId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessUpdateGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessUpdateGroupResponseContent( } 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 ProcessUpdateGroupResponseContent( 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 ProcessUpdateGroupResponseContent( __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 ProcessUpdateGroupResponseContent( __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 ProcessUpdateGroupResponseContent( 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 ProcessUpdateGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessUpdateGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessUpdateGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupResourceWithSuccess.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupResourceWithSuccess.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 ProcessUpdateGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupResourceWithSuccess.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupResourceWithSuccess.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.GroupsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.g.cs index 638a3bd4..0bafcc7c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.GroupsClient.g.cs @@ -72,10 +72,10 @@ public GroupsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public GroupsClient( - 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.IAssistantsClient.CancelARun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CancelARun.g.cs index 895c253a..c2ae2de1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CancelARun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CancelARun.g.cs @@ -17,5 +17,18 @@ public partial interface IAssistantsClient string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> CancelARunAsResponseAsync( + string threadId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateMessage.g.cs index 32b084f7..23afbde5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateMessage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateMessage.g.cs @@ -22,6 +22,20 @@ public partial interface IAssistantsClient /// Create a message. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); + /// + /// Create a message. + /// + /// /// /// The role of the entity that is creating the message. Allowed values include:
/// - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages.
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateRun.g.cs index 2c62a58c..480b7b34 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateRun.g.cs @@ -25,6 +25,22 @@ public partial interface IAssistantsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a run. + /// + /// + /// /// /// The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThread.g.cs index 82a3231f..f233d422 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThread.g.cs @@ -19,6 +19,18 @@ public partial interface IAssistantsClient /// /// Create a thread. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateThreadAsResponseAsync( + + global::tryAGI.OpenAI.CreateThreadRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a thread. + /// /// /// A list of [messages](/docs/api-reference/messages) to start the thread with. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThreadAndRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThreadAndRun.g.cs index f82ce2ba..8ff30f6d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThreadAndRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.CreateThreadAndRun.g.cs @@ -19,6 +19,18 @@ public partial interface IAssistantsClient /// /// 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 + /// + global::System.Threading.Tasks.Task> CreateThreadAndRunAsResponseAsync( + + global::tryAGI.OpenAI.CreateThreadAndRunRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a thread and run it in one request. + /// /// /// The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs index ae9af35b..4610bd54 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteMessage.g.cs @@ -17,5 +17,18 @@ public partial interface IAssistantsClient string messageId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a message. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteMessageAsResponseAsync( + string threadId, + string messageId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs index a6e271bf..b168cb22 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.DeleteThread.g.cs @@ -15,5 +15,16 @@ public partial interface IAssistantsClient string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a thread. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListMessages.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListMessages.g.cs index 9af8d470..40fbe142 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListMessages.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListMessages.g.cs @@ -29,5 +29,30 @@ public partial interface IAssistantsClient string? runId = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRunSteps.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRunSteps.g.cs index 1477ac59..3716853c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRunSteps.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRunSteps.g.cs @@ -31,5 +31,32 @@ public partial interface IAssistantsClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRuns.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRuns.g.cs index c2e09142..e0977b02 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRuns.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ListRuns.g.cs @@ -27,5 +27,28 @@ public partial interface IAssistantsClient string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyMessage.g.cs index ec9b7b2e..f559ba85 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyMessage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyMessage.g.cs @@ -25,6 +25,22 @@ public partial interface IAssistantsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); + /// + /// Modifies a message. + /// + /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyRun.g.cs index 46b7b4fa..d9768cc5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyRun.g.cs @@ -25,6 +25,22 @@ public partial interface IAssistantsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); + /// + /// Modifies a run. + /// + /// + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyThread.g.cs index b0a4d8d2..79f79ef4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.ModifyThread.g.cs @@ -22,6 +22,20 @@ public partial interface IAssistantsClient /// Modifies a thread. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); + /// + /// Modifies a thread. + /// + /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveMessage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveMessage.g.cs index 7eb64e04..87bc5559 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveMessage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveMessage.g.cs @@ -17,5 +17,18 @@ public partial interface IAssistantsClient string messageId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve a message. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveMessageAsResponseAsync( + string threadId, + string messageId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRun.g.cs index d64bdd79..54e266eb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRun.g.cs @@ -17,5 +17,18 @@ public partial interface IAssistantsClient string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a run. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveRunAsResponseAsync( + string threadId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRunStep.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRunStep.g.cs index 77dc4dc7..90a14952 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRunStep.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveRunStep.g.cs @@ -21,5 +21,22 @@ public partial interface IAssistantsClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a run step. + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveThread.g.cs index c425f5a6..9a35a761 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.RetrieveThread.g.cs @@ -15,5 +15,16 @@ public partial interface IAssistantsClient string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a thread. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.SubmitToolOutputsToRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.SubmitToolOutputsToRun.g.cs index 4efa0e23..6d9bc913 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.SubmitToolOutputsToRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAssistantsClient.SubmitToolOutputsToRun.g.cs @@ -25,6 +25,22 @@ public partial interface IAssistantsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + 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); + /// + /// 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. + /// + /// + /// /// /// A list of tools for which the outputs are being submitted. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscription.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscription.g.cs index bf170d7e..087991b2 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscription.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscription.g.cs @@ -23,6 +23,20 @@ public partial interface IAudioClient /// 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 + /// + global::System.Threading.Tasks.Task>> CreateTranscriptionAsResponseAsync( + + global::tryAGI.OpenAI.CreateTranscriptionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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. /// @@ -84,5 +98,138 @@ public partial interface IAudioClient global::System.Collections.Generic.IList? knownSpeakerReferences = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// 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 + /// + 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); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscriptionAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscriptionAsStream.g.cs index 921b61fd..2edf5402 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscriptionAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranscriptionAsStream.g.cs @@ -84,5 +84,72 @@ public partial interface IAudioClient global::System.Collections.Generic.IList? knownSpeakerReferences = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// 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 + /// + 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.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranslation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranslation.g.cs index 3a3990ae..81e533e7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranslation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateTranslation.g.cs @@ -19,6 +19,18 @@ public partial interface IAudioClient /// /// Translates audio into English. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task>> CreateTranslationAsResponseAsync( + + global::tryAGI.OpenAI.CreateTranslationRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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. /// @@ -52,5 +64,78 @@ public partial interface IAudioClient double? temperature = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// 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 + /// + 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); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoice.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoice.g.cs index 43d3b3e6..c6a38012 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoice.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoice.g.cs @@ -23,6 +23,20 @@ public partial interface IAudioClient /// 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 + /// + global::System.Threading.Tasks.Task> CreateVoiceAsResponseAsync( + + global::tryAGI.OpenAI.CreateVoiceRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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. /// @@ -49,5 +63,68 @@ public partial interface IAudioClient string consent, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// 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 + /// + 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); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoiceConsent.g.cs index 7c90e526..a86e6365 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoiceConsent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.CreateVoiceConsent.g.cs @@ -23,6 +23,20 @@ public partial interface IAudioClient /// 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 + /// + global::System.Threading.Tasks.Task> CreateVoiceConsentAsResponseAsync( + + global::tryAGI.OpenAI.CreateVoiceConsentRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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. /// @@ -49,5 +63,68 @@ public partial interface IAudioClient string language, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// 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 + /// + 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); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.DeleteVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.DeleteVoiceConsent.g.cs index 0321b2a0..38bd14aa 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.DeleteVoiceConsent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.DeleteVoiceConsent.g.cs @@ -17,5 +17,18 @@ public partial interface IAudioClient string consentId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> DeleteVoiceConsentAsResponseAsync( + string consentId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.ListVoiceConsents.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.ListVoiceConsents.g.cs index c0ada6ff..d2dc2cef 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.ListVoiceConsents.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.ListVoiceConsents.g.cs @@ -21,5 +21,22 @@ public partial interface IAudioClient int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListVoiceConsentsAsResponseAsync( + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.RetrieveVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.RetrieveVoiceConsent.g.cs index 997ac2a3..29e4a08d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.RetrieveVoiceConsent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.RetrieveVoiceConsent.g.cs @@ -17,5 +17,18 @@ public partial interface IAudioClient string consentId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> RetrieveVoiceConsentAsResponseAsync( + string consentId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.UpdateVoiceConsent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.UpdateVoiceConsent.g.cs index 2d45a7e7..2b6b4797 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.UpdateVoiceConsent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAudioClient.UpdateVoiceConsent.g.cs @@ -26,6 +26,22 @@ public partial interface IAudioClient /// 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 + /// + 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); + /// + /// 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. + ///
+ /// /// /// The updated label for this consent recording. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAuditLogsClient.ListAuditLogs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAuditLogsClient.ListAuditLogs.g.cs index 4e046b05..06350f5a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAuditLogsClient.ListAuditLogs.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IAuditLogsClient.ListAuditLogs.g.cs @@ -33,5 +33,34 @@ public partial interface IAuditLogsClient string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs index b5f40d46..42d5a9d3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CancelBatch.g.cs @@ -15,5 +15,16 @@ public partial interface IBatchClient string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> CancelBatchAsResponseAsync( + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CreateBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CreateBatch.g.cs index 06fc40b7..ac86536d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CreateBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.CreateBatch.g.cs @@ -19,6 +19,18 @@ public partial interface IBatchClient /// /// 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 + /// + global::System.Threading.Tasks.Task> CreateBatchAsResponseAsync( + + global::tryAGI.OpenAI.CreateBatchRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates and executes a batch from an uploaded file of requests + /// /// /// The ID of an uploaded file that contains requests for the new batch.
/// See [upload file](/docs/api-reference/files/create) for how to upload a file.
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.ListBatches.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.ListBatches.g.cs index 3996110b..38bdb1dd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.ListBatches.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.ListBatches.g.cs @@ -19,5 +19,20 @@ public partial interface IBatchClient int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListBatchesAsResponseAsync( + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs index fa3d628d..942e297e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IBatchClient.RetrieveBatch.g.cs @@ -15,5 +15,16 @@ public partial interface IBatchClient string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a batch. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveBatchAsResponseAsync( + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForOrganization.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForOrganization.g.cs index e724d0ae..98b4f97f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForOrganization.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForOrganization.g.cs @@ -21,6 +21,19 @@ public partial interface ICertificatesClient /// 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 + /// + global::System.Threading.Tasks.Task> ActivateCertificatesForOrganizationAsResponseAsync( + + global::tryAGI.OpenAI.ToggleCertificatesRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForProject.g.cs index f8138397..d0b21d0e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ActivateCertificatesForProject.g.cs @@ -24,6 +24,21 @@ public partial interface ICertificatesClient /// 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 + /// + 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); + /// + /// 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 diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForOrganization.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForOrganization.g.cs index a0ff5080..02f7c0b4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForOrganization.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForOrganization.g.cs @@ -21,6 +21,19 @@ public partial interface ICertificatesClient /// 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 + /// + global::System.Threading.Tasks.Task> DeactivateCertificatesForOrganizationAsResponseAsync( + + global::tryAGI.OpenAI.ToggleCertificatesRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForProject.g.cs index 3ebe7613..6f689183 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeactivateCertificatesForProject.g.cs @@ -24,6 +24,21 @@ public partial interface ICertificatesClient /// 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 + /// + 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); + /// + /// 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 diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs index 1d82f956..0b74ce3c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.DeleteCertificate.g.cs @@ -16,5 +16,17 @@ public partial interface ICertificatesClient string certificateId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> DeleteCertificateAsResponseAsync( + string certificateId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs index 131b7972..a16c527d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.GetCertificate.g.cs @@ -18,5 +18,19 @@ public partial interface ICertificatesClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs index 6c56362d..9515948f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListOrganizationCertificates.g.cs @@ -23,5 +23,24 @@ public partial interface ICertificatesClient global::tryAGI.OpenAI.ListOrganizationCertificatesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs index 7f67d4d9..344e1dfe 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ListProjectCertificates.g.cs @@ -25,5 +25,26 @@ public partial interface ICertificatesClient global::tryAGI.OpenAI.ListProjectCertificatesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ModifyCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ModifyCertificate.g.cs index 38e921c7..bd894539 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ModifyCertificate.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.ModifyCertificate.g.cs @@ -22,6 +22,20 @@ public partial interface ICertificatesClient /// 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 + /// + 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); + /// + /// Modify a certificate. Note that only the name can be modified. + /// + /// /// /// The updated name for the certificate /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.UploadCertificate.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.UploadCertificate.g.cs index 47f41845..7cbcbddc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.UploadCertificate.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICertificatesClient.UploadCertificate.g.cs @@ -21,6 +21,19 @@ public partial interface ICertificatesClient /// 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 + /// + global::System.Threading.Tasks.Task> UploadCertificateAsResponseAsync( + + global::tryAGI.OpenAI.UploadCertificateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload a certificate to the organization. This does **not** automatically activate the certificate.
+ /// Organizations can upload up to 50 certificates. + ///
/// /// An optional name for the certificate /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.CreateChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.CreateChatCompletion.g.cs index bc88cd99..c9733d71 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.CreateChatCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.CreateChatCompletion.g.cs @@ -45,6 +45,31 @@ public partial interface IChatClient /// 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 + /// + global::System.Threading.Tasks.Task> CreateChatCompletionAsResponseAsync( + + global::tryAGI.OpenAI.CreateChatCompletionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// **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 /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs index 4e5bb25c..a8ea8c5f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.DeleteChatCompletion.g.cs @@ -16,5 +16,17 @@ public partial interface IChatClient string completionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> DeleteChatCompletionAsResponseAsync( + string completionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs index 4e7387b6..6c6b770d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatCompletion.g.cs @@ -16,5 +16,17 @@ public partial interface IChatClient string completionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + global::System.Threading.Tasks.Task> GetChatCompletionAsResponseAsync( + string completionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatMessages.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatMessages.g.cs index 6d69741d..aa27b6b6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatMessages.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.GetChatMessages.g.cs @@ -27,5 +27,28 @@ public partial interface IChatClient global::tryAGI.OpenAI.GetChatCompletionMessagesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.ListChatCompletions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.ListChatCompletions.g.cs index cfeef99b..78ab8da6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.ListChatCompletions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.ListChatCompletions.g.cs @@ -28,5 +28,29 @@ public partial interface IChatClient global::tryAGI.OpenAI.ListChatCompletionsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// 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 + /// + 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); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.UpdateChatCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.UpdateChatCompletion.g.cs index 1cbb9a31..dafc708f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.UpdateChatCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IChatClient.UpdateChatCompletion.g.cs @@ -26,6 +26,22 @@ public partial interface IChatClient /// the only supported modification is to update the `metadata` field. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateChatCompletionAsResponseAsync( + string completionId, + + global::tryAGI.OpenAI.UpdateChatCompletionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modify a stored chat completion. Only Chat Completions that have been
+ /// created with the `store` parameter set to `true` can be modified. Currently,
+ /// the only supported modification is to update the `metadata` field. + ///
+ /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICompletionsClient.CreateCompletion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICompletionsClient.CreateCompletion.g.cs index 93690dcd..dc7b7cef 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICompletionsClient.CreateCompletion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ICompletionsClient.CreateCompletion.g.cs @@ -21,6 +21,19 @@ public partial interface ICompletionsClient /// Creates a completion for the provided prompt and parameters.
/// Returns a completion object, or a sequence of completion 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 + /// + global::System.Threading.Tasks.Task> CreateCompletionAsResponseAsync( + + global::tryAGI.OpenAI.CreateCompletionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a completion for the provided prompt and parameters.
+ /// Returns a completion object, or a sequence of completion objects if the request is streamed. + ///
/// /// ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateAConversation.g.cs index d1d18c62..fdd33a91 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateAConversation.g.cs @@ -19,6 +19,18 @@ public partial interface IConversationsClient /// /// Create a conversation. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateAConversationAsResponseAsync( + + global::tryAGI.OpenAI.CreateConversationBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a conversation. + /// /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateItems.g.cs index ca3a616d..8e55bc4c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.CreateItems.g.cs @@ -29,6 +29,24 @@ public partial interface IConversationsClient /// Example: conv_123 /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateItemsAsResponseAsync( + string conversationId, + + global::tryAGI.OpenAI.CreateConversationItemsRequest request, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create items in a conversation with the given ID. + /// + /// + /// Example: conv_123 + /// + /// /// /// The items to add to the conversation. You may add up to 20 items at a time. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAConversation.g.cs index 6c910142..abc11eea 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAConversation.g.cs @@ -17,5 +17,18 @@ public partial interface IConversationsClient string conversationId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a conversation. Items in the conversation will not be deleted. + /// + /// + /// Example: conv_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAConversationAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAnItem.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAnItem.g.cs index f4e78c13..308b00c0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAnItem.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.DeleteAnItem.g.cs @@ -21,5 +21,22 @@ public partial interface IConversationsClient string itemId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an item from a conversation with the given IDs. + /// + /// + /// Example: conv_123 + /// + /// + /// Example: msg_abc + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAnItemAsResponseAsync( + string conversationId, + string itemId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.ListItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.ListItems.g.cs index 432c85a7..eccc816b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.ListItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.ListItems.g.cs @@ -27,5 +27,28 @@ public partial interface IConversationsClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List all items for a conversation with the given ID. + /// + /// + /// Example: conv_123 + /// + /// + /// Default Value: 20 + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListItemsAsResponseAsync( + string conversationId, + int? limit = default, + global::tryAGI.OpenAI.ListConversationItemsOrder? order = default, + string? after = default, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAConversation.g.cs index b37aba48..b848797f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAConversation.g.cs @@ -17,5 +17,18 @@ public partial interface IConversationsClient string conversationId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a conversation + /// + /// + /// Example: conv_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveAConversationAsResponseAsync( + string conversationId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAnItem.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAnItem.g.cs index 5a8a5fe4..c805be18 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAnItem.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.RetrieveAnItem.g.cs @@ -23,5 +23,24 @@ public partial interface IConversationsClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a single item from a conversation with the given IDs. + /// + /// + /// Example: conv_123 + /// + /// + /// Example: msg_abc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveAnItemAsResponseAsync( + string conversationId, + string itemId, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.UpdateAConversation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.UpdateAConversation.g.cs index b92c9e3b..7c4a113d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.UpdateAConversation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IConversationsClient.UpdateAConversation.g.cs @@ -26,6 +26,22 @@ public partial interface IConversationsClient /// /// Example: conv_123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateAConversationAsResponseAsync( + string conversationId, + + global::tryAGI.OpenAI.UpdateConversationBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update a conversation + /// + /// + /// Example: conv_123 + /// /// /// Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
/// Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEmbeddingsClient.CreateEmbeddings.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEmbeddingsClient.CreateEmbeddings.g.cs index 3f728c4e..9d2e57be 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEmbeddingsClient.CreateEmbeddings.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEmbeddingsClient.CreateEmbeddings.g.cs @@ -19,6 +19,18 @@ public partial interface IEmbeddingsClient /// /// Creates an embedding vector representing the input text. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateEmbeddingsAsResponseAsync( + + global::tryAGI.OpenAI.CreateEmbeddingRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an embedding vector representing the input text. + /// /// /// Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.
/// Example: The quick brown fox jumped over the lazy dog diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs index 8da893ef..4ea939bd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CancelEvalRun.g.cs @@ -17,5 +17,18 @@ public partial interface IEvalsClient string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancel an ongoing evaluation run. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEval.g.cs index b9ef75da..ec34caf7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEval.g.cs @@ -25,6 +25,20 @@ public partial interface IEvalsClient /// An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.
/// For more information, see the [Evals guide](/docs/guides/evals). /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateEvalAsResponseAsync( + + global::tryAGI.OpenAI.CreateEvalRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create the structure of an evaluation that can be used to test a model's performance.
+ /// An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources.
+ /// For more information, see the [Evals guide](/docs/guides/evals). + ///
/// /// The name of the evaluation. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEvalRun.g.cs index 80f921b6..f448dd25 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.CreateEvalRun.g.cs @@ -22,6 +22,20 @@ public partial interface IEvalsClient /// Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateEvalRunAsResponseAsync( + string evalId, + + global::tryAGI.OpenAI.CreateEvalRunRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. + /// + /// /// /// The name of the run. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteAnEval.g.cs index a2699261..68cf5d74 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteAnEval.g.cs @@ -15,5 +15,16 @@ public partial interface IEvalsClient string evalId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an evaluation. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAnEvalAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs index e6b8b754..b561db98 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.DeleteEvalRun.g.cs @@ -17,5 +17,18 @@ public partial interface IEvalsClient string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an eval run. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEval.g.cs index 2b97b178..2fe61055 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEval.g.cs @@ -15,5 +15,16 @@ public partial interface IEvalsClient string evalId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get an evaluation by ID. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAnEvalAsResponseAsync( + string evalId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEvalRun.g.cs index 7c4245b2..b9e70a6c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnEvalRun.g.cs @@ -17,5 +17,18 @@ public partial interface IEvalsClient string runId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get an evaluation run by ID. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAnEvalRunAsResponseAsync( + string evalId, + string runId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnOutputItemOfAnEvalRun.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnOutputItemOfAnEvalRun.g.cs index c05bdeb9..adb497b9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnOutputItemOfAnEvalRun.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetAnOutputItemOfAnEvalRun.g.cs @@ -19,5 +19,20 @@ public partial interface IEvalsClient string outputItemId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get an evaluation run output item by ID. + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAnOutputItemOfAnEvalRunAsResponseAsync( + string evalId, + string runId, + string outputItemId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItems.g.cs index ead789b8..81029345 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRunOutputItems.g.cs @@ -29,5 +29,30 @@ public partial interface IEvalsClient global::tryAGI.OpenAI.GetEvalRunOutputItemsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a list of output items for an evaluation run. + /// + /// + /// + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> GetEvalRunOutputItemsAsResponseAsync( + string evalId, + string runId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.GetEvalRunOutputItemsStatus? status = default, + global::tryAGI.OpenAI.GetEvalRunOutputItemsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs index afe6c66d..6a79357a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.GetEvalRuns.g.cs @@ -27,5 +27,28 @@ public partial interface IEvalsClient global::tryAGI.OpenAI.GetEvalRunsStatus? status = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a list of runs for an evaluation. + /// + /// + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> GetEvalRunsAsResponseAsync( + string evalId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.GetEvalRunsOrder? order = default, + global::tryAGI.OpenAI.GetEvalRunsStatus? status = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs index 285fd8e7..fbf57dd1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.ListEvals.g.cs @@ -27,5 +27,28 @@ public partial interface IEvalsClient global::tryAGI.OpenAI.ListEvalsOrderBy? orderBy = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List evaluations for a project. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Default Value: asc + /// + /// + /// Default Value: created_at + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListEvalsAsResponseAsync( + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.ListEvalsOrder? order = default, + global::tryAGI.OpenAI.ListEvalsOrderBy? orderBy = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.UpdateAnEval.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.UpdateAnEval.g.cs index ee96e591..f4f61ae9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.UpdateAnEval.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IEvalsClient.UpdateAnEval.g.cs @@ -22,6 +22,20 @@ public partial interface IEvalsClient /// Update certain properties of an evaluation. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateAnEvalAsResponseAsync( + string evalId, + + global::tryAGI.OpenAI.UpdateEvalRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update certain properties of an evaluation. + /// + /// /// /// Rename the evaluation. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs index 2ece6017..221e2b77 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.DeleteFile.g.cs @@ -15,5 +15,16 @@ public partial interface IFilesClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a file and remove it from all vector stores. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteFileAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.ListFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.ListFiles.g.cs index fbfea807..c738261c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.ListFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.ListFiles.g.cs @@ -25,5 +25,26 @@ public partial interface IFilesClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of files. + /// + /// + /// + /// Default Value: 10000 + /// + /// + /// Default Value: desc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListFilesAsResponseAsync( + string? purpose = default, + int? limit = default, + global::tryAGI.OpenAI.ListFilesOrder? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs index 816006fd..ea008a7d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFile.g.cs @@ -15,5 +15,16 @@ public partial interface IFilesClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns information about a specific file. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveFileAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFileContent.g.cs index 30b0ec9d..9e86cfa1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.RetrieveFileContent.g.cs @@ -15,5 +15,16 @@ public partial interface IFilesClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns the contents of the specified file. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveFileContentAsResponseAsync( + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.UploadFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.UploadFile.g.cs index 5c66530e..194e5bdc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.UploadFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFilesClient.UploadFile.g.cs @@ -63,6 +63,40 @@ public partial interface IFilesClient /// Please [contact us](https://help.openai.com/) if you need to increase these
/// storage limits. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadFileAsResponseAsync( + + global::tryAGI.OpenAI.CreateFileRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload a file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
/// /// The File object (not file name) to be uploaded. /// @@ -91,5 +125,112 @@ public partial interface IFilesClient global::tryAGI.OpenAI.FileExpirationAfter? expiresAfter = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload a file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
+ /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The intended purpose of the uploaded file. One of:
+ /// - `assistants`: Used in the Assistants API
+ /// - `batch`: Used in the Batch API
+ /// - `fine-tune`: Used for fine-tuning
+ /// - `vision`: Images used for vision fine-tuning
+ /// - `user_data`: Flexible file type for any purpose
+ /// - `evals`: Used for eval data sets + /// + /// + /// The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UploadFileAsync( + global::System.IO.Stream file, + string filename, + global::tryAGI.OpenAI.CreateFileRequestPurpose purpose, + global::tryAGI.OpenAI.FileExpirationAfter? expiresAfter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Upload a file that can be used across various endpoints. Individual files
+ /// can be up to 512 MB, and each project can store up to 2.5 TB of files in
+ /// total. There is no organization-wide storage limit. Uploads to this
+ /// endpoint are rate-limited to 1,000 requests per minute per authenticated
+ /// user.
+ /// - The Assistants API supports files up to 2 million tokens and of specific
+ /// file types. See the [Assistants Tools guide](/docs/assistants/tools) for
+ /// details.
+ /// - The Fine-tuning API only supports `.jsonl` files. The input also has
+ /// certain required formats for fine-tuning
+ /// [chat](/docs/api-reference/fine-tuning/chat-input) or
+ /// [completions](/docs/api-reference/fine-tuning/completions-input) models.
+ /// - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
+ /// also has a specific required
+ /// [format](/docs/api-reference/batch/request-input).
+ /// - For Retrieval or `file_search` ingestion, upload files here first. If
+ /// you need to attach multiple uploaded files to the same vector store, use
+ /// [`/vector_stores/{vector_store_id}/file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch)
+ /// instead of attaching them one by one. Vector store attachment has separate
+ /// limits from file upload, including 2,000 attached files per minute per
+ /// organization.
+ /// Please [contact us](https://help.openai.com/) if you need to increase these
+ /// storage limits. + ///
+ /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The File object (not file name) to be uploaded. + /// + /// + /// The intended purpose of the uploaded file. One of:
+ /// - `assistants`: Used in the Assistants API
+ /// - `batch`: Used in the Batch API
+ /// - `fine-tune`: Used for fine-tuning
+ /// - `vision`: Images used for vision fine-tuning
+ /// - `user_data`: Flexible file type for any purpose
+ /// - `evals`: Used for eval data sets + /// + /// + /// The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UploadFileAsResponseAsync( + global::System.IO.Stream file, + string filename, + global::tryAGI.OpenAI.CreateFileRequestPurpose purpose, + global::tryAGI.OpenAI.FileExpirationAfter? expiresAfter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CancelFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CancelFineTuning.g.cs index e188a2cc..356c7a30 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CancelFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CancelFineTuning.g.cs @@ -17,5 +17,18 @@ public partial interface IFineTuningClient string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Immediately cancel a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateCheckpointPermissions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateCheckpointPermissions.g.cs index 9a1bb945..42f179ea 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateCheckpointPermissions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateCheckpointPermissions.g.cs @@ -28,6 +28,23 @@ public partial interface IFineTuningClient /// /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateCheckpointPermissionsAsResponseAsync( + string fineTunedModelCheckpoint, + + global::tryAGI.OpenAI.CreateFineTuningCheckpointPermissionRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
+ /// This enables organization owners to share fine-tuned models with other projects in their organization. + ///
+ /// + /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + /// /// /// The project identifiers to grant access to. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateFineTuningJob.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateFineTuningJob.g.cs index d7ac5f22..29e836f3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateFineTuningJob.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.CreateFineTuningJob.g.cs @@ -25,6 +25,20 @@ public partial interface IFineTuningClient /// Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
/// [Learn more about fine-tuning](/docs/guides/model-optimization) /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateFineTuningJobAsResponseAsync( + + global::tryAGI.OpenAI.CreateFineTuningJobRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
+ /// Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
+ /// [Learn more about fine-tuning](/docs/guides/model-optimization) + ///
/// /// The name of the model to fine-tune. You can select one of the
/// [supported models](/docs/guides/fine-tuning#which-models-can-be-fine-tuned).
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.DeleteCheckpointPermission.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.DeleteCheckpointPermission.g.cs index 3eb6d69c..c9943dfe 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.DeleteCheckpointPermission.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.DeleteCheckpointPermission.g.cs @@ -22,5 +22,23 @@ public partial interface IFineTuningClient string permissionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
+ /// Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. + ///
+ /// + /// Example: ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd + /// + /// + /// Example: cp_zc4Q7MP6XxulcVzj4MZdwsAB + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteCheckpointPermissionAsResponseAsync( + string fineTunedModelCheckpoint, + string permissionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListCheckpointPermissions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListCheckpointPermissions.g.cs index 816cf88d..9c612547 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListCheckpointPermissions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListCheckpointPermissions.g.cs @@ -30,5 +30,31 @@ public partial interface IFineTuningClient global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
+ /// Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. + ///
+ /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// + /// Default Value: 10 + /// + /// + /// Default Value: descending + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListCheckpointPermissionsAsResponseAsync( + string fineTunedModelCheckpoint, + string? projectId = default, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.ListFineTuningCheckpointPermissionsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningCheckpoints.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningCheckpoints.g.cs index 6ce3856c..7a195a13 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningCheckpoints.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningCheckpoints.g.cs @@ -23,5 +23,24 @@ public partial interface IFineTuningClient int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List checkpoints for a fine-tuning job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// Default Value: 10 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListFineTuningCheckpointsAsResponseAsync( + string fineTuningJobId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs index 046250b5..e7a228a3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningEvents.g.cs @@ -23,5 +23,24 @@ public partial interface IFineTuningClient int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get status updates for a fine-tuning job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// + /// + /// Default Value: 20 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListFineTuningEventsAsResponseAsync( + string fineTuningJobId, + string? after = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobs.g.cs index b9d1f960..70185eca 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobs.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ListFineTuningJobs.g.cs @@ -21,5 +21,22 @@ public partial interface IFineTuningClient global::System.Collections.Generic.Dictionary? metadata = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List your organization's fine-tuning jobs + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListFineTuningJobsAsResponseAsync( + string? after = default, + int? limit = default, + global::System.Collections.Generic.Dictionary? metadata = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.PauseFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.PauseFineTuning.g.cs index 346ddd15..06d2fbe6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.PauseFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.PauseFineTuning.g.cs @@ -17,5 +17,18 @@ public partial interface IFineTuningClient string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Pause a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PauseFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ResumeFineTuning.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ResumeFineTuning.g.cs index 6ba4401a..40a3a1d3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ResumeFineTuning.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ResumeFineTuning.g.cs @@ -17,5 +17,18 @@ public partial interface IFineTuningClient string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Resume a fine-tune job. + /// + /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ResumeFineTuningAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs index 73cdfb1c..b6f31986 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RetrieveFineTuningJob.g.cs @@ -18,5 +18,19 @@ public partial interface IFineTuningClient string fineTuningJobId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get info about a fine-tuning job.
+ /// [Learn more about fine-tuning](/docs/guides/model-optimization) + ///
+ /// + /// Example: ft-AF1WoRqd3aJAHsqc9NY7iL8F + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveFineTuningJobAsResponseAsync( + string fineTuningJobId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RunGrader.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RunGrader.g.cs index c7c23e23..a7ded80b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RunGrader.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.RunGrader.g.cs @@ -19,6 +19,18 @@ public partial interface IFineTuningClient /// /// Run a grader. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RunGraderAsResponseAsync( + + global::tryAGI.OpenAI.RunGraderRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Run a grader. + /// /// /// The grader used for the fine-tuning job. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ValidateGrader.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ValidateGrader.g.cs index 0899472f..ff69a6cd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ValidateGrader.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IFineTuningClient.ValidateGrader.g.cs @@ -19,6 +19,18 @@ public partial interface IFineTuningClient /// /// Validate a grader. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ValidateGraderAsResponseAsync( + + global::tryAGI.OpenAI.ValidateGraderRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Validate a grader. + /// /// /// The grader used for the fine-tuning job. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs index 43379018..096713c4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.AssignOrganizationRoleToGroup.g.cs @@ -22,6 +22,20 @@ public partial interface IGroupOrganizationRoleAssignmentsClient /// Assigns an organization role to a group within the organization. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AssignOrganizationRoleToGroupAsResponseAsync( + string groupId, + + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Assigns an organization role to a group within the organization. + /// + /// /// /// Identifier of the role to assign. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs index 9069508d..5fcedb27 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.ListGroupOrganizationRoleAssignments.g.cs @@ -21,5 +21,22 @@ public partial interface IGroupOrganizationRoleAssignmentsClient global::tryAGI.OpenAI.ListGroupRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the organization roles assigned to a group within the organization. + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListGroupOrganizationRoleAssignmentsAsResponseAsync( + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs index bfe43ced..066a036f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromGroup.g.cs @@ -17,5 +17,18 @@ public partial interface IGroupOrganizationRoleAssignmentsClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Unassigns an organization role from a group within the organization. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UnassignOrganizationRoleFromGroupAsResponseAsync( + string groupId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.AddGroupUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.AddGroupUser.g.cs index 99e2d7bf..feddc8c6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.AddGroupUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.AddGroupUser.g.cs @@ -22,6 +22,20 @@ public partial interface IGroupUsersClient /// Adds a user to a group. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AddGroupUserAsResponseAsync( + string groupId, + + global::tryAGI.OpenAI.CreateGroupUserBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Adds a user to a group. + /// + /// /// /// Identifier of the user to add to the group. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.ListGroupUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.ListGroupUsers.g.cs index 0ab813ef..b78ca6d8 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.ListGroupUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.ListGroupUsers.g.cs @@ -25,5 +25,26 @@ public partial interface IGroupUsersClient global::tryAGI.OpenAI.ListGroupUsersOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the users assigned to a group. + /// + /// + /// + /// Default Value: 100 + /// + /// + /// + /// Default Value: desc + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListGroupUsersAsResponseAsync( + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupUsersOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.RemoveGroupUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.RemoveGroupUser.g.cs index 984ad51a..c3c5515a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.RemoveGroupUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupUsersClient.RemoveGroupUser.g.cs @@ -17,5 +17,18 @@ public partial interface IGroupUsersClient string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Removes a user from a group. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RemoveGroupUserAsResponseAsync( + string groupId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.CreateGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.CreateGroup.g.cs index 14629e3b..174f6934 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.CreateGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.CreateGroup.g.cs @@ -19,6 +19,18 @@ public partial interface IGroupsClient /// /// Creates a new group in the organization. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateGroupAsResponseAsync( + + global::tryAGI.OpenAI.CreateGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a new group in the organization. + /// /// /// Human readable name for the group. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.DeleteGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.DeleteGroup.g.cs index 9d96c3c3..4bb615c4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.DeleteGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.DeleteGroup.g.cs @@ -15,5 +15,16 @@ public partial interface IGroupsClient string groupId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a group from the organization. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteGroupAsResponseAsync( + string groupId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.ListGroups.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.ListGroups.g.cs index 1098ccdd..de6397fc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.ListGroups.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.ListGroups.g.cs @@ -23,5 +23,24 @@ public partial interface IGroupsClient global::tryAGI.OpenAI.ListGroupsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists all groups in the organization. + /// + /// + /// Default Value: 100 + /// + /// + /// + /// Default Value: asc + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListGroupsAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListGroupsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.UpdateGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.UpdateGroup.g.cs index 1d94dbc1..75584074 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.UpdateGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IGroupsClient.UpdateGroup.g.cs @@ -22,6 +22,20 @@ public partial interface IGroupsClient /// Updates a group's information. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateGroupAsResponseAsync( + string groupId, + + global::tryAGI.OpenAI.UpdateGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Updates a group's information. + /// + /// /// /// New display name for the group. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImage.g.cs index 0baf960c..d0f47ddb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImage.g.cs @@ -19,6 +19,18 @@ public partial interface IImagesClient /// /// Creates an image given a prompt. [Learn more](/docs/guides/images). /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageAsResponseAsync( + + global::tryAGI.OpenAI.CreateImageRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an image given a prompt. [Learn more](/docs/guides/images). + /// /// /// A text description of the desired image(s). The maximum length is 32000 characters for the GPT image models, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.
/// Example: A cute baby sea otter diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEdit.g.cs index d16e0b95..a655f1ab 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEdit.g.cs @@ -27,6 +27,22 @@ public partial interface IImagesClient /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
/// Note that JSON requests use `images` (array) instead of the multipart `image` field. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageEditAsResponseAsync( + + global::tryAGI.OpenAI.CreateImageEditRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
/// /// The image(s) to edit. Must be a supported image file or an array of images.
/// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
@@ -120,5 +136,206 @@ public partial interface IImagesClient global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateImageEditAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageEditAsResponseAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEditAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEditAsStream.g.cs index 34e64529..2862ba51 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEditAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageEditAsStream.g.cs @@ -120,5 +120,106 @@ public partial interface IImagesClient global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable CreateImageEditAsStreamAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageVariation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageVariation.g.cs index f255ff2f..af5e1e01 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageVariation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IImagesClient.CreateImageVariation.g.cs @@ -19,6 +19,18 @@ public partial interface IImagesClient /// /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageVariationAsResponseAsync( + + global::tryAGI.OpenAI.CreateImageVariationRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /// /// /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. /// @@ -62,5 +74,98 @@ public partial interface IImagesClient string? user = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The model to use for image generation. Only `dall-e-2` is supported at this time.
+ /// Default Value: dall-e-2
+ /// Example: dall-e-2 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
+ /// Default Value: url
+ /// Example: url + /// + /// + /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateImageVariationAsync( + global::System.IO.Stream image, + string imagename, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageVariationRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageVariationRequestSize? size = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The model to use for image generation. Only `dall-e-2` is supported at this time.
+ /// Default Value: dall-e-2
+ /// Example: dall-e-2 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
+ /// Default Value: url
+ /// Example: url + /// + /// + /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateImageVariationAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageVariationRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageVariationRequestSize? size = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.CreateInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.CreateInvite.g.cs index 2340121d..9a20f1cd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.CreateInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.CreateInvite.g.cs @@ -19,6 +19,18 @@ public partial interface IInvitesClient /// /// Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateInviteAsResponseAsync( + + global::tryAGI.OpenAI.InviteRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + /// /// /// Send an email to this address /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs index e8d546ad..2c947811 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.DeleteInvite.g.cs @@ -15,5 +15,16 @@ public partial interface IInvitesClient string inviteId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an invite. If the invite has already been accepted, it cannot be deleted. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteInviteAsResponseAsync( + string inviteId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs index 8a940b5c..ef9eb21d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.ListInvites.g.cs @@ -19,5 +19,20 @@ public partial interface IInvitesClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of invites in the organization. + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListInvitesAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs index 87d02772..6f9f0711 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IInvitesClient.RetrieveInvite.g.cs @@ -15,5 +15,16 @@ public partial interface IInvitesClient string inviteId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves an invite. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveInviteAsResponseAsync( + string inviteId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.DeleteAFineTunedModel.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.DeleteAFineTunedModel.g.cs index 070e16d0..02e772ed 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.DeleteAFineTunedModel.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.DeleteAFineTunedModel.g.cs @@ -17,5 +17,18 @@ public partial interface IModelsClient string model, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. + /// + /// + /// Example: ft:gpt-4o-mini:acemeco:suffix:abc123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAFineTunedModelAsResponseAsync( + string model, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.ListModels.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.ListModels.g.cs index 36031e2a..f3b20f1e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.ListModels.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.ListModels.g.cs @@ -13,5 +13,14 @@ public partial interface IModelsClient global::System.Threading.Tasks.Task ListModelsAsync( global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the currently available models, and provides basic information about each one such as the owner and availability. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListModelsAsResponseAsync( + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs index b8bcb8b4..67fa12b2 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModelsClient.RetrieveModel.g.cs @@ -17,5 +17,18 @@ public partial interface IModelsClient string model, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a model instance, providing basic information about the model such as the owner and permissioning. + /// + /// + /// Example: gpt-4o-mini + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveModelAsResponseAsync( + string model, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModerationsClient.CreateModeration.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModerationsClient.CreateModeration.g.cs index 5dfe9a3d..ebef05c0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModerationsClient.CreateModeration.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IModerationsClient.CreateModeration.g.cs @@ -21,6 +21,19 @@ public partial interface IModerationsClient /// Classifies if text and/or image inputs are potentially harmful. Learn
/// more in the [moderation guide](/docs/guides/moderation). /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateModerationAsResponseAsync( + + global::tryAGI.OpenAI.CreateModerationRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Classifies if text and/or image inputs are potentially harmful. Learn
+ /// more in the [moderation guide](/docs/guides/moderation). + ///
/// /// Input (or inputs) to classify. Can be a single string, an array of strings, or
/// an array of multi-modal input objects similar to other models. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CancelChatSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CancelChatSession.g.cs index a520d22a..b2eae926 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CancelChatSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CancelChatSession.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string sessionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancel an active ChatKit session and return its most recent metadata.
+ /// Cancelling prevents new requests from using the issued client secret. + ///
+ /// + /// Example: cksess_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelChatSessionAsResponseAsync( + string sessionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CompactAResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CompactAResponse.g.cs index 4ce8c3a7..558622d9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CompactAResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CompactAResponse.g.cs @@ -21,6 +21,19 @@ public partial interface IOpenAiClient /// Compact a conversation. Returns a compacted response object.
/// Learn when and how to compact long-running conversations in the [conversation state guide](/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](/docs/guides/conversation-state#compaction-advanced). /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CompactAResponseAsResponseAsync( + + global::tryAGI.OpenAI.CompactResponseMethodPublicBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Compact a conversation. Returns a compacted response object.
+ /// Learn when and how to compact long-running conversations in the [conversation state guide](/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](/docs/guides/conversation-state#compaction-advanced). + ///
/// /// Model ID used to generate the response, like `gpt-5` or `o3`. OpenAI offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the [model guide](/docs/models) to browse and compare available models. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateAdminApiKey.g.cs index 8f23aa9d..28230639 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateAdminApiKey.g.cs @@ -21,6 +21,19 @@ public partial interface IOpenAiClient /// Create an organization admin API key
/// Create a new admin-level API key for the organization. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateAdminApiKeyAsResponseAsync( + + global::tryAGI.OpenAI.AdminApiKeysCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an organization admin API key
+ /// Create a new admin-level API key for the organization. + ///
/// /// Example: New Admin Key /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateChatKitSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateChatKitSession.g.cs index 7fb0d566..2b472486 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateChatKitSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateChatKitSession.g.cs @@ -19,6 +19,18 @@ public partial interface IOpenAiClient /// /// Create a ChatKit session. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateChatKitSessionAsResponseAsync( + + global::tryAGI.OpenAI.CreateChatSessionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a ChatKit session. + /// /// /// Workflow that powers the session. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainer.g.cs index 18d67034..0a8535c3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainer.g.cs @@ -21,6 +21,19 @@ public partial interface IOpenAiClient /// Create Container
/// Creates a container. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateContainerAsResponseAsync( + + global::tryAGI.OpenAI.CreateContainerBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create Container
+ /// Creates a container. + ///
/// /// Name of the container to create. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainerFile.g.cs index 12f53d16..89e49d7f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.CreateContainerFile.g.cs @@ -26,6 +26,22 @@ public partial interface IOpenAiClient /// Creates a container file. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateContainerFileAsResponseAsync( + string containerId, + + global::tryAGI.OpenAI.CreateContainerFileBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a Container File
+ /// You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
+ /// Creates a container file. + ///
+ /// /// /// Name of the file to create. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainer.g.cs index 7adf5d20..577b241e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainer.g.cs @@ -16,5 +16,17 @@ public partial interface IOpenAiClient string containerId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete Container
+ /// Delete a container. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAContainerAsResponseAsync( + string containerId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainerFile.g.cs index b5e167b6..6eff7dc3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAContainerFile.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete Container File
+ /// Delete a container file. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAContainerFileAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAdminApiKey.g.cs index 2a47a3f6..792dc8d4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteAdminApiKey.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string keyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an organization admin API key
+ /// Delete the specified admin API key. + ///
+ /// + /// The ID of the API key to be deleted. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteAdminApiKeyAsResponseAsync( + string keyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteChatKitThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteChatKitThread.g.cs index 3eafa9e2..4c6bc7a1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteChatKitThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.DeleteChatKitThread.g.cs @@ -17,5 +17,18 @@ public partial interface IOpenAiClient string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a ChatKit thread along with its items and stored attachments. + /// + /// + /// Example: cthr_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteChatKitThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.GetInputTokenCounts.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.GetInputTokenCounts.g.cs index 5e5c45af..206baad7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.GetInputTokenCounts.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.GetInputTokenCounts.g.cs @@ -21,6 +21,19 @@ public partial interface IOpenAiClient /// Returns input token counts of the request.
/// Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetInputTokenCountsAsResponseAsync( + + global::tryAGI.OpenAI.TokenCountsBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns input token counts of the request.
+ /// Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count. + ///
/// /// /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs index 05d6590a..aadfc040 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs @@ -28,5 +28,29 @@ public partial interface IOpenAiClient int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List organization API keys
+ /// Retrieve a paginated list of organization admin API keys. + ///
+ /// + /// Return keys with IDs that come after this ID in the pagination order. + /// + /// + /// Order results by creation time, ascending or descending.
+ /// Default Value: asc + /// + /// + /// Maximum number of keys to return.
+ /// Default Value: 20 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListAllOrganizationAndProjectApiKeysAsResponseAsync( + string? after = default, + global::tryAGI.OpenAI.AdminApiKeysListOrder? order = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreadItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreadItems.g.cs index b24cf408..2a969171 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreadItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreadItems.g.cs @@ -29,5 +29,30 @@ public partial interface IOpenAiClient string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List items that belong to a ChatKit thread. + /// + /// + /// Example: cthr_123 + /// + /// + /// + /// + /// List items created after this thread item ID. Defaults to null for the first page. + /// + /// + /// List items created before this thread item ID. Defaults to null for the newest results. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListChatKitThreadItemsAsResponseAsync( + string threadId, + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreads.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreads.g.cs index 248817c9..b8c3307e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreads.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListChatKitThreads.g.cs @@ -29,5 +29,30 @@ public partial interface IOpenAiClient string? user = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List ChatKit threads with optional pagination and user filters. + /// + /// + /// + /// + /// List items created after this thread item ID. Defaults to null for the first page. + /// + /// + /// List items created before this thread item ID. Defaults to null for the newest results. + /// + /// + /// Filter threads that belong to this user identifier. Defaults to null to return all users. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListChatKitThreadsAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + string? before = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs index 5824eb10..594b104c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainerFiles.g.cs @@ -26,5 +26,27 @@ public partial interface IOpenAiClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Container files
+ /// Lists container files. + ///
+ /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListContainerFilesAsResponseAsync( + string containerId, + int? limit = default, + global::tryAGI.OpenAI.ListContainerFilesOrder? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs index 559948e4..49dba0bf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.ListContainers.g.cs @@ -26,5 +26,27 @@ public partial interface IOpenAiClient string? name = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List Containers
+ /// Lists containers. + ///
+ /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListContainersAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.ListContainersOrder? order = default, + string? after = default, + string? name = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveAdminApiKey.g.cs index 885b2563..00018504 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveAdminApiKey.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string keyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve a single organization API key
+ /// Get details for a specific organization API key by its ID. + ///
+ /// + /// The ID of the API key. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveAdminApiKeyAsResponseAsync( + string keyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveChatKitThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveChatKitThread.g.cs index 5ddb5c7f..11ac9d33 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveChatKitThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveChatKitThread.g.cs @@ -17,5 +17,18 @@ public partial interface IOpenAiClient string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve a ChatKit thread by its identifier. + /// + /// + /// Example: cthr_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveChatKitThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs index 92b11c76..e180f931 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainer.g.cs @@ -16,5 +16,17 @@ public partial interface IOpenAiClient string containerId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve Container
+ /// Retrieves a container. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveContainerAsResponseAsync( + string containerId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs index 7dbcebd1..478c095e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFile.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve Container File
+ /// Retrieves a container file. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveContainerFileAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs index 8a89f1a0..0182a29a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IOpenAiClient.RetrieveContainerFileContent.g.cs @@ -18,5 +18,19 @@ public partial interface IOpenAiClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve Container File Content
+ /// Retrieves a container file content. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task RetrieveContainerFileContentAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs index f8a3c5b0..fcd00c3a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs @@ -25,6 +25,22 @@ public partial interface IProjectGroupRoleAssignmentsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AssignProjectRoleToGroupAsResponseAsync( + string projectId, + string groupId, + + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Assigns a project role to a group within a project. + /// + /// + /// /// /// Identifier of the role to assign. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs index 209d4b28..3cde8cdf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs @@ -23,5 +23,24 @@ public partial interface IProjectGroupRoleAssignmentsClient global::tryAGI.OpenAI.ListProjectGroupRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the project roles assigned to a group within a project. + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectGroupRoleAssignmentsAsResponseAsync( + string projectId, + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectGroupRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs index 01d8da8f..9a521b28 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs @@ -19,5 +19,20 @@ public partial interface IProjectGroupRoleAssignmentsClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Unassigns a project role from a group within a project. + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UnassignProjectRoleFromGroupAsResponseAsync( + string projectId, + string groupId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.AddProjectGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.AddProjectGroup.g.cs index 50f3e48b..bcb6e0fe 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.AddProjectGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.AddProjectGroup.g.cs @@ -22,6 +22,20 @@ public partial interface IProjectGroupsClient /// Grants a group access to a project. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AddProjectGroupAsResponseAsync( + string projectId, + + global::tryAGI.OpenAI.InviteProjectGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Grants a group access to a project. + /// + /// /// /// Identifier of the group to add to the project. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.ListProjectGroups.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.ListProjectGroups.g.cs index 330d6bdc..3561cb58 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.ListProjectGroups.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.ListProjectGroups.g.cs @@ -25,5 +25,26 @@ public partial interface IProjectGroupsClient global::tryAGI.OpenAI.ListProjectGroupsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the groups that have access to a project. + /// + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListProjectGroupsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectGroupsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.RemoveProjectGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.RemoveProjectGroup.g.cs index 1bfca0f8..4c8dc98c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.RemoveProjectGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectGroupsClient.RemoveProjectGroup.g.cs @@ -17,5 +17,18 @@ public partial interface IProjectGroupsClient string groupId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Revokes a group's access to a project. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RemoveProjectGroupAsResponseAsync( + string projectId, + string groupId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs index 50b512eb..3a30baae 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs @@ -25,6 +25,22 @@ public partial interface IProjectUserRoleAssignmentsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AssignProjectRoleToUserAsResponseAsync( + string projectId, + string userId, + + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Assigns a project role to a user within a project. + /// + /// + /// /// /// Identifier of the role to assign. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs index c3c3174d..ea2644d1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs @@ -23,5 +23,24 @@ public partial interface IProjectUserRoleAssignmentsClient global::tryAGI.OpenAI.ListProjectUserRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the project roles assigned to a user within a project. + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectUserRoleAssignmentsAsResponseAsync( + string projectId, + string userId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectUserRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs index f1af0c39..b15aabfe 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs @@ -19,5 +19,20 @@ public partial interface IProjectUserRoleAssignmentsClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Unassigns a project role from a user within a project. + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UnassignProjectRoleFromUserAsResponseAsync( + string projectId, + string userId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs index 5a1e1f7b..914a5b8e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ArchiveProject.g.cs @@ -15,5 +15,16 @@ public partial interface IProjectsClient string projectId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Archives a project in the organization. Archived projects cannot be used or updated. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ArchiveProjectAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProject.g.cs index ac2f6ddb..26123b3f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProject.g.cs @@ -19,6 +19,18 @@ public partial interface IProjectsClient /// /// Create a new project in the organization. Projects can be created and archived, but cannot be deleted. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateProjectAsResponseAsync( + + global::tryAGI.OpenAI.ProjectCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new project in the organization. Projects can be created and archived, but cannot be deleted. + /// /// /// The friendly name of the project, this name appears in reports. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectServiceAccount.g.cs index beb2cc0a..8a2b1da9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectServiceAccount.g.cs @@ -22,6 +22,20 @@ public partial interface IProjectsClient /// Creates a new service account in the project. This also returns an unredacted API key for the service account. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateProjectServiceAccountAsResponseAsync( + string projectId, + + global::tryAGI.OpenAI.ProjectServiceAccountCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a new service account in the project. This also returns an unredacted API key for the service account. + /// + /// /// /// The name of the service account being created. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectUser.g.cs index f7ebc0da..822536fd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.CreateProjectUser.g.cs @@ -22,6 +22,20 @@ public partial interface IProjectsClient /// Adds a user to the project. Users must already be members of the organization to be added to a project. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateProjectUserAsResponseAsync( + string projectId, + + global::tryAGI.OpenAI.ProjectUserCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Adds a user to the project. Users must already be members of the organization to be added to a project. + /// + /// /// /// The ID of the user. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs index 44c02209..f5b19943 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectApiKey.g.cs @@ -19,5 +19,20 @@ public partial interface IProjectsClient string apiKeyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes an API key from the project.
+ /// Returns confirmation of the key deletion, or an error if the key belonged to
+ /// a service account. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteProjectApiKeyAsResponseAsync( + string projectId, + string apiKeyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs index bd97b8a9..0c241230 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectServiceAccount.g.cs @@ -19,5 +19,20 @@ public partial interface IProjectsClient string serviceAccountId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a service account from the project.
+ /// Returns confirmation of service account deletion, or an error if the project
+ /// is archived (archived projects have no service accounts). + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteProjectServiceAccountAsResponseAsync( + string projectId, + string serviceAccountId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs index 514221ac..bc1b9a44 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.DeleteProjectUser.g.cs @@ -19,5 +19,20 @@ public partial interface IProjectsClient string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a user from the project.
+ /// Returns confirmation of project user deletion, or an error if the project is
+ /// archived (archived projects have no users). + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteProjectUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs index 5c95dd2d..88760b32 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectApiKeys.g.cs @@ -21,5 +21,22 @@ public partial interface IProjectsClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of API keys in the project. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectApiKeysAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs index 79687a8d..7d48c926 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectRateLimits.g.cs @@ -23,5 +23,24 @@ public partial interface IProjectsClient string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns the rate limits per model for a project. + /// + /// + /// + /// Default Value: 100 + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectRateLimitsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs index b268e251..116cbf9d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectServiceAccounts.g.cs @@ -21,5 +21,22 @@ public partial interface IProjectsClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of service accounts in the project. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectServiceAccountsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs index 486bb39f..225c44b4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjectUsers.g.cs @@ -21,5 +21,22 @@ public partial interface IProjectsClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of users in the project. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectUsersAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs index 01b82508..962ec134 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ListProjects.g.cs @@ -23,5 +23,24 @@ public partial interface IProjectsClient bool? includeArchived = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of projects. + /// + /// + /// Default Value: 20 + /// + /// + /// + /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectsAsResponseAsync( + int? limit = default, + string? after = default, + bool? includeArchived = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProject.g.cs index 6907634f..c327152e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProject.g.cs @@ -22,6 +22,20 @@ public partial interface IProjectsClient /// Modifies a project in the organization. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModifyProjectAsResponseAsync( + string projectId, + + global::tryAGI.OpenAI.ProjectUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modifies a project in the organization. + /// + /// /// /// The updated name of the project, this name appears in reports. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectRateLimit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectRateLimit.g.cs index fb472032..3540cdc8 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectRateLimit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectRateLimit.g.cs @@ -25,6 +25,22 @@ public partial interface IProjectsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModifyProjectRateLimitAsResponseAsync( + string projectId, + string rateLimitId, + + global::tryAGI.OpenAI.ProjectRateLimitUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Updates a project rate limit. + /// + /// + /// /// /// The maximum requests per minute. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectUser.g.cs index 0518110d..a5eae8ed 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.ModifyProjectUser.g.cs @@ -25,6 +25,22 @@ public partial interface IProjectsClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModifyProjectUserAsResponseAsync( + string projectId, + string userId, + + global::tryAGI.OpenAI.ProjectUserUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modifies a user's role in the project. + /// + /// + /// /// /// `owner` or `member` /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs index 6201354c..c2c48867 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProject.g.cs @@ -15,5 +15,16 @@ public partial interface IProjectsClient string projectId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a project. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveProjectAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs index c73a2071..4413d2d5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectApiKey.g.cs @@ -17,5 +17,18 @@ public partial interface IProjectsClient string apiKeyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves an API key in the project. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveProjectApiKeyAsResponseAsync( + string projectId, + string apiKeyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs index 8084e897..74669ce3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectServiceAccount.g.cs @@ -17,5 +17,18 @@ public partial interface IProjectsClient string serviceAccountId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a service account in the project. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveProjectServiceAccountAsResponseAsync( + string projectId, + string serviceAccountId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs index 081da6f5..e73df7de 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IProjectsClient.RetrieveProjectUser.g.cs @@ -17,5 +17,18 @@ public partial interface IProjectsClient string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a user in the project. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveProjectUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.AcceptCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.AcceptCall.g.cs index f50dddb4..e27736e2 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.AcceptCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.AcceptCall.g.cs @@ -24,6 +24,21 @@ public partial interface IRealtimeClient /// handle it. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task AcceptCallAsResponseAsync( + string callId, + + global::tryAGI.OpenAI.RealtimeSessionCreateRequestGA request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Accept an incoming SIP call and configure the realtime session that will
+ /// handle it. + ///
+ /// /// /// The type of session to create. Always `realtime` for the Realtime API. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateClientSecret.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateClientSecret.g.cs index 13e20236..5aa2697b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateClientSecret.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateClientSecret.g.cs @@ -35,6 +35,26 @@ public partial interface IRealtimeClient /// [Learn more about authentication with client secrets over WebRTC](/docs/guides/realtime-webrtc).
/// Returns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateClientSecretAsResponseAsync( + + global::tryAGI.OpenAI.RealtimeCreateClientSecretRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a Realtime client secret with an associated session configuration.
+ /// Client secrets are short-lived tokens that can be passed to a client app,
+ /// such as a web frontend or mobile client, which grants access to the Realtime API without
+ /// leaking your main API key. You can configure a custom TTL for each client secret.
+ /// You can also attach session configuration options to the client secret, which will be
+ /// applied to any sessions created using that client secret, but these can also be overridden
+ /// by the client connection.
+ /// [Learn more about authentication with client secrets over WebRTC](/docs/guides/realtime-webrtc).
+ /// Returns the created client secret and the effective session object. The client secret is a string that looks like `ek_1234`. + ///
/// /// Configuration for the client secret expiration. Expiration refers to the time after which
/// a client secret will no longer be valid for creating sessions. The session itself may
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateSession.g.cs index b5e1c429..b2f308d9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateSession.g.cs @@ -31,6 +31,24 @@ public partial interface IRealtimeClient /// for the Realtime API.
/// Returns the created Realtime session object, plus an ephemeral key. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSessionAsResponseAsync( + + global::tryAGI.OpenAI.RealtimeSessionCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an ephemeral API token for use in client-side applications with the
+ /// Realtime API. Can be configured with the same session parameters as the
+ /// `session.update` client event.
+ /// It responds with a session object, plus a `client_secret` key which contains
+ /// a usable ephemeral API token that can be used to authenticate browser clients
+ /// for the Realtime API.
+ /// Returns the created Realtime session object, plus an ephemeral key. + ///
/// /// Ephemeral key returned by the API. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateTranscriptionSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateTranscriptionSession.g.cs index 4a53fdea..82674f9c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateTranscriptionSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.CreateTranscriptionSession.g.cs @@ -31,6 +31,24 @@ public partial interface IRealtimeClient /// for the Realtime API.
/// Returns the created Realtime transcription session object, plus an ephemeral key. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateTranscriptionSessionAsResponseAsync( + + global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an ephemeral API token for use in client-side applications with the
+ /// Realtime API specifically for realtime transcriptions.
+ /// Can be configured with the same session parameters as the `transcription_session.update` client event.
+ /// It responds with a session object, plus a `client_secret` key which contains
+ /// a usable ephemeral API token that can be used to authenticate browser clients
+ /// for the Realtime API.
+ /// Returns the created Realtime transcription session object, plus an ephemeral key. + ///
/// /// Configuration for turn detection. Can be set to `null` to turn off. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.HangUpCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.HangUpCall.g.cs index 5204c084..62231856 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.HangUpCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.HangUpCall.g.cs @@ -16,5 +16,17 @@ public partial interface IRealtimeClient string callId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// End an active Realtime API call, whether it was initiated over SIP or
+ /// WebRTC. + ///
+ /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task HangUpCallAsResponseAsync( + string callId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.ReferCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.ReferCall.g.cs index 61f1cd95..5302af4c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.ReferCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.ReferCall.g.cs @@ -22,6 +22,20 @@ public partial interface IRealtimeClient /// Transfer an active SIP call to a new destination using the SIP REFER verb. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ReferCallAsResponseAsync( + string callId, + + global::tryAGI.OpenAI.RealtimeCallReferRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Transfer an active SIP call to a new destination using the SIP REFER verb. + /// + /// /// /// URI that should appear in the SIP Refer-To header. Supports values like
/// `tel:+14155550123` or `sip:agent@example.com`.
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.RejectCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.RejectCall.g.cs index fcbf3605..b957d2d7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.RejectCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRealtimeClient.RejectCall.g.cs @@ -22,6 +22,20 @@ public partial interface IRealtimeClient /// Decline an incoming SIP call by returning a SIP status code to the caller. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task RejectCallAsResponseAsync( + string callId, + + global::tryAGI.OpenAI.RealtimeCallRejectRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Decline an incoming SIP call by returning a SIP status code to the caller. + /// + /// /// /// SIP response code to send back to the caller. Defaults to `603` (Decline)
/// when omitted.
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CancelAResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CancelAResponse.g.cs index 2715284f..96b20318 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CancelAResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CancelAResponse.g.cs @@ -19,5 +19,20 @@ public partial interface IResponsesClient string responseId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancels a model response with the given ID. Only responses created with
+ /// the `background` parameter set to `true` can be cancelled.
+ /// [Learn more](/docs/guides/background). + ///
+ /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelAResponseAsResponseAsync( + string responseId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CreateAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CreateAModelResponse.g.cs index d1349a3f..5a717ef6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CreateAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.CreateAModelResponse.g.cs @@ -31,6 +31,24 @@ public partial interface IResponsesClient /// or [file search](/docs/guides/tools-file-search) to use your own data
/// as input for the model's response. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateAModelResponseAsResponseAsync( + + global::tryAGI.OpenAI.CreateResponse request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a model response. Provide [text](/docs/guides/text) or
+ /// [image](/docs/guides/images) inputs to generate [text](/docs/guides/text)
+ /// or [JSON](/docs/guides/structured-outputs) outputs. Have the model call
+ /// your own [custom code](/docs/guides/function-calling) or use built-in
+ /// [tools](/docs/guides/tools) like [web search](/docs/guides/tools-web-search)
+ /// or [file search](/docs/guides/tools-file-search) to use your own data
+ /// as input for the model's response. + ///
/// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.DeleteAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.DeleteAModelResponse.g.cs index e5461afa..fd3124bf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.DeleteAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.DeleteAModelResponse.g.cs @@ -17,5 +17,18 @@ public partial interface IResponsesClient string responseId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a model response with the given ID. + /// + /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteAModelResponseAsResponseAsync( + string responseId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.GetAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.GetAModelResponse.g.cs index a1507996..9ed777f6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.GetAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.GetAModelResponse.g.cs @@ -25,5 +25,26 @@ public partial interface IResponsesClient bool? includeObfuscation = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a model response with the given ID. + /// + /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetAModelResponseAsResponseAsync( + string responseId, + global::System.Collections.Generic.IList? include = default, + bool? stream = default, + int? startingAfter = default, + bool? includeObfuscation = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs index a96b1840..448366e4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IResponsesClient.ListInputItems.g.cs @@ -25,5 +25,26 @@ public partial interface IResponsesClient global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of input items for a given response. + /// + /// + /// + /// Default Value: 20 + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListInputItemsAsResponseAsync( + string responseId, + int? limit = default, + global::tryAGI.OpenAI.ListInputItemsOrder? order = default, + string? after = default, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateOrganizationRole.g.cs index d807301d..aa46c477 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateOrganizationRole.g.cs @@ -19,6 +19,18 @@ public partial interface IRolesClient /// /// Creates a custom role for the organization. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateOrganizationRoleAsResponseAsync( + + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a custom role for the organization. + /// /// /// Unique name for the role. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateProjectRole.g.cs index 142ac112..7cc8b885 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.CreateProjectRole.g.cs @@ -22,6 +22,20 @@ public partial interface IRolesClient /// Creates a custom role for a project. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateProjectRoleAsResponseAsync( + string projectId, + + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates a custom role for a project. + /// + /// /// /// Unique name for the role. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteOrganizationRole.g.cs index b953f4c7..ddfb0226 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteOrganizationRole.g.cs @@ -15,5 +15,16 @@ public partial interface IRolesClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a custom role from the organization. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteOrganizationRoleAsResponseAsync( + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteProjectRole.g.cs index 17d709d6..f9fee3c5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.DeleteProjectRole.g.cs @@ -17,5 +17,18 @@ public partial interface IRolesClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a custom role from a project. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteProjectRoleAsResponseAsync( + string projectId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListOrganizationRoles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListOrganizationRoles.g.cs index c1af1251..125226de 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListOrganizationRoles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListOrganizationRoles.g.cs @@ -23,5 +23,24 @@ public partial interface IRolesClient global::tryAGI.OpenAI.ListRolesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the roles configured for the organization. + /// + /// + /// Default Value: 1000 + /// + /// + /// + /// Default Value: asc + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListOrganizationRolesAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListRolesOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListProjectRoles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListProjectRoles.g.cs index 34efac81..1ba130fd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListProjectRoles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.ListProjectRoles.g.cs @@ -25,5 +25,26 @@ public partial interface IRolesClient global::tryAGI.OpenAI.ListProjectRolesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the roles configured for a project. + /// + /// + /// + /// Default Value: 1000 + /// + /// + /// + /// Default Value: asc + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListProjectRolesAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectRolesOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateOrganizationRole.g.cs index f2acddf9..513c43f5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateOrganizationRole.g.cs @@ -22,6 +22,20 @@ public partial interface IRolesClient /// Updates an existing organization role. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateOrganizationRoleAsResponseAsync( + string roleId, + + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Updates an existing organization role. + /// + /// /// /// Updated set of permissions for the role. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateProjectRole.g.cs index b1033aa5..4e40bcb0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IRolesClient.UpdateProjectRole.g.cs @@ -25,6 +25,22 @@ public partial interface IRolesClient /// /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateProjectRoleAsResponseAsync( + string projectId, + string roleId, + + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Updates an existing project role. + /// + /// + /// /// /// Updated set of permissions for the role. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkill.g.cs index fe333672..3458aabb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkill.g.cs @@ -19,6 +19,18 @@ public partial interface ISkillsClient /// /// Create a new skill. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSkillAsResponseAsync( + + global::tryAGI.OpenAI.CreateSkillBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new skill. + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkillVersion.g.cs index 5bb9f40a..c1e08a5f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.CreateSkillVersion.g.cs @@ -26,6 +26,22 @@ public partial interface ISkillsClient /// /// Example: skill_123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSkillVersionAsResponseAsync( + string skillId, + + global::tryAGI.OpenAI.CreateSkillVersionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new immutable skill version. + /// + /// + /// Example: skill_123 + /// /// /// /// Whether to set this version as the default. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkill.g.cs index 5af35aac..efd4b258 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkill.g.cs @@ -17,5 +17,18 @@ public partial interface ISkillsClient string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a skill by its ID. + /// + /// + /// Example: skill_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteSkillAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkillVersion.g.cs index bb42a2a9..1cfa8bd0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.DeleteSkillVersion.g.cs @@ -21,5 +21,22 @@ public partial interface ISkillsClient string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a skill version. + /// + /// + /// Example: skill_123 + /// + /// + /// The skill version number. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteSkillVersionAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkill.g.cs index d4496db7..19ca9ff6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkill.g.cs @@ -17,5 +17,18 @@ public partial interface ISkillsClient string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a skill by its ID. + /// + /// + /// Example: skill_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSkillAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillContent.g.cs index f4cf62a2..2b9fe6e6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillContent.g.cs @@ -17,5 +17,18 @@ public partial interface ISkillsClient string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Download a skill zip bundle by its ID. + /// + /// + /// Example: skill_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSkillContentAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersion.g.cs index c4eb1852..b4133572 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersion.g.cs @@ -21,5 +21,22 @@ public partial interface ISkillsClient string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a specific skill version. + /// + /// + /// Example: skill_123 + /// + /// + /// The version number to retrieve. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSkillVersionAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersionContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersionContent.g.cs index 499f4c09..a34de729 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersionContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.GetSkillVersionContent.g.cs @@ -21,5 +21,22 @@ public partial interface ISkillsClient string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Download a skill version zip bundle. + /// + /// + /// Example: skill_123 + /// + /// + /// The skill version number. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSkillVersionContentAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkillVersions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkillVersions.g.cs index 5016dc65..08127565 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkillVersions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkillVersions.g.cs @@ -25,5 +25,26 @@ public partial interface ISkillsClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List skill versions for a skill. + /// + /// + /// Example: skill_123 + /// + /// + /// + /// + /// Example: skillver_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListSkillVersionsAsResponseAsync( + string skillId, + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkills.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkills.g.cs index 34eb5353..b93d1d39 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkills.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.ListSkills.g.cs @@ -21,5 +21,22 @@ public partial interface ISkillsClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List all skills for the current project. + /// + /// + /// + /// + /// Identifier for the last item from the previous pagination request + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListSkillsAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.UpdateSkillDefaultVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.UpdateSkillDefaultVersion.g.cs index 8ce25001..7aa3b8ac 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.UpdateSkillDefaultVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ISkillsClient.UpdateSkillDefaultVersion.g.cs @@ -26,6 +26,22 @@ public partial interface ISkillsClient /// /// Example: skill_123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateSkillDefaultVersionAsResponseAsync( + string skillId, + + global::tryAGI.OpenAI.SetDefaultSkillVersionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update the default version pointer for a skill. + /// + /// + /// Example: skill_123 + /// /// /// The skill version number to set as default. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.AddUploadPart.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.AddUploadPart.g.cs index cbf56384..e84d0bde 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.AddUploadPart.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.AddUploadPart.g.cs @@ -30,6 +30,24 @@ public partial interface IUploadsClient /// /// Example: upload_abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AddUploadPartAsResponseAsync( + string uploadId, + + global::tryAGI.OpenAI.AddUploadPartRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// /// /// The chunk of bytes for this Part. /// @@ -45,5 +63,52 @@ public partial interface IUploadsClient string dataname, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// The chunk of bytes for this Part. + /// + /// + /// The chunk of bytes for this Part. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task AddUploadPartAsync( + string uploadId, + global::System.IO.Stream data, + string dataname, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// The chunk of bytes for this Part. + /// + /// + /// The chunk of bytes for this Part. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AddUploadPartAsResponseAsync( + string uploadId, + global::System.IO.Stream data, + string dataname, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs index 49db061c..c7c6630e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CancelUpload.g.cs @@ -18,5 +18,19 @@ public partial interface IUploadsClient string uploadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancels the Upload. No Parts may be added after an Upload is cancelled.
+ /// Returns the Upload object with status `cancelled`. + ///
+ /// + /// Example: upload_abc123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelUploadAsResponseAsync( + string uploadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CompleteUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CompleteUpload.g.cs index e9751181..649e8ae5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CompleteUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CompleteUpload.g.cs @@ -34,6 +34,26 @@ public partial interface IUploadsClient /// /// Example: upload_abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CompleteUploadAsResponseAsync( + string uploadId, + + global::tryAGI.OpenAI.CompleteUploadRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Completes the [Upload](/docs/api-reference/uploads/object).
+ /// Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
+ /// You can specify the order of the Parts by passing in an ordered list of the Part IDs.
+ /// The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
+ /// Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object. + ///
+ /// + /// Example: upload_abc123 + /// /// /// The ordered list of Part IDs. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CreateUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CreateUpload.g.cs index 8d948272..96ea6999 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CreateUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUploadsClient.CreateUpload.g.cs @@ -47,6 +47,32 @@ public partial interface IUploadsClient /// File](/docs/api-reference/files/create).
/// Returns the Upload object with status `pending`. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateUploadAsResponseAsync( + + global::tryAGI.OpenAI.CreateUploadRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object
+ /// that you can add [Parts](/docs/api-reference/uploads/part-object) to.
+ /// Currently, an Upload can accept at most 8 GB in total and expires after an
+ /// hour after you create it.
+ /// Once you complete the Upload, we will create a
+ /// [File](/docs/api-reference/files/object) object that contains all the parts
+ /// you uploaded. This File is usable in the rest of our platform as a regular
+ /// File object.
+ /// For certain `purpose` values, the correct `mime_type` must be specified.
+ /// Please refer to documentation for the
+ /// [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files).
+ /// For guidance on the proper filename extensions for each purpose, please
+ /// follow the documentation on [creating a
+ /// File](/docs/api-reference/files/create).
+ /// Returns the Upload object with status `pending`. + ///
/// /// The name of the file to upload. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioSpeeches.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioSpeeches.g.cs index 520f2ad7..7e15e443 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioSpeeches.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioSpeeches.g.cs @@ -35,5 +35,36 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get audio speeches usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AudioSpeechesAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageAudioSpeechesBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioTranscriptions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioTranscriptions.g.cs index 36640de3..203d431c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioTranscriptions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.AudioTranscriptions.g.cs @@ -35,5 +35,36 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get audio transcriptions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AudioTranscriptionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageAudioTranscriptionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.CodeInterpreterSessions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.CodeInterpreterSessions.g.cs index 94a50909..24630520 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.CodeInterpreterSessions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.CodeInterpreterSessions.g.cs @@ -29,5 +29,30 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get code interpreter sessions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CodeInterpreterSessionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCodeInterpreterSessionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Completions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Completions.g.cs index 9d9258e2..c47488c6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Completions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Completions.g.cs @@ -37,5 +37,38 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get completions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CompletionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCompletionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + bool? batch = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs index e1b0f081..86a42d5a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs @@ -33,5 +33,34 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get costs details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// Default Value: 7 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CostsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Embeddings.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Embeddings.g.cs index 63561c96..614bbe3c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Embeddings.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Embeddings.g.cs @@ -35,5 +35,36 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get embeddings usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> EmbeddingsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageEmbeddingsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Images.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Images.g.cs index 763f9699..675bdadc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Images.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Images.g.cs @@ -39,5 +39,40 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get images usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ImagesAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageImagesBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? sources = default, + global::System.Collections.Generic.IList? sizes = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Moderations.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Moderations.g.cs index c4ea84dd..6d63782f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Moderations.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Moderations.g.cs @@ -35,5 +35,36 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get moderations usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModerationsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageModerationsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.VectorStores.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.VectorStores.g.cs index 83c41e0d..5fe89ab4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.VectorStores.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.VectorStores.g.cs @@ -29,5 +29,30 @@ public partial interface IUsageClient string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get vector stores usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> VectorStoresAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageVectorStoresBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs index f8871b30..12357a09 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs @@ -22,6 +22,20 @@ public partial interface IUserOrganizationRoleAssignmentsClient /// Assigns an organization role to a user within the organization. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> AssignOrganizationRoleToUserAsResponseAsync( + string userId, + + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Assigns an organization role to a user within the organization. + /// + /// /// /// Identifier of the role to assign. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs index fae81065..adf7e403 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs @@ -21,5 +21,22 @@ public partial interface IUserOrganizationRoleAssignmentsClient global::tryAGI.OpenAI.ListUserRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists the organization roles assigned to a user within the organization. + /// + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListUserOrganizationRoleAssignmentsAsResponseAsync( + string userId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListUserRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs index da3cc076..b130a963 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs @@ -17,5 +17,18 @@ public partial interface IUserOrganizationRoleAssignmentsClient string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Unassigns an organization role from a user within the organization. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UnassignOrganizationRoleFromUserAsResponseAsync( + string userId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs index dea3a67d..1f9ad788 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.DeleteUser.g.cs @@ -15,5 +15,16 @@ public partial interface IUsersClient string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Deletes a user from the organization. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ListUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ListUsers.g.cs index 4f5a7115..f5c86a02 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ListUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ListUsers.g.cs @@ -21,5 +21,22 @@ public partial interface IUsersClient global::System.Collections.Generic.IList? emails = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Lists all of the users in the organization. + /// + /// + /// Default Value: 20 + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListUsersAsResponseAsync( + int? limit = default, + string? after = default, + global::System.Collections.Generic.IList? emails = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ModifyUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ModifyUser.g.cs index deafc878..8539908a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ModifyUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.ModifyUser.g.cs @@ -22,6 +22,20 @@ public partial interface IUsersClient /// Modifies a user's role in the organization. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModifyUserAsResponseAsync( + string userId, + + global::tryAGI.OpenAI.UserRoleUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modifies a user's role in the organization. + /// + /// /// /// `owner` or `reader` /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs index 13fc0ad2..b6bc7b56 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsersClient.RetrieveUser.g.cs @@ -15,5 +15,16 @@ public partial interface IUsersClient string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a user by their identifier. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs index ff7eda94..858e7b0c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CancelVectorStoreFileBatch.g.cs @@ -17,5 +17,18 @@ public partial interface IVectorStoresClient string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CancelVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStore.g.cs index a38b13bd..e339fe33 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStore.g.cs @@ -19,6 +19,18 @@ public partial interface IVectorStoresClient /// /// Create a vector store. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVectorStoreAsResponseAsync( + + global::tryAGI.OpenAI.CreateVectorStoreRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a vector store. + /// /// /// A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFile.g.cs index db1af890..7e87d9df 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFile.g.cs @@ -30,6 +30,24 @@ public partial interface IVectorStoresClient /// /// Example: vs_abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVectorStoreFileAsResponseAsync( + string vectorStoreId, + + global::tryAGI.OpenAI.CreateVectorStoreFileRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).
+ /// This endpoint is subject to a per-vector-store write rate limit of 300 requests per minute, shared with `/vector_stores/{vector_store_id}/file_batches`.
+ /// For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume. + ///
+ /// + /// Example: vs_abc123 + /// /// /// A [File](/docs/api-reference/files) ID that the vector store should use. Useful for tools like `file_search` that can access files. For multi-file ingestion, we recommend [`file_batches`](/docs/api-reference/vector-stores-file-batches/createBatch) to minimize per-vector-store write requests. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFileBatch.g.cs index 977c375f..4e7e4978 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.CreateVectorStoreFileBatch.g.cs @@ -32,6 +32,25 @@ public partial interface IVectorStoresClient /// /// Example: vs_abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + + global::tryAGI.OpenAI.CreateVectorStoreFileBatchRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a vector store file batch.
+ /// The maximum number of files in a single batch request is 2000.
+ /// Vector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`).
+ /// For ingesting multiple files into the same vector store, this batch endpoint is recommended. + ///
+ /// + /// Example: vs_abc123 + /// /// /// A list of [File](/docs/api-reference/files) IDs that the vector store should use. Useful for tools like `file_search` that can access files. If `attributes` or `chunking_strategy` are provided, they will be applied to all files in the batch. The maximum batch size is 2000 files. This endpoint is recommended for multi-file ingestion and helps reduce per-vector-store write request pressure. Mutually exclusive with `files`. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs index 5a0ac9a2..152878fd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStore.g.cs @@ -15,5 +15,16 @@ public partial interface IVectorStoresClient string vectorStoreId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a vector store. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs index 91071a1b..f9239c66 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.DeleteVectorStoreFile.g.cs @@ -17,5 +17,18 @@ public partial interface IVectorStoresClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint. + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteVectorStoreFileAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFiles.g.cs index f4cf01a2..a8960b28 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFiles.g.cs @@ -29,5 +29,30 @@ public partial interface IVectorStoresClient global::tryAGI.OpenAI.ListVectorStoreFilesFilter? filter = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of vector store files. + /// + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListVectorStoreFilesAsResponseAsync( + string vectorStoreId, + int? limit = default, + global::tryAGI.OpenAI.ListVectorStoreFilesOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.ListVectorStoreFilesFilter? filter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFilesInABatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFilesInABatch.g.cs index b3fa9247..5a2330b6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFilesInABatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStoreFilesInABatch.g.cs @@ -31,5 +31,32 @@ public partial interface IVectorStoresClient global::tryAGI.OpenAI.ListFilesInVectorStoreBatchFilter? filter = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of vector store files in a batch. + /// + /// + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListVectorStoreFilesInABatchAsResponseAsync( + string vectorStoreId, + string batchId, + int? limit = default, + global::tryAGI.OpenAI.ListFilesInVectorStoreBatchOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.ListFilesInVectorStoreBatchFilter? filter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs index 803406b4..e24adaf5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ListVectorStores.g.cs @@ -25,5 +25,26 @@ public partial interface IVectorStoresClient string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Returns a list of vector stores. + /// + /// + /// 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 + /// + global::System.Threading.Tasks.Task> ListVectorStoresAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.ListVectorStoresOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ModifyVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ModifyVectorStore.g.cs index a8259481..617a5be7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ModifyVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.ModifyVectorStore.g.cs @@ -22,6 +22,20 @@ public partial interface IVectorStoresClient /// Modifies a vector store. /// /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ModifyVectorStoreAsResponseAsync( + string vectorStoreId, + + global::tryAGI.OpenAI.UpdateVectorStoreRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Modifies a vector store. + /// + /// /// /// The name of the vector store. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStore.g.cs index ba0f42c2..f78a9298 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStore.g.cs @@ -15,5 +15,16 @@ public partial interface IVectorStoresClient string vectorStoreId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a vector store. + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFile.g.cs index 22a4b20d..1ec8ad32 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFile.g.cs @@ -21,5 +21,22 @@ public partial interface IVectorStoresClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVectorStoreFileAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileBatch.g.cs index a5949089..8253de98 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileBatch.g.cs @@ -21,5 +21,22 @@ public partial interface IVectorStoresClient string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieves a vector store file batch. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: vsfb_abc123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs index d62dd583..09d71bfd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.RetrieveVectorStoreFileContent.g.cs @@ -21,5 +21,22 @@ public partial interface IVectorStoresClient string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Retrieve the parsed contents of a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVectorStoreFileContentAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.SearchVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.SearchVectorStore.g.cs index e59d7c69..74686e73 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.SearchVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.SearchVectorStore.g.cs @@ -26,6 +26,22 @@ public partial interface IVectorStoresClient /// /// Example: vs_abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> SearchVectorStoreAsResponseAsync( + string vectorStoreId, + + global::tryAGI.OpenAI.VectorStoreSearchRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Search a vector store for relevant chunks based on a query and file attributes filter. + /// + /// + /// Example: vs_abc123 + /// /// /// A query string for a search /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.UpdateVectorStoreFileAttributes.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.UpdateVectorStoreFileAttributes.g.cs index 6bbd58fa..e33bc094 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.UpdateVectorStoreFileAttributes.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVectorStoresClient.UpdateVectorStoreFileAttributes.g.cs @@ -33,6 +33,26 @@ public partial interface IVectorStoresClient /// /// Example: file-abc123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateVectorStoreFileAttributesAsResponseAsync( + string vectorStoreId, + string fileId, + + global::tryAGI.OpenAI.UpdateVectorStoreFileAttributesRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update attributes on a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// /// /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. /// The token to cancel the operation with diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideo.g.cs index 690737c8..a374a921 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideo.g.cs @@ -19,6 +19,18 @@ public partial interface IVideosClient /// /// Create a new video generation job from a prompt and optional reference assets. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVideoAsResponseAsync( + + global::tryAGI.OpenAI.CreateVideoMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new video generation job from a prompt and optional reference assets. + /// /// /// The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoCharacter.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoCharacter.g.cs index ac80112f..ede4440a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoCharacter.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoCharacter.g.cs @@ -19,6 +19,18 @@ public partial interface IVideosClient /// /// Create a character from an uploaded video. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVideoCharacterAsResponseAsync( + + global::tryAGI.OpenAI.CreateVideoCharacterBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a character from an uploaded video. + /// /// /// Video file used to create a character. /// @@ -37,5 +49,48 @@ public partial interface IVideosClient string name, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a character from an uploaded video. + /// + /// + /// Video file used to create a character. + /// + /// + /// Video file used to create a character. + /// + /// + /// Display name for this API character. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateVideoCharacterAsync( + global::System.IO.Stream video, + string videoname, + string name, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a character from an uploaded video. + /// + /// + /// Video file used to create a character. + /// + /// + /// Video file used to create a character. + /// + /// + /// Display name for this API character. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVideoCharacterAsResponseAsync( + global::System.IO.Stream video, + string videoname, + string name, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoEdit.g.cs index 52c968fd..2bce1e6d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoEdit.g.cs @@ -19,6 +19,18 @@ public partial interface IVideosClient /// /// Create a new video generation job by editing a source video or existing generated video. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVideoEditAsResponseAsync( + + global::tryAGI.OpenAI.CreateVideoEditMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a new video generation job by editing a source video or existing generated video. + /// /// /// /// Text prompt that describes how to edit the source video. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoExtend.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoExtend.g.cs index 64bded72..4a207685 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoExtend.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.CreateVideoExtend.g.cs @@ -19,6 +19,18 @@ public partial interface IVideosClient /// /// Create an extension of a completed video. /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateVideoExtendAsResponseAsync( + + global::tryAGI.OpenAI.CreateVideoExtendMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create an extension of a completed video. + /// /// /// /// Updated text prompt that directs the extension generation. diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.DeleteVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.DeleteVideo.g.cs index 99db00db..8366a81e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.DeleteVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.DeleteVideo.g.cs @@ -17,5 +17,18 @@ public partial interface IVideosClient string videoId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Permanently delete a completed or failed video and its stored assets. + /// + /// + /// Example: video_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteVideoAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.GetVideoCharacter.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.GetVideoCharacter.g.cs index 48a0f8c5..36bc99ee 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.GetVideoCharacter.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.GetVideoCharacter.g.cs @@ -17,5 +17,18 @@ public partial interface IVideosClient string characterId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Fetch a character. + /// + /// + /// Example: char_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetVideoCharacterAsResponseAsync( + string characterId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.ListVideos.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.ListVideos.g.cs index c42fd6a6..68f37968 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.ListVideos.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.ListVideos.g.cs @@ -21,5 +21,22 @@ public partial interface IVideosClient string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List recently generated videos for the current project. + /// + /// + /// + /// + /// Identifier for the last item from the previous pagination request + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListVideosAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RemixVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RemixVideo.g.cs index cfbb98b0..2ed0ca82 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RemixVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RemixVideo.g.cs @@ -26,6 +26,22 @@ public partial interface IVideosClient /// /// Example: video_123 /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RemixVideoAsResponseAsync( + string videoId, + + global::tryAGI.OpenAI.CreateVideoRemixBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a remix of a completed video using a refreshed prompt. + /// + /// + /// Example: video_123 + /// /// /// Updated text prompt that directs the remix generation. /// diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideo.g.cs index 93451cfc..b2c0331d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideo.g.cs @@ -17,5 +17,18 @@ public partial interface IVideosClient string videoId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Fetch the latest metadata for a generated video. + /// + /// + /// Example: video_123 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVideoAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideoContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideoContent.g.cs index 7420aaef..8fb04976 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideoContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IVideosClient.RetrieveVideoContent.g.cs @@ -20,5 +20,21 @@ public partial interface IVideosClient global::tryAGI.OpenAI.VideoContentVariant? variant = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Download the generated video bytes or a derived preview asset.
+ /// Streams the rendered video content for the specified video job. + ///
+ /// + /// Example: video_123 + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> RetrieveVideoContentAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.VideoContentVariant? variant = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImage.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImage.g.cs index df51b01b..c7f9261f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImage.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImage.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateImageResponseContent( /// public async global::System.Threading.Tasks.Task CreateImageAsync( + global::tryAGI.OpenAI.CreateImageRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateImageAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates an image given a prompt. [Learn more](/docs/guides/images). + /// + /// + /// 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> CreateImageAsResponseAsync( + global::tryAGI.OpenAI.CreateImageRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -97,10 +119,11 @@ partial void ProcessCreateImageResponseContent( 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: "/images/generations", baseUri: HttpClient.BaseAddress); @@ -180,6 +203,8 @@ partial void ProcessCreateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -190,6 +215,11 @@ partial void ProcessCreateImageResponseContent( } 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, @@ -207,6 +237,8 @@ partial void ProcessCreateImageResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -216,8 +248,7 @@ partial void ProcessCreateImageResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -226,6 +257,11 @@ partial void ProcessCreateImageResponseContent( __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( @@ -242,14 +278,15 @@ partial void ProcessCreateImageResponseContent( 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; } @@ -289,6 +326,8 @@ partial void ProcessCreateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -309,6 +348,8 @@ partial void ProcessCreateImageResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -333,9 +374,13 @@ partial void ProcessCreateImageResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ImagesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ImagesResponse.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) { @@ -363,9 +408,13 @@ partial void ProcessCreateImageResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ImagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ImagesResponse.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.ImagesClient.CreateImageAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageAsStream.g.cs index 3c02821c..d479f726 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageAsStream.g.cs @@ -92,10 +92,11 @@ partial void ProcessCreateImageAsStreamResponse( 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: "/images/generations", baseUri: HttpClient.BaseAddress); @@ -175,6 +176,8 @@ partial void ProcessCreateImageAsStreamResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +188,11 @@ partial void ProcessCreateImageAsStreamResponse( } 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 +210,8 @@ partial void ProcessCreateImageAsStreamResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -211,8 +221,7 @@ partial void ProcessCreateImageAsStreamResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -221,6 +230,11 @@ partial void ProcessCreateImageAsStreamResponse( __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 +251,15 @@ partial void ProcessCreateImageAsStreamResponse( 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 +299,8 @@ partial void ProcessCreateImageAsStreamResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +321,8 @@ partial void ProcessCreateImageAsStreamResponse( 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.ImagesClient.CreateImageEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs index 9cf566c0..5910feba 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEdit.g.cs @@ -54,6 +54,32 @@ partial void ProcessCreateImageEditResponseContent( /// public async global::System.Threading.Tasks.Task CreateImageEditAsync( + global::tryAGI.OpenAI.CreateImageEditRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateImageEditAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// 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> CreateImageEditAsResponseAsync( + global::tryAGI.OpenAI.CreateImageEditRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -103,10 +129,11 @@ partial void ProcessCreateImageEditResponseContent( 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: "/images/edits", baseUri: HttpClient.BaseAddress); @@ -139,13 +166,16 @@ partial void ProcessCreateImageEditResponseContent( __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.Image.ToString() ?? string.Empty), name: "\"image\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Mask != default) { @@ -186,92 +216,107 @@ request.Maskname is null { __contentMask.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.Background != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Background).HasValue ? (request.Background).GetValueOrDefault().ToValueString() : string.Empty), name: "\"background\""); - } + + } if (request.Model != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), name: "\"model\""); - } + + } if (request.N != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); - } + + } if (request.Size != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), name: "\"size\""); - } + + } 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.OutputFormat != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.OutputFormat).HasValue ? (request.OutputFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"output_format\""); - } + + } if (request.OutputCompression != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.OutputCompression, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"output_compression\""); - } + + } if (request.User != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), name: "\"user\""); - } + + } if (request.InputFidelity != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.InputFidelity.ToString() ?? string.Empty), name: "\"input_fidelity\""); - } + + } 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.PartialImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PartialImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"partial_images\""); - } + + } if (request.Quality != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Quality).HasValue ? (request.Quality).GetValueOrDefault().ToValueString() : string.Empty), name: "\"quality\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -313,6 +358,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -323,6 +370,11 @@ request.Maskname 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, @@ -340,6 +392,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -349,8 +403,7 @@ request.Maskname is null __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -359,6 +412,11 @@ request.Maskname 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( @@ -375,14 +433,15 @@ request.Maskname 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; } @@ -422,6 +481,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -442,6 +503,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -466,9 +529,13 @@ request.Maskname is null { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ImagesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ImagesResponse.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) { @@ -496,9 +563,13 @@ request.Maskname is null #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ImagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ImagesResponse.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) { @@ -662,5 +733,1244 @@ request.Maskname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// 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 CreateImageEditAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + var request = new global::tryAGI.OpenAI.CreateImageEditRequest + { + Image = image, + Prompt = prompt, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Background = background, + Model = model, + N = n, + Size = size, + ResponseFormat = responseFormat, + OutputFormat = outputFormat, + OutputCompression = outputCompression, + User = user, + InputFidelity = inputFidelity, + Stream = false, + PartialImages = partialImages, + Quality = quality, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateImageEditArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateImageEditSecurityRequirements, + operationName: "CreateImageEditAsync"); + + 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: "/images/edits", + 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.Image.ToString() ?? string.Empty), + name: "\"image\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (mask != default) + { + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __contentMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Maskname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Maskname) ?? 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: __contentMask, + name: "\"mask\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.Background != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Background).HasValue ? (request.Background).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"background\""); + + } + if (request.Model != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), + name: "\"model\""); + + } + if (request.N != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"n\""); + + } + if (request.Size != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"size\""); + + } + 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.OutputFormat != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.OutputFormat).HasValue ? (request.OutputFormat).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"output_format\""); + + } + if (request.OutputCompression != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.OutputCompression, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"output_compression\""); + + } + if (request.User != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), + name: "\"user\""); + + } + if (request.InputFidelity != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.InputFidelity.ToString() ?? string.Empty), + name: "\"input_fidelity\""); + + } + 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.PartialImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PartialImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"partial_images\""); + + } + if (request.Quality != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Quality).HasValue ? (request.Quality).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"quality\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateImageEditRequest( + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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); + ProcessCreateImageEditResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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); + ProcessCreateImageEditResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::tryAGI.OpenAI.ImagesResponse.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.ImagesResponse.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 an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// 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> CreateImageEditAsResponseAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + var request = new global::tryAGI.OpenAI.CreateImageEditRequest + { + Image = image, + Prompt = prompt, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Background = background, + Model = model, + N = n, + Size = size, + ResponseFormat = responseFormat, + OutputFormat = outputFormat, + OutputCompression = outputCompression, + User = user, + InputFidelity = inputFidelity, + Stream = false, + PartialImages = partialImages, + Quality = quality, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateImageEditArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateImageEditSecurityRequirements, + operationName: "CreateImageEditAsync"); + + 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: "/images/edits", + 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.Image.ToString() ?? string.Empty), + name: "\"image\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (mask != default) + { + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __contentMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Maskname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Maskname) ?? 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: __contentMask, + name: "\"mask\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.Background != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Background).HasValue ? (request.Background).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"background\""); + + } + if (request.Model != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), + name: "\"model\""); + + } + if (request.N != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"n\""); + + } + if (request.Size != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"size\""); + + } + 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.OutputFormat != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.OutputFormat).HasValue ? (request.OutputFormat).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"output_format\""); + + } + if (request.OutputCompression != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.OutputCompression, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"output_compression\""); + + } + if (request.User != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), + name: "\"user\""); + + } + if (request.InputFidelity != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.InputFidelity.ToString() ?? string.Empty), + name: "\"input_fidelity\""); + + } + 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.PartialImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PartialImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"partial_images\""); + + } + if (request.Quality != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Quality).HasValue ? (request.Quality).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"quality\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateImageEditRequest( + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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); + ProcessCreateImageEditResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEdit", + methodName: "CreateImageEditAsync", + pathTemplate: "\"/images/edits\"", + 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); + ProcessCreateImageEditResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::tryAGI.OpenAI.ImagesResponse.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.ImagesResponse.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.ImagesClient.CreateImageEditAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs index e02d6c7f..6e0b926e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageEditAsStream.g.cs @@ -98,10 +98,11 @@ partial void ProcessCreateImageEditAsStreamResponse( 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: "/images/edits", baseUri: HttpClient.BaseAddress); @@ -134,13 +135,16 @@ partial void ProcessCreateImageEditAsStreamResponse( __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.Image.ToString() ?? string.Empty), name: "\"image\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.Mask != default) { @@ -181,92 +185,107 @@ request.Maskname is null { __contentMask.Headers.ContentDisposition.FileNameStar = null; } - } + + } if (request.Background != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Background).HasValue ? (request.Background).GetValueOrDefault().ToValueString() : string.Empty), name: "\"background\""); - } + + } if (request.Model != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), name: "\"model\""); - } + + } if (request.N != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); - } + + } if (request.Size != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), name: "\"size\""); - } + + } 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.OutputFormat != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.OutputFormat).HasValue ? (request.OutputFormat).GetValueOrDefault().ToValueString() : string.Empty), name: "\"output_format\""); - } + + } if (request.OutputCompression != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.OutputCompression, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"output_compression\""); - } + + } if (request.User != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), name: "\"user\""); - } + + } if (request.InputFidelity != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.InputFidelity.ToString() ?? string.Empty), name: "\"input_fidelity\""); - } + + } 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.PartialImages != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PartialImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"partial_images\""); - } + + } if (request.Quality != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Quality).HasValue ? (request.Quality).GetValueOrDefault().ToValueString() : string.Empty), name: "\"quality\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -308,6 +327,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -318,6 +339,11 @@ request.Maskname 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, @@ -335,6 +361,8 @@ request.Maskname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -344,8 +372,7 @@ request.Maskname is null __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -354,6 +381,11 @@ request.Maskname 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( @@ -370,14 +402,15 @@ request.Maskname 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; } @@ -417,6 +450,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -437,6 +472,8 @@ request.Maskname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -640,5 +677,599 @@ request.Maskname is null yield return __response; } } + + /// + /// Creates an edited or extended image given one or more source images and a prompt. This endpoint supports GPT Image models (`gpt-image-1.5`, `gpt-image-1`, `gpt-image-1-mini`, and `chatgpt-image-latest`) and `dall-e-2`.
+ /// You can call this endpoint with either:
+ /// - `multipart/form-data`: use binary uploads via `image` (and optional `mask`).
+ /// - `application/json`: use `images` (and optional `mask`) as references with either `image_url` or `file_id`.
+ /// Note that JSON requests use `images` (array) instead of the multipart `image` field. + ///
+ /// + /// The image(s) to edit. Must be a supported image file or an array of images.
+ /// For the GPT image models (`gpt-image-1`, `gpt-image-1-mini`, and `gpt-image-1.5`), each image should be a `png`, `webp`, or `jpg`
+ /// file less than 50MB. You can provide up to 16 images.
+ /// `chatgpt-image-latest` follows the same input constraints as GPT image models.
+ /// For `dall-e-2`, you can only provide one image, and it should be a square
+ /// `png` file less than 4MB. + /// + /// + /// A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2`, and 32000 characters for the GPT image models.
+ /// Example: A cute baby sea otter wearing a beret + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. If there are multiple images provided, the mask will be applied on the first image. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + /// + /// + /// Allows to set transparency for the background of the generated image(s).
+ /// This parameter is only supported for the GPT image models. Must be one of
+ /// `transparent`, `opaque` or `auto` (default value). When `auto` is used, the
+ /// model will automatically determine the best background for the image.
+ /// If `transparent`, the output format needs to support transparency, so it
+ /// should be set to either `png` (default value) or `webp`.
+ /// Default Value: auto
+ /// Example: transparent + /// + /// + /// The model to use for image generation. Defaults to `gpt-image-1.5`.
+ /// Default Value: gpt-image-1.5
+ /// Example: gpt-image-1.5 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for the GPT image models, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter is only supported for `dall-e-2` (default is `url` for `dall-e-2`), as GPT image models always return base64-encoded images.
+ /// Example: url + /// + /// + /// The format in which the generated images are returned. This parameter is
+ /// only supported for the GPT image models. Must be one of `png`, `jpeg`, or `webp`.
+ /// The default value is `png`.
+ /// Default Value: png
+ /// Example: png + /// + /// + /// The compression level (0-100%) for the generated images. This parameter
+ /// is only supported for the GPT image models with the `webp` or `jpeg` output
+ /// formats, and defaults to 100.
+ /// Default Value: 100
+ /// Example: 100 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-1234 + /// + /// + /// + /// + /// The quality of the image that will be generated for GPT image models. Defaults to `auto`.
+ /// Default Value: auto
+ /// Example: high + /// + /// 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 CreateImageEditAsStreamAsync( + global::tryAGI.OpenAI.AnyOf> image, + string prompt, + global::System.IO.Stream? mask = default, + string? maskname = default, + global::tryAGI.OpenAI.CreateImageEditRequestBackground? background = default, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageEditRequestSize? size = default, + global::tryAGI.OpenAI.CreateImageEditRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageEditRequestOutputFormat? outputFormat = default, + int? outputCompression = default, + string? user = default, + global::tryAGI.OpenAI.InputFidelity? inputFidelity = default, + int? partialImages = default, + global::tryAGI.OpenAI.CreateImageEditRequestQuality? quality = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) + { + + var request = new global::tryAGI.OpenAI.CreateImageEditRequest + { + Image = image, + Prompt = prompt, + Mask = global::System.Array.Empty(), + Maskname = maskname, + Background = background, + Model = model, + N = n, + Size = size, + ResponseFormat = responseFormat, + OutputFormat = outputFormat, + OutputCompression = outputCompression, + User = user, + InputFidelity = inputFidelity, + Stream = true, + PartialImages = partialImages, + Quality = quality, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateImageEditAsStreamArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateImageEditAsStreamSecurityRequirements, + operationName: "CreateImageEditAsStreamAsync"); + + 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: "/images/edits", + 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.Image.ToString() ?? string.Empty), + name: "\"image\""); + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), + name: "\"prompt\""); + + if (mask != default) + { + + var __contentMask = new global::System.Net.Http.StreamContent(mask); + __contentMask.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Maskname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Maskname) ?? 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: __contentMask, + name: "\"mask\"", + fileName: request.Maskname != null ? $"\"{request.Maskname}\"" : string.Empty); + if (__contentMask.Headers.ContentDisposition != null) + { + __contentMask.Headers.ContentDisposition.FileNameStar = null; + } + + } + if (request.Background != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Background).HasValue ? (request.Background).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"background\""); + + } + if (request.Model != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), + name: "\"model\""); + + } + if (request.N != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"n\""); + + } + if (request.Size != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"size\""); + + } + 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.OutputFormat != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.OutputFormat).HasValue ? (request.OutputFormat).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"output_format\""); + + } + if (request.OutputCompression != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.OutputCompression, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"output_compression\""); + + } + if (request.User != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), + name: "\"user\""); + + } + if (request.InputFidelity != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.InputFidelity.ToString() ?? string.Empty), + name: "\"input_fidelity\""); + + } + 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.PartialImages != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.PartialImages, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"partial_images\""); + + } + if (request.Quality != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Quality).HasValue ? (request.Quality).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"quality\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateImageEditAsStreamRequest( + 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: "CreateImageEditAsStream", + methodName: "CreateImageEditAsStreamAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEditAsStream", + methodName: "CreateImageEditAsStreamAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEditAsStream", + methodName: "CreateImageEditAsStreamAsync", + pathTemplate: "\"/images/edits\"", + 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); + ProcessCreateImageEditAsStreamResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateImageEditAsStream", + methodName: "CreateImageEditAsStreamAsync", + pathTemplate: "\"/images/edits\"", + 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: "CreateImageEditAsStream", + methodName: "CreateImageEditAsStreamAsync", + pathTemplate: "\"/images/edits\"", + 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.ImageEditStreamEvent.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.ImagesClient.CreateImageVariation.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageVariation.g.cs index e9464740..4428c458 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageVariation.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.CreateImageVariation.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateImageVariationResponseContent( /// public async global::System.Threading.Tasks.Task CreateImageVariationAsync( + global::tryAGI.OpenAI.CreateImageVariationRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateImageVariationAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /// + /// + /// 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> CreateImageVariationAsResponseAsync( + global::tryAGI.OpenAI.CreateImageVariationRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateImageVariationResponseContent( 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: "/images/variations", baseUri: HttpClient.BaseAddress); @@ -116,6 +139,7 @@ partial void ProcessCreateImageVariationResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentImage = new global::System.Net.Http.ByteArrayContent(request.Image ?? global::System.Array.Empty()); __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -154,42 +178,50 @@ request.Imagename is null { __contentImage.Headers.ContentDisposition.FileNameStar = null; } + if (request.Model != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), name: "\"model\""); - } + + } if (request.N != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), name: "\"n\""); - } + + } 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.Size != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), name: "\"size\""); - } + + } if (request.User != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), name: "\"user\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -231,6 +263,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -241,6 +275,11 @@ request.Imagename 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, @@ -258,6 +297,8 @@ request.Imagename is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -267,8 +308,7 @@ request.Imagename is null __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -277,6 +317,11 @@ request.Imagename 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( @@ -293,14 +338,15 @@ request.Imagename 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; } @@ -340,6 +386,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -360,6 +408,8 @@ request.Imagename is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -384,9 +434,13 @@ request.Imagename is null { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ImagesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ImagesResponse.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) { @@ -414,9 +468,13 @@ request.Imagename is null #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ImagesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ImagesResponse.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) { @@ -517,5 +575,984 @@ request.Imagename is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Creates a variation of a given image. This endpoint only supports `dall-e-2`. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The model to use for image generation. Only `dall-e-2` is supported at this time.
+ /// Default Value: dall-e-2
+ /// Example: dall-e-2 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
+ /// Default Value: url
+ /// Example: url + /// + /// + /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-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 CreateImageVariationAsync( + global::System.IO.Stream image, + string imagename, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageVariationRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageVariationRequestSize? size = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::tryAGI.OpenAI.CreateImageVariationRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Model = model, + N = n, + ResponseFormat = responseFormat, + Size = size, + User = user, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateImageVariationArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateImageVariationSecurityRequirements, + operationName: "CreateImageVariationAsync"); + + 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: "/images/variations", + 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 __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? 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: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Model != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), + name: "\"model\""); + + } + if (request.N != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"n\""); + + } + 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.Size != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"size\""); + + } + if (request.User != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), + name: "\"user\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateImageVariationRequest( + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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); + ProcessCreateImageVariationResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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); + ProcessCreateImageVariationResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::tryAGI.OpenAI.ImagesResponse.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.ImagesResponse.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 variation of a given image. This endpoint only supports `dall-e-2`. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. + /// + /// + /// The model to use for image generation. Only `dall-e-2` is supported at this time.
+ /// Default Value: dall-e-2
+ /// Example: dall-e-2 + /// + /// + /// The number of images to generate. Must be between 1 and 10.
+ /// Default Value: 1
+ /// Example: 1 + /// + /// + /// The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.
+ /// Default Value: url
+ /// Example: url + /// + /// + /// The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`.
+ /// Default Value: 1024x1024
+ /// Example: 1024x1024 + /// + /// + /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
+ /// Example: user-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> CreateImageVariationAsResponseAsync( + global::System.IO.Stream image, + string imagename, + global::tryAGI.OpenAI.AnyOf? model = default, + int? n = default, + global::tryAGI.OpenAI.CreateImageVariationRequestResponseFormat? responseFormat = default, + global::tryAGI.OpenAI.CreateImageVariationRequestSize? size = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + image = image ?? throw new global::System.ArgumentNullException(nameof(image)); + var request = new global::tryAGI.OpenAI.CreateImageVariationRequest + { + Image = global::System.Array.Empty(), + Imagename = imagename, + Model = model, + N = n, + ResponseFormat = responseFormat, + Size = size, + User = user, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateImageVariationArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateImageVariationSecurityRequirements, + operationName: "CreateImageVariationAsync"); + + 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: "/images/variations", + 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 __contentImage = new global::System.Net.Http.StreamContent(image); + __contentImage.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Imagename is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Imagename) ?? 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: __contentImage, + name: "\"image\"", + fileName: request.Imagename != null ? $"\"{request.Imagename}\"" : string.Empty); + if (__contentImage.Headers.ContentDisposition != null) + { + __contentImage.Headers.ContentDisposition.FileNameStar = null; + } + + if (request.Model != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), + name: "\"model\""); + + } + if (request.N != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(global::System.Convert.ToString(request.N, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty), + name: "\"n\""); + + } + 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.Size != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), + name: "\"size\""); + + } + if (request.User != default) + { + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.User ?? string.Empty), + name: "\"user\""); + + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateImageVariationRequest( + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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); + ProcessCreateImageVariationResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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: "CreateImageVariation", + methodName: "CreateImageVariationAsync", + pathTemplate: "\"/images/variations\"", + 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); + ProcessCreateImageVariationResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::tryAGI.OpenAI.ImagesResponse.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.ImagesResponse.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.ImagesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.g.cs index 81bcea1c..dbb2ae6d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ImagesClient.g.cs @@ -73,10 +73,10 @@ public ImagesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ImagesClient( - 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.InvitesClient.CreateInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.CreateInvite.g.cs index d9c4a7ff..a3a4a012 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.CreateInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.CreateInvite.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateInviteResponseContent( /// public async global::System.Threading.Tasks.Task CreateInviteAsync( + global::tryAGI.OpenAI.InviteRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateInviteAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. + /// + /// + /// 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> CreateInviteAsResponseAsync( + global::tryAGI.OpenAI.InviteRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateInviteResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/invites", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateInviteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateInviteResponseContent( } 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 ProcessCreateInviteResponseContent( 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 ProcessCreateInviteResponseContent( __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 ProcessCreateInviteResponseContent( __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 ProcessCreateInviteResponseContent( 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 ProcessCreateInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateInviteResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Invite.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Invite.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 ProcessCreateInviteResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Invite.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Invite.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.InvitesClient.DeleteInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.DeleteInvite.g.cs index 38e4c992..5d486e38 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.DeleteInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.DeleteInvite.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteInviteResponseContent( string inviteId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteInviteAsResponseAsync( + inviteId: inviteId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an invite. If the invite has already been accepted, it cannot 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> DeleteInviteAsResponseAsync( + string inviteId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteInviteResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/invites/{inviteId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteInviteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteInviteResponseContent( } 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 ProcessDeleteInviteResponseContent( 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 ProcessDeleteInviteResponseContent( __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 ProcessDeleteInviteResponseContent( __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 ProcessDeleteInviteResponseContent( 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 ProcessDeleteInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteInviteResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.InviteDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.InviteDeleteResponse.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 ProcessDeleteInviteResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.InviteDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.InviteDeleteResponse.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.InvitesClient.ListInvites.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.ListInvites.g.cs index 995a964a..d1727d46 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.ListInvites.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.ListInvites.g.cs @@ -58,6 +58,31 @@ partial void ProcessListInvitesResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListInvitesAsResponseAsync( + limit: limit, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of invites in the 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> ListInvitesAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -88,12 +113,13 @@ partial void ProcessListInvitesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/invites", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -166,6 +192,8 @@ partial void ProcessListInvitesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +204,11 @@ partial void ProcessListInvitesResponseContent( } 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 ProcessListInvitesResponseContent( 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 ProcessListInvitesResponseContent( __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 ProcessListInvitesResponseContent( __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 ProcessListInvitesResponseContent( 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 ProcessListInvitesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +337,8 @@ partial void ProcessListInvitesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -319,9 +363,13 @@ partial void ProcessListInvitesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.InviteListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.InviteListResponse.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 ProcessListInvitesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.InviteListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.InviteListResponse.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.InvitesClient.RetrieveInvite.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.RetrieveInvite.g.cs index a76050d6..65fe988c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.RetrieveInvite.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.RetrieveInvite.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveInviteResponseContent( string inviteId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveInviteAsResponseAsync( + inviteId: inviteId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves an invite. + /// + /// + /// 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> RetrieveInviteAsResponseAsync( + string inviteId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveInviteResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/invites/{inviteId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveInviteResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveInviteResponseContent( } 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 ProcessRetrieveInviteResponseContent( 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 ProcessRetrieveInviteResponseContent( __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 ProcessRetrieveInviteResponseContent( __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 ProcessRetrieveInviteResponseContent( 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 ProcessRetrieveInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveInviteResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessRetrieveInviteResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Invite.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Invite.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 ProcessRetrieveInviteResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Invite.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Invite.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.InvitesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.g.cs index 5676c450..2045441d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.InvitesClient.g.cs @@ -72,10 +72,10 @@ public InvitesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public InvitesClient( - 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.ModelsClient.DeleteAFineTunedModel.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.DeleteAFineTunedModel.g.cs index dc998569..cd146284 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.DeleteAFineTunedModel.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.DeleteAFineTunedModel.g.cs @@ -54,6 +54,28 @@ partial void ProcessDeleteAFineTunedModelResponseContent( string model, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAFineTunedModelAsResponseAsync( + model: model, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. + /// + /// + /// Example: ft:gpt-4o-mini:acemeco:suffix:abc123 + /// + /// 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> DeleteAFineTunedModelAsResponseAsync( + string model, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessDeleteAFineTunedModelResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/models/{model}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteAFineTunedModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteAFineTunedModelResponseContent( } 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 ProcessDeleteAFineTunedModelResponseContent( 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 ProcessDeleteAFineTunedModelResponseContent( __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 ProcessDeleteAFineTunedModelResponseContent( __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 ProcessDeleteAFineTunedModelResponseContent( 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 ProcessDeleteAFineTunedModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteAFineTunedModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessDeleteAFineTunedModelResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteModelResponse.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 ProcessDeleteAFineTunedModelResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteModelResponse.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.ModelsClient.ListModels.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.ListModels.g.cs index 53a3bccc..057d29f3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.ListModels.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.ListModels.g.cs @@ -48,6 +48,23 @@ partial void ProcessListModelsResponseContent( public async global::System.Threading.Tasks.Task ListModelsAsync( global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListModelsAsResponseAsync( + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the currently available models, and provides basic information about each one such as the owner and availability. + /// + /// 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> ListModelsAsResponseAsync( + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -76,6 +93,7 @@ partial void ProcessListModelsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/models", baseUri: HttpClient.BaseAddress); @@ -148,6 +166,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -158,6 +178,11 @@ partial void ProcessListModelsResponseContent( } 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, @@ -175,6 +200,8 @@ partial void ProcessListModelsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -184,8 +211,7 @@ partial void ProcessListModelsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -194,6 +220,11 @@ partial void ProcessListModelsResponseContent( __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( @@ -210,14 +241,15 @@ partial void ProcessListModelsResponseContent( 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; } @@ -257,6 +289,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -277,6 +311,8 @@ partial void ProcessListModelsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -301,9 +337,13 @@ partial void ProcessListModelsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListModelsResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListModelsResponse.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) { @@ -331,9 +371,13 @@ partial void ProcessListModelsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListModelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListModelsResponse.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.ModelsClient.RetrieveModel.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.RetrieveModel.g.cs index 0ead0156..2091e8f4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.RetrieveModel.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.RetrieveModel.g.cs @@ -54,6 +54,28 @@ partial void ProcessRetrieveModelResponseContent( string model, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveModelAsResponseAsync( + model: model, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a model instance, providing basic information about the model such as the owner and permissioning. + /// + /// + /// Example: gpt-4o-mini + /// + /// 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> RetrieveModelAsResponseAsync( + string model, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessRetrieveModelResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/models/{model}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessRetrieveModelResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessRetrieveModelResponseContent( } 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 ProcessRetrieveModelResponseContent( 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 ProcessRetrieveModelResponseContent( __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 ProcessRetrieveModelResponseContent( __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 ProcessRetrieveModelResponseContent( 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 ProcessRetrieveModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessRetrieveModelResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessRetrieveModelResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Model17.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Model17.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 ProcessRetrieveModelResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Model17.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Model17.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.ModelsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.g.cs index a7bb0e38..c778608c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModelsClient.g.cs @@ -73,10 +73,10 @@ public ModelsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ModelsClient( - 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.ModerationsClient.CreateModeration.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.CreateModeration.g.cs index d47ba5fd..1ed96ad9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.CreateModeration.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.CreateModeration.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateModerationResponseContent( /// public async global::System.Threading.Tasks.Task CreateModerationAsync( + global::tryAGI.OpenAI.CreateModerationRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateModerationAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Classifies if text and/or image inputs are potentially harmful. Learn
+ /// more in the [moderation guide](/docs/guides/moderation). + ///
+ /// + /// 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> CreateModerationAsResponseAsync( + global::tryAGI.OpenAI.CreateModerationRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateModerationResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/moderations", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateModerationResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateModerationResponseContent( } 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 ProcessCreateModerationResponseContent( 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 ProcessCreateModerationResponseContent( __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 ProcessCreateModerationResponseContent( __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 ProcessCreateModerationResponseContent( 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 ProcessCreateModerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateModerationResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessCreateModerationResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.CreateModerationResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.CreateModerationResponse.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 ProcessCreateModerationResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.CreateModerationResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.CreateModerationResponse.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.ModerationsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.g.cs index 34e3aecc..bba3a7f9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ModerationsClient.g.cs @@ -73,10 +73,10 @@ public ModerationsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ModerationsClient( - 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.OpenAiClient.CancelChatSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CancelChatSession.g.cs index b647790b..0fcc06db 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CancelChatSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CancelChatSession.g.cs @@ -55,6 +55,29 @@ partial void ProcessCancelChatSessionResponseContent( string sessionId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelChatSessionAsResponseAsync( + sessionId: sessionId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancel an active ChatKit session and return its most recent metadata.
+ /// Cancelling prevents new requests from using the issued client secret. + ///
+ /// + /// Example: cksess_123 + /// + /// 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> CancelChatSessionAsResponseAsync( + string sessionId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessCancelChatSessionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/chatkit/sessions/{sessionId}/cancel", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessCancelChatSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessCancelChatSessionResponseContent( } 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, @@ -184,6 +215,8 @@ partial void ProcessCancelChatSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessCancelChatSessionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessCancelChatSessionResponseContent( __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( @@ -219,14 +256,15 @@ partial void ProcessCancelChatSessionResponseContent( 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; } @@ -266,6 +304,8 @@ partial void ProcessCancelChatSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessCancelChatSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -310,9 +352,13 @@ partial void ProcessCancelChatSessionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ChatSessionResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ChatSessionResource.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) { @@ -340,9 +386,13 @@ partial void ProcessCancelChatSessionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ChatSessionResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ChatSessionResource.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.OpenAiClient.CompactAResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CompactAResponse.g.cs index a6957128..5c28c43c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CompactAResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CompactAResponse.g.cs @@ -51,6 +51,29 @@ partial void ProcessCompactAResponseResponseContent( /// public async global::System.Threading.Tasks.Task CompactAResponseAsync( + global::tryAGI.OpenAI.CompactResponseMethodPublicBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CompactAResponseAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Compact a conversation. Returns a compacted response object.
+ /// Learn when and how to compact long-running conversations in the [conversation state guide](/docs/guides/conversation-state#managing-the-context-window). For ZDR-compatible compaction details, see [Compaction (advanced)](/docs/guides/conversation-state#compaction-advanced). + ///
+ /// + /// 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> CompactAResponseAsResponseAsync( + global::tryAGI.OpenAI.CompactResponseMethodPublicBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCompactAResponseResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/responses/compact", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCompactAResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCompactAResponseResponseContent( } 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 ProcessCompactAResponseResponseContent( 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 ProcessCompactAResponseResponseContent( __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 ProcessCompactAResponseResponseContent( __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 ProcessCompactAResponseResponseContent( 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 ProcessCompactAResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCompactAResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessCompactAResponseResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.CompactResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.CompactResource.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 ProcessCompactAResponseResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.CompactResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.CompactResource.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.OpenAiClient.CreateAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateAdminApiKey.g.cs index e082c61c..44f48554 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateAdminApiKey.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateAdminApiKeyResponseContent( /// public async global::System.Threading.Tasks.Task CreateAdminApiKeyAsync( + global::tryAGI.OpenAI.AdminApiKeysCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateAdminApiKeyAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an organization admin API key
+ /// Create a new admin-level API key for the organization. + ///
+ /// + /// 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> CreateAdminApiKeyAsResponseAsync( + global::tryAGI.OpenAI.AdminApiKeysCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateAdminApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/admin_api_keys", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateAdminApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateAdminApiKeyResponseContent( } 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 ProcessCreateAdminApiKeyResponseContent( 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 ProcessCreateAdminApiKeyResponseContent( __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 ProcessCreateAdminApiKeyResponseContent( __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 ProcessCreateAdminApiKeyResponseContent( 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 ProcessCreateAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessCreateAdminApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.AdminApiKeyCreateResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.AdminApiKeyCreateResponse.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 ProcessCreateAdminApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.AdminApiKeyCreateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.AdminApiKeyCreateResponse.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.OpenAiClient.CreateChatKitSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateChatKitSession.g.cs index 16c90b1e..a6627702 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateChatKitSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateChatKitSession.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateChatKitSessionResponseContent( /// public async global::System.Threading.Tasks.Task CreateChatKitSessionAsync( + global::tryAGI.OpenAI.CreateChatSessionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateChatKitSessionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a ChatKit session. + /// + /// + /// 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> CreateChatKitSessionAsResponseAsync( + global::tryAGI.OpenAI.CreateChatSessionBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateChatKitSessionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/chatkit/sessions", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateChatKitSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateChatKitSessionResponseContent( } 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 ProcessCreateChatKitSessionResponseContent( 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 ProcessCreateChatKitSessionResponseContent( __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 ProcessCreateChatKitSessionResponseContent( __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 ProcessCreateChatKitSessionResponseContent( 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 ProcessCreateChatKitSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateChatKitSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateChatKitSessionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ChatSessionResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ChatSessionResource.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 ProcessCreateChatKitSessionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ChatSessionResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ChatSessionResource.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.OpenAiClient.CreateContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainer.g.cs index 0055ad86..ca7335ac 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainer.g.cs @@ -51,6 +51,29 @@ partial void ProcessCreateContainerResponseContent( /// public async global::System.Threading.Tasks.Task CreateContainerAsync( + global::tryAGI.OpenAI.CreateContainerBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateContainerAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create Container
+ /// Creates a container. + ///
+ /// + /// 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> CreateContainerAsResponseAsync( + global::tryAGI.OpenAI.CreateContainerBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessCreateContainerResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/containers", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessCreateContainerResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessCreateContainerResponseContent( } 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 ProcessCreateContainerResponseContent( 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 ProcessCreateContainerResponseContent( __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 ProcessCreateContainerResponseContent( __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 ProcessCreateContainerResponseContent( 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 ProcessCreateContainerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessCreateContainerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessCreateContainerResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerResource.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 ProcessCreateContainerResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerResource.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.OpenAiClient.CreateContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs index 0dbef7bf..187e604d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.CreateContainerFile.g.cs @@ -56,6 +56,33 @@ partial void ProcessCreateContainerFileResponseContent( public async global::System.Threading.Tasks.Task CreateContainerFileAsync( string containerId, + global::tryAGI.OpenAI.CreateContainerFileBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateContainerFileAsResponseAsync( + containerId: containerId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a Container File
+ /// You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
+ /// Creates a container 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> CreateContainerFileAsResponseAsync( + string containerId, + global::tryAGI.OpenAI.CreateContainerFileBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -91,6 +118,7 @@ partial void ProcessCreateContainerFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}/files", baseUri: HttpClient.BaseAddress); @@ -171,6 +199,8 @@ partial void ProcessCreateContainerFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +211,11 @@ partial void ProcessCreateContainerFileResponseContent( } 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 ProcessCreateContainerFileResponseContent( 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 ProcessCreateContainerFileResponseContent( __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 ProcessCreateContainerFileResponseContent( __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 ProcessCreateContainerFileResponseContent( 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 ProcessCreateContainerFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +344,8 @@ partial void ProcessCreateContainerFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +370,13 @@ partial void ProcessCreateContainerFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerFileResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerFileResource.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 ProcessCreateContainerFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerFileResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerFileResource.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.OpenAiClient.DeleteAContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainer.g.cs index e30e6d48..75527dae 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainer.g.cs @@ -48,6 +48,25 @@ partial void ProcessDeleteAContainerResponse( string containerId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteAContainerAsResponseAsync( + containerId: containerId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete Container
+ /// Delete a container. + ///
+ /// + /// 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 DeleteAContainerAsResponseAsync( + string containerId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessDeleteAContainerResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessDeleteAContainerResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessDeleteAContainerResponse( } 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, @@ -177,6 +204,8 @@ partial void ProcessDeleteAContainerResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessDeleteAContainerResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessDeleteAContainerResponse( __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( @@ -212,14 +245,15 @@ partial void ProcessDeleteAContainerResponse( 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; } @@ -259,6 +293,8 @@ partial void ProcessDeleteAContainerResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessDeleteAContainerResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -299,6 +337,10 @@ partial void ProcessDeleteAContainerResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -320,6 +362,10 @@ partial void ProcessDeleteAContainerResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainerFile.g.cs index f342d736..21129eac 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAContainerFile.g.cs @@ -52,6 +52,28 @@ partial void ProcessDeleteAContainerFileResponse( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteAContainerFileAsResponseAsync( + containerId: containerId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Delete Container File
+ /// Delete a container 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 DeleteAContainerFileAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +104,7 @@ partial void ProcessDeleteAContainerFileResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteAContainerFileResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteAContainerFileResponse( } 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 ProcessDeleteAContainerFileResponse( 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 ProcessDeleteAContainerFileResponse( __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 ProcessDeleteAContainerFileResponse( __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 ProcessDeleteAContainerFileResponse( 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 ProcessDeleteAContainerFileResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteAContainerFileResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -305,6 +346,10 @@ partial void ProcessDeleteAContainerFileResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -326,6 +371,10 @@ partial void ProcessDeleteAContainerFileResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAdminApiKey.g.cs index 23266e2e..fd35f59b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteAdminApiKey.g.cs @@ -55,6 +55,29 @@ partial void ProcessDeleteAdminApiKeyResponseContent( string keyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteAdminApiKeyAsResponseAsync( + keyId: keyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an organization admin API key
+ /// Delete the specified admin API key. + ///
+ /// + /// The ID of the API key to 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> DeleteAdminApiKeyAsResponseAsync( + string keyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessDeleteAdminApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/admin_api_keys/{keyId}", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessDeleteAdminApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessDeleteAdminApiKeyResponseContent( } 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, @@ -184,6 +215,8 @@ partial void ProcessDeleteAdminApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessDeleteAdminApiKeyResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessDeleteAdminApiKeyResponseContent( __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( @@ -219,14 +256,15 @@ partial void ProcessDeleteAdminApiKeyResponseContent( 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; } @@ -266,6 +304,8 @@ partial void ProcessDeleteAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessDeleteAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -310,9 +352,13 @@ partial void ProcessDeleteAdminApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.AdminApiKeysDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.AdminApiKeysDeleteResponse.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) { @@ -340,9 +386,13 @@ partial void ProcessDeleteAdminApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.AdminApiKeysDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.AdminApiKeysDeleteResponse.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.OpenAiClient.DeleteChatKitThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteChatKitThread.g.cs index 35d32f84..e45b85ee 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteChatKitThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.DeleteChatKitThread.g.cs @@ -54,6 +54,28 @@ partial void ProcessDeleteChatKitThreadResponseContent( string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteChatKitThreadAsResponseAsync( + threadId: threadId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a ChatKit thread along with its items and stored attachments. + /// + /// + /// Example: cthr_123 + /// + /// 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> DeleteChatKitThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessDeleteChatKitThreadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/chatkit/threads/{threadId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteChatKitThreadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteChatKitThreadResponseContent( } 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 ProcessDeleteChatKitThreadResponseContent( 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 ProcessDeleteChatKitThreadResponseContent( __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 ProcessDeleteChatKitThreadResponseContent( __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 ProcessDeleteChatKitThreadResponseContent( 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 ProcessDeleteChatKitThreadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteChatKitThreadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessDeleteChatKitThreadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedThreadResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedThreadResource.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 ProcessDeleteChatKitThreadResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedThreadResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedThreadResource.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.OpenAiClient.GetInputTokenCounts.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.GetInputTokenCounts.g.cs index 57d948bb..3e7723a9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.GetInputTokenCounts.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.GetInputTokenCounts.g.cs @@ -51,6 +51,29 @@ partial void ProcessGetInputTokenCountsResponseContent( /// public async global::System.Threading.Tasks.Task GetInputTokenCountsAsync( + global::tryAGI.OpenAI.TokenCountsBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetInputTokenCountsAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns input token counts of the request.
+ /// Returns an object with `object` set to `response.input_tokens` and an `input_tokens` count. + ///
+ /// + /// 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> GetInputTokenCountsAsResponseAsync( + global::tryAGI.OpenAI.TokenCountsBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +108,7 @@ partial void ProcessGetInputTokenCountsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/responses/input_tokens", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessGetInputTokenCountsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessGetInputTokenCountsResponseContent( } 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 ProcessGetInputTokenCountsResponseContent( 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 ProcessGetInputTokenCountsResponseContent( __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 ProcessGetInputTokenCountsResponseContent( __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 ProcessGetInputTokenCountsResponseContent( 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 ProcessGetInputTokenCountsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessGetInputTokenCountsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +359,13 @@ partial void ProcessGetInputTokenCountsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.TokenCountsResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.TokenCountsResource.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 ProcessGetInputTokenCountsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.TokenCountsResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.TokenCountsResource.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.OpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs index cd493dbb..baefaea2 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListAllOrganizationAndProjectApiKeys.g.cs @@ -69,6 +69,41 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( int? limit = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListAllOrganizationAndProjectApiKeysAsResponseAsync( + after: after, + order: order, + limit: limit, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List organization API keys
+ /// Retrieve a paginated list of organization admin API keys. + ///
+ /// + /// Return keys with IDs that come after this ID in the pagination order. + /// + /// + /// Order results by creation time, ascending or descending.
+ /// Default Value: asc + /// + /// + /// Maximum number of keys to return.
+ /// 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> ListAllOrganizationAndProjectApiKeysAsResponseAsync( + string? after = default, + global::tryAGI.OpenAI.AdminApiKeysListOrder? order = default, + int? limit = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,13 +135,14 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/admin_api_keys", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("after", after) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("limit", limit?.ToString()) + .AddOptionalParameter("limit", limit?.ToString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -180,6 +216,8 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -190,6 +228,11 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( } 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, @@ -207,6 +250,8 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -216,8 +261,7 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -226,6 +270,11 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( __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( @@ -242,14 +291,15 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( 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; } @@ -289,6 +339,8 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -309,6 +361,8 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -333,9 +387,13 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ApiKeyList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ApiKeyList.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) { @@ -363,9 +421,13 @@ partial void ProcessListAllOrganizationAndProjectApiKeysResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ApiKeyList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ApiKeyList.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.OpenAiClient.ListChatKitThreadItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreadItems.g.cs index 12841746..13cc802b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreadItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreadItems.g.cs @@ -74,6 +74,44 @@ partial void ProcessListChatKitThreadItemsResponseContent( string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListChatKitThreadItemsAsResponseAsync( + threadId: threadId, + limit: limit, + order: order, + after: after, + before: before, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List items that belong to a ChatKit thread. + /// + /// + /// Example: cthr_123 + /// + /// + /// + /// + /// List items created after this thread item ID. Defaults to null for the first page. + /// + /// + /// List items created before this thread item ID. Defaults to null for the newest results. + /// + /// 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> ListChatKitThreadItemsAsResponseAsync( + string threadId, + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -107,14 +145,15 @@ partial void ProcessListChatKitThreadItemsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/chatkit/threads/{threadId}/items", - 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( @@ -190,6 +229,8 @@ partial void ProcessListChatKitThreadItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -200,6 +241,11 @@ partial void ProcessListChatKitThreadItemsResponseContent( } 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 +263,8 @@ partial void ProcessListChatKitThreadItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -226,8 +274,7 @@ partial void ProcessListChatKitThreadItemsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -236,6 +283,11 @@ partial void ProcessListChatKitThreadItemsResponseContent( __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 +304,15 @@ partial void ProcessListChatKitThreadItemsResponseContent( 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 +352,8 @@ partial void ProcessListChatKitThreadItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -319,6 +374,8 @@ partial void ProcessListChatKitThreadItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -343,9 +400,13 @@ partial void ProcessListChatKitThreadItemsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ThreadItemListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ThreadItemListResource.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 +434,13 @@ partial void ProcessListChatKitThreadItemsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ThreadItemListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ThreadItemListResource.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.OpenAiClient.ListChatKitThreads.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreads.g.cs index 892cfcfe..8edc3d49 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreads.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListChatKitThreads.g.cs @@ -74,6 +74,44 @@ partial void ProcessListChatKitThreadsResponseContent( string? user = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListChatKitThreadsAsResponseAsync( + limit: limit, + order: order, + after: after, + before: before, + user: user, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List ChatKit threads with optional pagination and user filters. + /// + /// + /// + /// + /// List items created after this thread item ID. Defaults to null for the first page. + /// + /// + /// List items created before this thread item ID. Defaults to null for the newest results. + /// + /// + /// Filter threads that belong to this user identifier. Defaults to null to return all users. + /// + /// 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> ListChatKitThreadsAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + string? before = default, + string? user = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -107,15 +145,16 @@ partial void ProcessListChatKitThreadsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/chatkit/threads", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) .AddOptionalParameter("before", before) - .AddOptionalParameter("user", user) + .AddOptionalParameter("user", user) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -191,6 +230,8 @@ partial void ProcessListChatKitThreadsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -201,6 +242,11 @@ partial void ProcessListChatKitThreadsResponseContent( } 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, @@ -218,6 +264,8 @@ partial void ProcessListChatKitThreadsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -227,8 +275,7 @@ partial void ProcessListChatKitThreadsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -237,6 +284,11 @@ partial void ProcessListChatKitThreadsResponseContent( __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( @@ -253,14 +305,15 @@ partial void ProcessListChatKitThreadsResponseContent( 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; } @@ -300,6 +353,8 @@ partial void ProcessListChatKitThreadsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -320,6 +375,8 @@ partial void ProcessListChatKitThreadsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -344,9 +401,13 @@ partial void ProcessListChatKitThreadsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ThreadListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ThreadListResource.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) { @@ -374,9 +435,13 @@ partial void ProcessListChatKitThreadsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ThreadListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ThreadListResource.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.OpenAiClient.ListContainerFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainerFiles.g.cs index 788b512d..fcae4c25 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainerFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainerFiles.g.cs @@ -69,6 +69,40 @@ partial void ProcessListContainerFilesResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListContainerFilesAsResponseAsync( + containerId: containerId, + limit: limit, + order: order, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Container files
+ /// Lists container files. + ///
+ /// + /// + /// 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> ListContainerFilesAsResponseAsync( + string containerId, + int? limit = default, + global::tryAGI.OpenAI.ListContainerFilesOrder? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,13 +135,14 @@ partial void ProcessListContainerFilesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}/files", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -182,6 +217,8 @@ partial void ProcessListContainerFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +229,11 @@ partial void ProcessListContainerFilesResponseContent( } 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, @@ -209,6 +251,8 @@ partial void ProcessListContainerFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +262,7 @@ partial void ProcessListContainerFilesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +271,11 @@ partial void ProcessListContainerFilesResponseContent( __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( @@ -244,14 +292,15 @@ partial void ProcessListContainerFilesResponseContent( 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; } @@ -291,6 +340,8 @@ partial void ProcessListContainerFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +362,8 @@ partial void ProcessListContainerFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +388,13 @@ partial void ProcessListContainerFilesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerFileListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerFileListResource.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) { @@ -365,9 +422,13 @@ partial void ProcessListContainerFilesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerFileListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerFileListResource.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.OpenAiClient.ListContainers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainers.g.cs index 7f16ec94..5bd62a55 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.ListContainers.g.cs @@ -69,6 +69,40 @@ partial void ProcessListContainersResponseContent( string? name = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListContainersAsResponseAsync( + limit: limit, + order: order, + after: after, + name: name, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List Containers
+ /// Lists containers. + ///
+ /// + /// 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> ListContainersAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.ListContainersOrder? order = default, + string? after = default, + string? name = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,14 +135,15 @@ partial void ProcessListContainersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/containers", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) - .AddOptionalParameter("name", name) + .AddOptionalParameter("name", name) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -183,6 +218,8 @@ partial void ProcessListContainersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +230,11 @@ partial void ProcessListContainersResponseContent( } 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 +252,8 @@ partial void ProcessListContainersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +263,7 @@ partial void ProcessListContainersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +272,11 @@ partial void ProcessListContainersResponseContent( __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 +293,15 @@ partial void ProcessListContainersResponseContent( 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 +341,8 @@ partial void ProcessListContainersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +363,8 @@ partial void ProcessListContainersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -336,9 +389,13 @@ partial void ProcessListContainersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerListResource.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 +423,13 @@ partial void ProcessListContainersResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerListResource.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.OpenAiClient.RetrieveAdminApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveAdminApiKey.g.cs index db79aecb..ce3aaba4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveAdminApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveAdminApiKey.g.cs @@ -55,6 +55,29 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( string keyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveAdminApiKeyAsResponseAsync( + keyId: keyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve a single organization API key
+ /// Get details for a specific organization API key by its ID. + ///
+ /// + /// The ID of the API key. + /// + /// 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> RetrieveAdminApiKeyAsResponseAsync( + string keyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/admin_api_keys/{keyId}", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( } 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, @@ -184,6 +215,8 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( __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( @@ -219,14 +256,15 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( 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; } @@ -266,6 +304,8 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -310,9 +352,13 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.AdminApiKey.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.AdminApiKey.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) { @@ -340,9 +386,13 @@ partial void ProcessRetrieveAdminApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.AdminApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.AdminApiKey.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.OpenAiClient.RetrieveChatKitThread.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveChatKitThread.g.cs index d8c7c305..9306b951 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveChatKitThread.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveChatKitThread.g.cs @@ -54,6 +54,28 @@ partial void ProcessRetrieveChatKitThreadResponseContent( string threadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveChatKitThreadAsResponseAsync( + threadId: threadId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve a ChatKit thread by its identifier. + /// + /// + /// Example: cthr_123 + /// + /// 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> RetrieveChatKitThreadAsResponseAsync( + string threadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessRetrieveChatKitThreadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/chatkit/threads/{threadId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessRetrieveChatKitThreadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessRetrieveChatKitThreadResponseContent( } 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 ProcessRetrieveChatKitThreadResponseContent( 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 ProcessRetrieveChatKitThreadResponseContent( __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 ProcessRetrieveChatKitThreadResponseContent( __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 ProcessRetrieveChatKitThreadResponseContent( 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 ProcessRetrieveChatKitThreadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessRetrieveChatKitThreadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessRetrieveChatKitThreadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ThreadResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ThreadResource.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 ProcessRetrieveChatKitThreadResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ThreadResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ThreadResource.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.OpenAiClient.RetrieveContainer.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainer.g.cs index dbbf1fb6..08e9bd54 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainer.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainer.g.cs @@ -53,6 +53,27 @@ partial void ProcessRetrieveContainerResponseContent( string containerId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveContainerAsResponseAsync( + containerId: containerId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve Container
+ /// Retrieves a container. + ///
+ /// + /// 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> RetrieveContainerAsResponseAsync( + string containerId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +103,7 @@ partial void ProcessRetrieveContainerResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}", baseUri: HttpClient.BaseAddress); @@ -155,6 +177,8 @@ partial void ProcessRetrieveContainerResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -165,6 +189,11 @@ partial void ProcessRetrieveContainerResponseContent( } 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 ProcessRetrieveContainerResponseContent( 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 ProcessRetrieveContainerResponseContent( __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 ProcessRetrieveContainerResponseContent( __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 ProcessRetrieveContainerResponseContent( 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 ProcessRetrieveContainerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -284,6 +322,8 @@ partial void ProcessRetrieveContainerResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -308,9 +348,13 @@ partial void ProcessRetrieveContainerResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerResource.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 ProcessRetrieveContainerResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerResource.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.OpenAiClient.RetrieveContainerFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFile.g.cs index 0a3a3414..95509988 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFile.g.cs @@ -57,6 +57,30 @@ partial void ProcessRetrieveContainerFileResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveContainerFileAsResponseAsync( + containerId: containerId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve Container File
+ /// Retrieves a container 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> RetrieveContainerFileAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -87,6 +111,7 @@ partial void ProcessRetrieveContainerFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -161,6 +186,8 @@ partial void ProcessRetrieveContainerFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -171,6 +198,11 @@ partial void ProcessRetrieveContainerFileResponseContent( } 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, @@ -188,6 +220,8 @@ partial void ProcessRetrieveContainerFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -197,8 +231,7 @@ partial void ProcessRetrieveContainerFileResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -207,6 +240,11 @@ partial void ProcessRetrieveContainerFileResponseContent( __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( @@ -223,14 +261,15 @@ partial void ProcessRetrieveContainerFileResponseContent( 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; } @@ -270,6 +309,8 @@ partial void ProcessRetrieveContainerFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -290,6 +331,8 @@ partial void ProcessRetrieveContainerFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -314,9 +357,13 @@ partial void ProcessRetrieveContainerFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ContainerFileResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ContainerFileResource.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) { @@ -344,9 +391,13 @@ partial void ProcessRetrieveContainerFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ContainerFileResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ContainerFileResource.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.OpenAiClient.RetrieveContainerFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFileContent.g.cs index c204c2b6..101c5ea5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.RetrieveContainerFileContent.g.cs @@ -52,6 +52,28 @@ partial void ProcessRetrieveContainerFileContentResponse( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await RetrieveContainerFileContentAsResponseAsync( + containerId: containerId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Retrieve Container File Content
+ /// Retrieves a container file content. + ///
+ /// + /// + /// 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 RetrieveContainerFileContentAsResponseAsync( + string containerId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -82,6 +104,7 @@ partial void ProcessRetrieveContainerFileContentResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/containers/{containerId}/files/{fileId}/content", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessRetrieveContainerFileContentResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessRetrieveContainerFileContentResponse( } 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 ProcessRetrieveContainerFileContentResponse( 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 ProcessRetrieveContainerFileContentResponse( __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 ProcessRetrieveContainerFileContentResponse( __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 ProcessRetrieveContainerFileContentResponse( 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 ProcessRetrieveContainerFileContentResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessRetrieveContainerFileContentResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -305,6 +346,10 @@ partial void ProcessRetrieveContainerFileContentResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -326,6 +371,10 @@ partial void ProcessRetrieveContainerFileContentResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.g.cs index a01595cc..4d2c1870 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OpenAiClient.g.cs @@ -43,7 +43,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Build Assistants that can call models and use tools. /// - public AssistantsClient Assistants => new AssistantsClient(HttpClient, authorizations: Authorizations, options: Options) + public AssistantsClient Assistants => new AssistantsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -52,7 +52,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Turn audio into text or text into audio. /// - public AudioClient Audio => new AudioClient(HttpClient, authorizations: Authorizations, options: Options) + public AudioClient Audio => new AudioClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -61,7 +61,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// List user actions and configuration changes within this organization. /// - public AuditLogsClient AuditLogs => new AuditLogsClient(HttpClient, authorizations: Authorizations, options: Options) + public AuditLogsClient AuditLogs => new AuditLogsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -70,7 +70,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Create large batches of API requests to run asynchronously. /// - public BatchClient Batch => new BatchClient(HttpClient, authorizations: Authorizations, options: Options) + public BatchClient Batch => new BatchClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -79,7 +79,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public CertificatesClient Certificates => new CertificatesClient(HttpClient, authorizations: Authorizations, options: Options) + public CertificatesClient Certificates => new CertificatesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -88,7 +88,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Given a list of messages comprising a conversation, the model will return a response. /// - public ChatClient Chat => new ChatClient(HttpClient, authorizations: Authorizations, options: Options) + public ChatClient Chat => new ChatClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -97,7 +97,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. /// - public CompletionsClient Completions => new CompletionsClient(HttpClient, authorizations: Authorizations, options: Options) + public CompletionsClient Completions => new CompletionsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -106,7 +106,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Manage conversations and conversation items. /// - public ConversationsClient Conversations => new ConversationsClient(HttpClient, authorizations: Authorizations, options: Options) + public ConversationsClient Conversations => new ConversationsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -115,7 +115,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. /// - public EmbeddingsClient Embeddings => new EmbeddingsClient(HttpClient, authorizations: Authorizations, options: Options) + public EmbeddingsClient Embeddings => new EmbeddingsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -124,7 +124,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Manage and run evals in the OpenAI platform. /// - public EvalsClient Evals => new EvalsClient(HttpClient, authorizations: Authorizations, options: Options) + public EvalsClient Evals => new EvalsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -133,7 +133,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Files are used to upload documents that can be used with features like Assistants and Fine-tuning. /// - public FilesClient Files => new FilesClient(HttpClient, authorizations: Authorizations, options: Options) + public FilesClient Files => new FilesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -142,7 +142,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Manage fine-tuning jobs to tailor a model to your specific training data. /// - public FineTuningClient FineTuning => new FineTuningClient(HttpClient, authorizations: Authorizations, options: Options) + public FineTuningClient FineTuning => new FineTuningClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -151,7 +151,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public GroupOrganizationRoleAssignmentsClient GroupOrganizationRoleAssignments => new GroupOrganizationRoleAssignmentsClient(HttpClient, authorizations: Authorizations, options: Options) + public GroupOrganizationRoleAssignmentsClient GroupOrganizationRoleAssignments => new GroupOrganizationRoleAssignmentsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -160,7 +160,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public GroupUsersClient GroupUsers => new GroupUsersClient(HttpClient, authorizations: Authorizations, options: Options) + public GroupUsersClient GroupUsers => new GroupUsersClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -169,7 +169,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public GroupsClient Groups => new GroupsClient(HttpClient, authorizations: Authorizations, options: Options) + public GroupsClient Groups => new GroupsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -178,7 +178,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Given a prompt and/or an input image, the model will generate a new image. /// - public ImagesClient Images => new ImagesClient(HttpClient, authorizations: Authorizations, options: Options) + public ImagesClient Images => new ImagesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -187,7 +187,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public InvitesClient Invites => new InvitesClient(HttpClient, authorizations: Authorizations, options: Options) + public InvitesClient Invites => new InvitesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -196,7 +196,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// List and describe the various models available in the API. /// - public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations, options: Options) + public ModelsClient Models => new ModelsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -205,7 +205,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Given text and/or image inputs, classifies if those inputs are potentially harmful. /// - public ModerationsClient Moderations => new ModerationsClient(HttpClient, authorizations: Authorizations, options: Options) + public ModerationsClient Moderations => new ModerationsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -214,7 +214,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public ProjectGroupRoleAssignmentsClient ProjectGroupRoleAssignments => new ProjectGroupRoleAssignmentsClient(HttpClient, authorizations: Authorizations, options: Options) + public ProjectGroupRoleAssignmentsClient ProjectGroupRoleAssignments => new ProjectGroupRoleAssignmentsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -223,7 +223,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public ProjectGroupsClient ProjectGroups => new ProjectGroupsClient(HttpClient, authorizations: Authorizations, options: Options) + public ProjectGroupsClient ProjectGroups => new ProjectGroupsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -232,7 +232,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public ProjectUserRoleAssignmentsClient ProjectUserRoleAssignments => new ProjectUserRoleAssignmentsClient(HttpClient, authorizations: Authorizations, options: Options) + public ProjectUserRoleAssignmentsClient ProjectUserRoleAssignments => new ProjectUserRoleAssignmentsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -241,7 +241,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public ProjectsClient Projects => new ProjectsClient(HttpClient, authorizations: Authorizations, options: Options) + public ProjectsClient Projects => new ProjectsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -250,7 +250,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public RealtimeClient Realtime => new RealtimeClient(HttpClient, authorizations: Authorizations, options: Options) + public RealtimeClient Realtime => new RealtimeClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -259,7 +259,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public ResponsesClient Responses => new ResponsesClient(HttpClient, authorizations: Authorizations, options: Options) + public ResponsesClient Responses => new ResponsesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -268,7 +268,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public RolesClient Roles => new RolesClient(HttpClient, authorizations: Authorizations, options: Options) + public RolesClient Roles => new RolesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -277,7 +277,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public SkillsClient Skills => new SkillsClient(HttpClient, authorizations: Authorizations, options: Options) + public SkillsClient Skills => new SkillsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -286,7 +286,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// Use Uploads to upload large files in multiple parts. /// - public UploadsClient Uploads => new UploadsClient(HttpClient, authorizations: Authorizations, options: Options) + public UploadsClient Uploads => new UploadsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -295,7 +295,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public UsageClient Usage => new UsageClient(HttpClient, authorizations: Authorizations, options: Options) + public UsageClient Usage => new UsageClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -304,7 +304,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public UserOrganizationRoleAssignmentsClient UserOrganizationRoleAssignments => new UserOrganizationRoleAssignmentsClient(HttpClient, authorizations: Authorizations, options: Options) + public UserOrganizationRoleAssignmentsClient UserOrganizationRoleAssignments => new UserOrganizationRoleAssignmentsClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -313,7 +313,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public UsersClient Users => new UsersClient(HttpClient, authorizations: Authorizations, options: Options) + public UsersClient Users => new UsersClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -322,7 +322,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public VectorStoresClient VectorStores => new VectorStoresClient(HttpClient, authorizations: Authorizations, options: Options) + public VectorStoresClient VectorStores => new VectorStoresClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -331,7 +331,7 @@ public sealed partial class OpenAiClient : global::tryAGI.OpenAI.IOpenAiClient, /// /// /// - public VideosClient Videos => new VideosClient(HttpClient, authorizations: Authorizations, options: Options) + public VideosClient Videos => new VideosClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) { ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, @@ -370,10 +370,10 @@ public OpenAiClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public OpenAiClient( - 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.OptionsSupport.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OptionsSupport.g.cs index 5f08b562..ab708d07 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OptionsSupport.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::tryAGI.OpenAI.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::tryAGI.OpenAI.AutoSDKClientOptions clientOptions, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::tryAGI.OpenAI.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::tryAGI.OpenAI.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs index 51d73997..96bc7192 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.AssignProjectRoleToGroup.g.cs @@ -58,6 +58,34 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( string projectId, string groupId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AssignProjectRoleToGroupAsResponseAsync( + projectId: projectId, + groupId: groupId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Assigns a project role to a group within a project. + /// + /// + /// + /// + /// 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> AssignProjectRoleToGroupAsResponseAsync( + string projectId, + string groupId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +122,7 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/groups/{groupId}/roles", baseUri: HttpClient.BaseAddress); @@ -175,6 +204,8 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +216,11 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( } 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 ProcessAssignProjectRoleToGroupResponseContent( 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 ProcessAssignProjectRoleToGroupResponseContent( __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 ProcessAssignProjectRoleToGroupResponseContent( __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 ProcessAssignProjectRoleToGroupResponseContent( 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 ProcessAssignProjectRoleToGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +349,8 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +375,13 @@ partial void ProcessAssignProjectRoleToGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.GroupRoleAssignment.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.GroupRoleAssignment.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 ProcessAssignProjectRoleToGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.GroupRoleAssignment.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.GroupRoleAssignment.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.ProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs index 55de9632..247ece0b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.ListProjectGroupRoleAssignments.g.cs @@ -68,6 +68,38 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( global::tryAGI.OpenAI.ListProjectGroupRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectGroupRoleAssignmentsAsResponseAsync( + projectId: projectId, + groupId: groupId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the project roles assigned to a group within a project. + /// + /// + /// + /// + /// + /// + /// 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> ListProjectGroupRoleAssignmentsAsResponseAsync( + string projectId, + string groupId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectGroupRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,13 +133,14 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/groups/{groupId}/roles", - 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( @@ -183,6 +216,8 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +228,11 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( } 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 +250,8 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +261,7 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +270,11 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( __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 +291,15 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( 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 +339,8 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +361,8 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -336,9 +387,13 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleListResource.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 +421,13 @@ partial void ProcessListProjectGroupRoleAssignmentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleListResource.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.ProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs index 0ce35a37..33fd0e9e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.UnassignProjectRoleFromGroup.g.cs @@ -60,6 +60,32 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UnassignProjectRoleFromGroupAsResponseAsync( + projectId: projectId, + groupId: groupId, + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Unassigns a project role from a group within a project. + /// + /// + /// + /// + /// 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> UnassignProjectRoleFromGroupAsResponseAsync( + string projectId, + string groupId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,6 +117,7 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/groups/{groupId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -166,6 +193,8 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +205,11 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( } 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 +227,8 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +238,7 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +247,11 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( __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 +268,15 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( 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 +316,8 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +338,8 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -319,9 +364,13 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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 +398,13 @@ partial void ProcessUnassignProjectRoleFromGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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.ProjectGroupRoleAssignmentsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.g.cs index eb51737a..2ba0b6b1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupRoleAssignmentsClient.g.cs @@ -72,10 +72,10 @@ public ProjectGroupRoleAssignmentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ProjectGroupRoleAssignmentsClient( - 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.ProjectGroupsClient.AddProjectGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.AddProjectGroup.g.cs index 1327b96f..718b1381 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.AddProjectGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.AddProjectGroup.g.cs @@ -54,6 +54,31 @@ partial void ProcessAddProjectGroupResponseContent( public async global::System.Threading.Tasks.Task AddProjectGroupAsync( string projectId, + global::tryAGI.OpenAI.InviteProjectGroupBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AddProjectGroupAsResponseAsync( + projectId: projectId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Grants a group access to a project. + /// + /// + /// + /// 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> AddProjectGroupAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.InviteProjectGroupBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessAddProjectGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/groups", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessAddProjectGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessAddProjectGroupResponseContent( } 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 ProcessAddProjectGroupResponseContent( 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 ProcessAddProjectGroupResponseContent( __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 ProcessAddProjectGroupResponseContent( __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 ProcessAddProjectGroupResponseContent( 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 ProcessAddProjectGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessAddProjectGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessAddProjectGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectGroup.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectGroup.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 ProcessAddProjectGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectGroup.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectGroup.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.ProjectGroupsClient.ListProjectGroups.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.ListProjectGroups.g.cs index 863e603f..39f24672 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.ListProjectGroups.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.ListProjectGroups.g.cs @@ -68,6 +68,39 @@ partial void ProcessListProjectGroupsResponseContent( global::tryAGI.OpenAI.ListProjectGroupsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectGroupsAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the groups that have access to a project. + /// + /// + /// + /// 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> ListProjectGroupsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectGroupsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,13 +133,14 @@ partial void ProcessListProjectGroupsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/groups", - 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 ProcessListProjectGroupsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -191,6 +227,11 @@ partial void ProcessListProjectGroupsResponseContent( } 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 ProcessListProjectGroupsResponseContent( 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 ProcessListProjectGroupsResponseContent( __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 ProcessListProjectGroupsResponseContent( __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 ProcessListProjectGroupsResponseContent( 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 ProcessListProjectGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -310,6 +360,8 @@ partial void ProcessListProjectGroupsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -334,9 +386,13 @@ partial void ProcessListProjectGroupsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectGroupListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectGroupListResource.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 ProcessListProjectGroupsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectGroupListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectGroupListResource.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.ProjectGroupsClient.RemoveProjectGroup.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.RemoveProjectGroup.g.cs index 3516c692..241c2de1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.RemoveProjectGroup.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.RemoveProjectGroup.g.cs @@ -56,6 +56,29 @@ partial void ProcessRemoveProjectGroupResponseContent( string groupId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RemoveProjectGroupAsResponseAsync( + projectId: projectId, + groupId: groupId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Revokes a group's access to a project. + /// + /// + /// + /// 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> RemoveProjectGroupAsResponseAsync( + string projectId, + string groupId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessRemoveProjectGroupResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/groups/{groupId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessRemoveProjectGroupResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessRemoveProjectGroupResponseContent( } 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 ProcessRemoveProjectGroupResponseContent( 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 ProcessRemoveProjectGroupResponseContent( __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 ProcessRemoveProjectGroupResponseContent( __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 ProcessRemoveProjectGroupResponseContent( 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 ProcessRemoveProjectGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessRemoveProjectGroupResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessRemoveProjectGroupResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectGroupDeletedResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectGroupDeletedResource.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 ProcessRemoveProjectGroupResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectGroupDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectGroupDeletedResource.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.ProjectGroupsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.g.cs index 2a11b917..78027863 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectGroupsClient.g.cs @@ -72,10 +72,10 @@ public ProjectGroupsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ProjectGroupsClient( - 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.ProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs index d60a2914..e4b87264 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.AssignProjectRoleToUser.g.cs @@ -58,6 +58,34 @@ partial void ProcessAssignProjectRoleToUserResponseContent( string projectId, string userId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AssignProjectRoleToUserAsResponseAsync( + projectId: projectId, + userId: userId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Assigns a project role to a user within a project. + /// + /// + /// + /// + /// 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> AssignProjectRoleToUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +122,7 @@ partial void ProcessAssignProjectRoleToUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/users/{userId}/roles", baseUri: HttpClient.BaseAddress); @@ -175,6 +204,8 @@ partial void ProcessAssignProjectRoleToUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +216,11 @@ partial void ProcessAssignProjectRoleToUserResponseContent( } 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 ProcessAssignProjectRoleToUserResponseContent( 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 ProcessAssignProjectRoleToUserResponseContent( __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 ProcessAssignProjectRoleToUserResponseContent( __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 ProcessAssignProjectRoleToUserResponseContent( 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 ProcessAssignProjectRoleToUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +349,8 @@ partial void ProcessAssignProjectRoleToUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +375,13 @@ partial void ProcessAssignProjectRoleToUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UserRoleAssignment.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UserRoleAssignment.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 ProcessAssignProjectRoleToUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UserRoleAssignment.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UserRoleAssignment.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.ProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs index 910d476d..8a5876cf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.ListProjectUserRoleAssignments.g.cs @@ -68,6 +68,38 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( global::tryAGI.OpenAI.ListProjectUserRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectUserRoleAssignmentsAsResponseAsync( + projectId: projectId, + userId: userId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the project roles assigned to a user within a project. + /// + /// + /// + /// + /// + /// + /// 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> ListProjectUserRoleAssignmentsAsResponseAsync( + string projectId, + string userId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectUserRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -101,13 +133,14 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/users/{userId}/roles", - 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( @@ -183,6 +216,8 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -193,6 +228,11 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( } 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 +250,8 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -219,8 +261,7 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -229,6 +270,11 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( __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 +291,15 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( 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 +339,8 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -312,6 +361,8 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -336,9 +387,13 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleListResource.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 +421,13 @@ partial void ProcessListProjectUserRoleAssignmentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleListResource.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.ProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs index 2da37a8f..2972bade 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.UnassignProjectRoleFromUser.g.cs @@ -60,6 +60,32 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UnassignProjectRoleFromUserAsResponseAsync( + projectId: projectId, + userId: userId, + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Unassigns a project role from a user within a project. + /// + /// + /// + /// + /// 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> UnassignProjectRoleFromUserAsResponseAsync( + string projectId, + string userId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -91,6 +117,7 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/users/{userId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -166,6 +193,8 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +205,11 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( } 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 +227,8 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +238,7 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +247,11 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( __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 +268,15 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( 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 +316,8 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +338,8 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -319,9 +364,13 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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 +398,13 @@ partial void ProcessUnassignProjectRoleFromUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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.ProjectUserRoleAssignmentsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.g.cs index 815ea597..a1177137 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectUserRoleAssignmentsClient.g.cs @@ -72,10 +72,10 @@ public ProjectUserRoleAssignmentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ProjectUserRoleAssignmentsClient( - 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.ProjectsClient.ArchiveProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ArchiveProject.g.cs index 3a1e0ae2..77882ee9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ArchiveProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ArchiveProject.g.cs @@ -52,6 +52,26 @@ partial void ProcessArchiveProjectResponseContent( string projectId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ArchiveProjectAsResponseAsync( + projectId: projectId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Archives a project in the organization. Archived projects cannot be used or updated. + /// + /// + /// 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> ArchiveProjectAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessArchiveProjectResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/archive", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessArchiveProjectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessArchiveProjectResponseContent( } 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 ProcessArchiveProjectResponseContent( 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 ProcessArchiveProjectResponseContent( __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 ProcessArchiveProjectResponseContent( __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 ProcessArchiveProjectResponseContent( 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 ProcessArchiveProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessArchiveProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessArchiveProjectResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Project.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Project.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 ProcessArchiveProjectResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Project.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Project.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.ProjectsClient.CreateProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProject.g.cs index dd766c09..eaf7b07d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProject.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateProjectResponseContent( /// public async global::System.Threading.Tasks.Task CreateProjectAsync( + global::tryAGI.OpenAI.ProjectCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateProjectAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new project in the organization. Projects can be created and archived, but cannot 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> CreateProjectAsResponseAsync( + global::tryAGI.OpenAI.ProjectCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateProjectResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/projects", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateProjectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateProjectResponseContent( } 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 ProcessCreateProjectResponseContent( 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 ProcessCreateProjectResponseContent( __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 ProcessCreateProjectResponseContent( __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 ProcessCreateProjectResponseContent( 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 ProcessCreateProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateProjectResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Project.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Project.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 ProcessCreateProjectResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Project.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Project.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.ProjectsClient.CreateProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs index 2cb462a7..f8cbcda4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectServiceAccount.g.cs @@ -54,6 +54,31 @@ partial void ProcessCreateProjectServiceAccountResponseContent( public async global::System.Threading.Tasks.Task CreateProjectServiceAccountAsync( string projectId, + global::tryAGI.OpenAI.ProjectServiceAccountCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateProjectServiceAccountAsResponseAsync( + projectId: projectId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a new service account in the project. This also returns an unredacted API key for the service account. + /// + /// + /// + /// 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> CreateProjectServiceAccountAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.ProjectServiceAccountCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessCreateProjectServiceAccountResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/service_accounts", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessCreateProjectServiceAccountResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessCreateProjectServiceAccountResponseContent( } 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 ProcessCreateProjectServiceAccountResponseContent( 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 ProcessCreateProjectServiceAccountResponseContent( __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 ProcessCreateProjectServiceAccountResponseContent( __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 ProcessCreateProjectServiceAccountResponseContent( 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 ProcessCreateProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessCreateProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response when project is archived. @@ -360,9 +404,13 @@ partial void ProcessCreateProjectServiceAccountResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectServiceAccountCreateResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectServiceAccountCreateResponse.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) { @@ -390,9 +438,13 @@ partial void ProcessCreateProjectServiceAccountResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectServiceAccountCreateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectServiceAccountCreateResponse.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.ProjectsClient.CreateProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectUser.g.cs index 9a23e5c0..0237d59e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.CreateProjectUser.g.cs @@ -54,6 +54,31 @@ partial void ProcessCreateProjectUserResponseContent( public async global::System.Threading.Tasks.Task CreateProjectUserAsync( string projectId, + global::tryAGI.OpenAI.ProjectUserCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateProjectUserAsResponseAsync( + projectId: projectId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Adds a user to the project. Users must already be members of the organization to be added to a project. + /// + /// + /// + /// 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> CreateProjectUserAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.ProjectUserCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessCreateProjectUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/users", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessCreateProjectUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessCreateProjectUserResponseContent( } 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 ProcessCreateProjectUserResponseContent( 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 ProcessCreateProjectUserResponseContent( __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 ProcessCreateProjectUserResponseContent( __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 ProcessCreateProjectUserResponseContent( 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 ProcessCreateProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessCreateProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response for various conditions. @@ -360,9 +404,13 @@ partial void ProcessCreateProjectUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectUser.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectUser.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) { @@ -390,9 +438,13 @@ partial void ProcessCreateProjectUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectUser.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectUser.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.ProjectsClient.DeleteProjectApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs index e7fb48fe..98df7098 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectApiKey.g.cs @@ -58,6 +58,31 @@ partial void ProcessDeleteProjectApiKeyResponseContent( string apiKeyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteProjectApiKeyAsResponseAsync( + projectId: projectId, + apiKeyId: apiKeyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes an API key from the project.
+ /// Returns confirmation of the key deletion, or an error if the key belonged to
+ /// a service account. + ///
+ /// + /// + /// 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> DeleteProjectApiKeyAsResponseAsync( + string projectId, + string apiKeyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -88,6 +113,7 @@ partial void ProcessDeleteProjectApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/api_keys/{apiKeyId}", baseUri: HttpClient.BaseAddress); @@ -162,6 +188,8 @@ partial void ProcessDeleteProjectApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +200,11 @@ partial void ProcessDeleteProjectApiKeyResponseContent( } 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, @@ -189,6 +222,8 @@ partial void ProcessDeleteProjectApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +233,7 @@ partial void ProcessDeleteProjectApiKeyResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +242,11 @@ partial void ProcessDeleteProjectApiKeyResponseContent( __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( @@ -224,14 +263,15 @@ partial void ProcessDeleteProjectApiKeyResponseContent( 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; } @@ -271,6 +311,8 @@ partial void ProcessDeleteProjectApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +333,8 @@ partial void ProcessDeleteProjectApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response for various conditions. @@ -353,9 +397,13 @@ partial void ProcessDeleteProjectApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectApiKeyDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectApiKeyDeleteResponse.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) { @@ -383,9 +431,13 @@ partial void ProcessDeleteProjectApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectApiKeyDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectApiKeyDeleteResponse.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.ProjectsClient.DeleteProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs index c05175e1..e86b59c1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectServiceAccount.g.cs @@ -58,6 +58,31 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( string serviceAccountId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteProjectServiceAccountAsResponseAsync( + projectId: projectId, + serviceAccountId: serviceAccountId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a service account from the project.
+ /// Returns confirmation of service account deletion, or an error if the project
+ /// is archived (archived projects have no service accounts). + ///
+ /// + /// + /// 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> DeleteProjectServiceAccountAsResponseAsync( + string projectId, + string serviceAccountId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -88,6 +113,7 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/service_accounts/{serviceAccountId}", baseUri: HttpClient.BaseAddress); @@ -162,6 +188,8 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +200,11 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( } 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, @@ -189,6 +222,8 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +233,7 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +242,11 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( __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( @@ -224,14 +263,15 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( 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; } @@ -271,6 +311,8 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +333,8 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +359,13 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectServiceAccountDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectServiceAccountDeleteResponse.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) { @@ -345,9 +393,13 @@ partial void ProcessDeleteProjectServiceAccountResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectServiceAccountDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectServiceAccountDeleteResponse.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.ProjectsClient.DeleteProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectUser.g.cs index 66e7f54f..334314a4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.DeleteProjectUser.g.cs @@ -58,6 +58,31 @@ partial void ProcessDeleteProjectUserResponseContent( string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteProjectUserAsResponseAsync( + projectId: projectId, + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a user from the project.
+ /// Returns confirmation of project user deletion, or an error if the project is
+ /// archived (archived projects have no users). + ///
+ /// + /// + /// 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> DeleteProjectUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -88,6 +113,7 @@ partial void ProcessDeleteProjectUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -162,6 +188,8 @@ partial void ProcessDeleteProjectUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +200,11 @@ partial void ProcessDeleteProjectUserResponseContent( } 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, @@ -189,6 +222,8 @@ partial void ProcessDeleteProjectUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +233,7 @@ partial void ProcessDeleteProjectUserResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +242,11 @@ partial void ProcessDeleteProjectUserResponseContent( __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( @@ -224,14 +263,15 @@ partial void ProcessDeleteProjectUserResponseContent( 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; } @@ -271,6 +311,8 @@ partial void ProcessDeleteProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +333,8 @@ partial void ProcessDeleteProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response for various conditions. @@ -353,9 +397,13 @@ partial void ProcessDeleteProjectUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectUserDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectUserDeleteResponse.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) { @@ -383,9 +431,13 @@ partial void ProcessDeleteProjectUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectUserDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectUserDeleteResponse.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.ProjectsClient.ListProjectApiKeys.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectApiKeys.g.cs index a92b4ff7..a9e7e5d1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectApiKeys.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectApiKeys.g.cs @@ -62,6 +62,34 @@ partial void ProcessListProjectApiKeysResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectApiKeysAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of API keys in the project. + /// + /// + /// + /// 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> ListProjectApiKeysAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,12 +121,13 @@ partial void ProcessListProjectApiKeysResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/api_keys", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +201,8 @@ partial void ProcessListProjectApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +213,11 @@ partial void ProcessListProjectApiKeysResponseContent( } 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, @@ -199,6 +235,8 @@ partial void ProcessListProjectApiKeysResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +246,7 @@ partial void ProcessListProjectApiKeysResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +255,11 @@ partial void ProcessListProjectApiKeysResponseContent( __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( @@ -234,14 +276,15 @@ partial void ProcessListProjectApiKeysResponseContent( 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; } @@ -281,6 +324,8 @@ partial void ProcessListProjectApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +346,8 @@ partial void ProcessListProjectApiKeysResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -325,9 +372,13 @@ partial void ProcessListProjectApiKeysResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectApiKeyListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectApiKeyListResponse.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) { @@ -355,9 +406,13 @@ partial void ProcessListProjectApiKeysResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectApiKeyListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectApiKeyListResponse.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.ProjectsClient.ListProjectRateLimits.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectRateLimits.g.cs index 5a9f814b..38b957e8 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectRateLimits.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectRateLimits.g.cs @@ -66,6 +66,37 @@ partial void ProcessListProjectRateLimitsResponseContent( string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectRateLimitsAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + before: before, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns the rate limits per model for a project. + /// + /// + /// + /// Default Value: 100 + /// + /// + /// + /// 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> ListProjectRateLimitsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -98,13 +129,14 @@ partial void ProcessListProjectRateLimitsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/rate_limits", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) - .AddOptionalParameter("before", before) + .AddOptionalParameter("before", before) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -179,6 +211,8 @@ partial void ProcessListProjectRateLimitsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -189,6 +223,11 @@ partial void ProcessListProjectRateLimitsResponseContent( } 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, @@ -206,6 +245,8 @@ partial void ProcessListProjectRateLimitsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -215,8 +256,7 @@ partial void ProcessListProjectRateLimitsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -225,6 +265,11 @@ partial void ProcessListProjectRateLimitsResponseContent( __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( @@ -241,14 +286,15 @@ partial void ProcessListProjectRateLimitsResponseContent( 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; } @@ -288,6 +334,8 @@ partial void ProcessListProjectRateLimitsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -308,6 +356,8 @@ partial void ProcessListProjectRateLimitsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -332,9 +382,13 @@ partial void ProcessListProjectRateLimitsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectRateLimitListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectRateLimitListResponse.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) { @@ -362,9 +416,13 @@ partial void ProcessListProjectRateLimitsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectRateLimitListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectRateLimitListResponse.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.ProjectsClient.ListProjectServiceAccounts.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs index f02ccd4c..8fc00e81 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectServiceAccounts.g.cs @@ -62,6 +62,34 @@ partial void ProcessListProjectServiceAccountsResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectServiceAccountsAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of service accounts in the project. + /// + /// + /// + /// 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> ListProjectServiceAccountsAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,12 +121,13 @@ partial void ProcessListProjectServiceAccountsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/service_accounts", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +201,8 @@ partial void ProcessListProjectServiceAccountsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +213,11 @@ partial void ProcessListProjectServiceAccountsResponseContent( } 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, @@ -199,6 +235,8 @@ partial void ProcessListProjectServiceAccountsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +246,7 @@ partial void ProcessListProjectServiceAccountsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +255,11 @@ partial void ProcessListProjectServiceAccountsResponseContent( __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( @@ -234,14 +276,15 @@ partial void ProcessListProjectServiceAccountsResponseContent( 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; } @@ -281,6 +324,8 @@ partial void ProcessListProjectServiceAccountsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +346,8 @@ partial void ProcessListProjectServiceAccountsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response when project is archived. @@ -363,9 +410,13 @@ partial void ProcessListProjectServiceAccountsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectServiceAccountListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectServiceAccountListResponse.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) { @@ -393,9 +444,13 @@ partial void ProcessListProjectServiceAccountsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectServiceAccountListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectServiceAccountListResponse.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.ProjectsClient.ListProjectUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectUsers.g.cs index ec025b2a..e7719e76 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjectUsers.g.cs @@ -62,6 +62,34 @@ partial void ProcessListProjectUsersResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectUsersAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of users in the project. + /// + /// + /// + /// 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> ListProjectUsersAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,12 +121,13 @@ partial void ProcessListProjectUsersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/users", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -172,6 +201,8 @@ partial void ProcessListProjectUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -182,6 +213,11 @@ partial void ProcessListProjectUsersResponseContent( } 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, @@ -199,6 +235,8 @@ partial void ProcessListProjectUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -208,8 +246,7 @@ partial void ProcessListProjectUsersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -218,6 +255,11 @@ partial void ProcessListProjectUsersResponseContent( __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( @@ -234,14 +276,15 @@ partial void ProcessListProjectUsersResponseContent( 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; } @@ -281,6 +324,8 @@ partial void ProcessListProjectUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -301,6 +346,8 @@ partial void ProcessListProjectUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response when project is archived. @@ -363,9 +410,13 @@ partial void ProcessListProjectUsersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectUserListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectUserListResponse.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) { @@ -393,9 +444,13 @@ partial void ProcessListProjectUsersResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectUserListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectUserListResponse.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.ProjectsClient.ListProjects.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjects.g.cs index 50b7e04e..ec686f56 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjects.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ListProjects.g.cs @@ -64,6 +64,36 @@ partial void ProcessListProjectsResponseContent( bool? includeArchived = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectsAsResponseAsync( + limit: limit, + after: after, + includeArchived: includeArchived, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of projects. + /// + /// + /// Default Value: 20 + /// + /// + /// + /// Default Value: false + /// + /// 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> ListProjectsAsResponseAsync( + int? limit = default, + string? after = default, + bool? includeArchived = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,13 +125,14 @@ partial void ProcessListProjectsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/projects", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) - .AddOptionalParameter("include_archived", includeArchived?.ToString().ToLowerInvariant()) + .AddOptionalParameter("include_archived", includeArchived?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -175,6 +206,8 @@ partial void ProcessListProjectsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +218,11 @@ partial void ProcessListProjectsResponseContent( } 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 ProcessListProjectsResponseContent( 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 ProcessListProjectsResponseContent( __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 ProcessListProjectsResponseContent( __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 ProcessListProjectsResponseContent( 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 ProcessListProjectsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +351,8 @@ partial void ProcessListProjectsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +377,13 @@ partial void ProcessListProjectsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectListResponse.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 ProcessListProjectsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectListResponse.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.ProjectsClient.ModifyProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProject.g.cs index 086000ef..b36b2f7f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProject.g.cs @@ -54,6 +54,31 @@ partial void ProcessModifyProjectResponseContent( public async global::System.Threading.Tasks.Task ModifyProjectAsync( string projectId, + global::tryAGI.OpenAI.ProjectUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModifyProjectAsResponseAsync( + projectId: projectId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Modifies a project in the organization. + /// + /// + /// + /// 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> ModifyProjectAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.ProjectUpdateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessModifyProjectResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessModifyProjectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessModifyProjectResponseContent( } 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 ProcessModifyProjectResponseContent( 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 ProcessModifyProjectResponseContent( __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 ProcessModifyProjectResponseContent( __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 ProcessModifyProjectResponseContent( 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 ProcessModifyProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessModifyProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response when updating the default project. @@ -360,9 +404,13 @@ partial void ProcessModifyProjectResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Project.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Project.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) { @@ -390,9 +438,13 @@ partial void ProcessModifyProjectResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Project.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Project.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.ProjectsClient.ModifyProjectRateLimit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectRateLimit.g.cs index 318cfa4d..5c6d5872 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectRateLimit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectRateLimit.g.cs @@ -58,6 +58,34 @@ partial void ProcessModifyProjectRateLimitResponseContent( string projectId, string rateLimitId, + global::tryAGI.OpenAI.ProjectRateLimitUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModifyProjectRateLimitAsResponseAsync( + projectId: projectId, + rateLimitId: rateLimitId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Updates a project rate limit. + /// + /// + /// + /// + /// 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> ModifyProjectRateLimitAsResponseAsync( + string projectId, + string rateLimitId, + global::tryAGI.OpenAI.ProjectRateLimitUpdateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +122,7 @@ partial void ProcessModifyProjectRateLimitResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/rate_limits/{rateLimitId}", baseUri: HttpClient.BaseAddress); @@ -175,6 +204,8 @@ partial void ProcessModifyProjectRateLimitResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +216,11 @@ partial void ProcessModifyProjectRateLimitResponseContent( } 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 ProcessModifyProjectRateLimitResponseContent( 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 ProcessModifyProjectRateLimitResponseContent( __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 ProcessModifyProjectRateLimitResponseContent( __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 ProcessModifyProjectRateLimitResponseContent( 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 ProcessModifyProjectRateLimitResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +349,8 @@ partial void ProcessModifyProjectRateLimitResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response for various conditions. @@ -366,9 +413,13 @@ partial void ProcessModifyProjectRateLimitResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectRateLimit.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectRateLimit.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) { @@ -396,9 +447,13 @@ partial void ProcessModifyProjectRateLimitResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectRateLimit.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectRateLimit.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.ProjectsClient.ModifyProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectUser.g.cs index fc781aa5..d1623b20 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.ModifyProjectUser.g.cs @@ -58,6 +58,34 @@ partial void ProcessModifyProjectUserResponseContent( string projectId, string userId, + global::tryAGI.OpenAI.ProjectUserUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModifyProjectUserAsResponseAsync( + projectId: projectId, + userId: userId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Modifies a user's role in the project. + /// + /// + /// + /// + /// 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> ModifyProjectUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.ProjectUserUpdateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +122,7 @@ partial void ProcessModifyProjectUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -175,6 +204,8 @@ partial void ProcessModifyProjectUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +216,11 @@ partial void ProcessModifyProjectUserResponseContent( } 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 ProcessModifyProjectUserResponseContent( 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 ProcessModifyProjectUserResponseContent( __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 ProcessModifyProjectUserResponseContent( __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 ProcessModifyProjectUserResponseContent( 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 ProcessModifyProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +349,8 @@ partial void ProcessModifyProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Error response for various conditions. @@ -366,9 +413,13 @@ partial void ProcessModifyProjectUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectUser.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectUser.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) { @@ -396,9 +447,13 @@ partial void ProcessModifyProjectUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectUser.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectUser.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.ProjectsClient.RetrieveProject.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProject.g.cs index 44199fa7..86bc4faf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProject.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProject.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveProjectResponseContent( string projectId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveProjectAsResponseAsync( + projectId: projectId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a project. + /// + /// + /// 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> RetrieveProjectAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveProjectResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveProjectResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveProjectResponseContent( } 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 ProcessRetrieveProjectResponseContent( 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 ProcessRetrieveProjectResponseContent( __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 ProcessRetrieveProjectResponseContent( __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 ProcessRetrieveProjectResponseContent( 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 ProcessRetrieveProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveProjectResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessRetrieveProjectResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Project.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Project.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 ProcessRetrieveProjectResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Project.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Project.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.ProjectsClient.RetrieveProjectApiKey.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs index b98a3b39..31c0de3d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectApiKey.g.cs @@ -56,6 +56,29 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( string apiKeyId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveProjectApiKeyAsResponseAsync( + projectId: projectId, + apiKeyId: apiKeyId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves an API key in the project. + /// + /// + /// + /// 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> RetrieveProjectApiKeyAsResponseAsync( + string projectId, + string apiKeyId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/api_keys/{apiKeyId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( } 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 ProcessRetrieveProjectApiKeyResponseContent( 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 ProcessRetrieveProjectApiKeyResponseContent( __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 ProcessRetrieveProjectApiKeyResponseContent( __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 ProcessRetrieveProjectApiKeyResponseContent( 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 ProcessRetrieveProjectApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessRetrieveProjectApiKeyResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectApiKey.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectApiKey.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 ProcessRetrieveProjectApiKeyResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectApiKey.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectApiKey.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.ProjectsClient.RetrieveProjectServiceAccount.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs index 8ae478d1..4cf99564 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectServiceAccount.g.cs @@ -56,6 +56,29 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( string serviceAccountId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveProjectServiceAccountAsResponseAsync( + projectId: projectId, + serviceAccountId: serviceAccountId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a service account in the project. + /// + /// + /// + /// 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> RetrieveProjectServiceAccountAsResponseAsync( + string projectId, + string serviceAccountId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/service_accounts/{serviceAccountId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( } 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 ProcessRetrieveProjectServiceAccountResponseContent( 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 ProcessRetrieveProjectServiceAccountResponseContent( __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 ProcessRetrieveProjectServiceAccountResponseContent( __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 ProcessRetrieveProjectServiceAccountResponseContent( 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 ProcessRetrieveProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessRetrieveProjectServiceAccountResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectServiceAccount.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectServiceAccount.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 ProcessRetrieveProjectServiceAccountResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectServiceAccount.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectServiceAccount.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.ProjectsClient.RetrieveProjectUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectUser.g.cs index 2ab31d82..9ad09716 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.RetrieveProjectUser.g.cs @@ -56,6 +56,29 @@ partial void ProcessRetrieveProjectUserResponseContent( string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveProjectUserAsResponseAsync( + projectId: projectId, + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a user in the project. + /// + /// + /// + /// 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> RetrieveProjectUserAsResponseAsync( + string projectId, + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessRetrieveProjectUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/projects/{projectId}/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessRetrieveProjectUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessRetrieveProjectUserResponseContent( } 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 ProcessRetrieveProjectUserResponseContent( 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 ProcessRetrieveProjectUserResponseContent( __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 ProcessRetrieveProjectUserResponseContent( __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 ProcessRetrieveProjectUserResponseContent( 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 ProcessRetrieveProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessRetrieveProjectUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessRetrieveProjectUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ProjectUser.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ProjectUser.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 ProcessRetrieveProjectUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ProjectUser.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ProjectUser.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.ProjectsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.g.cs index d120e1c0..28665333 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ProjectsClient.g.cs @@ -72,10 +72,10 @@ public ProjectsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ProjectsClient( - 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.Realtime.OpenAiRealtimeClient.ReceiveUpdates.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.ReceiveUpdates.g.cs index a12539a2..d8b34cfd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.ReceiveUpdates.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.ReceiveUpdates.g.cs @@ -41,8 +41,14 @@ public sealed partial class OpenAiRealtimeClient } catch (global::System.Net.WebSockets.WebSocketException exception) { + RaiseException(exception); var rethrow = false; OnReceiveException(exception, ref rethrow); + if (await TryReconnectAsync(exception, cancellationToken).ConfigureAwait(false)) + { + continue; + } + if (rethrow) { throw; @@ -52,6 +58,11 @@ public sealed partial class OpenAiRealtimeClient } catch (global::System.OperationCanceledException exception) { + if (!cancellationToken.IsCancellationRequested) + { + RaiseException(exception); + } + var rethrow = false; OnReceiveException(exception, ref rethrow); if (rethrow) @@ -64,6 +75,7 @@ public sealed partial class OpenAiRealtimeClient if (result.MessageType == global::System.Net.WebSockets.WebSocketMessageType.Close) { + RaiseClosed(result.CloseStatus, result.CloseStatusDescription); await _clientWebSocket.CloseAsync( closeStatus: global::System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, statusDescription: "Closing", @@ -93,10 +105,75 @@ await _clientWebSocket.CloseAsync( } string json = global::System.Text.Encoding.UTF8.GetString(__messageBuffer.ToArray()); - var @event = (global::tryAGI.OpenAI.Realtime.RealtimeServerEvent)global::System.Text.Json.JsonSerializer.Deserialize(json, typeof(global::tryAGI.OpenAI.Realtime.RealtimeServerEvent), JsonSerializerContext)!; + global::tryAGI.OpenAI.Realtime.RealtimeServerEvent @event; + try + { + @event = (global::tryAGI.OpenAI.Realtime.RealtimeServerEvent)global::System.Text.Json.JsonSerializer.Deserialize(json, typeof(global::tryAGI.OpenAI.Realtime.RealtimeServerEvent), JsonSerializerContext)!; + } + catch (global::System.Exception exception) when ( + exception is global::System.Text.Json.JsonException || + exception is global::System.NotSupportedException || + exception is global::System.InvalidOperationException) + { + var rethrow = false; + OnReceiveException(exception, ref rethrow); + DispatchUnknownMessage(json); + if (rethrow) + { + throw; + } + continue; + } + + DispatchReceivedMessage(@event, json); yield return @event; } } + + + private static global::System.Text.Json.JsonElement? TryParseMessageJson( + string rawText) + { + try + { + using var document = global::System.Text.Json.JsonDocument.Parse(rawText); + return document.RootElement.Clone(); + } + catch (global::System.Text.Json.JsonException) + { + return null; + } + } + + private void DispatchUnknownMessage( + string rawText) + { + UnknownMessage?.Invoke( + this, + new AutoSDKWebSocketUnknownMessageEventArgs( + rawText, + TryParseMessageJson(rawText))); + } + + private void DispatchReceivedMessage( + global::tryAGI.OpenAI.Realtime.RealtimeServerEvent @event, + string rawText) + { + var json = TryParseMessageJson(rawText); + MessageReceived?.Invoke( + this, + new AutoSDKWebSocketMessageEventArgs( + @event, + rawText, + json)); + + ServerEventReceived?.Invoke( + this, + new AutoSDKWebSocketMessageEventArgs( + @event, + rawText, + json)); + } } } \ No newline at end of file diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.g.cs index b7186cb0..95a8b36c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OpenAiRealtimeClient.g.cs @@ -14,7 +14,262 @@ public sealed partial class OpenAiRealtimeClient : global::System.IDisposable, g /// public const string DefaultBaseUrl = "wss://api.openai.com/v1/realtime"; - private readonly global::System.Net.WebSockets.ClientWebSocket _clientWebSocket; + private global::System.Net.WebSockets.ClientWebSocket _clientWebSocket; + private global::System.Uri? _lastConnectUri; + private global::System.Collections.Generic.Dictionary? _lastAdditionalHeaders; + private global::System.Collections.Generic.List? _lastAdditionalSubProtocols; + private global::System.TimeSpan? _lastKeepAliveInterval; + private global::System.TimeSpan? _lastConnectTimeout; + private bool _lastUseSubprotocolAuth; + + + /// + /// Current WebSocket connection status. + /// + public enum AutoSDKWebSocketConnectionStatus + { + /// + /// The client is not connected. + /// + Disconnected, + + /// + /// The client is connecting. + /// + Connecting, + + /// + /// The client is connected. + /// + Connected, + + /// + /// The client observed a normal close. + /// + Closed, + + /// + /// The client observed a connection error. + /// + Faulted, + } + + /// + /// Configures automatic reconnect attempts after receive-loop WebSocket failures. + /// + public sealed class AutoSDKWebSocketReconnectOptions + { + /// + /// Enables reconnect attempts from the receive loop. + /// + public bool Enabled { get; set; } + + /// + /// Maximum reconnect attempts per observed receive failure. + /// + public int MaxAttempts { get; set; } = 3; + + /// + /// Delay before the first reconnect attempt. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum delay between reconnect attempts. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to the delay after each failed reconnect attempt. + /// + public double BackoffMultiplier { get; set; } = 2D; + } + + /// + /// Event data for closed WebSocket connections. + /// + public sealed class AutoSDKWebSocketClosedEventArgs : global::System.EventArgs + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKWebSocketClosedEventArgs( + global::System.Net.WebSockets.WebSocketCloseStatus? closeStatus, + string? closeStatusDescription) + { + CloseStatus = closeStatus; + CloseStatusDescription = closeStatusDescription; + } + + /// + /// Gets the WebSocket close status. + /// + public global::System.Net.WebSockets.WebSocketCloseStatus? CloseStatus { get; } + + /// + /// Gets the WebSocket close status description. + /// + public string? CloseStatusDescription { get; } + } + + /// + /// Event data for WebSocket exceptions. + /// + public sealed class AutoSDKWebSocketExceptionEventArgs : global::System.EventArgs + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKWebSocketExceptionEventArgs( + global::System.Exception exception) + { + Exception = exception ?? throw new global::System.ArgumentNullException(nameof(exception)); + } + + /// + /// Gets the observed exception. + /// + public global::System.Exception Exception { get; } + } + + /// + /// Event data for WebSocket reconnect attempts. + /// + public sealed class AutoSDKWebSocketReconnectEventArgs : global::System.EventArgs + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKWebSocketReconnectEventArgs( + int attempt, + global::System.TimeSpan delay, + global::System.Exception exception) + { + Attempt = attempt; + Delay = delay; + Exception = exception ?? throw new global::System.ArgumentNullException(nameof(exception)); + } + + /// + /// Gets the reconnect attempt number. + /// + public int Attempt { get; } + + /// + /// Gets the delay before the reconnect attempt. + /// + public global::System.TimeSpan Delay { get; } + + /// + /// Gets the exception that triggered reconnect. + /// + public global::System.Exception Exception { get; } + } + + /// + /// Event data for deserialized WebSocket messages. + /// + public sealed class AutoSDKWebSocketMessageEventArgs : global::System.EventArgs + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKWebSocketMessageEventArgs( + TMessage message, + string rawText, + global::System.Text.Json.JsonElement? json) + { + Message = message; + RawText = rawText ?? string.Empty; + Json = json; + } + + /// + /// Gets the deserialized message. + /// + public TMessage Message { get; } + + /// + /// Gets the raw text received from the WebSocket. + /// + public string RawText { get; } + + /// + /// Gets the parsed JSON payload when available. + /// + public global::System.Text.Json.JsonElement? Json { get; } + } + + /// + /// Event data for messages that could not be deserialized into a known receive type. + /// + public sealed class AutoSDKWebSocketUnknownMessageEventArgs : global::System.EventArgs + { + /// + /// Initializes a new instance of the class. + /// + public AutoSDKWebSocketUnknownMessageEventArgs( + string rawText, + global::System.Text.Json.JsonElement? json) + { + RawText = rawText ?? string.Empty; + Json = json; + } + + /// + /// Gets the raw text received from the WebSocket. + /// + public string RawText { get; } + + /// + /// Gets the parsed JSON payload when available. + /// + public global::System.Text.Json.JsonElement? Json { get; } + } + + /// + /// Gets the current WebSocket connection status. + /// + public AutoSDKWebSocketConnectionStatus Status { get; private set; } = AutoSDKWebSocketConnectionStatus.Disconnected; + + /// + /// Gets reconnect options used by the receive loop. + /// + public AutoSDKWebSocketReconnectOptions ReconnectOptions { get; } = new AutoSDKWebSocketReconnectOptions(); + + /// + /// Raised after the WebSocket connection is opened. + /// + public event global::System.EventHandler? Connected; + + /// + /// Raised after the WebSocket connection is closed. + /// + public event global::System.EventHandler? Closed; + + /// + /// Raised after a WebSocket connection exception is observed. + /// + public event global::System.EventHandler? ExceptionOccurred; + + /// + /// Raised before a reconnect attempt starts. + /// + public event global::System.EventHandler? Reconnecting; + + /// + /// Raised when an inbound text message cannot be deserialized into a known receive event. + /// + public event global::System.EventHandler? UnknownMessage; + + /// + /// Raised after a text message is deserialized into the receive event type. + /// + public event global::System.EventHandler>? MessageReceived; + /// + /// Raised after a ServerEvent message is deserialized. + /// + public event global::System.EventHandler>? ServerEventReceived; /// /// @@ -125,6 +380,145 @@ private void ApplyStoredAuthorization( _clientWebSocket.Options.SetRequestHeader(_storedAuthorizationHeaderName, __authorizationValue); } } + private void RememberConnectionOptions( + global::System.Uri uri, + global::System.Collections.Generic.IDictionary? additionalHeaders, + global::System.Collections.Generic.IEnumerable? additionalSubProtocols, + global::System.TimeSpan? keepAliveInterval, + global::System.TimeSpan? connectTimeout, + bool useSubprotocolAuth) + { + _lastConnectUri = uri; + _lastAdditionalHeaders = additionalHeaders is null + ? null + : new global::System.Collections.Generic.Dictionary( + additionalHeaders, + global::System.StringComparer.OrdinalIgnoreCase); + _lastAdditionalSubProtocols = additionalSubProtocols is null + ? null + : new global::System.Collections.Generic.List(additionalSubProtocols); + _lastKeepAliveInterval = keepAliveInterval; + _lastConnectTimeout = connectTimeout; + _lastUseSubprotocolAuth = useSubprotocolAuth; + } + + private void ResetClientWebSocket() + { + _clientWebSocket.Dispose(); + _clientWebSocket = new global::System.Net.WebSockets.ClientWebSocket(); + Initialized(_clientWebSocket); + } + + private void RaiseClosed( + global::System.Net.WebSockets.WebSocketCloseStatus? closeStatus, + string? closeStatusDescription) + { + Status = AutoSDKWebSocketConnectionStatus.Closed; + Closed?.Invoke( + this, + new AutoSDKWebSocketClosedEventArgs(closeStatus, closeStatusDescription)); + } + + private void RaiseException( + global::System.Exception exception) + { + Status = AutoSDKWebSocketConnectionStatus.Faulted; + ExceptionOccurred?.Invoke( + this, + new AutoSDKWebSocketExceptionEventArgs(exception)); + } + + private global::System.TimeSpan GetReconnectDelay( + int attempt) + { + var delay = ReconnectOptions.InitialDelay; + if (delay < global::System.TimeSpan.Zero) + { + delay = global::System.TimeSpan.Zero; + } + + var multiplier = ReconnectOptions.BackoffMultiplier; + if (multiplier < 1D) + { + multiplier = 1D; + } + + for (var index = 1; index < attempt; index++) + { + var nextMilliseconds = delay.TotalMilliseconds * multiplier; + if (nextMilliseconds >= ReconnectOptions.MaxDelay.TotalMilliseconds) + { + delay = ReconnectOptions.MaxDelay; + break; + } + + delay = global::System.TimeSpan.FromMilliseconds(nextMilliseconds); + } + + if (ReconnectOptions.MaxDelay >= global::System.TimeSpan.Zero && + delay > ReconnectOptions.MaxDelay) + { + delay = ReconnectOptions.MaxDelay; + } + + return delay; + } + + private async global::System.Threading.Tasks.Task TryReconnectAsync( + global::System.Exception exception, + global::System.Threading.CancellationToken cancellationToken) + { + if (!ReconnectOptions.Enabled || + _lastConnectUri is null || + cancellationToken.IsCancellationRequested) + { + return false; + } + + var maxAttempts = ReconnectOptions.MaxAttempts < 1 ? 1 : ReconnectOptions.MaxAttempts; + var lastException = exception; + for (var attempt = 1; attempt <= maxAttempts; attempt++) + { + var delay = GetReconnectDelay(attempt); + Reconnecting?.Invoke( + this, + new AutoSDKWebSocketReconnectEventArgs(attempt, delay, lastException)); + + if (delay > global::System.TimeSpan.Zero) + { + await global::System.Threading.Tasks.Task.Delay(delay, cancellationToken).ConfigureAwait(false); + } + + try + { + ResetClientWebSocket(); + await ConnectAsync( + uri: _lastConnectUri, + additionalHeaders: _lastAdditionalHeaders, + additionalSubProtocols: _lastAdditionalSubProtocols, + keepAliveInterval: _lastKeepAliveInterval, + connectTimeout: _lastConnectTimeout, + useSubprotocolAuth: _lastUseSubprotocolAuth, + cancellationToken: cancellationToken).ConfigureAwait(false); + return true; + } + catch (global::System.Exception reconnectException) when ( + reconnectException is global::System.Net.WebSockets.WebSocketException || + reconnectException is global::System.Net.Http.HttpRequestException || + reconnectException is global::System.OperationCanceledException) + { + lastException = reconnectException; + RaiseException(reconnectException); + if (cancellationToken.IsCancellationRequested) + { + return false; + } + } + } + + return false; + } + private void ApplyConnectionOptions( global::System.Collections.Generic.IDictionary? additionalHeaders, global::System.Collections.Generic.IEnumerable? additionalSubProtocols, @@ -172,7 +566,18 @@ private void ApplyConnectionOptions( try { + Status = AutoSDKWebSocketConnectionStatus.Connecting; await _clientWebSocket.ConnectAsync(uri, __effectiveCancellationToken).ConfigureAwait(false); + Status = AutoSDKWebSocketConnectionStatus.Connected; + Connected?.Invoke(this, global::System.EventArgs.Empty); + } + catch (global::System.Exception exception) when ( + exception is global::System.Net.WebSockets.WebSocketException || + exception is global::System.Net.Http.HttpRequestException || + exception is global::System.OperationCanceledException) + { + RaiseException(exception); + throw; } finally { @@ -206,6 +611,7 @@ private void ApplyConnectionOptions( __uri = new global::System.Uri(__pathBuilder.ToString()); } + RememberConnectionOptions(__uri, additionalHeaders, additionalSubProtocols, keepAliveInterval, connectTimeout, useSubprotocolAuth); ApplyConnectionOptions(additionalHeaders, additionalSubProtocols, keepAliveInterval, useSubprotocolAuth); await ConnectAsyncCore(__uri, connectTimeout, cancellationToken).ConfigureAwait(false); } @@ -248,6 +654,7 @@ private void ApplyConnectionOptions( __uri = new global::System.Uri(__pathBuilder.ToString()); } + RememberConnectionOptions(__uri, additionalHeaders, additionalSubProtocols, keepAliveInterval, connectTimeout, useSubprotocolAuth); ApplyConnectionOptions(additionalHeaders, additionalSubProtocols, keepAliveInterval, useSubprotocolAuth); await ConnectAsyncCore(__uri, connectTimeout, cancellationToken).ConfigureAwait(false); } diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OptionsSupport.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OptionsSupport.g.cs index 8c1ddb48..c7452e2f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OptionsSupport.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Realtime.OptionsSupport.g.cs @@ -101,9 +101,45 @@ public sealed class AutoSDKRetryOptions public int MaxAttempts { get; set; } = 1; /// - /// Optional fixed delay between retry attempts. + /// Optional fixed delay between retry attempts. When set, this takes precedence over exponential backoff. /// public global::System.TimeSpan? Delay { get; set; } + + /// + /// Initial exponential backoff delay used when is not set. + /// + public global::System.TimeSpan InitialDelay { get; set; } = global::System.TimeSpan.FromSeconds(1); + + /// + /// Maximum retry delay after applying retry headers, backoff, and jitter. + /// + public global::System.TimeSpan MaxDelay { get; set; } = global::System.TimeSpan.FromSeconds(30); + + /// + /// Multiplier applied to exponential backoff after each failed attempt. + /// Values below 1 are normalized to 1. + /// + public double BackoffMultiplier { get; set; } = 2D; + + /// + /// Randomizes computed backoff by plus or minus this ratio. Values are clamped to 0..1. + /// + public double JitterRatio { get; set; } = 0.2D; + + /// + /// Whether Retry-After response headers should control retry delay when present. + /// + public bool UseRetryAfterHeader { get; set; } = true; + + /// + /// Whether a rate-limit reset response header should control retry delay when present. + /// + public bool UseRateLimitResetHeader { get; set; } + + /// + /// Optional provider-specific rate-limit reset header name. Values may be Unix seconds or an HTTP date. + /// + public string? RateLimitResetHeaderName { get; set; } = "X-RateLimit-Reset"; } @@ -231,6 +267,16 @@ public sealed class AutoSDKHookContext /// public bool WillRetry { get; set; } + /// + /// The computed retry delay when is true. + /// + public global::System.TimeSpan? RetryDelay { get; set; } + + /// + /// A short retry reason such as exception or status:429. + /// + public string RetryReason { get; set; } = string.Empty; + /// /// The effective cancellation token for the current request attempt. /// @@ -254,6 +300,8 @@ internal static class AutoSDKRequestOptionsSupport int attempt, int maxAttempts, bool willRetry, + global::System.TimeSpan? retryDelay, + string retryReason, global::System.Threading.CancellationToken cancellationToken) { return new global::tryAGI.OpenAI.Realtime.AutoSDKHookContext @@ -271,6 +319,8 @@ internal static class AutoSDKRequestOptionsSupport Attempt = attempt, MaxAttempts = maxAttempts, WillRetry = willRetry, + RetryDelay = retryDelay, + RetryReason = retryReason ?? string.Empty, CancellationToken = cancellationToken, }; } @@ -338,19 +388,188 @@ internal static int GetMaxAttempts( return maxAttempts < 1 ? 1 : maxAttempts; } - internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + internal static global::System.TimeSpan GetRetryDelay( global::tryAGI.OpenAI.Realtime.AutoSDKClientOptions clientOptions, global::tryAGI.OpenAI.Realtime.AutoSDKRequestOptions? requestOptions, + global::System.Net.Http.HttpResponseMessage? response, + int attempt) + { + var retryOptions = requestOptions?.Retry ?? clientOptions.Retry ?? new global::tryAGI.OpenAI.Realtime.AutoSDKRetryOptions(); + + if (retryOptions.UseRetryAfterHeader && + TryGetRetryAfterDelay(response, out var retryAfterDelay)) + { + return ClampRetryDelay(retryAfterDelay, retryOptions); + } + + if (retryOptions.UseRateLimitResetHeader && + TryGetRateLimitResetDelay(response, retryOptions.RateLimitResetHeaderName, out var rateLimitResetDelay)) + { + return ClampRetryDelay(rateLimitResetDelay, retryOptions); + } + + if (retryOptions.Delay.HasValue) + { + return ClampRetryDelay(retryOptions.Delay.Value, retryOptions); + } + + var initialDelay = retryOptions.InitialDelay; + if (initialDelay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var multiplier = retryOptions.BackoffMultiplier < 1D ? 1D : retryOptions.BackoffMultiplier; + var exponent = attempt <= 1 ? 0 : attempt - 1; + var delayMilliseconds = initialDelay.TotalMilliseconds * global::System.Math.Pow(multiplier, exponent); + if (double.IsNaN(delayMilliseconds) || double.IsInfinity(delayMilliseconds) || delayMilliseconds < 0D) + { + delayMilliseconds = 0D; + } + + var delay = global::System.TimeSpan.FromMilliseconds(delayMilliseconds); + delay = ApplyJitter(delay, retryOptions.JitterRatio); + return ClampRetryDelay(delay, retryOptions); + } + + internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync( + global::System.TimeSpan retryDelay, global::System.Threading.CancellationToken cancellationToken) { - var delay = requestOptions?.Retry?.Delay ?? - clientOptions.Retry?.Delay; - if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero) + if (retryDelay <= global::System.TimeSpan.Zero) { return; } - await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false); + await global::System.Threading.Tasks.Task.Delay(retryDelay, cancellationToken).ConfigureAwait(false); + } + + private static bool TryGetRetryAfterDelay( + global::System.Net.Http.HttpResponseMessage? response, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + var retryAfter = response?.Headers.RetryAfter; + if (retryAfter == null) + { + return false; + } + + if (retryAfter.Delta.HasValue) + { + delay = retryAfter.Delta.Value; + return delay > global::System.TimeSpan.Zero; + } + + if (retryAfter.Date.HasValue) + { + delay = retryAfter.Date.Value - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static bool TryGetRateLimitResetDelay( + global::System.Net.Http.HttpResponseMessage? response, + string? headerName, + out global::System.TimeSpan delay) + { + delay = global::System.TimeSpan.Zero; + if (response == null || string.IsNullOrWhiteSpace(headerName)) + { + return false; + } + + if (!response.Headers.TryGetValues(headerName, out var values) && + (response.Content?.Headers == null || !response.Content.Headers.TryGetValues(headerName, out values))) + { + return false; + } + + var value = global::System.Linq.Enumerable.FirstOrDefault(values); + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + value = value.Trim(); + if (long.TryParse( + value, + global::System.Globalization.NumberStyles.Integer, + global::System.Globalization.CultureInfo.InvariantCulture, + out var unixSeconds)) + { + delay = global::System.DateTimeOffset.FromUnixTimeSeconds(unixSeconds) - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + if (global::System.DateTimeOffset.TryParse( + value, + global::System.Globalization.CultureInfo.InvariantCulture, + global::System.Globalization.DateTimeStyles.AssumeUniversal | global::System.Globalization.DateTimeStyles.AdjustToUniversal, + out var resetAt)) + { + delay = resetAt - global::System.DateTimeOffset.UtcNow; + return delay > global::System.TimeSpan.Zero; + } + + return false; + } + + private static global::System.TimeSpan ApplyJitter( + global::System.TimeSpan delay, + double jitterRatio) + { + if (delay <= global::System.TimeSpan.Zero || jitterRatio <= 0D) + { + return delay; + } + + if (jitterRatio > 1D) + { + jitterRatio = 1D; + } + + var sample = NextJitterSample(); + var multiplier = 1D - jitterRatio + (sample * jitterRatio * 2D); + var milliseconds = delay.TotalMilliseconds * multiplier; + if (double.IsNaN(milliseconds) || double.IsInfinity(milliseconds) || milliseconds < 0D) + { + milliseconds = 0D; + } + + return global::System.TimeSpan.FromMilliseconds(milliseconds); + } + + private static double NextJitterSample() + { + var bytes = new byte[8]; + using (var randomNumberGenerator = global::System.Security.Cryptography.RandomNumberGenerator.Create()) + { + randomNumberGenerator.GetBytes(bytes); + } + + var value = global::System.BitConverter.ToUInt64(bytes, 0); + return value / (double)ulong.MaxValue; + } + + private static global::System.TimeSpan ClampRetryDelay( + global::System.TimeSpan delay, + global::tryAGI.OpenAI.Realtime.AutoSDKRetryOptions retryOptions) + { + if (delay <= global::System.TimeSpan.Zero) + { + return global::System.TimeSpan.Zero; + } + + var maxDelay = retryOptions.MaxDelay; + if (maxDelay > global::System.TimeSpan.Zero && delay > maxDelay) + { + return maxDelay; + } + + return delay; } internal static bool ShouldRetryStatusCode( diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.AcceptCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.AcceptCall.g.cs index 31d4e574..1c59b0eb 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.AcceptCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.AcceptCall.g.cs @@ -50,6 +50,30 @@ partial void ProcessAcceptCallResponse( public async global::System.Threading.Tasks.Task AcceptCallAsync( string callId, + global::tryAGI.OpenAI.RealtimeSessionCreateRequestGA request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await AcceptCallAsResponseAsync( + callId: callId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Accept an incoming SIP call and configure the realtime session that will
+ /// handle it. + ///
+ /// + /// + /// 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 AcceptCallAsResponseAsync( + string callId, + global::tryAGI.OpenAI.RealtimeSessionCreateRequestGA request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -85,6 +109,7 @@ partial void ProcessAcceptCallResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/realtime/calls/{callId}/accept", baseUri: HttpClient.BaseAddress); @@ -165,6 +190,8 @@ partial void ProcessAcceptCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +202,11 @@ partial void ProcessAcceptCallResponse( } 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, @@ -192,6 +224,8 @@ partial void ProcessAcceptCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +235,7 @@ partial void ProcessAcceptCallResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +244,11 @@ partial void ProcessAcceptCallResponse( __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( @@ -227,14 +265,15 @@ partial void ProcessAcceptCallResponse( 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; } @@ -274,6 +313,8 @@ partial void ProcessAcceptCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +335,8 @@ partial void ProcessAcceptCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -314,6 +357,10 @@ partial void ProcessAcceptCallResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -335,6 +382,10 @@ partial void ProcessAcceptCallResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateCall.g.cs index 76e7b87c..de020340 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateCall.g.cs @@ -104,10 +104,11 @@ partial void ProcessCreateCallResponseContent( 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: "/realtime/calls", baseUri: HttpClient.BaseAddress); @@ -140,18 +141,23 @@ partial void ProcessCreateCallResponseContent( __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.Sdp ?? string.Empty), name: "\"sdp\""); + if (request.Session != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Session.ToJson(JsonSerializerContext)), name: "\"session\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -193,6 +199,8 @@ partial void ProcessCreateCallResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -203,6 +211,11 @@ partial void ProcessCreateCallResponseContent( } 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, @@ -220,6 +233,8 @@ partial void ProcessCreateCallResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -229,8 +244,7 @@ partial void ProcessCreateCallResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -239,6 +253,11 @@ partial void ProcessCreateCallResponseContent( __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( @@ -255,14 +274,15 @@ partial void ProcessCreateCallResponseContent( 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; } @@ -302,6 +322,8 @@ partial void ProcessCreateCallResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -322,6 +344,8 @@ partial void ProcessCreateCallResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -349,6 +373,7 @@ partial void ProcessCreateCallResponseContent( return new global::tryAGI.OpenAI.AutoSDKHttpResponse( statusCode: __response.StatusCode, headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, body: __content); } catch (global::System.Exception __ex) @@ -380,6 +405,7 @@ partial void ProcessCreateCallResponseContent( return new global::tryAGI.OpenAI.AutoSDKHttpResponse( statusCode: __response.StatusCode, headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, body: __content); } catch (global::System.Exception __ex) diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateClientSecret.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateClientSecret.g.cs index c2e6b3f4..074277aa 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateClientSecret.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateClientSecret.g.cs @@ -58,6 +58,36 @@ partial void ProcessCreateClientSecretResponseContent( /// public async global::System.Threading.Tasks.Task CreateClientSecretAsync( + global::tryAGI.OpenAI.RealtimeCreateClientSecretRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateClientSecretAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a Realtime client secret with an associated session configuration.
+ /// Client secrets are short-lived tokens that can be passed to a client app,
+ /// such as a web frontend or mobile client, which grants access to the Realtime API without
+ /// leaking your main API key. You can configure a custom TTL for each client secret.
+ /// You can also attach session configuration options to the client secret, which will be
+ /// applied to any sessions created using that client secret, but these can also be overridden
+ /// by the client connection.
+ /// [Learn more about authentication with client secrets over WebRTC](/docs/guides/realtime-webrtc).
+ /// Returns the created client secret and the effective session object. The client secret is a string that looks like `ek_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> CreateClientSecretAsResponseAsync( + global::tryAGI.OpenAI.RealtimeCreateClientSecretRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -92,6 +122,7 @@ partial void ProcessCreateClientSecretResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/realtime/client_secrets", baseUri: HttpClient.BaseAddress); @@ -171,6 +202,8 @@ partial void ProcessCreateClientSecretResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +214,11 @@ partial void ProcessCreateClientSecretResponseContent( } 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 +236,8 @@ partial void ProcessCreateClientSecretResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -207,8 +247,7 @@ partial void ProcessCreateClientSecretResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -217,6 +256,11 @@ partial void ProcessCreateClientSecretResponseContent( __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 +277,15 @@ partial void ProcessCreateClientSecretResponseContent( 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 +325,8 @@ partial void ProcessCreateClientSecretResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +347,8 @@ partial void ProcessCreateClientSecretResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +373,13 @@ partial void ProcessCreateClientSecretResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RealtimeCreateClientSecretResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RealtimeCreateClientSecretResponse.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 +407,13 @@ partial void ProcessCreateClientSecretResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RealtimeCreateClientSecretResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RealtimeCreateClientSecretResponse.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.RealtimeClient.CreateSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateSession.g.cs index 3f122a32..d0ff4436 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateSession.g.cs @@ -56,6 +56,34 @@ partial void ProcessCreateSessionResponseContent( /// public async global::System.Threading.Tasks.Task CreateSessionAsync( + global::tryAGI.OpenAI.RealtimeSessionCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSessionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an ephemeral API token for use in client-side applications with the
+ /// Realtime API. Can be configured with the same session parameters as the
+ /// `session.update` client event.
+ /// It responds with a session object, plus a `client_secret` key which contains
+ /// a usable ephemeral API token that can be used to authenticate browser clients
+ /// for the Realtime API.
+ /// Returns the created Realtime session object, plus an ephemeral key. + ///
+ /// + /// 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> CreateSessionAsResponseAsync( + global::tryAGI.OpenAI.RealtimeSessionCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +118,7 @@ partial void ProcessCreateSessionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/realtime/sessions", baseUri: HttpClient.BaseAddress); @@ -169,6 +198,8 @@ partial void ProcessCreateSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +210,11 @@ partial void ProcessCreateSessionResponseContent( } 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 +232,8 @@ partial void ProcessCreateSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -205,8 +243,7 @@ partial void ProcessCreateSessionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -215,6 +252,11 @@ partial void ProcessCreateSessionResponseContent( __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 +273,15 @@ partial void ProcessCreateSessionResponseContent( 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 +321,8 @@ partial void ProcessCreateSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +343,8 @@ partial void ProcessCreateSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +369,13 @@ partial void ProcessCreateSessionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RealtimeSessionCreateResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RealtimeSessionCreateResponse.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 +403,13 @@ partial void ProcessCreateSessionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RealtimeSessionCreateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RealtimeSessionCreateResponse.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.RealtimeClient.CreateTranscriptionSession.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateTranscriptionSession.g.cs index 42494136..c8f5e12d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateTranscriptionSession.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.CreateTranscriptionSession.g.cs @@ -56,6 +56,34 @@ partial void ProcessCreateTranscriptionSessionResponseContent( /// public async global::System.Threading.Tasks.Task CreateTranscriptionSessionAsync( + global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateTranscriptionSessionAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an ephemeral API token for use in client-side applications with the
+ /// Realtime API specifically for realtime transcriptions.
+ /// Can be configured with the same session parameters as the `transcription_session.update` client event.
+ /// It responds with a session object, plus a `client_secret` key which contains
+ /// a usable ephemeral API token that can be used to authenticate browser clients
+ /// for the Realtime API.
+ /// Returns the created Realtime transcription session object, plus an ephemeral key. + ///
+ /// + /// 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> CreateTranscriptionSessionAsResponseAsync( + global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -90,6 +118,7 @@ partial void ProcessCreateTranscriptionSessionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/realtime/transcription_sessions", baseUri: HttpClient.BaseAddress); @@ -169,6 +198,8 @@ partial void ProcessCreateTranscriptionSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +210,11 @@ partial void ProcessCreateTranscriptionSessionResponseContent( } 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 +232,8 @@ partial void ProcessCreateTranscriptionSessionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -205,8 +243,7 @@ partial void ProcessCreateTranscriptionSessionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -215,6 +252,11 @@ partial void ProcessCreateTranscriptionSessionResponseContent( __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 +273,15 @@ partial void ProcessCreateTranscriptionSessionResponseContent( 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 +321,8 @@ partial void ProcessCreateTranscriptionSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +343,8 @@ partial void ProcessCreateTranscriptionSessionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +369,13 @@ partial void ProcessCreateTranscriptionSessionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateResponse.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 +403,13 @@ partial void ProcessCreateTranscriptionSessionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RealtimeTranscriptionSessionCreateResponse.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.RealtimeClient.HangUpCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.HangUpCall.g.cs index 08857179..1999ad43 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.HangUpCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.HangUpCall.g.cs @@ -48,6 +48,25 @@ partial void ProcessHangUpCallResponse( string callId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await HangUpCallAsResponseAsync( + callId: callId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// End an active Realtime API call, whether it was initiated over SIP or
+ /// WebRTC. + ///
+ /// + /// 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 HangUpCallAsResponseAsync( + string callId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -77,6 +96,7 @@ partial void ProcessHangUpCallResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/realtime/calls/{callId}/hangup", baseUri: HttpClient.BaseAddress); @@ -150,6 +170,8 @@ partial void ProcessHangUpCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -160,6 +182,11 @@ partial void ProcessHangUpCallResponse( } 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, @@ -177,6 +204,8 @@ partial void ProcessHangUpCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -186,8 +215,7 @@ partial void ProcessHangUpCallResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -196,6 +224,11 @@ partial void ProcessHangUpCallResponse( __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( @@ -212,14 +245,15 @@ partial void ProcessHangUpCallResponse( 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; } @@ -259,6 +293,8 @@ partial void ProcessHangUpCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -279,6 +315,8 @@ partial void ProcessHangUpCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -299,6 +337,10 @@ partial void ProcessHangUpCallResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -320,6 +362,10 @@ partial void ProcessHangUpCallResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.ReferCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.ReferCall.g.cs index 6c4ca643..f894728e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.ReferCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.ReferCall.g.cs @@ -49,6 +49,29 @@ partial void ProcessReferCallResponse( public async global::System.Threading.Tasks.Task ReferCallAsync( string callId, + global::tryAGI.OpenAI.RealtimeCallReferRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await ReferCallAsResponseAsync( + callId: callId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Transfer an active SIP call to a new destination using the SIP REFER verb. + /// + /// + /// + /// 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 ReferCallAsResponseAsync( + string callId, + global::tryAGI.OpenAI.RealtimeCallReferRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +107,7 @@ partial void ProcessReferCallResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/realtime/calls/{callId}/refer", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessReferCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessReferCallResponse( } 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 ProcessReferCallResponse( 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 ProcessReferCallResponse( __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 ProcessReferCallResponse( __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 ProcessReferCallResponse( 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 ProcessReferCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessReferCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,6 +355,10 @@ partial void ProcessReferCallResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -334,6 +380,10 @@ partial void ProcessReferCallResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.RejectCall.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.RejectCall.g.cs index ec780532..0157f863 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.RejectCall.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.RejectCall.g.cs @@ -49,6 +49,29 @@ partial void ProcessRejectCallResponse( public async global::System.Threading.Tasks.Task RejectCallAsync( string callId, + global::tryAGI.OpenAI.RealtimeCallRejectRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + await RejectCallAsResponseAsync( + callId: callId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Decline an incoming SIP call by returning a SIP status code to the caller. + /// + /// + /// + /// 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 RejectCallAsResponseAsync( + string callId, + global::tryAGI.OpenAI.RealtimeCallRejectRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +107,7 @@ partial void ProcessRejectCallResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/realtime/calls/{callId}/reject", baseUri: HttpClient.BaseAddress); @@ -164,6 +188,8 @@ partial void ProcessRejectCallResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +200,11 @@ partial void ProcessRejectCallResponse( } 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 ProcessRejectCallResponse( 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 ProcessRejectCallResponse( __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 ProcessRejectCallResponse( __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 ProcessRejectCallResponse( 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 ProcessRejectCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +333,8 @@ partial void ProcessRejectCallResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,6 +355,10 @@ partial void ProcessRejectCallResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -334,6 +380,10 @@ partial void ProcessRejectCallResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.g.cs index dc353a9d..7c5d607e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RealtimeClient.g.cs @@ -72,10 +72,10 @@ public RealtimeClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public RealtimeClient( - 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.ResponsesClient.CancelAResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CancelAResponse.g.cs index 5dfe339d..8c08edd7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CancelAResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CancelAResponse.g.cs @@ -56,6 +56,30 @@ partial void ProcessCancelAResponseResponseContent( string responseId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelAResponseAsResponseAsync( + responseId: responseId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancels a model response with the given ID. Only responses created with
+ /// the `background` parameter set to `true` can be cancelled.
+ /// [Learn more](/docs/guides/background). + ///
+ /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// 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> CancelAResponseAsResponseAsync( + string responseId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -85,6 +109,7 @@ partial void ProcessCancelAResponseResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/responses/{responseId}/cancel", baseUri: HttpClient.BaseAddress); @@ -158,6 +183,8 @@ partial void ProcessCancelAResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -168,6 +195,11 @@ partial void ProcessCancelAResponseResponseContent( } 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, @@ -185,6 +217,8 @@ partial void ProcessCancelAResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -194,8 +228,7 @@ partial void ProcessCancelAResponseResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -204,6 +237,11 @@ partial void ProcessCancelAResponseResponseContent( __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( @@ -220,14 +258,15 @@ partial void ProcessCancelAResponseResponseContent( 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; } @@ -267,6 +306,8 @@ partial void ProcessCancelAResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -287,6 +328,8 @@ partial void ProcessCancelAResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Not Found @@ -349,9 +392,13 @@ partial void ProcessCancelAResponseResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Response.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Response.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) { @@ -379,9 +426,13 @@ partial void ProcessCancelAResponseResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Response.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.ResponsesClient.CreateAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponse.g.cs index 889b3650..aa444398 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponse.g.cs @@ -56,6 +56,34 @@ partial void ProcessCreateAModelResponseResponseContent( /// public async global::System.Threading.Tasks.Task CreateAModelResponseAsync( + global::tryAGI.OpenAI.CreateResponse request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateAModelResponseAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a model response. Provide [text](/docs/guides/text) or
+ /// [image](/docs/guides/images) inputs to generate [text](/docs/guides/text)
+ /// or [JSON](/docs/guides/structured-outputs) outputs. Have the model call
+ /// your own [custom code](/docs/guides/function-calling) or use built-in
+ /// [tools](/docs/guides/tools) like [web search](/docs/guides/tools-web-search)
+ /// or [file search](/docs/guides/tools-file-search) to use your own data
+ /// as input for the model's response. + ///
+ /// + /// 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> CreateAModelResponseAsResponseAsync( + global::tryAGI.OpenAI.CreateResponse request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -88,6 +116,7 @@ partial void ProcessCreateAModelResponseResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/responses", baseUri: HttpClient.BaseAddress); @@ -167,6 +196,8 @@ partial void ProcessCreateAModelResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -177,6 +208,11 @@ partial void ProcessCreateAModelResponseResponseContent( } 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, @@ -194,6 +230,8 @@ partial void ProcessCreateAModelResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -203,8 +241,7 @@ partial void ProcessCreateAModelResponseResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -213,6 +250,11 @@ partial void ProcessCreateAModelResponseResponseContent( __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( @@ -229,14 +271,15 @@ partial void ProcessCreateAModelResponseResponseContent( 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; } @@ -276,6 +319,8 @@ partial void ProcessCreateAModelResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -296,6 +341,8 @@ partial void ProcessCreateAModelResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -320,9 +367,13 @@ partial void ProcessCreateAModelResponseResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Response.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Response.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) { @@ -350,9 +401,13 @@ partial void ProcessCreateAModelResponseResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Response.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.ResponsesClient.CreateAModelResponseAsStream.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponseAsStream.g.cs index 2576aa78..564bd37f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponseAsStream.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.CreateAModelResponseAsStream.g.cs @@ -83,6 +83,7 @@ partial void ProcessCreateAModelResponseAsStreamResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/responses", baseUri: HttpClient.BaseAddress); @@ -162,6 +163,8 @@ partial void ProcessCreateAModelResponseAsStreamResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +175,11 @@ partial void ProcessCreateAModelResponseAsStreamResponse( } 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, @@ -189,6 +197,8 @@ partial void ProcessCreateAModelResponseAsStreamResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +208,7 @@ partial void ProcessCreateAModelResponseAsStreamResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +217,11 @@ partial void ProcessCreateAModelResponseAsStreamResponse( __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( @@ -224,14 +238,15 @@ partial void ProcessCreateAModelResponseAsStreamResponse( 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; } @@ -271,6 +286,8 @@ partial void ProcessCreateAModelResponseAsStreamResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +308,8 @@ partial void ProcessCreateAModelResponseAsStreamResponse( 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.ResponsesClient.DeleteAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.DeleteAModelResponse.g.cs index 1cc32c83..fecc1edd 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.DeleteAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.DeleteAModelResponse.g.cs @@ -49,6 +49,26 @@ partial void ProcessDeleteAModelResponseResponse( string responseId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + await DeleteAModelResponseAsResponseAsync( + responseId: responseId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + } + /// + /// Deletes a model response with the given ID. + /// + /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// 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 DeleteAModelResponseAsResponseAsync( + string responseId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -78,6 +98,7 @@ partial void ProcessDeleteAModelResponseResponse( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/responses/{responseId}", baseUri: HttpClient.BaseAddress); @@ -151,6 +172,8 @@ partial void ProcessDeleteAModelResponseResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -161,6 +184,11 @@ partial void ProcessDeleteAModelResponseResponse( } 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, @@ -178,6 +206,8 @@ partial void ProcessDeleteAModelResponseResponse( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -187,8 +217,7 @@ partial void ProcessDeleteAModelResponseResponse( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -197,6 +226,11 @@ partial void ProcessDeleteAModelResponseResponse( __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( @@ -213,14 +247,15 @@ partial void ProcessDeleteAModelResponseResponse( 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; } @@ -260,6 +295,8 @@ partial void ProcessDeleteAModelResponseResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -280,6 +317,8 @@ partial void ProcessDeleteAModelResponseResponse( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } // Not Found @@ -338,6 +377,10 @@ partial void ProcessDeleteAModelResponseResponse( { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { @@ -359,6 +402,10 @@ partial void ProcessDeleteAModelResponseResponse( try { __response.EnsureSuccessStatusCode(); + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.GetAModelResponse.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.GetAModelResponse.g.cs index 310f1b26..0b9bdd9a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.GetAModelResponse.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.GetAModelResponse.g.cs @@ -70,6 +70,40 @@ partial void ProcessGetAModelResponseResponseContent( bool? includeObfuscation = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetAModelResponseAsResponseAsync( + responseId: responseId, + include: include, + stream: stream, + startingAfter: startingAfter, + includeObfuscation: includeObfuscation, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a model response with the given ID. + /// + /// + /// Example: resp_677efb5139a88190b512bc3fef8e535d + /// + /// + /// + /// + /// + /// 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> GetAModelResponseAsResponseAsync( + string responseId, + global::System.Collections.Generic.IList? include = default, + bool? stream = default, + int? startingAfter = default, + bool? includeObfuscation = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -103,14 +137,15 @@ partial void ProcessGetAModelResponseResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/responses/{responseId}", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("include", include, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("stream", stream?.ToString().ToLowerInvariant()) .AddOptionalParameter("starting_after", startingAfter?.ToString()) - .AddOptionalParameter("include_obfuscation", includeObfuscation?.ToString().ToLowerInvariant()) + .AddOptionalParameter("include_obfuscation", includeObfuscation?.ToString().ToLowerInvariant()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -186,6 +221,8 @@ partial void ProcessGetAModelResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -196,6 +233,11 @@ partial void ProcessGetAModelResponseResponseContent( } 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, @@ -213,6 +255,8 @@ partial void ProcessGetAModelResponseResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -222,8 +266,7 @@ partial void ProcessGetAModelResponseResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -232,6 +275,11 @@ partial void ProcessGetAModelResponseResponseContent( __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( @@ -248,14 +296,15 @@ partial void ProcessGetAModelResponseResponseContent( 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; } @@ -295,6 +344,8 @@ partial void ProcessGetAModelResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -315,6 +366,8 @@ partial void ProcessGetAModelResponseResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -339,9 +392,13 @@ partial void ProcessGetAModelResponseResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Response.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Response.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) { @@ -369,9 +426,13 @@ partial void ProcessGetAModelResponseResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Response.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Response.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.ResponsesClient.ListInputItems.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.ListInputItems.g.cs index 86129386..5aa3b451 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.ListInputItems.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.ListInputItems.g.cs @@ -70,6 +70,40 @@ partial void ProcessListInputItemsResponseContent( global::System.Collections.Generic.IList? include = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListInputItemsAsResponseAsync( + responseId: responseId, + limit: limit, + order: order, + after: after, + include: include, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of input items for a given response. + /// + /// + /// + /// 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> ListInputItemsAsResponseAsync( + string responseId, + int? limit = default, + global::tryAGI.OpenAI.ListInputItemsOrder? order = default, + string? after = default, + global::System.Collections.Generic.IList? include = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -103,14 +137,15 @@ partial void ProcessListInputItemsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/responses/{responseId}/input_items", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) - .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( @@ -186,6 +221,8 @@ partial void ProcessListInputItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -196,6 +233,11 @@ partial void ProcessListInputItemsResponseContent( } 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, @@ -213,6 +255,8 @@ partial void ProcessListInputItemsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -222,8 +266,7 @@ partial void ProcessListInputItemsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -232,6 +275,11 @@ partial void ProcessListInputItemsResponseContent( __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( @@ -248,14 +296,15 @@ partial void ProcessListInputItemsResponseContent( 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; } @@ -295,6 +344,8 @@ partial void ProcessListInputItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -315,6 +366,8 @@ partial void ProcessListInputItemsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -339,9 +392,13 @@ partial void ProcessListInputItemsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ResponseItemList.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ResponseItemList.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) { @@ -369,9 +426,13 @@ partial void ProcessListInputItemsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ResponseItemList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ResponseItemList.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.ResponsesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.g.cs index 50faa32e..59c7fe8c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.ResponsesClient.g.cs @@ -72,10 +72,10 @@ public ResponsesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public ResponsesClient( - 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.RolesClient.CreateOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateOrganizationRole.g.cs index f480587d..08173be7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateOrganizationRole.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateOrganizationRoleResponseContent( /// public async global::System.Threading.Tasks.Task CreateOrganizationRoleAsync( + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateOrganizationRoleAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a custom role for the organization. + /// + /// + /// 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> CreateOrganizationRoleAsResponseAsync( + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateOrganizationRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/roles", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateOrganizationRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateOrganizationRoleResponseContent( } 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 ProcessCreateOrganizationRoleResponseContent( 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 ProcessCreateOrganizationRoleResponseContent( __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 ProcessCreateOrganizationRoleResponseContent( __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 ProcessCreateOrganizationRoleResponseContent( 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 ProcessCreateOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateOrganizationRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Role.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Role.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 ProcessCreateOrganizationRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Role.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Role.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.RolesClient.CreateProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateProjectRole.g.cs index 7e331f5d..2d8dd526 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.CreateProjectRole.g.cs @@ -54,6 +54,31 @@ partial void ProcessCreateProjectRoleResponseContent( public async global::System.Threading.Tasks.Task CreateProjectRoleAsync( string projectId, + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateProjectRoleAsResponseAsync( + projectId: projectId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates a custom role for a project. + /// + /// + /// + /// 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> CreateProjectRoleAsResponseAsync( + string projectId, + global::tryAGI.OpenAI.PublicCreateOrganizationRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessCreateProjectRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/roles", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessCreateProjectRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessCreateProjectRoleResponseContent( } 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 ProcessCreateProjectRoleResponseContent( 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 ProcessCreateProjectRoleResponseContent( __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 ProcessCreateProjectRoleResponseContent( __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 ProcessCreateProjectRoleResponseContent( 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 ProcessCreateProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessCreateProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessCreateProjectRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Role.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Role.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 ProcessCreateProjectRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Role.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Role.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.RolesClient.DeleteOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteOrganizationRole.g.cs index 80764b10..b18ed336 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteOrganizationRole.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteOrganizationRoleResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteOrganizationRoleAsResponseAsync( + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a custom role from the organization. + /// + /// + /// 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> DeleteOrganizationRoleAsResponseAsync( + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteOrganizationRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteOrganizationRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteOrganizationRoleResponseContent( } 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 ProcessDeleteOrganizationRoleResponseContent( 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 ProcessDeleteOrganizationRoleResponseContent( __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 ProcessDeleteOrganizationRoleResponseContent( __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 ProcessDeleteOrganizationRoleResponseContent( 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 ProcessDeleteOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteOrganizationRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleDeletedResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleDeletedResource.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 ProcessDeleteOrganizationRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleDeletedResource.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.RolesClient.DeleteProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteProjectRole.g.cs index c76d6ab6..d34767cc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.DeleteProjectRole.g.cs @@ -56,6 +56,29 @@ partial void ProcessDeleteProjectRoleResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteProjectRoleAsResponseAsync( + projectId: projectId, + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a custom role from a project. + /// + /// + /// + /// 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> DeleteProjectRoleAsResponseAsync( + string projectId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessDeleteProjectRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessDeleteProjectRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessDeleteProjectRoleResponseContent( } 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 ProcessDeleteProjectRoleResponseContent( 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 ProcessDeleteProjectRoleResponseContent( __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 ProcessDeleteProjectRoleResponseContent( __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 ProcessDeleteProjectRoleResponseContent( 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 ProcessDeleteProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessDeleteProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessDeleteProjectRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleDeletedResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleDeletedResource.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 ProcessDeleteProjectRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleDeletedResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleDeletedResource.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.RolesClient.ListOrganizationRoles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListOrganizationRoles.g.cs index 02b8dda1..3c10ce26 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListOrganizationRoles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListOrganizationRoles.g.cs @@ -64,6 +64,36 @@ partial void ProcessListOrganizationRolesResponseContent( global::tryAGI.OpenAI.ListRolesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListOrganizationRolesAsResponseAsync( + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the roles configured for the organization. + /// + /// + /// Default Value: 1000 + /// + /// + /// + /// 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> ListOrganizationRolesAsResponseAsync( + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListRolesOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -95,13 +125,14 @@ partial void ProcessListOrganizationRolesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/roles", - 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 ProcessListOrganizationRolesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +218,11 @@ partial void ProcessListOrganizationRolesResponseContent( } 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 ProcessListOrganizationRolesResponseContent( 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 ProcessListOrganizationRolesResponseContent( __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 ProcessListOrganizationRolesResponseContent( __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 ProcessListOrganizationRolesResponseContent( 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 ProcessListOrganizationRolesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +351,8 @@ partial void ProcessListOrganizationRolesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +377,13 @@ partial void ProcessListOrganizationRolesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.PublicRoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.PublicRoleListResource.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 ProcessListOrganizationRolesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.PublicRoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.PublicRoleListResource.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.RolesClient.ListProjectRoles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListProjectRoles.g.cs index c327225e..26d40fdc 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListProjectRoles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.ListProjectRoles.g.cs @@ -68,6 +68,39 @@ partial void ProcessListProjectRolesResponseContent( global::tryAGI.OpenAI.ListProjectRolesOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListProjectRolesAsResponseAsync( + projectId: projectId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the roles configured for a project. + /// + /// + /// + /// Default Value: 1000 + /// + /// + /// + /// 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> ListProjectRolesAsResponseAsync( + string projectId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListProjectRolesOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,13 +133,14 @@ partial void ProcessListProjectRolesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/roles", - 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 ProcessListProjectRolesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -191,6 +227,11 @@ partial void ProcessListProjectRolesResponseContent( } 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 ProcessListProjectRolesResponseContent( 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 ProcessListProjectRolesResponseContent( __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 ProcessListProjectRolesResponseContent( __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 ProcessListProjectRolesResponseContent( 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 ProcessListProjectRolesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -310,6 +360,8 @@ partial void ProcessListProjectRolesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -334,9 +386,13 @@ partial void ProcessListProjectRolesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.PublicRoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.PublicRoleListResource.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 ProcessListProjectRolesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.PublicRoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.PublicRoleListResource.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.RolesClient.UpdateOrganizationRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateOrganizationRole.g.cs index 6fe00323..e587d508 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateOrganizationRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateOrganizationRole.g.cs @@ -54,6 +54,31 @@ partial void ProcessUpdateOrganizationRoleResponseContent( public async global::System.Threading.Tasks.Task UpdateOrganizationRoleAsync( string roleId, + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateOrganizationRoleAsResponseAsync( + roleId: roleId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Updates an existing organization role. + /// + /// + /// + /// 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> UpdateOrganizationRoleAsResponseAsync( + string roleId, + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessUpdateOrganizationRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessUpdateOrganizationRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessUpdateOrganizationRoleResponseContent( } 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 ProcessUpdateOrganizationRoleResponseContent( 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 ProcessUpdateOrganizationRoleResponseContent( __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 ProcessUpdateOrganizationRoleResponseContent( __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 ProcessUpdateOrganizationRoleResponseContent( 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 ProcessUpdateOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessUpdateOrganizationRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessUpdateOrganizationRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Role.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Role.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 ProcessUpdateOrganizationRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Role.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Role.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.RolesClient.UpdateProjectRole.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateProjectRole.g.cs index e07a645c..9e453225 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateProjectRole.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.UpdateProjectRole.g.cs @@ -58,6 +58,34 @@ partial void ProcessUpdateProjectRoleResponseContent( string projectId, string roleId, + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateProjectRoleAsResponseAsync( + projectId: projectId, + roleId: roleId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Updates an existing project role. + /// + /// + /// + /// + /// 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> UpdateProjectRoleAsResponseAsync( + string projectId, + string roleId, + global::tryAGI.OpenAI.PublicUpdateOrganizationRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +122,7 @@ partial void ProcessUpdateProjectRoleResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/projects/{projectId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -175,6 +204,8 @@ partial void ProcessUpdateProjectRoleResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +216,11 @@ partial void ProcessUpdateProjectRoleResponseContent( } 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 ProcessUpdateProjectRoleResponseContent( 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 ProcessUpdateProjectRoleResponseContent( __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 ProcessUpdateProjectRoleResponseContent( __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 ProcessUpdateProjectRoleResponseContent( 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 ProcessUpdateProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +349,8 @@ partial void ProcessUpdateProjectRoleResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +375,13 @@ partial void ProcessUpdateProjectRoleResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Role.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Role.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 ProcessUpdateProjectRoleResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Role.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Role.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.RolesClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.g.cs index 399d4545..24cda379 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.RolesClient.g.cs @@ -72,10 +72,10 @@ public RolesClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public RolesClient( - 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.SkillsClient.CreateSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs index e2860b64..a2af26d6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkill.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateSkillResponseContent( /// public async global::System.Threading.Tasks.Task CreateSkillAsync( + global::tryAGI.OpenAI.CreateSkillBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSkillAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new skill. + /// + /// + /// 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> CreateSkillAsResponseAsync( + global::tryAGI.OpenAI.CreateSkillBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateSkillResponseContent( 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: "/skills", baseUri: HttpClient.BaseAddress); @@ -116,11 +139,14 @@ partial void ProcessCreateSkillResponseContent( __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.Files.ToString() ?? string.Empty), name: "\"files\""); + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -162,6 +188,8 @@ partial void ProcessCreateSkillResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -172,6 +200,11 @@ partial void ProcessCreateSkillResponseContent( } 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, @@ -189,6 +222,8 @@ partial void ProcessCreateSkillResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -198,8 +233,7 @@ partial void ProcessCreateSkillResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -208,6 +242,11 @@ partial void ProcessCreateSkillResponseContent( __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( @@ -224,14 +263,15 @@ partial void ProcessCreateSkillResponseContent( 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; } @@ -271,6 +311,8 @@ partial void ProcessCreateSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -291,6 +333,8 @@ partial void ProcessCreateSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -315,9 +359,13 @@ partial void ProcessCreateSkillResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillResource.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) { @@ -345,9 +393,13 @@ partial void ProcessCreateSkillResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillResource.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.SkillsClient.CreateSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs index 15b8eced..17c41b6d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.CreateSkillVersion.g.cs @@ -56,6 +56,33 @@ partial void ProcessCreateSkillVersionResponseContent( public async global::System.Threading.Tasks.Task CreateSkillVersionAsync( string skillId, + global::tryAGI.OpenAI.CreateSkillVersionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSkillVersionAsResponseAsync( + skillId: skillId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new immutable skill version. + /// + /// + /// Example: skill_123 + /// + /// + /// 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> CreateSkillVersionAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.CreateSkillVersionBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -87,10 +114,11 @@ partial void ProcessCreateSkillVersionResponseContent( 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: $"/skills/{skillId}/versions", baseUri: HttpClient.BaseAddress); @@ -123,21 +151,27 @@ partial void ProcessCreateSkillVersionResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(skillId ?? string.Empty), name: "\"skill_id\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Files.ToString() ?? string.Empty), name: "\"files\""); + if (request.Default != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((global::System.Convert.ToString(request.Default, global::System.Globalization.CultureInfo.InvariantCulture) ?? string.Empty).ToLowerInvariant()), name: "\"default\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -180,6 +214,8 @@ partial void ProcessCreateSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -190,6 +226,11 @@ partial void ProcessCreateSkillVersionResponseContent( } 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, @@ -207,6 +248,8 @@ partial void ProcessCreateSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -216,8 +259,7 @@ partial void ProcessCreateSkillVersionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -226,6 +268,11 @@ partial void ProcessCreateSkillVersionResponseContent( __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( @@ -242,14 +289,15 @@ partial void ProcessCreateSkillVersionResponseContent( 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; } @@ -289,6 +337,8 @@ partial void ProcessCreateSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -309,6 +359,8 @@ partial void ProcessCreateSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -333,9 +385,13 @@ partial void ProcessCreateSkillVersionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillVersionResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillVersionResource.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) { @@ -363,9 +419,13 @@ partial void ProcessCreateSkillVersionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillVersionResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillVersionResource.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.SkillsClient.DeleteSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkill.g.cs index b8141b0f..7162063e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkill.g.cs @@ -54,6 +54,28 @@ partial void ProcessDeleteSkillResponseContent( string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteSkillAsResponseAsync( + skillId: skillId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a skill by its ID. + /// + /// + /// Example: skill_123 + /// + /// 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> DeleteSkillAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessDeleteSkillResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteSkillResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteSkillResponseContent( } 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 ProcessDeleteSkillResponseContent( 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 ProcessDeleteSkillResponseContent( __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 ProcessDeleteSkillResponseContent( __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 ProcessDeleteSkillResponseContent( 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 ProcessDeleteSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessDeleteSkillResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedSkillResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedSkillResource.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 ProcessDeleteSkillResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedSkillResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedSkillResource.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.SkillsClient.DeleteSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkillVersion.g.cs index f5aab4f9..770aa6be 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.DeleteSkillVersion.g.cs @@ -60,6 +60,33 @@ partial void ProcessDeleteSkillVersionResponseContent( string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteSkillVersionAsResponseAsync( + skillId: skillId, + version: version, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a skill version. + /// + /// + /// Example: skill_123 + /// + /// + /// The skill version number. + /// + /// 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> DeleteSkillVersionAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessDeleteSkillVersionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}/versions/{version}", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessDeleteSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessDeleteSkillVersionResponseContent( } 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 +226,8 @@ partial void ProcessDeleteSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessDeleteSkillVersionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessDeleteSkillVersionResponseContent( __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 +267,15 @@ partial void ProcessDeleteSkillVersionResponseContent( 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 +315,8 @@ partial void ProcessDeleteSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessDeleteSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessDeleteSkillVersionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedSkillVersionResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedSkillVersionResource.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 +397,13 @@ partial void ProcessDeleteSkillVersionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedSkillVersionResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedSkillVersionResource.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.SkillsClient.GetSkill.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkill.g.cs index 1acdae91..36f79fa7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkill.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkill.g.cs @@ -54,6 +54,28 @@ partial void ProcessGetSkillResponseContent( string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSkillAsResponseAsync( + skillId: skillId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a skill by its ID. + /// + /// + /// Example: skill_123 + /// + /// 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> GetSkillAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessGetSkillResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessGetSkillResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessGetSkillResponseContent( } 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 ProcessGetSkillResponseContent( 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 ProcessGetSkillResponseContent( __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 ProcessGetSkillResponseContent( __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 ProcessGetSkillResponseContent( 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 ProcessGetSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessGetSkillResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessGetSkillResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillResource.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 ProcessGetSkillResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillResource.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.SkillsClient.GetSkillContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillContent.g.cs index 47711ac0..9e313330 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillContent.g.cs @@ -54,6 +54,28 @@ partial void ProcessGetSkillContentResponseContent( string skillId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSkillContentAsResponseAsync( + skillId: skillId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Download a skill zip bundle by its ID. + /// + /// + /// Example: skill_123 + /// + /// 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> GetSkillContentAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessGetSkillContentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}/content", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessGetSkillContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessGetSkillContentResponseContent( } 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 ProcessGetSkillContentResponseContent( 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 ProcessGetSkillContentResponseContent( __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 ProcessGetSkillContentResponseContent( __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 ProcessGetSkillContentResponseContent( 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 ProcessGetSkillContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessGetSkillContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,7 +350,11 @@ partial void ProcessGetSkillContentResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -337,7 +382,11 @@ partial void ProcessGetSkillContentResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersion.g.cs index f653430b..5b47f2d4 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersion.g.cs @@ -60,6 +60,33 @@ partial void ProcessGetSkillVersionResponseContent( string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSkillVersionAsResponseAsync( + skillId: skillId, + version: version, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a specific skill version. + /// + /// + /// Example: skill_123 + /// + /// + /// The version number to retrieve. + /// + /// 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> GetSkillVersionAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessGetSkillVersionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}/versions/{version}", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessGetSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessGetSkillVersionResponseContent( } 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 +226,8 @@ partial void ProcessGetSkillVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessGetSkillVersionResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessGetSkillVersionResponseContent( __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 +267,15 @@ partial void ProcessGetSkillVersionResponseContent( 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 +315,8 @@ partial void ProcessGetSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessGetSkillVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessGetSkillVersionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillVersionResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillVersionResource.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 +397,13 @@ partial void ProcessGetSkillVersionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillVersionResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillVersionResource.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.SkillsClient.GetSkillVersionContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersionContent.g.cs index 90276023..e3bf1790 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersionContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.GetSkillVersionContent.g.cs @@ -60,6 +60,33 @@ partial void ProcessGetSkillVersionContentResponseContent( string version, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSkillVersionContentAsResponseAsync( + skillId: skillId, + version: version, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Download a skill version zip bundle. + /// + /// + /// Example: skill_123 + /// + /// + /// The skill version number. + /// + /// 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> GetSkillVersionContentAsResponseAsync( + string skillId, + string version, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessGetSkillVersionContentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}/versions/{version}/content", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessGetSkillVersionContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessGetSkillVersionContentResponseContent( } 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 +226,8 @@ partial void ProcessGetSkillVersionContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessGetSkillVersionContentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessGetSkillVersionContentResponseContent( __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 +267,15 @@ partial void ProcessGetSkillVersionContentResponseContent( 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 +315,8 @@ partial void ProcessGetSkillVersionContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessGetSkillVersionContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,7 +363,11 @@ partial void ProcessGetSkillVersionContentResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -345,7 +395,11 @@ partial void ProcessGetSkillVersionContentResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkillVersions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkillVersions.g.cs index 2a69b5b1..c5eb1e29 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkillVersions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkillVersions.g.cs @@ -68,6 +68,39 @@ partial void ProcessListSkillVersionsResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListSkillVersionsAsResponseAsync( + skillId: skillId, + limit: limit, + order: order, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List skill versions for a skill. + /// + /// + /// Example: skill_123 + /// + /// + /// + /// + /// Example: skillver_123 + /// + /// 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> ListSkillVersionsAsResponseAsync( + string skillId, + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,13 +133,14 @@ partial void ProcessListSkillVersionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}/versions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -181,6 +215,8 @@ partial void ProcessListSkillVersionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -191,6 +227,11 @@ partial void ProcessListSkillVersionsResponseContent( } 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 ProcessListSkillVersionsResponseContent( 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 ProcessListSkillVersionsResponseContent( __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 ProcessListSkillVersionsResponseContent( __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 ProcessListSkillVersionsResponseContent( 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 ProcessListSkillVersionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -310,6 +360,8 @@ partial void ProcessListSkillVersionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -334,9 +386,13 @@ partial void ProcessListSkillVersionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillVersionListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillVersionListResource.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 ProcessListSkillVersionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillVersionListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillVersionListResource.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.SkillsClient.ListSkills.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkills.g.cs index 5c0c2f82..f4b388b3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkills.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.ListSkills.g.cs @@ -62,6 +62,34 @@ partial void ProcessListSkillsResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListSkillsAsResponseAsync( + limit: limit, + order: order, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List all skills for the current project. + /// + /// + /// + /// + /// Identifier for the last item from the previous pagination 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> ListSkillsAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,13 +121,14 @@ partial void ProcessListSkillsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/skills", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -173,6 +202,8 @@ partial void ProcessListSkillsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +214,11 @@ partial void ProcessListSkillsResponseContent( } 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, @@ -200,6 +236,8 @@ partial void ProcessListSkillsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +247,7 @@ partial void ProcessListSkillsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +256,11 @@ partial void ProcessListSkillsResponseContent( __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( @@ -235,14 +277,15 @@ partial void ProcessListSkillsResponseContent( 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; } @@ -282,6 +325,8 @@ partial void ProcessListSkillsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +347,8 @@ partial void ProcessListSkillsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +373,13 @@ partial void ProcessListSkillsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillListResource.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) { @@ -356,9 +407,13 @@ partial void ProcessListSkillsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillListResource.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.SkillsClient.UpdateSkillDefaultVersion.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.UpdateSkillDefaultVersion.g.cs index 3c04e147..4d6218e9 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.UpdateSkillDefaultVersion.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.UpdateSkillDefaultVersion.g.cs @@ -56,6 +56,33 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( public async global::System.Threading.Tasks.Task UpdateSkillDefaultVersionAsync( string skillId, + global::tryAGI.OpenAI.SetDefaultSkillVersionBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateSkillDefaultVersionAsResponseAsync( + skillId: skillId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update the default version pointer for a skill. + /// + /// + /// Example: skill_123 + /// + /// + /// 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> UpdateSkillDefaultVersionAsResponseAsync( + string skillId, + global::tryAGI.OpenAI.SetDefaultSkillVersionBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -91,6 +118,7 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/skills/{skillId}", baseUri: HttpClient.BaseAddress); @@ -171,6 +199,8 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +211,11 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( } 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 ProcessUpdateSkillDefaultVersionResponseContent( 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 ProcessUpdateSkillDefaultVersionResponseContent( __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 ProcessUpdateSkillDefaultVersionResponseContent( __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 ProcessUpdateSkillDefaultVersionResponseContent( 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 ProcessUpdateSkillDefaultVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +344,8 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +370,13 @@ partial void ProcessUpdateSkillDefaultVersionResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.SkillResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.SkillResource.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 ProcessUpdateSkillDefaultVersionResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.SkillResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.SkillResource.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.SkillsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.g.cs index 88de9f04..5e92d015 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.SkillsClient.g.cs @@ -72,10 +72,10 @@ public SkillsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public SkillsClient( - 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.UploadsClient.AddUploadPart.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.AddUploadPart.g.cs index d2616686..c50765da 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.AddUploadPart.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.AddUploadPart.g.cs @@ -58,6 +58,35 @@ partial void ProcessAddUploadPartResponseContent( public async global::System.Threading.Tasks.Task AddUploadPartAsync( string uploadId, + global::tryAGI.OpenAI.AddUploadPartRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AddUploadPartAsResponseAsync( + uploadId: uploadId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// 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> AddUploadPartAsResponseAsync( + string uploadId, + global::tryAGI.OpenAI.AddUploadPartRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,10 +118,11 @@ partial void ProcessAddUploadPartResponseContent( 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: $"/uploads/{uploadId}/parts", baseUri: HttpClient.BaseAddress); @@ -125,10 +155,12 @@ partial void ProcessAddUploadPartResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(uploadId ?? string.Empty), name: "\"upload_id\""); + var __contentData = new global::System.Net.Http.ByteArrayContent(request.Data ?? global::System.Array.Empty()); __contentData.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( request.Dataname is null @@ -166,7 +198,9 @@ request.Dataname is null { __contentData.Headers.ContentDisposition.FileNameStar = null; } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -209,6 +243,8 @@ request.Dataname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -219,6 +255,11 @@ request.Dataname 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, @@ -236,6 +277,8 @@ request.Dataname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -245,8 +288,7 @@ request.Dataname is null __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -255,6 +297,11 @@ request.Dataname 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( @@ -271,14 +318,15 @@ request.Dataname 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; } @@ -318,6 +366,8 @@ request.Dataname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -338,6 +388,8 @@ request.Dataname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -362,9 +414,13 @@ request.Dataname is null { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UploadPart.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UploadPart.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) { @@ -392,9 +448,13 @@ request.Dataname is null #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UploadPart.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UploadPart.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) { @@ -468,5 +528,858 @@ request.Dataname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// The chunk of bytes for this Part. + /// + /// + /// The chunk of bytes for this Part. + /// + /// 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 AddUploadPartAsync( + string uploadId, + global::System.IO.Stream data, + string dataname, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + var request = new global::tryAGI.OpenAI.AddUploadPartRequest + { + Data = global::System.Array.Empty(), + Dataname = dataname, + }; + PrepareArguments( + client: HttpClient); + PrepareAddUploadPartArguments( + httpClient: HttpClient, + uploadId: ref uploadId, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_AddUploadPartSecurityRequirements, + operationName: "AddUploadPartAsync"); + + 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: $"/uploads/{uploadId}/parts", + 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(uploadId ?? string.Empty), + name: "\"upload_id\""); + + var __contentData = new global::System.Net.Http.StreamContent(data); + __contentData.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Dataname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Dataname) ?? 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: __contentData, + name: "\"data\"", + fileName: request.Dataname != null ? $"\"{request.Dataname}\"" : string.Empty); + if (__contentData.Headers.ContentDisposition != null) + { + __contentData.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareAddUploadPartRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + uploadId: uploadId!, + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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); + ProcessAddUploadPartResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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); + ProcessAddUploadPartResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::tryAGI.OpenAI.UploadPart.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.UploadPart.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(); + } + } + /// + /// Adds a [Part](/docs/api-reference/uploads/part-object) to an [Upload](/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
+ /// Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
+ /// It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](/docs/api-reference/uploads/complete). + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// The chunk of bytes for this Part. + /// + /// + /// The chunk of bytes for this Part. + /// + /// 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> AddUploadPartAsResponseAsync( + string uploadId, + global::System.IO.Stream data, + string dataname, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + data = data ?? throw new global::System.ArgumentNullException(nameof(data)); + var request = new global::tryAGI.OpenAI.AddUploadPartRequest + { + Data = global::System.Array.Empty(), + Dataname = dataname, + }; + PrepareArguments( + client: HttpClient); + PrepareAddUploadPartArguments( + httpClient: HttpClient, + uploadId: ref uploadId, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_AddUploadPartSecurityRequirements, + operationName: "AddUploadPartAsync"); + + 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: $"/uploads/{uploadId}/parts", + 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(uploadId ?? string.Empty), + name: "\"upload_id\""); + + var __contentData = new global::System.Net.Http.StreamContent(data); + __contentData.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Dataname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Dataname) ?? 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: __contentData, + name: "\"data\"", + fileName: request.Dataname != null ? $"\"{request.Dataname}\"" : string.Empty); + if (__contentData.Headers.ContentDisposition != null) + { + __contentData.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareAddUploadPartRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + uploadId: uploadId!, + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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); + ProcessAddUploadPartResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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: "AddUploadPart", + methodName: "AddUploadPartAsync", + pathTemplate: "$\"/uploads/{uploadId}/parts\"", + 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); + ProcessAddUploadPartResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::tryAGI.OpenAI.UploadPart.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.UploadPart.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.UploadsClient.CancelUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CancelUpload.g.cs index 3935b42a..94f62bd7 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CancelUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CancelUpload.g.cs @@ -55,6 +55,29 @@ partial void ProcessCancelUploadResponseContent( string uploadId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelUploadAsResponseAsync( + uploadId: uploadId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancels the Upload. No Parts may be added after an Upload is cancelled.
+ /// Returns the Upload object with status `cancelled`. + ///
+ /// + /// Example: upload_abc123 + /// + /// 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> CancelUploadAsResponseAsync( + string uploadId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -84,6 +107,7 @@ partial void ProcessCancelUploadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/uploads/{uploadId}/cancel", baseUri: HttpClient.BaseAddress); @@ -157,6 +181,8 @@ partial void ProcessCancelUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -167,6 +193,11 @@ partial void ProcessCancelUploadResponseContent( } 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, @@ -184,6 +215,8 @@ partial void ProcessCancelUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -193,8 +226,7 @@ partial void ProcessCancelUploadResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -203,6 +235,11 @@ partial void ProcessCancelUploadResponseContent( __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( @@ -219,14 +256,15 @@ partial void ProcessCancelUploadResponseContent( 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; } @@ -266,6 +304,8 @@ partial void ProcessCancelUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -286,6 +326,8 @@ partial void ProcessCancelUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -310,9 +352,13 @@ partial void ProcessCancelUploadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Upload.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Upload.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) { @@ -340,9 +386,13 @@ partial void ProcessCancelUploadResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Upload.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Upload.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.UploadsClient.CompleteUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CompleteUpload.g.cs index 415f589c..0aa44284 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CompleteUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CompleteUpload.g.cs @@ -60,6 +60,37 @@ partial void ProcessCompleteUploadResponseContent( public async global::System.Threading.Tasks.Task CompleteUploadAsync( string uploadId, + global::tryAGI.OpenAI.CompleteUploadRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CompleteUploadAsResponseAsync( + uploadId: uploadId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Completes the [Upload](/docs/api-reference/uploads/object).
+ /// Within the returned Upload object, there is a nested [File](/docs/api-reference/files/object) object that is ready to use in the rest of the platform.
+ /// You can specify the order of the Parts by passing in an ordered list of the Part IDs.
+ /// The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
+ /// Returns the Upload object with status `completed`, including an additional `file` property containing the created usable File object. + ///
+ /// + /// Example: upload_abc123 + /// + /// + /// 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> CompleteUploadAsResponseAsync( + string uploadId, + global::tryAGI.OpenAI.CompleteUploadRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -95,6 +126,7 @@ partial void ProcessCompleteUploadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/uploads/{uploadId}/complete", baseUri: HttpClient.BaseAddress); @@ -175,6 +207,8 @@ partial void ProcessCompleteUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -185,6 +219,11 @@ partial void ProcessCompleteUploadResponseContent( } 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 +241,8 @@ partial void ProcessCompleteUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -211,8 +252,7 @@ partial void ProcessCompleteUploadResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -221,6 +261,11 @@ partial void ProcessCompleteUploadResponseContent( __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 +282,15 @@ partial void ProcessCompleteUploadResponseContent( 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 +330,8 @@ partial void ProcessCompleteUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -304,6 +352,8 @@ partial void ProcessCompleteUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -328,9 +378,13 @@ partial void ProcessCompleteUploadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Upload.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Upload.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 +412,13 @@ partial void ProcessCompleteUploadResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Upload.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Upload.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.UploadsClient.CreateUpload.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CreateUpload.g.cs index db00893f..0c9e6514 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CreateUpload.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.CreateUpload.g.cs @@ -64,6 +64,42 @@ partial void ProcessCreateUploadResponseContent( /// public async global::System.Threading.Tasks.Task CreateUploadAsync( + global::tryAGI.OpenAI.CreateUploadRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateUploadAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Creates an intermediate [Upload](/docs/api-reference/uploads/object) object
+ /// that you can add [Parts](/docs/api-reference/uploads/part-object) to.
+ /// Currently, an Upload can accept at most 8 GB in total and expires after an
+ /// hour after you create it.
+ /// Once you complete the Upload, we will create a
+ /// [File](/docs/api-reference/files/object) object that contains all the parts
+ /// you uploaded. This File is usable in the rest of our platform as a regular
+ /// File object.
+ /// For certain `purpose` values, the correct `mime_type` must be specified.
+ /// Please refer to documentation for the
+ /// [supported MIME types for your use case](/docs/assistants/tools/file-search#supported-files).
+ /// For guidance on the proper filename extensions for each purpose, please
+ /// follow the documentation on [creating a
+ /// File](/docs/api-reference/files/create).
+ /// Returns the Upload object with status `pending`. + ///
+ /// + /// 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> CreateUploadAsResponseAsync( + global::tryAGI.OpenAI.CreateUploadRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -98,6 +134,7 @@ partial void ProcessCreateUploadResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/uploads", baseUri: HttpClient.BaseAddress); @@ -177,6 +214,8 @@ partial void ProcessCreateUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -187,6 +226,11 @@ partial void ProcessCreateUploadResponseContent( } 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, @@ -204,6 +248,8 @@ partial void ProcessCreateUploadResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -213,8 +259,7 @@ partial void ProcessCreateUploadResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -223,6 +268,11 @@ partial void ProcessCreateUploadResponseContent( __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( @@ -239,14 +289,15 @@ partial void ProcessCreateUploadResponseContent( 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; } @@ -286,6 +337,8 @@ partial void ProcessCreateUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -306,6 +359,8 @@ partial void ProcessCreateUploadResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -330,9 +385,13 @@ partial void ProcessCreateUploadResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.Upload.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.Upload.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) { @@ -360,9 +419,13 @@ partial void ProcessCreateUploadResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.Upload.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.Upload.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.UploadsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.g.cs index c932e74b..504cafde 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UploadsClient.g.cs @@ -73,10 +73,10 @@ public UploadsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public UploadsClient( - 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.UsageClient.AudioSpeeches.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioSpeeches.g.cs index 8557eae5..3b46196c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioSpeeches.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioSpeeches.g.cs @@ -90,6 +90,55 @@ partial void ProcessAudioSpeechesResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AudioSpeechesAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get audio speeches usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> AudioSpeechesAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageAudioSpeechesBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -128,9 +177,10 @@ partial void ProcessAudioSpeechesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/audio_speeches", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -141,7 +191,7 @@ partial void ProcessAudioSpeechesResponseContent( .AddOptionalParameter("models", models, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -222,6 +272,8 @@ partial void ProcessAudioSpeechesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -232,6 +284,11 @@ partial void ProcessAudioSpeechesResponseContent( } 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, @@ -249,6 +306,8 @@ partial void ProcessAudioSpeechesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -258,8 +317,7 @@ partial void ProcessAudioSpeechesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -268,6 +326,11 @@ partial void ProcessAudioSpeechesResponseContent( __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( @@ -284,14 +347,15 @@ partial void ProcessAudioSpeechesResponseContent( 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; } @@ -331,6 +395,8 @@ partial void ProcessAudioSpeechesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -351,6 +417,8 @@ partial void ProcessAudioSpeechesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -375,9 +443,13 @@ partial void ProcessAudioSpeechesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -405,9 +477,13 @@ partial void ProcessAudioSpeechesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.AudioTranscriptions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioTranscriptions.g.cs index 234781c3..b1299f5f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioTranscriptions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.AudioTranscriptions.g.cs @@ -90,6 +90,55 @@ partial void ProcessAudioTranscriptionsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AudioTranscriptionsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get audio transcriptions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> AudioTranscriptionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageAudioTranscriptionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -128,9 +177,10 @@ partial void ProcessAudioTranscriptionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/audio_transcriptions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -141,7 +191,7 @@ partial void ProcessAudioTranscriptionsResponseContent( .AddOptionalParameter("models", models, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -222,6 +272,8 @@ partial void ProcessAudioTranscriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -232,6 +284,11 @@ partial void ProcessAudioTranscriptionsResponseContent( } 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, @@ -249,6 +306,8 @@ partial void ProcessAudioTranscriptionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -258,8 +317,7 @@ partial void ProcessAudioTranscriptionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -268,6 +326,11 @@ partial void ProcessAudioTranscriptionsResponseContent( __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( @@ -284,14 +347,15 @@ partial void ProcessAudioTranscriptionsResponseContent( 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; } @@ -331,6 +395,8 @@ partial void ProcessAudioTranscriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -351,6 +417,8 @@ partial void ProcessAudioTranscriptionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -375,9 +443,13 @@ partial void ProcessAudioTranscriptionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -405,9 +477,13 @@ partial void ProcessAudioTranscriptionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.CodeInterpreterSessions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.CodeInterpreterSessions.g.cs index 7dfbcd50..35113180 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.CodeInterpreterSessions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.CodeInterpreterSessions.g.cs @@ -78,6 +78,46 @@ partial void ProcessCodeInterpreterSessionsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CodeInterpreterSessionsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get code interpreter sessions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// 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> CodeInterpreterSessionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCodeInterpreterSessionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -113,9 +153,10 @@ partial void ProcessCodeInterpreterSessionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/code_interpreter_sessions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -123,7 +164,7 @@ partial void ProcessCodeInterpreterSessionsResponseContent( .AddOptionalParameter("project_ids", projectIds, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -201,6 +242,8 @@ partial void ProcessCodeInterpreterSessionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -211,6 +254,11 @@ partial void ProcessCodeInterpreterSessionsResponseContent( } 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 +276,8 @@ partial void ProcessCodeInterpreterSessionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -237,8 +287,7 @@ partial void ProcessCodeInterpreterSessionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -247,6 +296,11 @@ partial void ProcessCodeInterpreterSessionsResponseContent( __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 +317,15 @@ partial void ProcessCodeInterpreterSessionsResponseContent( 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 +365,8 @@ partial void ProcessCodeInterpreterSessionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -330,6 +387,8 @@ partial void ProcessCodeInterpreterSessionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -354,9 +413,13 @@ partial void ProcessCodeInterpreterSessionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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 +447,13 @@ partial void ProcessCodeInterpreterSessionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.Completions.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Completions.g.cs index 1fab8be1..46cba6e8 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Completions.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Completions.g.cs @@ -94,6 +94,58 @@ partial void ProcessCompletionsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CompletionsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + batch: batch, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get completions usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> CompletionsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCompletionsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + bool? batch = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -133,9 +185,10 @@ partial void ProcessCompletionsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/completions", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -147,7 +200,7 @@ partial void ProcessCompletionsResponseContent( .AddOptionalParameter("batch", batch?.ToString().ToLowerInvariant()) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -229,6 +282,8 @@ partial void ProcessCompletionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -239,6 +294,11 @@ partial void ProcessCompletionsResponseContent( } 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, @@ -256,6 +316,8 @@ partial void ProcessCompletionsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -265,8 +327,7 @@ partial void ProcessCompletionsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -275,6 +336,11 @@ partial void ProcessCompletionsResponseContent( __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( @@ -291,14 +357,15 @@ partial void ProcessCompletionsResponseContent( 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; } @@ -338,6 +405,8 @@ partial void ProcessCompletionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -358,6 +427,8 @@ partial void ProcessCompletionsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -382,9 +453,13 @@ partial void ProcessCompletionsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -412,9 +487,13 @@ partial void ProcessCompletionsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.Costs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs index 46b47f7d..8b249b3b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs @@ -84,6 +84,51 @@ partial void ProcessCostsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CostsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + apiKeyIds: apiKeyIds, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get costs details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// Default Value: 7 + /// + /// + /// 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> CostsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -120,9 +165,10 @@ partial void ProcessCostsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/costs", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -131,7 +177,7 @@ partial void ProcessCostsResponseContent( .AddOptionalParameter("api_key_ids", apiKeyIds, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -210,6 +256,8 @@ partial void ProcessCostsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -220,6 +268,11 @@ partial void ProcessCostsResponseContent( } 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, @@ -237,6 +290,8 @@ partial void ProcessCostsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -246,8 +301,7 @@ partial void ProcessCostsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -256,6 +310,11 @@ partial void ProcessCostsResponseContent( __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( @@ -272,14 +331,15 @@ partial void ProcessCostsResponseContent( 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; } @@ -319,6 +379,8 @@ partial void ProcessCostsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -339,6 +401,8 @@ partial void ProcessCostsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -363,9 +427,13 @@ partial void ProcessCostsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -393,9 +461,13 @@ partial void ProcessCostsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.Embeddings.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Embeddings.g.cs index 5f786bac..5afe204f 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Embeddings.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Embeddings.g.cs @@ -90,6 +90,55 @@ partial void ProcessEmbeddingsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await EmbeddingsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get embeddings usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> EmbeddingsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageEmbeddingsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -128,9 +177,10 @@ partial void ProcessEmbeddingsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/embeddings", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -141,7 +191,7 @@ partial void ProcessEmbeddingsResponseContent( .AddOptionalParameter("models", models, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -222,6 +272,8 @@ partial void ProcessEmbeddingsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -232,6 +284,11 @@ partial void ProcessEmbeddingsResponseContent( } 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, @@ -249,6 +306,8 @@ partial void ProcessEmbeddingsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -258,8 +317,7 @@ partial void ProcessEmbeddingsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -268,6 +326,11 @@ partial void ProcessEmbeddingsResponseContent( __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( @@ -284,14 +347,15 @@ partial void ProcessEmbeddingsResponseContent( 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; } @@ -331,6 +395,8 @@ partial void ProcessEmbeddingsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -351,6 +417,8 @@ partial void ProcessEmbeddingsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -375,9 +443,13 @@ partial void ProcessEmbeddingsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -405,9 +477,13 @@ partial void ProcessEmbeddingsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.Images.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Images.g.cs index 7dee9c90..4fb7576c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Images.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Images.g.cs @@ -98,6 +98,61 @@ partial void ProcessImagesResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ImagesAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + sources: sources, + sizes: sizes, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get images usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> ImagesAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageImagesBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? sources = default, + global::System.Collections.Generic.IList? sizes = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -138,9 +193,10 @@ partial void ProcessImagesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/images", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -153,7 +209,7 @@ partial void ProcessImagesResponseContent( .AddOptionalParameter("models", models, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -236,6 +292,8 @@ partial void ProcessImagesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -246,6 +304,11 @@ partial void ProcessImagesResponseContent( } 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, @@ -263,6 +326,8 @@ partial void ProcessImagesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -272,8 +337,7 @@ partial void ProcessImagesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -282,6 +346,11 @@ partial void ProcessImagesResponseContent( __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( @@ -298,14 +367,15 @@ partial void ProcessImagesResponseContent( 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; } @@ -345,6 +415,8 @@ partial void ProcessImagesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -365,6 +437,8 @@ partial void ProcessImagesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -389,9 +463,13 @@ partial void ProcessImagesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -419,9 +497,13 @@ partial void ProcessImagesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.Moderations.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Moderations.g.cs index 73eecd51..18cf4847 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Moderations.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Moderations.g.cs @@ -90,6 +90,55 @@ partial void ProcessModerationsResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModerationsAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + userIds: userIds, + apiKeyIds: apiKeyIds, + models: models, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get moderations usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// + /// + /// + /// 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> ModerationsAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageModerationsBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? userIds = default, + global::System.Collections.Generic.IList? apiKeyIds = default, + global::System.Collections.Generic.IList? models = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -128,9 +177,10 @@ partial void ProcessModerationsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/moderations", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -141,7 +191,7 @@ partial void ProcessModerationsResponseContent( .AddOptionalParameter("models", models, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -222,6 +272,8 @@ partial void ProcessModerationsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -232,6 +284,11 @@ partial void ProcessModerationsResponseContent( } 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, @@ -249,6 +306,8 @@ partial void ProcessModerationsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -258,8 +317,7 @@ partial void ProcessModerationsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -268,6 +326,11 @@ partial void ProcessModerationsResponseContent( __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( @@ -284,14 +347,15 @@ partial void ProcessModerationsResponseContent( 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; } @@ -331,6 +395,8 @@ partial void ProcessModerationsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -351,6 +417,8 @@ partial void ProcessModerationsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -375,9 +443,13 @@ partial void ProcessModerationsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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) { @@ -405,9 +477,13 @@ partial void ProcessModerationsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.VectorStores.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.VectorStores.g.cs index 77ed7b93..50c7dc33 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.VectorStores.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.VectorStores.g.cs @@ -78,6 +78,46 @@ partial void ProcessVectorStoresResponseContent( string? page = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await VectorStoresAsResponseAsync( + startTime: startTime, + endTime: endTime, + bucketWidth: bucketWidth, + projectIds: projectIds, + groupBy: groupBy, + limit: limit, + page: page, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get vector stores usage details for the organization. + /// + /// + /// + /// + /// Default Value: 1d + /// + /// + /// + /// + /// + /// 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> VectorStoresAsResponseAsync( + int startTime, + int? endTime = default, + global::tryAGI.OpenAI.UsageVectorStoresBucketWidth? bucketWidth = default, + global::System.Collections.Generic.IList? projectIds = default, + global::System.Collections.Generic.IList? groupBy = default, + int? limit = default, + string? page = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -113,9 +153,10 @@ partial void ProcessVectorStoresResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/usage/vector_stores", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddRequiredParameter("start_time", startTime.ToString()!) .AddOptionalParameter("end_time", endTime?.ToString()) @@ -123,7 +164,7 @@ partial void ProcessVectorStoresResponseContent( .AddOptionalParameter("project_ids", projectIds, delimiter: ",", explode: true) .AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true) .AddOptionalParameter("limit", limit?.ToString()) - .AddOptionalParameter("page", page) + .AddOptionalParameter("page", page) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -201,6 +242,8 @@ partial void ProcessVectorStoresResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -211,6 +254,11 @@ partial void ProcessVectorStoresResponseContent( } 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 +276,8 @@ partial void ProcessVectorStoresResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -237,8 +287,7 @@ partial void ProcessVectorStoresResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -247,6 +296,11 @@ partial void ProcessVectorStoresResponseContent( __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 +317,15 @@ partial void ProcessVectorStoresResponseContent( 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 +365,8 @@ partial void ProcessVectorStoresResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -330,6 +387,8 @@ partial void ProcessVectorStoresResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -354,9 +413,13 @@ partial void ProcessVectorStoresResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UsageResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UsageResponse.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 +447,13 @@ partial void ProcessVectorStoresResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UsageResponse.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.UsageClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.g.cs index a6b380dd..f0f9ce4d 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.g.cs @@ -72,10 +72,10 @@ public UsageClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public UsageClient( - 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.UserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs index a7042658..99270097 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.AssignOrganizationRoleToUser.g.cs @@ -54,6 +54,31 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( public async global::System.Threading.Tasks.Task AssignOrganizationRoleToUserAsync( string userId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await AssignOrganizationRoleToUserAsResponseAsync( + userId: userId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Assigns an organization role to a user within the organization. + /// + /// + /// + /// 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> AssignOrganizationRoleToUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.PublicAssignOrganizationGroupRoleBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}/roles", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( } 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 ProcessAssignOrganizationRoleToUserResponseContent( 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 ProcessAssignOrganizationRoleToUserResponseContent( __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 ProcessAssignOrganizationRoleToUserResponseContent( __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 ProcessAssignOrganizationRoleToUserResponseContent( 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 ProcessAssignOrganizationRoleToUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessAssignOrganizationRoleToUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UserRoleAssignment.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UserRoleAssignment.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 ProcessAssignOrganizationRoleToUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UserRoleAssignment.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UserRoleAssignment.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.UserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs index b6a84801..7c8ed07b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.ListUserOrganizationRoleAssignments.g.cs @@ -64,6 +64,35 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( global::tryAGI.OpenAI.ListUserRoleAssignmentsOrder? order = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListUserOrganizationRoleAssignmentsAsResponseAsync( + userId: userId, + limit: limit, + after: after, + order: order, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists the organization roles assigned to a user within the organization. + /// + /// + /// + /// + /// + /// 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> ListUserOrganizationRoleAssignmentsAsResponseAsync( + string userId, + int? limit = default, + string? after = default, + global::tryAGI.OpenAI.ListUserRoleAssignmentsOrder? order = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -96,13 +125,14 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}/roles", - 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( @@ -177,6 +207,8 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -187,6 +219,11 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( } 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, @@ -204,6 +241,8 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -213,8 +252,7 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -223,6 +261,11 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( __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( @@ -239,14 +282,15 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( 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; } @@ -286,6 +330,8 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -306,6 +352,8 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -330,9 +378,13 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.RoleListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.RoleListResource.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) { @@ -360,9 +412,13 @@ partial void ProcessListUserOrganizationRoleAssignmentsResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.RoleListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.RoleListResource.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.UserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs index 328e57e1..9b20671a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.UnassignOrganizationRoleFromUser.g.cs @@ -56,6 +56,29 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( string roleId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UnassignOrganizationRoleFromUserAsResponseAsync( + userId: userId, + roleId: roleId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Unassigns an organization role from a user within the organization. + /// + /// + /// + /// 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> UnassignOrganizationRoleFromUserAsResponseAsync( + string userId, + string roleId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}/roles/{roleId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( } 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 ProcessUnassignOrganizationRoleFromUserResponseContent( 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 ProcessUnassignOrganizationRoleFromUserResponseContent( __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 ProcessUnassignOrganizationRoleFromUserResponseContent( __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 ProcessUnassignOrganizationRoleFromUserResponseContent( 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 ProcessUnassignOrganizationRoleFromUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessUnassignOrganizationRoleFromUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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 ProcessUnassignOrganizationRoleFromUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedRoleAssignmentResource.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.UserOrganizationRoleAssignmentsClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.g.cs index 73284bf3..4a267f41 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UserOrganizationRoleAssignmentsClient.g.cs @@ -72,10 +72,10 @@ public UserOrganizationRoleAssignmentsClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public UserOrganizationRoleAssignmentsClient( - 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.UsersClient.DeleteUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.DeleteUser.g.cs index c7014ce8..b00b29f0 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.DeleteUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.DeleteUser.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteUserResponseContent( string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteUserAsResponseAsync( + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Deletes a user from the organization. + /// + /// + /// 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> DeleteUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteUserResponseContent( } 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 ProcessDeleteUserResponseContent( 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 ProcessDeleteUserResponseContent( __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 ProcessDeleteUserResponseContent( __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 ProcessDeleteUserResponseContent( 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 ProcessDeleteUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UserDeleteResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UserDeleteResponse.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 ProcessDeleteUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UserDeleteResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UserDeleteResponse.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.UsersClient.ListUsers.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ListUsers.g.cs index dde5f8d0..d9671c72 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ListUsers.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ListUsers.g.cs @@ -62,6 +62,34 @@ partial void ProcessListUsersResponseContent( global::System.Collections.Generic.IList? emails = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListUsersAsResponseAsync( + limit: limit, + after: after, + emails: emails, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Lists all of the users in the 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> ListUsersAsResponseAsync( + int? limit = default, + string? after = default, + global::System.Collections.Generic.IList? emails = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,13 +121,14 @@ partial void ProcessListUsersResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/organization/users", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("after", after) - .AddOptionalParameter("emails", emails, delimiter: ",", explode: true) + .AddOptionalParameter("emails", emails, delimiter: ",", explode: true) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -173,6 +202,8 @@ partial void ProcessListUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +214,11 @@ partial void ProcessListUsersResponseContent( } 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, @@ -200,6 +236,8 @@ partial void ProcessListUsersResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +247,7 @@ partial void ProcessListUsersResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +256,11 @@ partial void ProcessListUsersResponseContent( __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( @@ -235,14 +277,15 @@ partial void ProcessListUsersResponseContent( 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; } @@ -282,6 +325,8 @@ partial void ProcessListUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +347,8 @@ partial void ProcessListUsersResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +373,13 @@ partial void ProcessListUsersResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.UserListResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.UserListResponse.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) { @@ -356,9 +407,13 @@ partial void ProcessListUsersResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.UserListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.UserListResponse.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.UsersClient.ModifyUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ModifyUser.g.cs index 7190507a..4246fd43 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ModifyUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.ModifyUser.g.cs @@ -54,6 +54,31 @@ partial void ProcessModifyUserResponseContent( public async global::System.Threading.Tasks.Task ModifyUserAsync( string userId, + global::tryAGI.OpenAI.UserRoleUpdateRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModifyUserAsResponseAsync( + userId: userId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Modifies a user's role in the organization. + /// + /// + /// + /// 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> ModifyUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.UserRoleUpdateRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessModifyUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessModifyUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessModifyUserResponseContent( } 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 ProcessModifyUserResponseContent( 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 ProcessModifyUserResponseContent( __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 ProcessModifyUserResponseContent( __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 ProcessModifyUserResponseContent( 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 ProcessModifyUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessModifyUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessModifyUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.User.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.User.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 ProcessModifyUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.User.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.UsersClient.RetrieveUser.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.RetrieveUser.g.cs index fd9a5a40..5aa4238a 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.RetrieveUser.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.RetrieveUser.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveUserResponseContent( string userId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveUserAsResponseAsync( + userId: userId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a user by their identifier. + /// + /// + /// 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> RetrieveUserAsResponseAsync( + string userId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveUserResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/organization/users/{userId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveUserResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveUserResponseContent( } 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 ProcessRetrieveUserResponseContent( 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 ProcessRetrieveUserResponseContent( __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 ProcessRetrieveUserResponseContent( __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 ProcessRetrieveUserResponseContent( 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 ProcessRetrieveUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveUserResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessRetrieveUserResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.User.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.User.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 ProcessRetrieveUserResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.User.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.User.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.UsersClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.g.cs index abe494f6..309b5019 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsersClient.g.cs @@ -72,10 +72,10 @@ public UsersClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public UsersClient( - 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.VectorStoresClient.CancelVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs index 1abb9215..17f52bcf 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CancelVectorStoreFileBatch.g.cs @@ -56,6 +56,29 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CancelVectorStoreFileBatchAsResponseAsync( + vectorStoreId: vectorStoreId, + batchId: batchId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. + /// + /// + /// + /// 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> CancelVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}/cancel", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( } 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 ProcessCancelVectorStoreFileBatchResponseContent( 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 ProcessCancelVectorStoreFileBatchResponseContent( __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 ProcessCancelVectorStoreFileBatchResponseContent( __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 ProcessCancelVectorStoreFileBatchResponseContent( 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 ProcessCancelVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessCancelVectorStoreFileBatchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileBatchObject.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 ProcessCancelVectorStoreFileBatchResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileBatchObject.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.VectorStoresClient.CreateVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStore.g.cs index 2abca6d1..af3b6d91 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStore.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVectorStoreResponseContent( /// public async global::System.Threading.Tasks.Task CreateVectorStoreAsync( + global::tryAGI.OpenAI.CreateVectorStoreRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVectorStoreAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a vector store. + /// + /// + /// 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> CreateVectorStoreAsResponseAsync( + global::tryAGI.OpenAI.CreateVectorStoreRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -84,6 +106,7 @@ partial void ProcessCreateVectorStoreResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/vector_stores", baseUri: HttpClient.BaseAddress); @@ -163,6 +186,8 @@ partial void ProcessCreateVectorStoreResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -173,6 +198,11 @@ partial void ProcessCreateVectorStoreResponseContent( } 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 ProcessCreateVectorStoreResponseContent( 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 ProcessCreateVectorStoreResponseContent( __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 ProcessCreateVectorStoreResponseContent( __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 ProcessCreateVectorStoreResponseContent( 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 ProcessCreateVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -292,6 +331,8 @@ partial void ProcessCreateVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -316,9 +357,13 @@ partial void ProcessCreateVectorStoreResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreObject.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 ProcessCreateVectorStoreResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreObject.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.VectorStoresClient.CreateVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs index 003c64fb..23d1976c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFile.g.cs @@ -58,6 +58,35 @@ partial void ProcessCreateVectorStoreFileResponseContent( public async global::System.Threading.Tasks.Task CreateVectorStoreFileAsync( string vectorStoreId, + global::tryAGI.OpenAI.CreateVectorStoreFileRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVectorStoreFileAsResponseAsync( + vectorStoreId: vectorStoreId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).
+ /// This endpoint is subject to a per-vector-store write rate limit of 300 requests per minute, shared with `/vector_stores/{vector_store_id}/file_batches`.
+ /// For uploading multiple files to the same vector store, use the file batches endpoint to reduce request volume. + ///
+ /// + /// Example: vs_abc123 + /// + /// + /// 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> CreateVectorStoreFileAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.CreateVectorStoreFileRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -93,6 +122,7 @@ partial void ProcessCreateVectorStoreFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files", baseUri: HttpClient.BaseAddress); @@ -173,6 +203,8 @@ partial void ProcessCreateVectorStoreFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +215,11 @@ partial void ProcessCreateVectorStoreFileResponseContent( } 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, @@ -200,6 +237,8 @@ partial void ProcessCreateVectorStoreFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +248,7 @@ partial void ProcessCreateVectorStoreFileResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +257,11 @@ partial void ProcessCreateVectorStoreFileResponseContent( __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( @@ -235,14 +278,15 @@ partial void ProcessCreateVectorStoreFileResponseContent( 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; } @@ -282,6 +326,8 @@ partial void ProcessCreateVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +348,8 @@ partial void ProcessCreateVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +374,13 @@ partial void ProcessCreateVectorStoreFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileObject.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) { @@ -356,9 +408,13 @@ partial void ProcessCreateVectorStoreFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileObject.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.VectorStoresClient.CreateVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs index 9a7dc9c7..c45405b1 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.CreateVectorStoreFileBatch.g.cs @@ -59,6 +59,36 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( public async global::System.Threading.Tasks.Task CreateVectorStoreFileBatchAsync( string vectorStoreId, + global::tryAGI.OpenAI.CreateVectorStoreFileBatchRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVectorStoreFileBatchAsResponseAsync( + vectorStoreId: vectorStoreId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a vector store file batch.
+ /// The maximum number of files in a single batch request is 2000.
+ /// Vector store file attach requests are rate limited per vector store (300 requests per minute across both this endpoint and `/vector_stores/{vector_store_id}/files`).
+ /// For ingesting multiple files into the same vector store, this batch endpoint is recommended. + ///
+ /// + /// Example: vs_abc123 + /// + /// + /// 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> CreateVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.CreateVectorStoreFileBatchRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -94,6 +124,7 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches", baseUri: HttpClient.BaseAddress); @@ -174,6 +205,8 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -184,6 +217,11 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( } 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 +239,8 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -210,8 +250,7 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -220,6 +259,11 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( __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 +280,15 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( 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 +328,8 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -303,6 +350,8 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -327,9 +376,13 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileBatchObject.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 +410,13 @@ partial void ProcessCreateVectorStoreFileBatchResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileBatchObject.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.VectorStoresClient.DeleteVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStore.g.cs index 13842830..5fdf3324 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStore.g.cs @@ -52,6 +52,26 @@ partial void ProcessDeleteVectorStoreResponseContent( string vectorStoreId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteVectorStoreAsResponseAsync( + vectorStoreId: vectorStoreId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a vector store. + /// + /// + /// 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> DeleteVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessDeleteVectorStoreResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessDeleteVectorStoreResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessDeleteVectorStoreResponseContent( } 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 ProcessDeleteVectorStoreResponseContent( 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 ProcessDeleteVectorStoreResponseContent( __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 ProcessDeleteVectorStoreResponseContent( __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 ProcessDeleteVectorStoreResponseContent( 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 ProcessDeleteVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessDeleteVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessDeleteVectorStoreResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteVectorStoreResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteVectorStoreResponse.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 ProcessDeleteVectorStoreResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteVectorStoreResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteVectorStoreResponse.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.VectorStoresClient.DeleteVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs index dc0595fa..7f85c769 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.DeleteVectorStoreFile.g.cs @@ -56,6 +56,29 @@ partial void ProcessDeleteVectorStoreFileResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteVectorStoreFileAsResponseAsync( + vectorStoreId: vectorStoreId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](/docs/api-reference/files/delete) endpoint. + /// + /// + /// + /// 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> DeleteVectorStoreFileAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -86,6 +109,7 @@ partial void ProcessDeleteVectorStoreFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -160,6 +184,8 @@ partial void ProcessDeleteVectorStoreFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -170,6 +196,11 @@ partial void ProcessDeleteVectorStoreFileResponseContent( } 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 ProcessDeleteVectorStoreFileResponseContent( 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 ProcessDeleteVectorStoreFileResponseContent( __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 ProcessDeleteVectorStoreFileResponseContent( __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 ProcessDeleteVectorStoreFileResponseContent( 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 ProcessDeleteVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -289,6 +329,8 @@ partial void ProcessDeleteVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -313,9 +355,13 @@ partial void ProcessDeleteVectorStoreFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeleteVectorStoreFileResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeleteVectorStoreFileResponse.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 ProcessDeleteVectorStoreFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeleteVectorStoreFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeleteVectorStoreFileResponse.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.VectorStoresClient.ListVectorStoreFiles.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs index faa650b7..25fcec68 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFiles.g.cs @@ -76,6 +76,45 @@ partial void ProcessListVectorStoreFilesResponseContent( global::tryAGI.OpenAI.ListVectorStoreFilesFilter? filter = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVectorStoreFilesAsResponseAsync( + vectorStoreId: vectorStoreId, + limit: limit, + order: order, + after: after, + before: before, + filter: filter, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of vector store files. + /// + /// + /// + /// 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> ListVectorStoreFilesAsResponseAsync( + string vectorStoreId, + int? limit = default, + global::tryAGI.OpenAI.ListVectorStoreFilesOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.ListVectorStoreFilesFilter? filter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -110,15 +149,16 @@ partial void ProcessListVectorStoreFilesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) .AddOptionalParameter("before", before) - .AddOptionalParameter("filter", filter?.ToValueString()) + .AddOptionalParameter("filter", filter?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -195,6 +235,8 @@ partial void ProcessListVectorStoreFilesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -205,6 +247,11 @@ partial void ProcessListVectorStoreFilesResponseContent( } 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 ProcessListVectorStoreFilesResponseContent( 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 ProcessListVectorStoreFilesResponseContent( __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 ProcessListVectorStoreFilesResponseContent( __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 ProcessListVectorStoreFilesResponseContent( 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 ProcessListVectorStoreFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -324,6 +380,8 @@ partial void ProcessListVectorStoreFilesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -348,9 +406,13 @@ partial void ProcessListVectorStoreFilesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListVectorStoreFilesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListVectorStoreFilesResponse.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 ProcessListVectorStoreFilesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListVectorStoreFilesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListVectorStoreFilesResponse.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.VectorStoresClient.ListVectorStoreFilesInABatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFilesInABatch.g.cs index 2e677dde..aa94bbb3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFilesInABatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStoreFilesInABatch.g.cs @@ -80,6 +80,48 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( global::tryAGI.OpenAI.ListFilesInVectorStoreBatchFilter? filter = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVectorStoreFilesInABatchAsResponseAsync( + vectorStoreId: vectorStoreId, + batchId: batchId, + limit: limit, + order: order, + after: after, + before: before, + filter: filter, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of vector store files in a batch. + /// + /// + /// + /// + /// 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> ListVectorStoreFilesInABatchAsResponseAsync( + string vectorStoreId, + string batchId, + int? limit = default, + global::tryAGI.OpenAI.ListFilesInVectorStoreBatchOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.ListFilesInVectorStoreBatchFilter? filter = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -115,15 +157,16 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}/files", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) .AddOptionalParameter("after", after) .AddOptionalParameter("before", before) - .AddOptionalParameter("filter", filter?.ToValueString()) + .AddOptionalParameter("filter", filter?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -201,6 +244,8 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -211,6 +256,11 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( } 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 ProcessListVectorStoreFilesInABatchResponseContent( 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 ProcessListVectorStoreFilesInABatchResponseContent( __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 ProcessListVectorStoreFilesInABatchResponseContent( __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 ProcessListVectorStoreFilesInABatchResponseContent( 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 ProcessListVectorStoreFilesInABatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -330,6 +389,8 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -354,9 +415,13 @@ partial void ProcessListVectorStoreFilesInABatchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListVectorStoreFilesResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListVectorStoreFilesResponse.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 ProcessListVectorStoreFilesInABatchResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListVectorStoreFilesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListVectorStoreFilesResponse.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.VectorStoresClient.ListVectorStores.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStores.g.cs index fbaa2479..e40ffc2e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStores.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ListVectorStores.g.cs @@ -68,6 +68,39 @@ partial void ProcessListVectorStoresResponseContent( string? before = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVectorStoresAsResponseAsync( + limit: limit, + order: order, + after: after, + before: before, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Returns a list of vector stores. + /// + /// + /// 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> ListVectorStoresAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.ListVectorStoresOrder? order = default, + string? after = default, + string? before = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -100,14 +133,15 @@ partial void ProcessListVectorStoresResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/vector_stores", - 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( @@ -182,6 +216,8 @@ partial void ProcessListVectorStoresResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -192,6 +228,11 @@ partial void ProcessListVectorStoresResponseContent( } 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, @@ -209,6 +250,8 @@ partial void ProcessListVectorStoresResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -218,8 +261,7 @@ partial void ProcessListVectorStoresResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -228,6 +270,11 @@ partial void ProcessListVectorStoresResponseContent( __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( @@ -244,14 +291,15 @@ partial void ProcessListVectorStoresResponseContent( 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; } @@ -291,6 +339,8 @@ partial void ProcessListVectorStoresResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -311,6 +361,8 @@ partial void ProcessListVectorStoresResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -335,9 +387,13 @@ partial void ProcessListVectorStoresResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.ListVectorStoresResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.ListVectorStoresResponse.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) { @@ -365,9 +421,13 @@ partial void ProcessListVectorStoresResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.ListVectorStoresResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.ListVectorStoresResponse.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.VectorStoresClient.ModifyVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ModifyVectorStore.g.cs index 67be541a..a186f1f3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ModifyVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.ModifyVectorStore.g.cs @@ -54,6 +54,31 @@ partial void ProcessModifyVectorStoreResponseContent( public async global::System.Threading.Tasks.Task ModifyVectorStoreAsync( string vectorStoreId, + global::tryAGI.OpenAI.UpdateVectorStoreRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ModifyVectorStoreAsResponseAsync( + vectorStoreId: vectorStoreId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Modifies a vector store. + /// + /// + /// + /// 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> ModifyVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.UpdateVectorStoreRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -89,6 +114,7 @@ partial void ProcessModifyVectorStoreResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}", baseUri: HttpClient.BaseAddress); @@ -169,6 +195,8 @@ partial void ProcessModifyVectorStoreResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -179,6 +207,11 @@ partial void ProcessModifyVectorStoreResponseContent( } 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 ProcessModifyVectorStoreResponseContent( 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 ProcessModifyVectorStoreResponseContent( __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 ProcessModifyVectorStoreResponseContent( __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 ProcessModifyVectorStoreResponseContent( 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 ProcessModifyVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -298,6 +340,8 @@ partial void ProcessModifyVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -322,9 +366,13 @@ partial void ProcessModifyVectorStoreResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreObject.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 ProcessModifyVectorStoreResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreObject.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.VectorStoresClient.RetrieveVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStore.g.cs index a1dc99a7..1abeea6e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStore.g.cs @@ -52,6 +52,26 @@ partial void ProcessRetrieveVectorStoreResponseContent( string vectorStoreId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVectorStoreAsResponseAsync( + vectorStoreId: vectorStoreId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a vector store. + /// + /// + /// 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> RetrieveVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -81,6 +101,7 @@ partial void ProcessRetrieveVectorStoreResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}", baseUri: HttpClient.BaseAddress); @@ -154,6 +175,8 @@ partial void ProcessRetrieveVectorStoreResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -164,6 +187,11 @@ partial void ProcessRetrieveVectorStoreResponseContent( } 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 ProcessRetrieveVectorStoreResponseContent( 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 ProcessRetrieveVectorStoreResponseContent( __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 ProcessRetrieveVectorStoreResponseContent( __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 ProcessRetrieveVectorStoreResponseContent( 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 ProcessRetrieveVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -283,6 +320,8 @@ partial void ProcessRetrieveVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -307,9 +346,13 @@ partial void ProcessRetrieveVectorStoreResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreObject.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 ProcessRetrieveVectorStoreResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreObject.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.VectorStoresClient.RetrieveVectorStoreFile.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFile.g.cs index abbf4b66..93ad8566 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFile.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFile.g.cs @@ -60,6 +60,33 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVectorStoreFileAsResponseAsync( + vectorStoreId: vectorStoreId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// + /// 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> RetrieveVectorStoreFileAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( } 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 +226,8 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( __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 +267,15 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( 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 +315,8 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileObject.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 +397,13 @@ partial void ProcessRetrieveVectorStoreFileResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileObject.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.VectorStoresClient.RetrieveVectorStoreFileBatch.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileBatch.g.cs index 7bc1f418..8f09333b 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileBatch.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileBatch.g.cs @@ -60,6 +60,33 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( string batchId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVectorStoreFileBatchAsResponseAsync( + vectorStoreId: vectorStoreId, + batchId: batchId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieves a vector store file batch. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: vsfb_abc123 + /// + /// 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> RetrieveVectorStoreFileBatchAsResponseAsync( + string vectorStoreId, + string batchId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/file_batches/{batchId}", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( } 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 +226,8 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( __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 +267,15 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( 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 +315,8 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileBatchObject.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 +397,13 @@ partial void ProcessRetrieveVectorStoreFileBatchResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileBatchObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileBatchObject.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.VectorStoresClient.RetrieveVectorStoreFileContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileContent.g.cs index 9f5764a4..d1c9c0d3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.RetrieveVectorStoreFileContent.g.cs @@ -60,6 +60,33 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( string fileId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVectorStoreFileContentAsResponseAsync( + vectorStoreId: vectorStoreId, + fileId: fileId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Retrieve the parsed contents of a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// + /// 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> RetrieveVectorStoreFileContentAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -90,6 +117,7 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}/content", baseUri: HttpClient.BaseAddress); @@ -164,6 +192,8 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -174,6 +204,11 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( } 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 +226,8 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -200,8 +237,7 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -210,6 +246,11 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( __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 +267,15 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( 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 +315,8 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -293,6 +337,8 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -317,9 +363,13 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileContentResponse.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileContentResponse.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 +397,13 @@ partial void ProcessRetrieveVectorStoreFileContentResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileContentResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileContentResponse.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.VectorStoresClient.SearchVectorStore.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.SearchVectorStore.g.cs index 1b27fae8..24b4b3c3 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.SearchVectorStore.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.SearchVectorStore.g.cs @@ -56,6 +56,33 @@ partial void ProcessSearchVectorStoreResponseContent( public async global::System.Threading.Tasks.Task SearchVectorStoreAsync( string vectorStoreId, + global::tryAGI.OpenAI.VectorStoreSearchRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SearchVectorStoreAsResponseAsync( + vectorStoreId: vectorStoreId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Search a vector store for relevant chunks based on a query and file attributes filter. + /// + /// + /// Example: vs_abc123 + /// + /// + /// 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> SearchVectorStoreAsResponseAsync( + string vectorStoreId, + global::tryAGI.OpenAI.VectorStoreSearchRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -91,6 +118,7 @@ partial void ProcessSearchVectorStoreResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/search", baseUri: HttpClient.BaseAddress); @@ -171,6 +199,8 @@ partial void ProcessSearchVectorStoreResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -181,6 +211,11 @@ partial void ProcessSearchVectorStoreResponseContent( } 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 ProcessSearchVectorStoreResponseContent( 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 ProcessSearchVectorStoreResponseContent( __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 ProcessSearchVectorStoreResponseContent( __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 ProcessSearchVectorStoreResponseContent( 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 ProcessSearchVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -300,6 +344,8 @@ partial void ProcessSearchVectorStoreResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -324,9 +370,13 @@ partial void ProcessSearchVectorStoreResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreSearchResultsPage.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreSearchResultsPage.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 ProcessSearchVectorStoreResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreSearchResultsPage.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreSearchResultsPage.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.VectorStoresClient.UpdateVectorStoreFileAttributes.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.UpdateVectorStoreFileAttributes.g.cs index 93a2d030..ae596105 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.UpdateVectorStoreFileAttributes.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.UpdateVectorStoreFileAttributes.g.cs @@ -62,6 +62,38 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( string vectorStoreId, string fileId, + global::tryAGI.OpenAI.UpdateVectorStoreFileAttributesRequest request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateVectorStoreFileAttributesAsResponseAsync( + vectorStoreId: vectorStoreId, + fileId: fileId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update attributes on a vector store file. + /// + /// + /// Example: vs_abc123 + /// + /// + /// Example: file-abc123 + /// + /// + /// 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> UpdateVectorStoreFileAttributesAsResponseAsync( + string vectorStoreId, + string fileId, + global::tryAGI.OpenAI.UpdateVectorStoreFileAttributesRequest request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -98,6 +130,7 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/vector_stores/{vectorStoreId}/files/{fileId}", baseUri: HttpClient.BaseAddress); @@ -179,6 +212,8 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -189,6 +224,11 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( } 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, @@ -206,6 +246,8 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -215,8 +257,7 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -225,6 +266,11 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( __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( @@ -241,14 +287,15 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( 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; } @@ -288,6 +335,8 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -308,6 +357,8 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -332,9 +383,13 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VectorStoreFileObject.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VectorStoreFileObject.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) { @@ -362,9 +417,13 @@ partial void ProcessUpdateVectorStoreFileAttributesResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VectorStoreFileObject.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VectorStoreFileObject.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.VectorStoresClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.g.cs index 27c7b404..993cee35 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VectorStoresClient.g.cs @@ -72,10 +72,10 @@ public VectorStoresClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public VectorStoresClient( - 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.VideosClient.CreateVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs index c83143c1..3bb5a664 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideo.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoAsync( + global::tryAGI.OpenAI.CreateVideoMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new video generation job from a prompt and optional reference assets. + /// + /// + /// 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> CreateVideoAsResponseAsync( + global::tryAGI.OpenAI.CreateVideoMultipartBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateVideoResponseContent( 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: "/videos", baseUri: HttpClient.BaseAddress); @@ -116,6 +139,7 @@ partial void ProcessCreateVideoResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); if (request.Model != default) { @@ -123,32 +147,39 @@ partial void ProcessCreateVideoResponseContent( __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Model.ToString() ?? string.Empty), name: "\"model\""); + } __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + if (request.InputReference != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.InputReference.ToString() ?? string.Empty), name: "\"input_reference\""); - } + + } if (request.Seconds != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Seconds).HasValue ? (request.Seconds).GetValueOrDefault().ToValueString() : string.Empty), name: "\"seconds\""); - } + + } if (request.Size != default) { __httpRequestContent.Add( content: new global::System.Net.Http.StringContent((request.Size).HasValue ? (request.Size).GetValueOrDefault().ToValueString() : string.Empty), name: "\"size\""); + } + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -190,6 +221,8 @@ partial void ProcessCreateVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -200,6 +233,11 @@ partial void ProcessCreateVideoResponseContent( } 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 +255,8 @@ partial void ProcessCreateVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -226,8 +266,7 @@ partial void ProcessCreateVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -236,6 +275,11 @@ partial void ProcessCreateVideoResponseContent( __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 +296,15 @@ partial void ProcessCreateVideoResponseContent( 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 +344,8 @@ partial void ProcessCreateVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -319,6 +366,8 @@ partial void ProcessCreateVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -343,9 +392,13 @@ partial void ProcessCreateVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoResource.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 +426,13 @@ partial void ProcessCreateVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoResource.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.VideosClient.CreateVideoCharacter.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoCharacter.g.cs index 13d956b9..a4312a86 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoCharacter.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoCharacter.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoCharacterResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoCharacterAsync( + global::tryAGI.OpenAI.CreateVideoCharacterBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoCharacterAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a character from an uploaded video. + /// + /// + /// 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> CreateVideoCharacterAsResponseAsync( + global::tryAGI.OpenAI.CreateVideoCharacterBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateVideoCharacterResponseContent( 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: "/videos/characters", baseUri: HttpClient.BaseAddress); @@ -116,6 +139,7 @@ partial void ProcessCreateVideoCharacterResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); var __contentVideo = new global::System.Net.Http.ByteArrayContent(request.Video ?? global::System.Array.Empty()); __contentVideo.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( @@ -154,10 +178,13 @@ request.Videoname is null { __contentVideo.Headers.ContentDisposition.FileNameStar = null; } + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), name: "\"name\""); + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -199,6 +226,8 @@ request.Videoname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -209,6 +238,11 @@ request.Videoname 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, @@ -226,6 +260,8 @@ request.Videoname is null attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -235,8 +271,7 @@ request.Videoname is null __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -245,6 +280,11 @@ request.Videoname 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( @@ -261,14 +301,15 @@ request.Videoname 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; } @@ -308,6 +349,8 @@ request.Videoname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -328,6 +371,8 @@ request.Videoname is null attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -352,9 +397,13 @@ request.Videoname is null { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoCharacterResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoCharacterResource.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) { @@ -382,9 +431,13 @@ request.Videoname is null #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoCharacterResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoCharacterResource.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) { @@ -456,5 +509,852 @@ request.Videoname is null requestOptions: requestOptions, cancellationToken: cancellationToken).ConfigureAwait(false); } + + /// + /// Create a character from an uploaded video. + /// + /// + /// Video file used to create a character. + /// + /// + /// Video file used to create a character. + /// + /// + /// Display name for this API character. + /// + /// 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 CreateVideoCharacterAsync( + global::System.IO.Stream video, + string videoname, + string name, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + video = video ?? throw new global::System.ArgumentNullException(nameof(video)); + var request = new global::tryAGI.OpenAI.CreateVideoCharacterBody + { + Video = global::System.Array.Empty(), + Videoname = videoname, + Name = name, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateVideoCharacterArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateVideoCharacterSecurityRequirements, + operationName: "CreateVideoCharacterAsync"); + + 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: "/videos/characters", + 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 __contentVideo = new global::System.Net.Http.StreamContent(video); + __contentVideo.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Videoname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Videoname) ?? 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: __contentVideo, + name: "\"video\"", + fileName: request.Videoname != null ? $"\"{request.Videoname}\"" : string.Empty); + if (__contentVideo.Headers.ContentDisposition != null) + { + __contentVideo.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), + name: "\"name\""); + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateVideoCharacterRequest( + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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); + ProcessCreateVideoCharacterResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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); + ProcessCreateVideoCharacterResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + return + global::tryAGI.OpenAI.VideoCharacterResource.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.VideoCharacterResource.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(); + } + } + /// + /// Create a character from an uploaded video. + /// + /// + /// Video file used to create a character. + /// + /// + /// Video file used to create a character. + /// + /// + /// Display name for this API character. + /// + /// 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> CreateVideoCharacterAsResponseAsync( + global::System.IO.Stream video, + string videoname, + string name, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + + video = video ?? throw new global::System.ArgumentNullException(nameof(video)); + var request = new global::tryAGI.OpenAI.CreateVideoCharacterBody + { + Video = global::System.Array.Empty(), + Videoname = videoname, + Name = name, + }; + PrepareArguments( + client: HttpClient); + PrepareCreateVideoCharacterArguments( + httpClient: HttpClient, + request: request); + + + var __authorizations = global::tryAGI.OpenAI.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateVideoCharacterSecurityRequirements, + operationName: "CreateVideoCharacterAsync"); + + 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: "/videos/characters", + 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 __contentVideo = new global::System.Net.Http.StreamContent(video); + __contentVideo.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue( + request.Videoname is null + ? "application/octet-stream" + : (global::System.IO.Path.GetExtension(request.Videoname) ?? 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: __contentVideo, + name: "\"video\"", + fileName: request.Videoname != null ? $"\"{request.Videoname}\"" : string.Empty); + if (__contentVideo.Headers.ContentDisposition != null) + { + __contentVideo.Headers.ContentDisposition.FileNameStar = null; + } + + __httpRequestContent.Add( + content: new global::System.Net.Http.StringContent(request.Name ?? string.Empty), + name: "\"name\""); + + __httpRequest.Content = __httpRequestContent; + + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateVideoCharacterRequest( + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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); + ProcessCreateVideoCharacterResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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: "CreateVideoCharacter", + methodName: "CreateVideoCharacterAsync", + pathTemplate: "\"/videos/characters\"", + 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); + ProcessCreateVideoCharacterResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::tryAGI.OpenAI.VideoCharacterResource.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.VideoCharacterResource.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.VideosClient.CreateVideoEdit.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs index 29610c82..a3c3e0e6 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoEdit.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoEditResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoEditAsync( + global::tryAGI.OpenAI.CreateVideoEditMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoEditAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a new video generation job by editing a source video or existing generated video. + /// + /// + /// 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> CreateVideoEditAsResponseAsync( + global::tryAGI.OpenAI.CreateVideoEditMultipartBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateVideoEditResponseContent( 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: "/videos/edits", baseUri: HttpClient.BaseAddress); @@ -116,14 +139,18 @@ partial void ProcessCreateVideoEditResponseContent( __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.Video.ToString() ?? string.Empty), name: "\"video\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -165,6 +192,8 @@ partial void ProcessCreateVideoEditResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -175,6 +204,11 @@ partial void ProcessCreateVideoEditResponseContent( } 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, @@ -192,6 +226,8 @@ partial void ProcessCreateVideoEditResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -201,8 +237,7 @@ partial void ProcessCreateVideoEditResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -211,6 +246,11 @@ partial void ProcessCreateVideoEditResponseContent( __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( @@ -227,14 +267,15 @@ partial void ProcessCreateVideoEditResponseContent( 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; } @@ -274,6 +315,8 @@ partial void ProcessCreateVideoEditResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -294,6 +337,8 @@ partial void ProcessCreateVideoEditResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -318,9 +363,13 @@ partial void ProcessCreateVideoEditResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoResource.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) { @@ -348,9 +397,13 @@ partial void ProcessCreateVideoEditResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoResource.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.VideosClient.CreateVideoExtend.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs index 8da0d00b..9027ef56 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.CreateVideoExtend.g.cs @@ -50,6 +50,28 @@ partial void ProcessCreateVideoExtendResponseContent( /// public async global::System.Threading.Tasks.Task CreateVideoExtendAsync( + global::tryAGI.OpenAI.CreateVideoExtendMultipartBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateVideoExtendAsResponseAsync( + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create an extension of a completed video. + /// + /// + /// 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> CreateVideoExtendAsResponseAsync( + global::tryAGI.OpenAI.CreateVideoExtendMultipartBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -80,10 +102,11 @@ partial void ProcessCreateVideoExtendResponseContent( 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: "/videos/extensions", baseUri: HttpClient.BaseAddress); @@ -116,17 +139,22 @@ partial void ProcessCreateVideoExtendResponseContent( __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.Video.ToString() ?? string.Empty), name: "\"video\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Seconds.ToValueString()), name: "\"seconds\""); + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -168,6 +196,8 @@ partial void ProcessCreateVideoExtendResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -178,6 +208,11 @@ partial void ProcessCreateVideoExtendResponseContent( } 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 ProcessCreateVideoExtendResponseContent( 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 ProcessCreateVideoExtendResponseContent( __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 ProcessCreateVideoExtendResponseContent( __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 ProcessCreateVideoExtendResponseContent( 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 ProcessCreateVideoExtendResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -297,6 +341,8 @@ partial void ProcessCreateVideoExtendResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -321,9 +367,13 @@ partial void ProcessCreateVideoExtendResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoResource.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 ProcessCreateVideoExtendResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoResource.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.VideosClient.DeleteVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.DeleteVideo.g.cs index 1919d6e8..29e6f703 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.DeleteVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.DeleteVideo.g.cs @@ -54,6 +54,28 @@ partial void ProcessDeleteVideoResponseContent( string videoId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteVideoAsResponseAsync( + videoId: videoId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Permanently delete a completed or failed video and its stored assets. + /// + /// + /// Example: video_123 + /// + /// 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> DeleteVideoAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessDeleteVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/videos/{videoId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessDeleteVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessDeleteVideoResponseContent( } 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 ProcessDeleteVideoResponseContent( 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 ProcessDeleteVideoResponseContent( __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 ProcessDeleteVideoResponseContent( __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 ProcessDeleteVideoResponseContent( 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 ProcessDeleteVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessDeleteVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessDeleteVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.DeletedVideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.DeletedVideoResource.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 ProcessDeleteVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.DeletedVideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.DeletedVideoResource.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.VideosClient.GetVideoCharacter.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.GetVideoCharacter.g.cs index 4fdb5d39..1929de03 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.GetVideoCharacter.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.GetVideoCharacter.g.cs @@ -54,6 +54,28 @@ partial void ProcessGetVideoCharacterResponseContent( string characterId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetVideoCharacterAsResponseAsync( + characterId: characterId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Fetch a character. + /// + /// + /// Example: char_123 + /// + /// 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> GetVideoCharacterAsResponseAsync( + string characterId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessGetVideoCharacterResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/videos/characters/{characterId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessGetVideoCharacterResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessGetVideoCharacterResponseContent( } 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 ProcessGetVideoCharacterResponseContent( 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 ProcessGetVideoCharacterResponseContent( __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 ProcessGetVideoCharacterResponseContent( __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 ProcessGetVideoCharacterResponseContent( 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 ProcessGetVideoCharacterResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessGetVideoCharacterResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessGetVideoCharacterResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoCharacterResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoCharacterResource.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 ProcessGetVideoCharacterResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoCharacterResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoCharacterResource.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.VideosClient.ListVideos.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.ListVideos.g.cs index aae3ed62..b7d83b4e 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.ListVideos.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.ListVideos.g.cs @@ -62,6 +62,34 @@ partial void ProcessListVideosResponseContent( string? after = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListVideosAsResponseAsync( + limit: limit, + order: order, + after: after, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List recently generated videos for the current project. + /// + /// + /// + /// + /// Identifier for the last item from the previous pagination 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> ListVideosAsResponseAsync( + int? limit = default, + global::tryAGI.OpenAI.OrderEnum? order = default, + string? after = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -93,13 +121,14 @@ partial void ProcessListVideosResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: "/videos", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder .AddOptionalParameter("limit", limit?.ToString()) .AddOptionalParameter("order", order?.ToValueString()) - .AddOptionalParameter("after", after) + .AddOptionalParameter("after", after) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -173,6 +202,8 @@ partial void ProcessListVideosResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +214,11 @@ partial void ProcessListVideosResponseContent( } 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, @@ -200,6 +236,8 @@ partial void ProcessListVideosResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +247,7 @@ partial void ProcessListVideosResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +256,11 @@ partial void ProcessListVideosResponseContent( __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( @@ -235,14 +277,15 @@ partial void ProcessListVideosResponseContent( 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; } @@ -282,6 +325,8 @@ partial void ProcessListVideosResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +347,8 @@ partial void ProcessListVideosResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +373,13 @@ partial void ProcessListVideosResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoListResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoListResource.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) { @@ -356,9 +407,13 @@ partial void ProcessListVideosResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoListResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoListResource.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.VideosClient.RemixVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RemixVideo.g.cs index 4a1a0d6c..98b81157 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RemixVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RemixVideo.g.cs @@ -56,6 +56,33 @@ partial void ProcessRemixVideoResponseContent( public async global::System.Threading.Tasks.Task RemixVideoAsync( string videoId, + global::tryAGI.OpenAI.CreateVideoRemixBody request, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RemixVideoAsResponseAsync( + videoId: videoId, + + request: request, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a remix of a completed video using a refreshed prompt. + /// + /// + /// Example: video_123 + /// + /// + /// 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> RemixVideoAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.CreateVideoRemixBody request, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) @@ -87,10 +114,11 @@ partial void ProcessRemixVideoResponseContent( 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: $"/videos/{videoId}/remix", baseUri: HttpClient.BaseAddress); @@ -123,14 +151,18 @@ partial void ProcessRemixVideoResponseContent( __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); } } + var __httpRequestContent = new global::System.Net.Http.MultipartFormDataContent(); __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(videoId ?? string.Empty), name: "\"video_id\""); + __httpRequestContent.Add( content: new global::System.Net.Http.StringContent(request.Prompt ?? string.Empty), name: "\"prompt\""); + __httpRequest.Content = __httpRequestContent; + global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.ApplyHeaders( request: __httpRequest, clientHeaders: Options.Headers, @@ -173,6 +205,8 @@ partial void ProcessRemixVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -183,6 +217,11 @@ partial void ProcessRemixVideoResponseContent( } 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, @@ -200,6 +239,8 @@ partial void ProcessRemixVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -209,8 +250,7 @@ partial void ProcessRemixVideoResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -219,6 +259,11 @@ partial void ProcessRemixVideoResponseContent( __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( @@ -235,14 +280,15 @@ partial void ProcessRemixVideoResponseContent( 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; } @@ -282,6 +328,8 @@ partial void ProcessRemixVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -302,6 +350,8 @@ partial void ProcessRemixVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -326,9 +376,13 @@ partial void ProcessRemixVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoResource.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) { @@ -356,9 +410,13 @@ partial void ProcessRemixVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoResource.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.VideosClient.RetrieveVideo.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideo.g.cs index 0a3c1726..70eb5e29 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideo.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideo.g.cs @@ -54,6 +54,28 @@ partial void ProcessRetrieveVideoResponseContent( string videoId, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVideoAsResponseAsync( + videoId: videoId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Fetch the latest metadata for a generated video. + /// + /// + /// Example: video_123 + /// + /// 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> RetrieveVideoAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -83,6 +105,7 @@ partial void ProcessRetrieveVideoResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/videos/{videoId}", baseUri: HttpClient.BaseAddress); @@ -156,6 +179,8 @@ partial void ProcessRetrieveVideoResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -166,6 +191,11 @@ partial void ProcessRetrieveVideoResponseContent( } 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 ProcessRetrieveVideoResponseContent( 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 ProcessRetrieveVideoResponseContent( __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 ProcessRetrieveVideoResponseContent( __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 ProcessRetrieveVideoResponseContent( 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 ProcessRetrieveVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -285,6 +324,8 @@ partial void ProcessRetrieveVideoResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -309,9 +350,13 @@ partial void ProcessRetrieveVideoResponseContent( { __response.EnsureSuccessStatusCode(); - return - global::tryAGI.OpenAI.VideoResource.FromJson(__content, JsonSerializerContext) ?? + var __value = global::tryAGI.OpenAI.VideoResource.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 ProcessRetrieveVideoResponseContent( #endif ).ConfigureAwait(false); - return - await global::tryAGI.OpenAI.VideoResource.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + var __value = await global::tryAGI.OpenAI.VideoResource.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.VideosClient.RetrieveVideoContent.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideoContent.g.cs index 89119878..6c7a57f5 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideoContent.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.RetrieveVideoContent.g.cs @@ -59,6 +59,32 @@ partial void ProcessRetrieveVideoContentResponseContent( global::tryAGI.OpenAI.VideoContentVariant? variant = default, global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await RetrieveVideoContentAsResponseAsync( + videoId: videoId, + variant: variant, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Download the generated video bytes or a derived preview asset.
+ /// Streams the rendered video content for the specified video job. + ///
+ /// + /// Example: video_123 + /// + /// + /// 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> RetrieveVideoContentAsResponseAsync( + string videoId, + global::tryAGI.OpenAI.VideoContentVariant? variant = default, + global::tryAGI.OpenAI.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( client: HttpClient); @@ -89,11 +115,12 @@ partial void ProcessRetrieveVideoContentResponseContent( global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() { + var __pathBuilder = new global::tryAGI.OpenAI.PathBuilder( path: $"/videos/{videoId}/content", - baseUri: HttpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); __pathBuilder - .AddOptionalParameter("variant", variant?.ToValueString()) + .AddOptionalParameter("variant", variant?.ToValueString()) ; var __path = __pathBuilder.ToString(); __path = global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.AppendQueryParameters( @@ -166,6 +193,8 @@ partial void ProcessRetrieveVideoContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); try { @@ -176,6 +205,11 @@ partial void ProcessRetrieveVideoContentResponseContent( } 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 +227,8 @@ partial void ProcessRetrieveVideoContentResponseContent( attempt: __attempt, maxAttempts: __maxAttempts, willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); if (!__willRetry) { @@ -202,8 +238,7 @@ partial void ProcessRetrieveVideoContentResponseContent( __httpRequest.Dispose(); __httpRequest = null; await global::tryAGI.OpenAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( - clientOptions: Options, - requestOptions: requestOptions, + retryDelay: __retryDelay, cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); continue; } @@ -212,6 +247,11 @@ partial void ProcessRetrieveVideoContentResponseContent( __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 +268,15 @@ partial void ProcessRetrieveVideoContentResponseContent( 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 +316,8 @@ partial void ProcessRetrieveVideoContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } else @@ -295,6 +338,8 @@ partial void ProcessRetrieveVideoContentResponseContent( attempt: __attemptNumber, maxAttempts: __maxAttempts, willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); } @@ -319,7 +364,11 @@ partial void ProcessRetrieveVideoContentResponseContent( { __response.EnsureSuccessStatusCode(); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { @@ -347,7 +396,11 @@ partial void ProcessRetrieveVideoContentResponseContent( #endif ).ConfigureAwait(false); - return __content; + return new global::tryAGI.OpenAI.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::tryAGI.OpenAI.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __content); } catch (global::System.Exception __ex) { diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.g.cs index 23d8cd3f..06d1443c 100644 --- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.g.cs +++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.VideosClient.g.cs @@ -72,10 +72,10 @@ public VideosClient( /// Client-wide request defaults such as headers, query parameters, retries, and timeout. /// Dispose the HttpClient when the instance is disposed. True by default. public VideosClient( - 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) {