diff --git a/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs b/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs index e97e327..4514e48 100644 --- a/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs @@ -38,15 +38,11 @@ public class AnyOfJsonConverter : global::System.Text.Json.Serialization catch (global::System.Text.Json.JsonException) { } + var result = new global::System.AnyOf( value1, - value2 ); - if (!result.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid JSON format for AnyOf<{typeof(T1).Name}, {typeof(T2).Name}>"); - } if (value1 != null) { @@ -54,13 +50,13 @@ public class AnyOfJsonConverter : global::System.Text.Json.Serialization throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - else if (value2 != null) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } + return result; } @@ -73,18 +69,12 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - if (!value.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid AnyOf<{typeof(T1).Name}, {typeof(T2).Name}> object."); - } - if (value.IsValue1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); } - else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? diff --git a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs index 773c423..c331ede 100644 --- a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs @@ -39,15 +39,11 @@ public class CreateModelStatusJsonConverter : global::System.Text.Json.Serializa catch (global::System.Text.Json.JsonException) { } + var result = new global::Ollama.CreateModelStatus( value1, - value2 ); - if (!result.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid JSON format for AnyOf<{typeof(string).Name}, {typeof(global::Ollama.CreateModelStatusEnum).Name}>"); - } if (value1 != null) { @@ -55,13 +51,13 @@ public class CreateModelStatusJsonConverter : global::System.Text.Json.Serializa throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - else if (value2 != null) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.CreateModelStatusEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ollama.CreateModelStatusEnum).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } + return result; } @@ -74,18 +70,12 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - if (!value.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid AnyOf<{typeof(string).Name}, {typeof(global::Ollama.CreateModelStatusEnum).Name}> object."); - } - if (value.IsValue1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); } - else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.CreateModelStatusEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? diff --git a/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs b/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs index a22e437..a746361 100644 --- a/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs @@ -39,15 +39,11 @@ public class DoneReasonJsonConverter : global::System.Text.Json.Serialization.Js catch (global::System.Text.Json.JsonException) { } + var result = new global::Ollama.DoneReason( value1, - value2 ); - if (!result.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid JSON format for AnyOf<{typeof(string).Name}, {typeof(global::Ollama.DoneReasonEnum).Name}>"); - } if (value1 != null) { @@ -55,13 +51,13 @@ public class DoneReasonJsonConverter : global::System.Text.Json.Serialization.Js throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - else if (value2 != null) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.DoneReasonEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ollama.DoneReasonEnum).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } + return result; } @@ -74,18 +70,12 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - if (!value.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid AnyOf<{typeof(string).Name}, {typeof(global::Ollama.DoneReasonEnum).Name}> object."); - } - if (value.IsValue1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); } - else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.DoneReasonEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? diff --git a/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs b/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs index 5d1f1ab..0e1528c 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs @@ -39,15 +39,11 @@ public class PullModelStatusJsonConverter : global::System.Text.Json.Serializati catch (global::System.Text.Json.JsonException) { } + var result = new global::Ollama.PullModelStatus( value1, - value2 ); - if (!result.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid JSON format for AnyOf<{typeof(string).Name}, {typeof(global::Ollama.PullModelStatusEnum).Name}>"); - } if (value1 != null) { @@ -55,13 +51,13 @@ public class PullModelStatusJsonConverter : global::System.Text.Json.Serializati throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } - else if (value2 != null) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.PullModelStatusEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Ollama.PullModelStatusEnum).Name}"); _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); } + return result; } @@ -74,18 +70,12 @@ public override void Write( options = options ?? throw new global::System.ArgumentNullException(nameof(options)); var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); - if (!value.Validate()) - { - throw new global::System.Text.Json.JsonException($"Invalid AnyOf<{typeof(string).Name}, {typeof(global::Ollama.PullModelStatusEnum).Name}> object."); - } - if (value.IsValue1) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(string), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(string).Name}"); global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); } - else if (value.IsValue2) { var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Ollama.PullModelStatusEnum), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs index 80ac73e..5403097 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs @@ -38,8 +38,9 @@ partial void ProcessGenerateChatCompletionResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/chat", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateChatCompletionRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateChatCompletionRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs index 40fc35f..650e6c8 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs @@ -38,8 +38,9 @@ partial void ProcessGenerateCompletionResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/generate", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateCompletionRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateCompletionRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs index 8c38ea0..6db6856 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs @@ -42,8 +42,9 @@ partial void ProcessGenerateEmbeddingResponseContent( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/embeddings", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateEmbeddingRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateEmbeddingRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs index 99f7d82..c49bc21 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs @@ -37,8 +37,9 @@ partial void ProcessCopyModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/copy", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CopyModelRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CopyModelRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs index fc85918..8e1c11c 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs @@ -42,8 +42,9 @@ partial void ProcessCreateBlobResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/blobs/{digest}", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ByteArray); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ByteArray), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/octet-stream"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs index 872ce77..1019c97 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs @@ -38,8 +38,9 @@ partial void ProcessCreateModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/create", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CreateModelRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CreateModelRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs index 3118b7b..e3c8584 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs @@ -37,8 +37,9 @@ partial void ProcessDeleteModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Delete, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/delete", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.DeleteModelRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.DeleteModelRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs index fe2c76d..72173eb 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs @@ -38,8 +38,9 @@ partial void ProcessPullModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/pull", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PullModelRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PullModelRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs index 8e71c41..e03060d 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs @@ -38,8 +38,9 @@ partial void ProcessPushModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/push", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PushModelRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PushModelRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs index d068649..a20271b 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs @@ -42,8 +42,9 @@ partial void ProcessShowModelInfoResponseContent( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/show", global::System.UriKind.RelativeOrAbsolute)); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ModelInfoRequest); var __httpRequestContent = new global::System.Net.Http.StringContent( - content: global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ModelInfoRequest), + content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); httpRequest.Content = __httpRequestContent;