Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
68 changes: 59 additions & 9 deletions src/libs/Mistral/Generated/Mistral.AudioSpeechClient.Speech.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,29 @@ partial void ProcessSpeechResponseContent(
/// <exception cref="global::Mistral.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Mistral.SpeechResponse> SpeechAsync(

global::Mistral.SpeechRequest request,
global::Mistral.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await SpeechAsResponseAsync(

request: request,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// Speech<br/>
/// Generate speech from text using a saved voice or a reference audio clip.
/// </summary>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Mistral.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Mistral.AutoSDKHttpResponse<global::Mistral.SpeechResponse>> SpeechAsResponseAsync(

global::Mistral.SpeechRequest request,
global::Mistral.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -90,10 +113,11 @@ partial void ProcessSpeechResponseContent(
var __maxAttempts = global::Mistral.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
supportsRetry: true);
supportsRetry: false);

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::Mistral.PathBuilder(
path: "/v1/audio/speech",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -173,6 +197,8 @@ partial void ProcessSpeechResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -183,6 +209,11 @@ partial void ProcessSpeechResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Mistral.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Mistral.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -200,6 +231,8 @@ partial void ProcessSpeechResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -209,8 +242,7 @@ partial void ProcessSpeechResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Mistral.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -219,6 +251,11 @@ partial void ProcessSpeechResponseContent(
__attempt < __maxAttempts &&
global::Mistral.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Mistral.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Mistral.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Mistral.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -235,14 +272,15 @@ partial void ProcessSpeechResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::Mistral.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -282,6 +320,8 @@ partial void ProcessSpeechResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -302,6 +342,8 @@ partial void ProcessSpeechResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Validation Error
Expand Down Expand Up @@ -364,9 +406,13 @@ partial void ProcessSpeechResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::Mistral.SpeechResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::Mistral.SpeechResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::Mistral.AutoSDKHttpResponse<global::Mistral.SpeechResponse>(
statusCode: __response.StatusCode,
headers: global::Mistral.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -394,9 +440,13 @@ partial void ProcessSpeechResponseContent(
#endif
).ConfigureAwait(false);

return
await global::Mistral.SpeechResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::Mistral.SpeechResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::Mistral.AutoSDKHttpResponse<global::Mistral.SpeechResponse>(
statusCode: __response.StatusCode,
headers: global::Mistral.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ partial void ProcessSpeechAsStreamResponse(
var __maxAttempts = global::Mistral.AutoSDKRequestOptionsSupport.GetMaxAttempts(
clientOptions: Options,
requestOptions: requestOptions,
supportsRetry: true);
supportsRetry: false);

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::Mistral.PathBuilder(
path: "/v1/audio/speech",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -168,6 +169,8 @@ partial void ProcessSpeechAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -178,6 +181,11 @@ partial void ProcessSpeechAsStreamResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Mistral.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Mistral.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -195,6 +203,8 @@ partial void ProcessSpeechAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -204,8 +214,7 @@ partial void ProcessSpeechAsStreamResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::Mistral.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -214,6 +223,11 @@ partial void ProcessSpeechAsStreamResponse(
__attempt < __maxAttempts &&
global::Mistral.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Mistral.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Mistral.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Mistral.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -230,14 +244,15 @@ partial void ProcessSpeechAsStreamResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::Mistral.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -277,6 +292,8 @@ partial void ProcessSpeechAsStreamResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -297,6 +314,8 @@ partial void ProcessSpeechAsStreamResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}

Expand Down
8 changes: 4 additions & 4 deletions src/libs/Mistral/Generated/Mistral.AudioSpeechClient.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public AudioSpeechClient(
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public AudioSpeechClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::Mistral.EndPointAuthorization>? authorizations = null,
global::Mistral.AutoSDKClientOptions? options = null,
global::System.Net.Http.HttpClient? httpClient,
global::System.Uri? baseUri,
global::System.Collections.Generic.List<global::Mistral.EndPointAuthorization>? authorizations,
global::Mistral.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{

Expand Down
Loading
Loading