diff --git a/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.CreateOpenaiBatch.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.CreateOpenaiBatch.g.cs new file mode 100644 index 0000000..5dc710d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.CreateOpenaiBatch.g.cs @@ -0,0 +1,240 @@ + +#nullable enable + +namespace DeepInfra +{ + public partial class DeepInfraApi + { + partial void PrepareCreateOpenaiBatchArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? xiApiKey, + global::DeepInfra.OpenAIBatchesIn request); + partial void PrepareCreateOpenaiBatchRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? xiApiKey, + global::DeepInfra.OpenAIBatchesIn request); + partial void ProcessCreateOpenaiBatchResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCreateOpenaiBatchResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create Openai Batch + /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateOpenaiBatchAsync( + global::DeepInfra.OpenAIBatchesIn request, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareCreateOpenaiBatchArguments( + httpClient: HttpClient, + xiApiKey: ref xiApiKey, + request: request); + + var __pathBuilder = new PathBuilder( + path: "/v1/openai/batches", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + using 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") + { + __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); + } + } + + if (xiApiKey != default) + { + __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateOpenaiBatchRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + xiApiKey: xiApiKey, + request: request); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCreateOpenaiBatchResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::DeepInfra.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::DeepInfra.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateOpenaiBatchResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.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), + }; + } + + return + global::DeepInfra.OpenAIBatch.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + using var __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + + return + await global::DeepInfra.OpenAIBatch.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } + } + + /// + /// Create Openai Batch + /// + /// + /// + /// The ID of an uploaded file that contains requests for the new batch. + /// + /// + /// The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported. + /// + /// + /// The time frame within which the batch should be processed. Currently only 24h is supported. + /// + /// + /// Optional metadata to be stored with the batch. + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateOpenaiBatchAsync( + string inputFileId, + global::DeepInfra.OpenAIBatchesInEndpoint endpoint, + string? xiApiKey = default, + global::DeepInfra.OpenAIBatchesInCompletionWindow completionWindow = default, + object? metadata = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::DeepInfra.OpenAIBatchesIn + { + InputFileId = inputFileId, + Endpoint = endpoint, + CompletionWindow = completionWindow, + Metadata = metadata, + }; + + return await CreateOpenaiBatchAsync( + xiApiKey: xiApiKey, + request: __request, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.ListFiles.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.ListFiles.g.cs new file mode 100644 index 0000000..91c2594 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.ListFiles.g.cs @@ -0,0 +1,214 @@ + +#nullable enable + +namespace DeepInfra +{ + public partial class DeepInfraApi + { + partial void PrepareListFilesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? after, + ref string? purpose, + ref string? order, + ref int? limit, + ref string? xiApiKey); + partial void PrepareListFilesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? after, + string? purpose, + string? order, + int? limit, + string? xiApiKey); + partial void ProcessListFilesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListFilesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List Files + /// + /// + /// + /// + /// + /// Default Value: 100 + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ListFilesAsync( + string? after = default, + string? purpose = default, + string? order = default, + int? limit = default, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListFilesArguments( + httpClient: HttpClient, + after: ref after, + purpose: ref purpose, + order: ref order, + limit: ref limit, + xiApiKey: ref xiApiKey); + + var __pathBuilder = new PathBuilder( + path: "/v1/openai/files", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("after", after) + .AddOptionalParameter("purpose", purpose) + .AddOptionalParameter("order", order) + .AddOptionalParameter("limit", limit?.ToString()) + ; + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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") + { + __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); + } + } + + if (xiApiKey != default) + { + __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString()); + } + + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListFilesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + after: after, + purpose: purpose, + order: order, + limit: limit, + xiApiKey: xiApiKey); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListFilesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::DeepInfra.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::DeepInfra.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListFilesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.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), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatch.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatch.g.cs new file mode 100644 index 0000000..f7c81fc --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatch.g.cs @@ -0,0 +1,188 @@ + +#nullable enable + +namespace DeepInfra +{ + public partial class DeepInfraApi + { + partial void PrepareRetrieveOpenaiBatchArguments( + global::System.Net.Http.HttpClient httpClient, + ref string batchId, + ref string? xiApiKey); + partial void PrepareRetrieveOpenaiBatchRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string batchId, + string? xiApiKey); + partial void ProcessRetrieveOpenaiBatchResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessRetrieveOpenaiBatchResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve Openai Batch + /// + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task RetrieveOpenaiBatchAsync( + string batchId, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareRetrieveOpenaiBatchArguments( + httpClient: HttpClient, + batchId: ref batchId, + xiApiKey: ref xiApiKey); + + var __pathBuilder = new PathBuilder( + path: $"/v1/openai/batches/{batchId}", + baseUri: HttpClient.BaseAddress); + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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") + { + __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); + } + } + + if (xiApiKey != default) + { + __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString()); + } + + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareRetrieveOpenaiBatchRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + batchId: batchId, + xiApiKey: xiApiKey); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessRetrieveOpenaiBatchResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::DeepInfra.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::DeepInfra.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessRetrieveOpenaiBatchResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.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), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatches.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatches.g.cs new file mode 100644 index 0000000..4aa075d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.DeepInfraApi.RetrieveOpenaiBatches.g.cs @@ -0,0 +1,200 @@ + +#nullable enable + +namespace DeepInfra +{ + public partial class DeepInfraApi + { + partial void PrepareRetrieveOpenaiBatchesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string after, + ref int? limit, + ref string? xiApiKey); + partial void PrepareRetrieveOpenaiBatchesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string after, + int? limit, + string? xiApiKey); + partial void ProcessRetrieveOpenaiBatchesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessRetrieveOpenaiBatchesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Retrieve Openai Batches + /// + /// + /// + /// Default Value: 20 + /// + /// + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task RetrieveOpenaiBatchesAsync( + string after, + int? limit = default, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareRetrieveOpenaiBatchesArguments( + httpClient: HttpClient, + after: ref after, + limit: ref limit, + xiApiKey: ref xiApiKey); + + var __pathBuilder = new PathBuilder( + path: "/v1/openai/batches", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddRequiredParameter("after", after) + .AddOptionalParameter("limit", limit?.ToString()) + ; + var __path = __pathBuilder.ToString(); + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + 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") + { + __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); + } + } + + if (xiApiKey != default) + { + __httpRequest.Headers.TryAddWithoutValidation("xi-api-key", xiApiKey.ToString()); + } + + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareRetrieveOpenaiBatchesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + after: after, + limit: limit, + xiApiKey: xiApiKey); + + using var __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: cancellationToken).ConfigureAwait(false); + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessRetrieveOpenaiBatchesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + // Validation Error + if ((int)__response.StatusCode == 422) + { + string? __content_422 = null; + global::DeepInfra.HTTPValidationError? __value_422 = null; + if (ReadResponseAsString) + { + __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + __value_422 = global::DeepInfra.HTTPValidationError.FromJson(__content_422, JsonSerializerContext); + } + else + { + var __contentStream_422 = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + __value_422 = await global::DeepInfra.HTTPValidationError.FromJsonStreamAsync(__contentStream_422, JsonSerializerContext).ConfigureAwait(false); + } + + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + statusCode: __response.StatusCode) + { + ResponseBody = __content_422, + ResponseObject = __value_422, + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessRetrieveOpenaiBatchesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.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), + }; + } + + return __content; + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::DeepInfra.ApiException( + message: __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + statusCode: __response.StatusCode) + { + ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value), + }; + } + + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + return __content; + } + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.CreateOpenaiBatch.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.CreateOpenaiBatch.g.cs new file mode 100644 index 0000000..020b01b --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.CreateOpenaiBatch.g.cs @@ -0,0 +1,45 @@ +#nullable enable + +namespace DeepInfra +{ + public partial interface IDeepInfraApi + { + /// + /// Create Openai Batch + /// + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateOpenaiBatchAsync( + global::DeepInfra.OpenAIBatchesIn request, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create Openai Batch + /// + /// + /// + /// The ID of an uploaded file that contains requests for the new batch. + /// + /// + /// The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported. + /// + /// + /// The time frame within which the batch should be processed. Currently only 24h is supported. + /// + /// + /// Optional metadata to be stored with the batch. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateOpenaiBatchAsync( + string inputFileId, + global::DeepInfra.OpenAIBatchesInEndpoint endpoint, + string? xiApiKey = default, + global::DeepInfra.OpenAIBatchesInCompletionWindow completionWindow = default, + object? metadata = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.ListFiles.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.ListFiles.g.cs new file mode 100644 index 0000000..d12535d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.ListFiles.g.cs @@ -0,0 +1,27 @@ +#nullable enable + +namespace DeepInfra +{ + public partial interface IDeepInfraApi + { + /// + /// List Files + /// + /// + /// + /// + /// + /// Default Value: 100 + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListFilesAsync( + string? after = default, + string? purpose = default, + string? order = default, + int? limit = default, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatch.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatch.g.cs new file mode 100644 index 0000000..351984d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatch.g.cs @@ -0,0 +1,19 @@ +#nullable enable + +namespace DeepInfra +{ + public partial interface IDeepInfraApi + { + /// + /// Retrieve Openai Batch + /// + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task RetrieveOpenaiBatchAsync( + string batchId, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatches.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatches.g.cs new file mode 100644 index 0000000..b0ba6ef --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraApi.RetrieveOpenaiBatches.g.cs @@ -0,0 +1,23 @@ +#nullable enable + +namespace DeepInfra +{ + public partial interface IDeepInfraApi + { + /// + /// Retrieve Openai Batches + /// + /// + /// + /// Default Value: 20 + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task RetrieveOpenaiBatchesAsync( + string after, + int? limit = default, + string? xiApiKey = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.Json.g.cs new file mode 100644 index 0000000..49add4d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class ListFilesV1OpenaiFilesGetResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.ListFilesV1OpenaiFilesGetResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.ListFilesV1OpenaiFilesGetResponse), + jsonSerializerContext) as global::DeepInfra.ListFilesV1OpenaiFilesGetResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.ListFilesV1OpenaiFilesGetResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.ListFilesV1OpenaiFilesGetResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.ListFilesV1OpenaiFilesGetResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.g.cs new file mode 100644 index 0000000..34bf95c --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.ListFilesV1OpenaiFilesGetResponse.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class ListFilesV1OpenaiFilesGetResponse + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ListFilesV1OpenaiFilesGetResponse( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.Json.g.cs new file mode 100644 index 0000000..bf238df --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatch + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatch? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatch), + jsonSerializerContext) as global::DeepInfra.OpenAIBatch; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatch? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatch), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatch; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.g.cs new file mode 100644 index 0000000..a14ed9d --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatch.g.cs @@ -0,0 +1,220 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class OpenAIBatch + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Id { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("object")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Object { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("endpoint")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Endpoint { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("errors")] + public object? Errors { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input_file_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string InputFileId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("completion_window")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string CompletionWindow { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("status")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Status { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("output_file_id")] + public string? OutputFileId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("error_file_id")] + public string? ErrorFileId { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int CreatedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("in_progress_at")] + public int? InProgressAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("completed_at")] + public int? CompletedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("failed_at")] + public int? FailedAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("finalizing_at")] + public int? FinalizingAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expires_at")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int ExpiresAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("expired_at")] + public int? ExpiredAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cancelled_at")] + public int? CancelledAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("cancelling_at")] + public int? CancellingAt { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("request_counts")] + public object? RequestCounts { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object? Metadata { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatch( + string id, + string @object, + string endpoint, + string inputFileId, + string completionWindow, + string status, + int createdAt, + int expiresAt, + object? errors, + string? outputFileId, + string? errorFileId, + int? inProgressAt, + int? completedAt, + int? failedAt, + int? finalizingAt, + int? expiredAt, + int? cancelledAt, + int? cancellingAt, + object? requestCounts, + object? metadata) + { + this.Id = id ?? throw new global::System.ArgumentNullException(nameof(id)); + this.Object = @object ?? throw new global::System.ArgumentNullException(nameof(@object)); + this.Endpoint = endpoint ?? throw new global::System.ArgumentNullException(nameof(endpoint)); + this.InputFileId = inputFileId ?? throw new global::System.ArgumentNullException(nameof(inputFileId)); + this.CompletionWindow = completionWindow ?? throw new global::System.ArgumentNullException(nameof(completionWindow)); + this.Status = status ?? throw new global::System.ArgumentNullException(nameof(status)); + this.CreatedAt = createdAt; + this.ExpiresAt = expiresAt; + this.Errors = errors; + this.OutputFileId = outputFileId; + this.ErrorFileId = errorFileId; + this.InProgressAt = inProgressAt; + this.CompletedAt = completedAt; + this.FailedAt = failedAt; + this.FinalizingAt = finalizingAt; + this.ExpiredAt = expiredAt; + this.CancelledAt = cancelledAt; + this.CancellingAt = cancellingAt; + this.RequestCounts = requestCounts; + this.Metadata = metadata; + } + + /// + /// Initializes a new instance of the class. + /// + public OpenAIBatch() + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.Json.g.cs new file mode 100644 index 0000000..55fe947 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatchErrors + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatchErrors? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatchErrors), + jsonSerializerContext) as global::DeepInfra.OpenAIBatchErrors; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatchErrors? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatchErrors), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatchErrors; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.g.cs new file mode 100644 index 0000000..af0f990 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchErrors.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class OpenAIBatchErrors + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatchErrors( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.Json.g.cs new file mode 100644 index 0000000..6539afe --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatchMetadata + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatchMetadata? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatchMetadata), + jsonSerializerContext) as global::DeepInfra.OpenAIBatchMetadata; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatchMetadata? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatchMetadata), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatchMetadata; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.g.cs new file mode 100644 index 0000000..1290efb --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchMetadata.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class OpenAIBatchMetadata + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatchMetadata( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.Json.g.cs new file mode 100644 index 0000000..2a98e9a --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatchRequestCounts + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatchRequestCounts? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatchRequestCounts), + jsonSerializerContext) as global::DeepInfra.OpenAIBatchRequestCounts; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatchRequestCounts? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatchRequestCounts), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatchRequestCounts; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.g.cs new file mode 100644 index 0000000..aaf3243 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchRequestCounts.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class OpenAIBatchRequestCounts + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatchRequestCounts( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.Json.g.cs new file mode 100644 index 0000000..e9e2d55 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatchesIn + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatchesIn? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatchesIn), + jsonSerializerContext) as global::DeepInfra.OpenAIBatchesIn; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatchesIn? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatchesIn), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatchesIn; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.g.cs new file mode 100644 index 0000000..8c1e90f --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesIn.g.cs @@ -0,0 +1,80 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class OpenAIBatchesIn + { + /// + /// The ID of an uploaded file that contains requests for the new batch. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("input_file_id")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string InputFileId { get; set; } + + /// + /// The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("endpoint")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInEndpointJsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::DeepInfra.OpenAIBatchesInEndpoint Endpoint { get; set; } + + /// + /// The time frame within which the batch should be processed. Currently only 24h is supported. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("completion_window")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInCompletionWindowJsonConverter))] + public global::DeepInfra.OpenAIBatchesInCompletionWindow CompletionWindow { get; set; } + + /// + /// Optional metadata to be stored with the batch. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("metadata")] + public object? Metadata { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The ID of an uploaded file that contains requests for the new batch. + /// + /// + /// The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported. + /// + /// + /// The time frame within which the batch should be processed. Currently only 24h is supported. + /// + /// + /// Optional metadata to be stored with the batch. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatchesIn( + string inputFileId, + global::DeepInfra.OpenAIBatchesInEndpoint endpoint, + global::DeepInfra.OpenAIBatchesInCompletionWindow completionWindow, + object? metadata) + { + this.InputFileId = inputFileId ?? throw new global::System.ArgumentNullException(nameof(inputFileId)); + this.Endpoint = endpoint; + this.CompletionWindow = completionWindow; + this.Metadata = metadata; + } + + /// + /// Initializes a new instance of the class. + /// + public OpenAIBatchesIn() + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInCompletionWindow.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInCompletionWindow.g.cs new file mode 100644 index 0000000..0989f1e --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInCompletionWindow.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// The time frame within which the batch should be processed. Currently only 24h is supported. + /// + public enum OpenAIBatchesInCompletionWindow + { + /// + /// + /// + x24h, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class OpenAIBatchesInCompletionWindowExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this OpenAIBatchesInCompletionWindow value) + { + return value switch + { + OpenAIBatchesInCompletionWindow.x24h => "24h", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static OpenAIBatchesInCompletionWindow? ToEnum(string value) + { + return value switch + { + "24h" => OpenAIBatchesInCompletionWindow.x24h, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInEndpoint.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInEndpoint.g.cs new file mode 100644 index 0000000..9986373 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInEndpoint.g.cs @@ -0,0 +1,51 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported. + /// + public enum OpenAIBatchesInEndpoint + { + /// + /// + /// + V1ChatCompletions, + /// + /// + /// + V1Completions, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class OpenAIBatchesInEndpointExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this OpenAIBatchesInEndpoint value) + { + return value switch + { + OpenAIBatchesInEndpoint.V1ChatCompletions => "/v1/chat/completions", + OpenAIBatchesInEndpoint.V1Completions => "/v1/completions", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static OpenAIBatchesInEndpoint? ToEnum(string value) + { + return value switch + { + "/v1/chat/completions" => OpenAIBatchesInEndpoint.V1ChatCompletions, + "/v1/completions" => OpenAIBatchesInEndpoint.V1Completions, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.Json.g.cs new file mode 100644 index 0000000..e81e008 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class OpenAIBatchesInMetadata + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.OpenAIBatchesInMetadata? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.OpenAIBatchesInMetadata), + jsonSerializerContext) as global::DeepInfra.OpenAIBatchesInMetadata; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.OpenAIBatchesInMetadata? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.OpenAIBatchesInMetadata), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.OpenAIBatchesInMetadata; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.g.cs new file mode 100644 index 0000000..01a67ba --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.OpenAIBatchesInMetadata.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// Optional metadata to be stored with the batch. + /// + public sealed partial class OpenAIBatchesInMetadata + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public OpenAIBatchesInMetadata( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.Json.g.cs new file mode 100644 index 0000000..7788429 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse), + jsonSerializerContext) as global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.g.cs new file mode 100644 index 0000000..804d1ca --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieveOpenaiBatchV1OpenaiBatchesBatchIdGetResponse( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.Json.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.Json.g.cs new file mode 100644 index 0000000..8d6fb1c --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace DeepInfra +{ + public sealed partial class RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse), + jsonSerializerContext) as global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse; + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::DeepInfra.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse; + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.g.cs b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.g.cs new file mode 100644 index 0000000..f297538 --- /dev/null +++ b/src/libs/DeepInfra/Generated/DeepInfra.Models.RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse.g.cs @@ -0,0 +1,27 @@ + +#nullable enable + +namespace DeepInfra +{ + /// + /// + /// + public sealed partial class RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RetrieveOpenaiBatchesV1OpenaiBatchesGetResponse( + ) + { + } + } +} \ No newline at end of file diff --git a/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindow.g.cs b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindow.g.cs new file mode 100644 index 0000000..09c8442 --- /dev/null +++ b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindow.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace DeepInfra.JsonConverters +{ + /// + public sealed class OpenAIBatchesInCompletionWindowJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::DeepInfra.OpenAIBatchesInCompletionWindow Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::DeepInfra.OpenAIBatchesInCompletionWindowExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::DeepInfra.OpenAIBatchesInCompletionWindow)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::DeepInfra.OpenAIBatchesInCompletionWindow value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::DeepInfra.OpenAIBatchesInCompletionWindowExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindowNullable.g.cs b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindowNullable.g.cs new file mode 100644 index 0000000..a945339 --- /dev/null +++ b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInCompletionWindowNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace DeepInfra.JsonConverters +{ + /// + public sealed class OpenAIBatchesInCompletionWindowNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::DeepInfra.OpenAIBatchesInCompletionWindow? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::DeepInfra.OpenAIBatchesInCompletionWindowExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::DeepInfra.OpenAIBatchesInCompletionWindow)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::DeepInfra.OpenAIBatchesInCompletionWindow? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::DeepInfra.OpenAIBatchesInCompletionWindowExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpoint.g.cs b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpoint.g.cs new file mode 100644 index 0000000..eca6767 --- /dev/null +++ b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpoint.g.cs @@ -0,0 +1,49 @@ +#nullable enable + +namespace DeepInfra.JsonConverters +{ + /// + public sealed class OpenAIBatchesInEndpointJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::DeepInfra.OpenAIBatchesInEndpoint Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::DeepInfra.OpenAIBatchesInEndpointExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::DeepInfra.OpenAIBatchesInEndpoint)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::DeepInfra.OpenAIBatchesInEndpoint value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::DeepInfra.OpenAIBatchesInEndpointExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpointNullable.g.cs b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpointNullable.g.cs new file mode 100644 index 0000000..1c2c4e4 --- /dev/null +++ b/src/libs/DeepInfra/Generated/JsonConverters.OpenAIBatchesInEndpointNullable.g.cs @@ -0,0 +1,56 @@ +#nullable enable + +namespace DeepInfra.JsonConverters +{ + /// + public sealed class OpenAIBatchesInEndpointNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::DeepInfra.OpenAIBatchesInEndpoint? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::DeepInfra.OpenAIBatchesInEndpointExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::DeepInfra.OpenAIBatchesInEndpoint)numValue; + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::DeepInfra.OpenAIBatchesInEndpoint? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::DeepInfra.OpenAIBatchesInEndpointExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/DeepInfra/Generated/JsonSerializerContext.g.cs b/src/libs/DeepInfra/Generated/JsonSerializerContext.g.cs index afce4a1..a156ced 100644 --- a/src/libs/DeepInfra/Generated/JsonSerializerContext.g.cs +++ b/src/libs/DeepInfra/Generated/JsonSerializerContext.g.cs @@ -51,6 +51,10 @@ namespace DeepInfra typeof(global::DeepInfra.JsonConverters.ModelDocBlockKeyNullableJsonConverter), typeof(global::DeepInfra.JsonConverters.SchemaVariantKeyJsonConverter), typeof(global::DeepInfra.JsonConverters.SchemaVariantKeyNullableJsonConverter), + typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInEndpointJsonConverter), + typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInEndpointNullableJsonConverter), + typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInCompletionWindowJsonConverter), + typeof(global::DeepInfra.JsonConverters.OpenAIBatchesInCompletionWindowNullableJsonConverter), typeof(global::DeepInfra.JsonConverters.ResponseFormatTypeJsonConverter), typeof(global::DeepInfra.JsonConverters.ResponseFormatTypeNullableJsonConverter), typeof(global::DeepInfra.JsonConverters.OpenAIEmbeddingsInEncodingFormatJsonConverter), diff --git a/src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs b/src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs index 4151105..7f10110 100644 --- a/src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs +++ b/src/libs/DeepInfra/Generated/JsonSerializerContextTypes.g.cs @@ -542,106 +542,122 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::DeepInfra.OpenAIChatCompletionsIn? Type131 { get; set; } + public global::DeepInfra.OpenAIBatch? Type131 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type132 { get; set; } + public global::DeepInfra.OpenAIBatchesIn? Type132 { get; set; } /// /// /// - public global::DeepInfra.AnyOf? Type133 { get; set; } + public global::DeepInfra.OpenAIBatchesInEndpoint? Type133 { get; set; } /// /// /// - public global::DeepInfra.AnyOf>? Type134 { get; set; } + public global::DeepInfra.OpenAIBatchesInCompletionWindow? Type134 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type135 { get; set; } + public global::DeepInfra.OpenAIChatCompletionsIn? Type135 { get; set; } /// /// /// - public global::DeepInfra.ResponseFormat? Type136 { get; set; } + public global::System.Collections.Generic.IList>? Type136 { get; set; } /// /// /// - public global::DeepInfra.ResponseFormatType? Type137 { get; set; } + public global::DeepInfra.AnyOf? Type137 { get; set; } /// /// /// - public global::DeepInfra.OpenAICompletionsIn? Type138 { get; set; } + public global::DeepInfra.AnyOf>? Type138 { get; set; } /// /// /// - public global::DeepInfra.OpenAIEmbeddingsIn? Type139 { get; set; } + public global::System.Collections.Generic.IList? Type139 { get; set; } /// /// /// - public global::DeepInfra.AnyOf, string>? Type140 { get; set; } + public global::DeepInfra.ResponseFormat? Type140 { get; set; } /// /// /// - public global::DeepInfra.OpenAIEmbeddingsInEncodingFormat? Type141 { get; set; } + public global::DeepInfra.ResponseFormatType? Type141 { get; set; } /// /// /// - public global::DeepInfra.OpenAIModelOut? Type142 { get; set; } + public global::DeepInfra.OpenAICompletionsIn? Type142 { get; set; } /// /// /// - public global::DeepInfra.OpenAIModelsOut? Type143 { get; set; } + public global::DeepInfra.OpenAIEmbeddingsIn? Type143 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type144 { get; set; } + public global::DeepInfra.AnyOf, string>? Type144 { get; set; } /// /// /// - public global::DeepInfra.OpenAITextToSpeechIn? Type145 { get; set; } + public global::DeepInfra.OpenAIEmbeddingsInEncodingFormat? Type145 { get; set; } /// /// /// - public global::DeepInfra.TtsVoice? Type146 { get; set; } + public global::DeepInfra.OpenAIModelOut? Type146 { get; set; } /// /// /// - public global::DeepInfra.RateLimitOut? Type147 { get; set; } + public global::DeepInfra.OpenAIModelsOut? Type147 { get; set; } /// /// /// - public global::DeepInfra.RateLimitRequestIn? Type148 { get; set; } + public global::System.Collections.Generic.IList? Type148 { get; set; } /// /// /// - public global::DeepInfra.SchemaFieldOut? Type149 { get; set; } + public global::DeepInfra.OpenAITextToSpeechIn? Type149 { get; set; } /// /// /// - public global::DeepInfra.SchemaOut? Type150 { get; set; } + public global::DeepInfra.TtsVoice? Type150 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type151 { get; set; } + public global::DeepInfra.RateLimitOut? Type151 { get; set; } /// /// /// - public global::DeepInfra.UpdateLoraApiRequest? Type152 { get; set; } + public global::DeepInfra.RateLimitRequestIn? Type152 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type153 { get; set; } + public global::DeepInfra.SchemaFieldOut? Type153 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type154 { get; set; } + public global::DeepInfra.SchemaOut? Type154 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type155 { get; set; } + public global::System.Collections.Generic.IList? Type155 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type156 { get; set; } + public global::DeepInfra.UpdateLoraApiRequest? Type156 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type157 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type158 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type159 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type160 { get; set; } } } \ No newline at end of file diff --git a/src/libs/DeepInfra/openapi.yaml b/src/libs/DeepInfra/openapi.yaml index 47fccc6..c16dfcb 100644 --- a/src/libs/DeepInfra/openapi.yaml +++ b/src/libs/DeepInfra/openapi.yaml @@ -1331,6 +1331,50 @@ paths: security: - HTTPBearer: [ ] /v1/openai/files: + get: + summary: List Files + operationId: list_files_v1_openai_files_get + parameters: + - name: after + in: query + schema: + title: After + type: string + - name: purpose + in: query + schema: + title: Purpose + type: string + - name: order + in: query + schema: + title: Order + type: string + - name: limit + in: query + schema: + title: Limit + type: integer + default: 100 + - name: xi-api-key + in: header + schema: + title: Xi-Api-Key + type: string + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [ ] post: summary: Openai Files operationId: openai_files_v1_openai_files_post @@ -1360,6 +1404,102 @@ paths: $ref: '#/components/schemas/HTTPValidationError' security: - HTTPBearer: [ ] + /v1/openai/batches: + get: + summary: Retrieve Openai Batches + operationId: retrieve_openai_batches_v1_openai_batches_get + parameters: + - name: after + in: query + required: true + schema: + title: After + type: string + - name: limit + in: query + schema: + title: Limit + type: integer + default: 20 + - name: xi-api-key + in: header + schema: + title: Xi-Api-Key + type: string + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [ ] + post: + summary: Create Openai Batch + operationId: create_openai_batch_v1_openai_batches_post + parameters: + - name: xi-api-key + in: header + schema: + title: Xi-Api-Key + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIBatchesIn' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/OpenAIBatch' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [ ] + '/v1/openai/batches/{batch_id}': + get: + summary: Retrieve Openai Batch + operationId: retrieve_openai_batch_v1_openai_batches__batch_id__get + parameters: + - name: batch_id + in: path + required: true + schema: + title: Batch Id + type: string + - name: xi-api-key + in: header + schema: + title: Xi-Api-Key + type: string + responses: + '200': + description: Successful Response + content: + application/json: + schema: { } + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + security: + - HTTPBearer: [ ] /v1/openai/chat/completions: post: summary: Openai Chat Completions @@ -4511,6 +4651,108 @@ components: description: Upload time format: date-time example: '2023-01-19T21:52:03.6262410+00:00' + OpenAIBatch: + title: OpenAIBatch + required: + - id + - object + - endpoint + - input_file_id + - completion_window + - status + - created_at + - expires_at + type: object + properties: + id: + title: Id + type: string + object: + title: Object + type: string + endpoint: + title: Endpoint + type: string + errors: + title: Errors + type: object + input_file_id: + title: Input File Id + type: string + completion_window: + title: Completion Window + type: string + status: + title: Status + type: string + output_file_id: + title: Output File Id + type: string + error_file_id: + title: Error File Id + type: string + created_at: + title: Created At + type: integer + in_progress_at: + title: In Progress At + type: integer + completed_at: + title: Completed At + type: integer + failed_at: + title: Failed At + type: integer + finalizing_at: + title: Finalizing At + type: integer + expires_at: + title: Expires At + type: integer + expired_at: + title: Expired At + type: integer + cancelled_at: + title: Cancelled At + type: integer + cancelling_at: + title: Cancelling At + type: integer + request_counts: + title: Request Counts + type: object + metadata: + title: Metadata + type: object + OpenAIBatchesIn: + title: OpenAIBatchesIn + required: + - input_file_id + - endpoint + - completion_window + type: object + properties: + input_file_id: + title: Input File Id + type: string + description: The ID of an uploaded file that contains requests for the new batch. + endpoint: + title: Endpoint + enum: + - /v1/chat/completions + - /v1/completions + type: string + description: 'The endpoint to be used for all requests in the batch. Currently /v1/chat/completions, /v1/completions are supported.' + completion_window: + title: Completion Window + enum: + - 24h + type: string + description: The time frame within which the batch should be processed. Currently only 24h is supported. + metadata: + title: Metadata + type: object + description: Optional metadata to be stored with the batch. OpenAIChatCompletionsIn: title: OpenAIChatCompletionsIn required: