diff --git a/src/libs/Ollama/Generated/AnyOf.2.Json.g.cs b/src/libs/Ollama/Generated/AnyOf.2.Json.g.cs new file mode 100644 index 0000000..57a6d83 --- /dev/null +++ b/src/libs/Ollama/Generated/AnyOf.2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public readonly partial struct AnyOf + { + /// + /// 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::Ollama.AnyOf? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.AnyOf), + jsonSerializerContext) as global::Ollama.AnyOf?; + } + + /// + /// 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::Ollama.AnyOf? 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::Ollama.AnyOf), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.AnyOf?; + } + + /// + /// 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/Ollama/Generated/AnyOf.2.g.cs b/src/libs/Ollama/Generated/AnyOf.2.g.cs index 13ee52b..97f6963 100644 --- a/src/libs/Ollama/Generated/AnyOf.2.g.cs +++ b/src/libs/Ollama/Generated/AnyOf.2.g.cs @@ -1,4 +1,3 @@ -using System.Linq; #nullable enable @@ -172,7 +171,8 @@ public override int GetHashCode() static int HashCodeAggregator(int hashCode, object? value) => value == null ? (hashCode ^ 0) * prime : (hashCode ^ value.GetHashCode()) * prime; - return fields.Aggregate(offset, HashCodeAggregator); + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); } /// @@ -209,92 +209,5 @@ public override bool Equals(object? obj) { return obj is AnyOf o && Equals(o); } - - - /// - /// 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::Ollama.AnyOf? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.AnyOf), - jsonSerializerContext) as global::Ollama.AnyOf?; - } - - /// - /// 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::Ollama.AnyOf? 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?> FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.AnyOf), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.AnyOf?; - } - - /// - /// 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?> FromJsonStream( - 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/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs index 914f6ee..b5f308d 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs @@ -22,7 +22,7 @@ partial void ProcessGenerateChatCompletionResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Collections.Generic.IAsyncEnumerable GenerateChatCompletionAsync( global::Ollama.GenerateChatCompletionRequest request, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) @@ -68,18 +68,34 @@ partial void ProcessGenerateChatCompletionResponse( ProcessGenerateChatCompletionResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - using var reader = new global::System.IO.StreamReader(stream); + using var __stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var __reader = new global::System.IO.StreamReader(__stream); - while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) + while (!__reader.EndOfStream && !cancellationToken.IsCancellationRequested) { - var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::Ollama.GenerateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ?? + var __content = await __reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; + var __streamedResponse = global::Ollama.GenerateChatCompletionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - yield return streamedResponse; + yield return __streamedResponse; } } diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs index 3e18ecf..7dbebe7 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs @@ -26,6 +26,11 @@ public sealed partial class ChatClient : global::Ollama.IChatClient, global::Sys /// public global::System.Collections.Generic.List Authorizations { get; } + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs index 0c828fe..612f0a2 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs @@ -22,7 +22,7 @@ partial void ProcessGenerateCompletionResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Collections.Generic.IAsyncEnumerable GenerateCompletionAsync( global::Ollama.GenerateCompletionRequest request, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) @@ -68,18 +68,34 @@ partial void ProcessGenerateCompletionResponse( ProcessGenerateCompletionResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - using var reader = new global::System.IO.StreamReader(stream); + using var __stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var __reader = new global::System.IO.StreamReader(__stream); - while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) + while (!__reader.EndOfStream && !cancellationToken.IsCancellationRequested) { - var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::Ollama.GenerateCompletionResponse.FromJson(__content, JsonSerializerContext) ?? + var __content = await __reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; + var __streamedResponse = global::Ollama.GenerateCompletionResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - yield return streamedResponse; + yield return __streamedResponse; } } diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs index 6dda616..de2f038 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs @@ -26,6 +26,11 @@ public sealed partial class CompletionsClient : global::Ollama.ICompletionsClien /// public global::System.Collections.Generic.List Authorizations { get; } + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs index 6a351fd..b6e1f7d 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs @@ -26,7 +26,7 @@ partial void ProcessGenerateEmbeddingResponseContent( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task GenerateEmbeddingAsync( global::Ollama.GenerateEmbeddingRequest request, global::System.Threading.CancellationToken cancellationToken = default) @@ -73,29 +73,70 @@ partial void ProcessGenerateEmbeddingResponseContent( httpClient: HttpClient, httpResponseMessage: __response); - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGenerateEmbeddingResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGenerateEmbeddingResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); - try - { - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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::Ollama.GenerateEmbeddingResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + else { - throw new global::System.InvalidOperationException(__content, __ex); - } + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - return - global::Ollama.GenerateEmbeddingResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + var __responseValue = await global::Ollama.GenerateEmbeddingResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false); + + return + __responseValue ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } } /// diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs index 5de4574..795c81a 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs @@ -26,6 +26,11 @@ public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient, /// public global::System.Collections.Generic.List Authorizations { get; } + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.Exceptions.g.cs b/src/libs/Ollama/Generated/Ollama.Exceptions.g.cs new file mode 100644 index 0000000..e3ccaaa --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Exceptions.g.cs @@ -0,0 +1,90 @@ +#nullable enable + +namespace Ollama +{ + /// + /// Represents an exception thrown by the API. + /// + [global::System.Serializable] + public partial class ApiException : global::System.Exception + { + /// + /// The HTTP status code of the response. + /// + public global::System.Net.HttpStatusCode StatusCode { get; } + /// + /// The response body. + /// + public string? ResponseBody { get; set; } + /// + /// The response headers. + /// + public global::System.Collections.Generic.Dictionary>? ResponseHeaders { get; set; } + /// + /// Initializes a new instance of the class. + /// + public ApiException() + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// The message that describes the error. + /// The HTTP status code of the response. + public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message) + { + StatusCode = statusCode; + } + + /// + /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. + /// The HTTP status code of the response. + public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException) + { + StatusCode = statusCode; + } + } + + /// + /// Represents an exception thrown by the API. + /// + /// + [global::System.Serializable] + public partial class ApiException : ApiException + { + /// + /// The response object. + /// + public T? ResponseObject { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + /// The message that describes the error. + /// The HTTP status code of the response. + public ApiException(string message, global::System.Net.HttpStatusCode statusCode) : base(message, statusCode) + { + } + + /// + /// Initializes a new instance of the class with a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a null reference if no inner exception is specified. + /// The HTTP status code of the response. + public ApiException(string message, global::System.Exception innerException, global::System.Net.HttpStatusCode statusCode) : base(message, innerException, statusCode) + { + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs index d6d9815..9ae8069 100644 --- a/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs @@ -10,7 +10,7 @@ public partial interface IChatClient /// /// /// The token to cancel the operation with - /// + /// global::System.Collections.Generic.IAsyncEnumerable GenerateChatCompletionAsync( global::Ollama.GenerateChatCompletionRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs index a911e26..0ed7c7f 100644 --- a/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs @@ -25,6 +25,12 @@ public partial interface IChatClient : global::System.IDisposable /// public global::System.Collections.Generic.List Authorizations { get; } + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs index cf578a6..abfac30 100644 --- a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs @@ -10,7 +10,7 @@ public partial interface ICompletionsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Collections.Generic.IAsyncEnumerable GenerateCompletionAsync( global::Ollama.GenerateCompletionRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs index 1331d2d..8d73cba 100644 --- a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs @@ -25,6 +25,12 @@ public partial interface ICompletionsClient : global::System.IDisposable /// public global::System.Collections.Generic.List Authorizations { get; } + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs index 4a0254c..4e80713 100644 --- a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs @@ -9,7 +9,7 @@ public partial interface IEmbeddingsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task GenerateEmbeddingAsync( global::Ollama.GenerateEmbeddingRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs index bad6d5e..40050d9 100644 --- a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs @@ -25,6 +25,12 @@ public partial interface IEmbeddingsClient : global::System.IDisposable /// public global::System.Collections.Generic.List Authorizations { get; } + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs index f6dbc5c..7e8aa7d 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs @@ -10,7 +10,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task CheckBlobAsync( string digest, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs index d587f90..e64ff14 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs @@ -9,7 +9,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task CopyModelAsync( global::Ollama.CopyModelRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs index 4c63455..4dfebea 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs @@ -10,7 +10,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task CreateBlobAsync( string digest, byte[] request, diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs index 3459c3a..9e7d83d 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs @@ -10,7 +10,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( global::Ollama.CreateModelRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs index dd05c93..ca0afc3 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs @@ -9,7 +9,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task DeleteModelAsync( global::Ollama.DeleteModelRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs index ecb5adb..460b6b9 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs @@ -8,7 +8,7 @@ public partial interface IModelsClient /// List models that are available locally. /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task ListModelsAsync( global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs index 9f62a6f..6e1a621 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs @@ -8,7 +8,7 @@ public partial interface IModelsClient /// List models that are running. /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task ListRunningModelsAsync( global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs index 16883a3..5d4bf9e 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs @@ -10,7 +10,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Collections.Generic.IAsyncEnumerable PullModelAsync( global::Ollama.PullModelRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs index 8d45ff2..8feb7ab 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs @@ -10,7 +10,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Collections.Generic.IAsyncEnumerable PushModelAsync( global::Ollama.PushModelRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs index 1f900c0..243e728 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs @@ -9,7 +9,7 @@ public partial interface IModelsClient /// /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task ShowModelInfoAsync( global::Ollama.ModelInfoRequest request, global::System.Threading.CancellationToken cancellationToken = default); diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs index c1881b3..96dfe4b 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs @@ -25,6 +25,12 @@ public partial interface IModelsClient : global::System.IDisposable /// public global::System.Collections.Generic.List Authorizations { get; } + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs index 0f66736..5aec855 100644 --- a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs @@ -9,7 +9,7 @@ public partial interface IOllamaApiClient /// This endpoint returns the version of the Ollama server. /// /// The token to cancel the operation with - /// + /// global::System.Threading.Tasks.Task GetVersionAsync( global::System.Threading.CancellationToken cancellationToken = default); } diff --git a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs index fd7d0ae..095848a 100644 --- a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs @@ -25,6 +25,12 @@ public partial interface IOllamaApiClient : global::System.IDisposable /// public global::System.Collections.Generic.List Authorizations { get; } + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// + public bool ReadResponseAsString { get; set; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.Json.g.cs new file mode 100644 index 0000000..a19c4c2 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CopyModelRequest + { + /// + /// 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::Ollama.CopyModelRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CopyModelRequest), + jsonSerializerContext) as global::Ollama.CopyModelRequest; + } + + /// + /// 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::Ollama.CopyModelRequest? 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::Ollama.CopyModelRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CopyModelRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.CopyModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.g.cs index 1e826c4..b9fa487 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CopyModelRequest.g.cs @@ -12,6 +12,7 @@ public sealed partial class CopyModelRequest /// Name of the model to copy.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("source")] [global::System.Text.Json.Serialization.JsonRequired] public required string Source { get; set; } @@ -20,6 +21,7 @@ public sealed partial class CopyModelRequest /// Name of the new model.
/// Example: llama3-backup /// + /// llama3-backup [global::System.Text.Json.Serialization.JsonPropertyName("destination")] [global::System.Text.Json.Serialization.JsonRequired] public required string Destination { get; set; } @@ -30,91 +32,31 @@ public sealed partial class CopyModelRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.CopyModelRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.CopyModelRequest), - jsonSerializerContext) as global::Ollama.CopyModelRequest; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.CopyModelRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// Name of the model to copy.
+ /// Example: llama3.2 + /// + /// + /// Name of the new model.
+ /// Example: llama3-backup + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CopyModelRequest( + string source, + string destination) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.CopyModelRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CopyModelRequest; + this.Source = source ?? throw new global::System.ArgumentNullException(nameof(source)); + this.Destination = destination ?? throw new global::System.ArgumentNullException(nameof(destination)); } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public CopyModelRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.Json.g.cs new file mode 100644 index 0000000..932f734 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CreateModelRequest + { + /// + /// 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::Ollama.CreateModelRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelRequest), + jsonSerializerContext) as global::Ollama.CreateModelRequest; + } + + /// + /// 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::Ollama.CreateModelRequest? 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::Ollama.CreateModelRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs index adab7f0..55a6749 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class CreateModelRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: mario /// + /// mario [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -21,6 +22,7 @@ public sealed partial class CreateModelRequest /// The contents of the Modelfile.
/// Example: FROM llama3\nSYSTEM You are mario from Super Mario Bros. /// + /// FROM llama3\nSYSTEM You are mario from Super Mario Bros. [global::System.Text.Json.Serialization.JsonPropertyName("modelfile")] [global::System.Text.Json.Serialization.JsonRequired] public required string Modelfile { get; set; } @@ -50,91 +52,48 @@ public sealed partial class CreateModelRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.CreateModelRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.CreateModelRequest), - jsonSerializerContext) as global::Ollama.CreateModelRequest; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.CreateModelRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: mario + /// + /// + /// The contents of the Modelfile.
+ /// Example: FROM llama3\nSYSTEM You are mario from Super Mario Bros. + /// + /// + /// Path to the Modelfile (optional) + /// + /// + /// The quantization level of the model. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateModelRequest( + string model, + string modelfile, + string? path, + string? quantize, + bool? stream) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.CreateModelRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Modelfile = modelfile ?? throw new global::System.ArgumentNullException(nameof(modelfile)); + this.Path = path; + this.Quantize = quantize; + this.Stream = stream; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public CreateModelRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.Json.g.cs new file mode 100644 index 0000000..876a110 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CreateModelResponse + { + /// + /// 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::Ollama.CreateModelResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelResponse), + jsonSerializerContext) as global::Ollama.CreateModelResponse; + } + + /// + /// 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::Ollama.CreateModelResponse? 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::Ollama.CreateModelResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs index 5d6d36e..a2db600 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs @@ -21,91 +21,24 @@ public sealed partial class CreateModelResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.CreateModelResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.CreateModelResponse), - jsonSerializerContext) as global::Ollama.CreateModelResponse; - } - - /// - /// 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::Ollama.CreateModelResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// Status creating the model + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public CreateModelResponse( + global::Ollama.CreateModelStatus? status) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.CreateModelResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelResponse; + this.Status = status; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public CreateModelResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.Json.g.cs new file mode 100644 index 0000000..3f68f30 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public readonly partial struct CreateModelStatus + { + /// + /// 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::Ollama.CreateModelStatus? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelStatus), + jsonSerializerContext) as global::Ollama.CreateModelStatus?; + } + + /// + /// 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::Ollama.CreateModelStatus? 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::Ollama.CreateModelStatus), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelStatus?; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.CreateModelStatus.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.g.cs index d4fcf5f..4d78f55 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelStatus.g.cs @@ -1,4 +1,3 @@ -using System.Linq; #pragma warning disable CS0618 // Type or member is obsolete #nullable enable @@ -173,7 +172,8 @@ public override int GetHashCode() static int HashCodeAggregator(int hashCode, object? value) => value == null ? (hashCode ^ 0) * prime : (hashCode ^ value.GetHashCode()) * prime; - return fields.Aggregate(offset, HashCodeAggregator); + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); } /// @@ -210,92 +210,5 @@ public override bool Equals(object? obj) { return obj is CreateModelStatus o && Equals(o); } - - - /// - /// 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::Ollama.CreateModelStatus? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.CreateModelStatus), - jsonSerializerContext) as global::Ollama.CreateModelStatus?; - } - - /// - /// 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::Ollama.CreateModelStatus? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.CreateModelStatus), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelStatus?; - } - - /// - /// 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 FromJsonStream( - 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/Ollama/Generated/Ollama.Models.DeleteModelRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.DeleteModelRequest.Json.g.cs new file mode 100644 index 0000000..2c46d82 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.DeleteModelRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class DeleteModelRequest + { + /// + /// 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::Ollama.DeleteModelRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.DeleteModelRequest), + jsonSerializerContext) as global::Ollama.DeleteModelRequest; + } + + /// + /// 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::Ollama.DeleteModelRequest? 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::Ollama.DeleteModelRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.DeleteModelRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.DeleteModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.DeleteModelRequest.g.cs index 6409ee9..61db7d8 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.DeleteModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.DeleteModelRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class DeleteModelRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3:13b ///
+ /// llama3:13b [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -23,91 +24,26 @@ public sealed partial class DeleteModelRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// Initializes a new instance of the class. /// - 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::Ollama.DeleteModelRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.DeleteModelRequest), - jsonSerializerContext) as global::Ollama.DeleteModelRequest; - } - - /// - /// 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::Ollama.DeleteModelRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3:13b + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public DeleteModelRequest( + string model) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.DeleteModelRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.DeleteModelRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public DeleteModelRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.DoneReason.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.DoneReason.Json.g.cs new file mode 100644 index 0000000..44c24d9 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.DoneReason.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public readonly partial struct DoneReason + { + /// + /// 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::Ollama.DoneReason? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.DoneReason), + jsonSerializerContext) as global::Ollama.DoneReason?; + } + + /// + /// 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::Ollama.DoneReason? 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::Ollama.DoneReason), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.DoneReason?; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.DoneReason.g.cs b/src/libs/Ollama/Generated/Ollama.Models.DoneReason.g.cs index 0be0685..7d489d1 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.DoneReason.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.DoneReason.g.cs @@ -1,4 +1,3 @@ -using System.Linq; #pragma warning disable CS0618 // Type or member is obsolete #nullable enable @@ -173,7 +172,8 @@ public override int GetHashCode() static int HashCodeAggregator(int hashCode, object? value) => value == null ? (hashCode ^ 0) * prime : (hashCode ^ value.GetHashCode()) * prime; - return fields.Aggregate(offset, HashCodeAggregator); + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); } /// @@ -210,92 +210,5 @@ public override bool Equals(object? obj) { return obj is DoneReason o && Equals(o); } - - - /// - /// 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::Ollama.DoneReason? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.DoneReason), - jsonSerializerContext) as global::Ollama.DoneReason?; - } - - /// - /// 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::Ollama.DoneReason? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.DoneReason), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.DoneReason?; - } - - /// - /// 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 FromJsonStream( - 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/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.Json.g.cs new file mode 100644 index 0000000..b477fe1 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateChatCompletionRequest + { + /// + /// 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::Ollama.GenerateChatCompletionRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateChatCompletionRequest), + jsonSerializerContext) as global::Ollama.GenerateChatCompletionRequest; + } + + /// + /// 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::Ollama.GenerateChatCompletionRequest? 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::Ollama.GenerateChatCompletionRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateChatCompletionRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs index 88df658..acb487b 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class GenerateChatCompletionRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 ///
+ /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -68,91 +69,63 @@ public sealed partial class GenerateChatCompletionRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.GenerateChatCompletionRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateChatCompletionRequest), - jsonSerializerContext) as global::Ollama.GenerateChatCompletionRequest; - } - - /// - /// 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::Ollama.GenerateChatCompletionRequest? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// The messages of the chat, this can be used to keep a chat memory + /// + /// + /// The format to return a response in. Currently the only accepted value is json.
+ /// Enable JSON mode by setting the format parameter to json. This will structure the response as valid JSON.
+ /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + /// + /// A list of tools the model may call. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateChatCompletionRequest( + string model, + global::System.Collections.Generic.IList messages, + global::Ollama.ResponseFormat? format, + global::Ollama.RequestOptions? options, + bool? stream, + int? keepAlive, + global::System.Collections.Generic.IList? tools) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateChatCompletionRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateChatCompletionRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); + this.Format = format; + this.Options = options; + this.Stream = stream; + this.KeepAlive = keepAlive; + this.Tools = tools; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateChatCompletionRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.Json.g.cs new file mode 100644 index 0000000..1819b90 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateChatCompletionResponse + { + /// + /// 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::Ollama.GenerateChatCompletionResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateChatCompletionResponse), + jsonSerializerContext) as global::Ollama.GenerateChatCompletionResponse; + } + + /// + /// 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::Ollama.GenerateChatCompletionResponse? 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::Ollama.GenerateChatCompletionResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateChatCompletionResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs index 11803e9..eff0b0c 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs @@ -20,6 +20,7 @@ public sealed partial class GenerateChatCompletionResponse /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -35,6 +36,7 @@ public sealed partial class GenerateChatCompletionResponse /// Whether the response has completed.
/// Example: true /// + /// true [global::System.Text.Json.Serialization.JsonPropertyName("done")] [global::System.Text.Json.Serialization.JsonRequired] public required bool Done { get; set; } @@ -50,6 +52,7 @@ public sealed partial class GenerateChatCompletionResponse /// Time spent generating the response.
/// Example: 5589157167L /// + /// 5589157167L [global::System.Text.Json.Serialization.JsonPropertyName("total_duration")] public long? TotalDuration { get; set; } @@ -57,6 +60,7 @@ public sealed partial class GenerateChatCompletionResponse /// Time spent in nanoseconds loading the model.
/// Example: 3013701500L /// + /// 3013701500L [global::System.Text.Json.Serialization.JsonPropertyName("load_duration")] public long? LoadDuration { get; set; } @@ -64,6 +68,7 @@ public sealed partial class GenerateChatCompletionResponse /// Number of tokens in the prompt.
/// Example: 46 /// + /// 46 [global::System.Text.Json.Serialization.JsonPropertyName("prompt_eval_count")] public int? PromptEvalCount { get; set; } @@ -71,6 +76,7 @@ public sealed partial class GenerateChatCompletionResponse /// Time spent in nanoseconds evaluating the prompt.
/// Example: 1160282000L /// + /// 1160282000L [global::System.Text.Json.Serialization.JsonPropertyName("prompt_eval_duration")] public long? PromptEvalDuration { get; set; } @@ -78,6 +84,7 @@ public sealed partial class GenerateChatCompletionResponse /// Number of tokens the response.
/// Example: 113 /// + /// 113 [global::System.Text.Json.Serialization.JsonPropertyName("eval_count")] public int? EvalCount { get; set; } @@ -85,6 +92,7 @@ public sealed partial class GenerateChatCompletionResponse /// Time in nanoseconds spent generating the response.
/// Example: 1325948000L /// + /// 1325948000L [global::System.Text.Json.Serialization.JsonPropertyName("eval_duration")] public long? EvalDuration { get; set; } @@ -94,91 +102,83 @@ public sealed partial class GenerateChatCompletionResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.GenerateChatCompletionResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateChatCompletionResponse), - jsonSerializerContext) as global::Ollama.GenerateChatCompletionResponse; - } - - /// - /// 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::Ollama.GenerateChatCompletionResponse? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// A message in the chat endpoint + /// + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Date on which a model was created. + /// + /// + /// Whether the response has completed.
+ /// Example: true + /// + /// + /// Reason why the model is done generating a response. + /// + /// + /// Time spent generating the response.
+ /// Example: 5589157167L + /// + /// + /// Time spent in nanoseconds loading the model.
+ /// Example: 3013701500L + /// + /// + /// Number of tokens in the prompt.
+ /// Example: 46 + /// + /// + /// Time spent in nanoseconds evaluating the prompt.
+ /// Example: 1160282000L + /// + /// + /// Number of tokens the response.
+ /// Example: 113 + /// + /// + /// Time in nanoseconds spent generating the response.
+ /// Example: 1325948000L + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateChatCompletionResponse( + global::Ollama.Message message, + string model, + global::System.DateTime createdAt, + bool done, + global::Ollama.DoneReason? doneReason, + long? totalDuration, + long? loadDuration, + int? promptEvalCount, + long? promptEvalDuration, + int? evalCount, + long? evalDuration) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateChatCompletionResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateChatCompletionResponse; + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.CreatedAt = createdAt; + this.Done = done; + this.DoneReason = doneReason; + this.TotalDuration = totalDuration; + this.LoadDuration = loadDuration; + this.PromptEvalCount = promptEvalCount; + this.PromptEvalDuration = promptEvalDuration; + this.EvalCount = evalCount; + this.EvalDuration = evalDuration; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateChatCompletionResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.Json.g.cs new file mode 100644 index 0000000..f37df0e --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateCompletionRequest + { + /// + /// 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::Ollama.GenerateCompletionRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateCompletionRequest), + jsonSerializerContext) as global::Ollama.GenerateCompletionRequest; + } + + /// + /// 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::Ollama.GenerateCompletionRequest? 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::Ollama.GenerateCompletionRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateCompletionRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs index 46f52f1..4448807 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class GenerateCompletionRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -21,6 +22,7 @@ public sealed partial class GenerateCompletionRequest /// The prompt to generate a response.
/// Example: Why is the sky blue? /// + /// Why is the sky blue? [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] [global::System.Text.Json.Serialization.JsonRequired] public required string Prompt { get; set; } @@ -100,91 +102,90 @@ public sealed partial class GenerateCompletionRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.GenerateCompletionRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateCompletionRequest), - jsonSerializerContext) as global::Ollama.GenerateCompletionRequest; - } - - /// - /// 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::Ollama.GenerateCompletionRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// The prompt to generate a response.
+ /// Example: Why is the sky blue? + /// + /// + /// The text that comes after the inserted text. + /// + /// + /// (optional) a list of Base64-encoded images to include in the message (for multimodal models such as llava) + /// + /// + /// The system prompt to (overrides what is defined in the Modelfile). + /// + /// + /// The full prompt or prompt template (overrides what is defined in the Modelfile). + /// + /// + /// The context parameter returned from a previous request to [generateCompletion], this can be used to keep a short conversational memory. + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// The format to return a response in. Currently the only accepted value is json.
+ /// Enable JSON mode by setting the format parameter to json. This will structure the response as valid JSON.
+ /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. + /// + /// + /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// You may choose to use the `raw` parameter if you are specifying a full templated prompt in your request to the API, and are managing history yourself. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateCompletionRequest( + string model, + string prompt, + string? suffix, + global::System.Collections.Generic.IList? images, + string? system, + string? template, + global::System.Collections.Generic.IList? context, + global::Ollama.RequestOptions? options, + global::Ollama.ResponseFormat? format, + bool? raw, + bool? stream, + int? keepAlive) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateCompletionRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateCompletionRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Suffix = suffix; + this.Images = images; + this.System = system; + this.Template = template; + this.Context = context; + this.Options = options; + this.Format = format; + this.Raw = raw; + this.Stream = stream; + this.KeepAlive = keepAlive; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateCompletionRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.Json.g.cs new file mode 100644 index 0000000..603187b --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateCompletionResponse + { + /// + /// 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::Ollama.GenerateCompletionResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateCompletionResponse), + jsonSerializerContext) as global::Ollama.GenerateCompletionResponse; + } + + /// + /// 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::Ollama.GenerateCompletionResponse? 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::Ollama.GenerateCompletionResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateCompletionResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs index c628978..5b54589 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs @@ -13,6 +13,7 @@ public sealed partial class GenerateCompletionResponse /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] public string? Model { get; set; } @@ -26,6 +27,7 @@ public sealed partial class GenerateCompletionResponse /// The response for a given prompt with a provided model.
/// Example: The sky appears blue because of a phenomenon called Rayleigh scattering. /// + /// The sky appears blue because of a phenomenon called Rayleigh scattering. [global::System.Text.Json.Serialization.JsonPropertyName("response")] public string? Response { get; set; } @@ -33,6 +35,7 @@ public sealed partial class GenerateCompletionResponse /// Whether the response has completed.
/// Example: true /// + /// true [global::System.Text.Json.Serialization.JsonPropertyName("done")] public bool? Done { get; set; } @@ -40,6 +43,7 @@ public sealed partial class GenerateCompletionResponse /// An encoding of the conversation used in this response, this can be sent in the next request to keep a conversational memory.
/// Example: [1L, 2L, 3L] /// + /// [1L, 2L, 3L] [global::System.Text.Json.Serialization.JsonPropertyName("context")] public global::System.Collections.Generic.IList? Context { get; set; } @@ -47,6 +51,7 @@ public sealed partial class GenerateCompletionResponse /// Time spent generating the response.
/// Example: 5589157167L /// + /// 5589157167L [global::System.Text.Json.Serialization.JsonPropertyName("total_duration")] public long? TotalDuration { get; set; } @@ -54,6 +59,7 @@ public sealed partial class GenerateCompletionResponse /// Time spent in nanoseconds loading the model.
/// Example: 3013701500L /// + /// 3013701500L [global::System.Text.Json.Serialization.JsonPropertyName("load_duration")] public long? LoadDuration { get; set; } @@ -61,6 +67,7 @@ public sealed partial class GenerateCompletionResponse /// Number of tokens in the prompt.
/// Example: 46 /// + /// 46 [global::System.Text.Json.Serialization.JsonPropertyName("prompt_eval_count")] public int? PromptEvalCount { get; set; } @@ -68,6 +75,7 @@ public sealed partial class GenerateCompletionResponse /// Time spent in nanoseconds evaluating the prompt.
/// Example: 1160282000L /// + /// 1160282000L [global::System.Text.Json.Serialization.JsonPropertyName("prompt_eval_duration")] public long? PromptEvalDuration { get; set; } @@ -75,6 +83,7 @@ public sealed partial class GenerateCompletionResponse /// Number of tokens the response.
/// Example: 113 /// + /// 113 [global::System.Text.Json.Serialization.JsonPropertyName("eval_count")] public int? EvalCount { get; set; } @@ -82,6 +91,7 @@ public sealed partial class GenerateCompletionResponse /// Time in nanoseconds spent generating the response.
/// Example: 1325948000L /// + /// 1325948000L [global::System.Text.Json.Serialization.JsonPropertyName("eval_duration")] public long? EvalDuration { get; set; } @@ -91,91 +101,85 @@ public sealed partial class GenerateCompletionResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// - public static global::Ollama.GenerateCompletionResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateCompletionResponse), - jsonSerializerContext) as global::Ollama.GenerateCompletionResponse; - } - - /// - /// 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::Ollama.GenerateCompletionResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Date on which a model was created. + /// + /// + /// The response for a given prompt with a provided model.
+ /// Example: The sky appears blue because of a phenomenon called Rayleigh scattering. + /// + /// + /// Whether the response has completed.
+ /// Example: true + /// + /// + /// An encoding of the conversation used in this response, this can be sent in the next request to keep a conversational memory.
+ /// Example: [1L, 2L, 3L] + /// + /// + /// Time spent generating the response.
+ /// Example: 5589157167L + /// + /// + /// Time spent in nanoseconds loading the model.
+ /// Example: 3013701500L + /// + /// + /// Number of tokens in the prompt.
+ /// Example: 46 + /// + /// + /// Time spent in nanoseconds evaluating the prompt.
+ /// Example: 1160282000L + /// + /// + /// Number of tokens the response.
+ /// Example: 113 + /// + /// + /// Time in nanoseconds spent generating the response.
+ /// Example: 1325948000L + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateCompletionResponse( + string? model, + global::System.DateTime? createdAt, + string? response, + bool? done, + global::System.Collections.Generic.IList? context, + long? totalDuration, + long? loadDuration, + int? promptEvalCount, + long? promptEvalDuration, + int? evalCount, + long? evalDuration) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateCompletionResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateCompletionResponse; + this.Model = model; + this.CreatedAt = createdAt; + this.Response = response; + this.Done = done; + this.Context = context; + this.TotalDuration = totalDuration; + this.LoadDuration = loadDuration; + this.PromptEvalCount = promptEvalCount; + this.PromptEvalDuration = promptEvalDuration; + this.EvalCount = evalCount; + this.EvalDuration = evalDuration; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateCompletionResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.Json.g.cs new file mode 100644 index 0000000..5298272 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateEmbeddingRequest + { + /// + /// 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::Ollama.GenerateEmbeddingRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateEmbeddingRequest), + jsonSerializerContext) as global::Ollama.GenerateEmbeddingRequest; + } + + /// + /// 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::Ollama.GenerateEmbeddingRequest? 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::Ollama.GenerateEmbeddingRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateEmbeddingRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.g.cs index e0aa407..d9b8686 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class GenerateEmbeddingRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -21,6 +22,7 @@ public sealed partial class GenerateEmbeddingRequest /// Text to generate embeddings for.
/// Example: Here is an article about llamas... /// + /// Here is an article about llamas... [global::System.Text.Json.Serialization.JsonPropertyName("prompt")] [global::System.Text.Json.Serialization.JsonRequired] public required string Prompt { get; set; } @@ -47,91 +49,46 @@ public sealed partial class GenerateEmbeddingRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// Initializes a new instance of the class. /// - 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::Ollama.GenerateEmbeddingRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateEmbeddingRequest), - jsonSerializerContext) as global::Ollama.GenerateEmbeddingRequest; - } - - /// - /// 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::Ollama.GenerateEmbeddingRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Text to generate embeddings for.
+ /// Example: Here is an article about llamas... + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateEmbeddingRequest( + string model, + string prompt, + global::Ollama.RequestOptions? options, + int? keepAlive) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateEmbeddingRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateEmbeddingRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); + this.Options = options; + this.KeepAlive = keepAlive; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateEmbeddingRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.Json.g.cs new file mode 100644 index 0000000..51c3143 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateEmbeddingResponse + { + /// + /// 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::Ollama.GenerateEmbeddingResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateEmbeddingResponse), + jsonSerializerContext) as global::Ollama.GenerateEmbeddingResponse; + } + + /// + /// 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::Ollama.GenerateEmbeddingResponse? 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::Ollama.GenerateEmbeddingResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateEmbeddingResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.g.cs index b825e13..4544b32 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateEmbeddingResponse.g.cs @@ -12,6 +12,7 @@ public sealed partial class GenerateEmbeddingResponse /// The embedding for the prompt.
/// Example: [0.5670403838157654, 0.009260174818336964, ...] /// + /// [0.5670403838157654, 0.009260174818336964, ...] [global::System.Text.Json.Serialization.JsonPropertyName("embedding")] public global::System.Collections.Generic.IList? Embedding { get; set; } @@ -21,91 +22,25 @@ public sealed partial class GenerateEmbeddingResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.GenerateEmbeddingResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.GenerateEmbeddingResponse), - jsonSerializerContext) as global::Ollama.GenerateEmbeddingResponse; - } - - /// - /// 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::Ollama.GenerateEmbeddingResponse? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The embedding for the prompt.
+ /// Example: [0.5670403838157654, 0.009260174818336964, ...] + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public GenerateEmbeddingResponse( + global::System.Collections.Generic.IList? embedding) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.GenerateEmbeddingResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateEmbeddingResponse; + this.Embedding = embedding; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public GenerateEmbeddingResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.Message.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Message.Json.g.cs new file mode 100644 index 0000000..ad5d07b --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.Message.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class Message + { + /// + /// 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::Ollama.Message? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.Message), + jsonSerializerContext) as global::Ollama.Message; + } + + /// + /// 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::Ollama.Message? 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::Ollama.Message), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Message; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.Message.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs index 7d43ac4..5cb3bf9 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs @@ -20,6 +20,7 @@ public sealed partial class Message /// The content of the message
/// Example: Why is the sky blue? /// + /// Why is the sky blue? [global::System.Text.Json.Serialization.JsonPropertyName("content")] [global::System.Text.Json.Serialization.JsonRequired] public required string Content { get; set; } @@ -42,91 +43,40 @@ public sealed partial class Message [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// - public static global::Ollama.Message? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.Message), - jsonSerializerContext) as global::Ollama.Message; - } - - /// - /// 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::Ollama.Message? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The role of the message + /// + /// + /// The content of the message
+ /// Example: Why is the sky blue? + /// + /// + /// (optional) a list of Base64-encoded images to include in the message (for multimodal models such as llava) + /// + /// + /// A list of tools the model wants to call. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Message( + global::Ollama.MessageRole role, + string content, + global::System.Collections.Generic.IList? images, + global::System.Collections.Generic.IList? toolCalls) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.Message), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Message; + this.Role = role; + this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); + this.Images = images; + this.ToolCalls = toolCalls; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public Message() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.Model.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Model.Json.g.cs new file mode 100644 index 0000000..39cbf15 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.Model.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class Model + { + /// + /// 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::Ollama.Model? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.Model), + jsonSerializerContext) as global::Ollama.Model; + } + + /// + /// 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::Ollama.Model? 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::Ollama.Model), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Model; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.Model.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs index 80c934a..5561bae 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs @@ -13,6 +13,7 @@ public sealed partial class Model /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] public string? Model1 { get; set; } @@ -26,6 +27,7 @@ public sealed partial class Model /// Size of the model on disk.
/// Example: 7323310500L /// + /// 7323310500L [global::System.Text.Json.Serialization.JsonPropertyName("size")] public long? Size { get; set; } @@ -33,6 +35,7 @@ public sealed partial class Model /// The model's digest.
/// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a /// + /// sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a [global::System.Text.Json.Serialization.JsonPropertyName("digest")] public string? Digest { get; set; } @@ -48,91 +51,48 @@ public sealed partial class Model [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.Model? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.Model), - jsonSerializerContext) as global::Ollama.Model; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.Model? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Model modification date. + /// + /// + /// Size of the model on disk.
+ /// Example: 7323310500L + /// + /// + /// The model's digest.
+ /// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a + /// + /// + /// Details about a model. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Model( + string? model1, + global::System.DateTime? modifiedAt, + long? size, + string? digest, + global::Ollama.ModelDetails? details) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.Model), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Model; + this.Model1 = model1; + this.ModifiedAt = modifiedAt; + this.Size = size; + this.Digest = digest; + this.Details = details; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public Model() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.Json.g.cs new file mode 100644 index 0000000..b051d58 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ModelDetails + { + /// + /// 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::Ollama.ModelDetails? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ModelDetails), + jsonSerializerContext) as global::Ollama.ModelDetails; + } + + /// + /// 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::Ollama.ModelDetails? 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::Ollama.ModelDetails), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelDetails; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ModelDetails.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.g.cs index 73faf64..6384b53 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelDetails.g.cs @@ -50,91 +50,49 @@ public sealed partial class ModelDetails [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.ModelDetails? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ModelDetails), - jsonSerializerContext) as global::Ollama.ModelDetails; - } - - /// - /// 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::Ollama.ModelDetails? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The parent model of the model. + /// + /// + /// The format of the model. + /// + /// + /// The family of the model. + /// + /// + /// The families of the model. + /// + /// + /// The size of the model's parameters. + /// + /// + /// The quantization level of the model. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelDetails( + string? parentModel, + string? format, + string? family, + global::System.Collections.Generic.IList? families, + string? parameterSize, + string? quantizationLevel) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ModelDetails), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelDetails; + this.ParentModel = parentModel; + this.Format = format; + this.Family = family; + this.Families = families; + this.ParameterSize = parameterSize; + this.QuantizationLevel = quantizationLevel; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ModelDetails() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.Json.g.cs new file mode 100644 index 0000000..dd7c6e1 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ModelInfo + { + /// + /// 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::Ollama.ModelInfo? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ModelInfo), + jsonSerializerContext) as global::Ollama.ModelInfo; + } + + /// + /// 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::Ollama.ModelInfo? 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::Ollama.ModelInfo), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInfo; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs index 89cfd0d..d7ebf8d 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs @@ -12,6 +12,7 @@ public sealed partial class ModelInfo /// The model's license.
/// Example: <contents of license block> /// + /// <contents of license block> [global::System.Text.Json.Serialization.JsonPropertyName("license")] public string? License { get; set; } @@ -19,6 +20,7 @@ public sealed partial class ModelInfo /// The modelfile associated with the model.
/// Example: Modelfile generated by \"ollama show\"\n# To build a new Modelfile based on this one, replace the FROM line with:\n# FROM llama3:latest\n\nFROM /Users/username/.ollama/models/blobs/sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8\nTEMPLATE \"\"\"[INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] \"\"\"\nSYSTEM \"\"\"\"\"\"\nPARAMETER stop [INST]\nPARAMETER stop [/INST]\nPARAMETER stop <<SYS>>\nPARAMETER stop <</SYS>>\n" /// + /// Modelfile generated by \"ollama show\"\n# To build a new Modelfile based on this one, replace the FROM line with:\n# FROM llama3:latest\n\nFROM /Users/username/.ollama/models/blobs/sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8\nTEMPLATE \"\"\"[INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] \"\"\"\nSYSTEM \"\"\"\"\"\"\nPARAMETER stop [INST]\nPARAMETER stop [/INST]\nPARAMETER stop <<SYS>>\nPARAMETER stop <</SYS>>\n" [global::System.Text.Json.Serialization.JsonPropertyName("modelfile")] public string? Modelfile { get; set; } @@ -26,6 +28,7 @@ public sealed partial class ModelInfo /// The model parameters.
/// Example: stop [INST]\nstop [/INST]\nstop <<SYS>>\nstop <</SYS>> /// + /// stop [INST]\nstop [/INST]\nstop <<SYS>>\nstop <</SYS>> [global::System.Text.Json.Serialization.JsonPropertyName("parameters")] public string? Parameters { get; set; } @@ -33,6 +36,7 @@ public sealed partial class ModelInfo /// The prompt template for the model.
/// Example: [INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] /// + /// [INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] [global::System.Text.Json.Serialization.JsonPropertyName("template")] public string? Template { get; set; } @@ -66,91 +70,63 @@ public sealed partial class ModelInfo [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.ModelInfo? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ModelInfo), - jsonSerializerContext) as global::Ollama.ModelInfo; - } - - /// - /// 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::Ollama.ModelInfo? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model's license.
+ /// Example: <contents of license block> + /// + /// + /// The modelfile associated with the model.
+ /// Example: Modelfile generated by \"ollama show\"\n# To build a new Modelfile based on this one, replace the FROM line with:\n# FROM llama3:latest\n\nFROM /Users/username/.ollama/models/blobs/sha256:8daa9615cce30c259a9555b1cc250d461d1bc69980a274b44d7eda0be78076d8\nTEMPLATE \"\"\"[INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] \"\"\"\nSYSTEM \"\"\"\"\"\"\nPARAMETER stop [INST]\nPARAMETER stop [/INST]\nPARAMETER stop <<SYS>>\nPARAMETER stop <</SYS>>\n" + /// + /// + /// The model parameters.
+ /// Example: stop [INST]\nstop [/INST]\nstop <<SYS>>\nstop <</SYS>> + /// + /// + /// The prompt template for the model.
+ /// Example: [INST] {{ if and .First .System }}<<SYS>>{{ .System }}<</SYS>>\n\n{{ end }}{{ .Prompt }} [/INST] + /// + /// + /// The system prompt for the model. + /// + /// + /// Details about a model. + /// + /// + /// Details about a model. + /// + /// + /// The default messages for the model. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelInfo( + string? license, + string? modelfile, + string? parameters, + string? template, + string? system, + global::Ollama.ModelDetails? details, + global::Ollama.ModelInformation? modelInfo1, + global::System.Collections.Generic.IList? messages) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ModelInfo), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInfo; + this.License = license; + this.Modelfile = modelfile; + this.Parameters = parameters; + this.Template = template; + this.System = system; + this.Details = details; + this.ModelInfo1 = modelInfo1; + this.Messages = messages; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ModelInfo() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.Json.g.cs new file mode 100644 index 0000000..29fb568 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ModelInfoRequest + { + /// + /// 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::Ollama.ModelInfoRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ModelInfoRequest), + jsonSerializerContext) as global::Ollama.ModelInfoRequest; + } + + /// + /// 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::Ollama.ModelInfoRequest? 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::Ollama.ModelInfoRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInfoRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ModelInfoRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.g.cs index 59d04d1..94090c7 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInfoRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class ModelInfoRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -23,91 +24,26 @@ public sealed partial class ModelInfoRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// Initializes a new instance of the class. /// - 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::Ollama.ModelInfoRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ModelInfoRequest), - jsonSerializerContext) as global::Ollama.ModelInfoRequest; - } - - /// - /// 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::Ollama.ModelInfoRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelInfoRequest( + string model) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ModelInfoRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInfoRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ModelInfoRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.Json.g.cs new file mode 100644 index 0000000..1fbdce6 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ModelInformation + { + /// + /// 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::Ollama.ModelInformation? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ModelInformation), + jsonSerializerContext) as global::Ollama.ModelInformation; + } + + /// + /// 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::Ollama.ModelInformation? 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::Ollama.ModelInformation), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInformation; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ModelInformation.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.g.cs index cda6d53..a60a343 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInformation.g.cs @@ -38,91 +38,39 @@ public sealed partial class ModelInformation [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.ModelInformation? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ModelInformation), - jsonSerializerContext) as global::Ollama.ModelInformation; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.ModelInformation? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The architecture of the model. + /// + /// + /// The file type of the model. + /// + /// + /// The number of parameters in the model. + /// + /// + /// The number of parameters in the model. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelInformation( + string? generalArchitecture, + int? generalFileType, + long? generalParameterCount, + int? generalQuantizationVersion) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ModelInformation), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelInformation; + this.GeneralArchitecture = generalArchitecture; + this.GeneralFileType = generalFileType; + this.GeneralParameterCount = generalParameterCount; + this.GeneralQuantizationVersion = generalQuantizationVersion; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ModelInformation() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.Json.g.cs new file mode 100644 index 0000000..79f9ee2 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ModelsResponse + { + /// + /// 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::Ollama.ModelsResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ModelsResponse), + jsonSerializerContext) as global::Ollama.ModelsResponse; + } + + /// + /// 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::Ollama.ModelsResponse? 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::Ollama.ModelsResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelsResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ModelsResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.g.cs index d08b858..e4ddb0b 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelsResponse.g.cs @@ -20,91 +20,24 @@ public sealed partial class ModelsResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.ModelsResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ModelsResponse), - jsonSerializerContext) as global::Ollama.ModelsResponse; - } - - /// - /// 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::Ollama.ModelsResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// List of models available locally. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ModelsResponse( + global::System.Collections.Generic.IList? models) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ModelsResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ModelsResponse; + this.Models = models; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ModelsResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.Json.g.cs new file mode 100644 index 0000000..30009da --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ProcessModel + { + /// + /// 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::Ollama.ProcessModel? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ProcessModel), + jsonSerializerContext) as global::Ollama.ProcessModel; + } + + /// + /// 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::Ollama.ProcessModel? 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::Ollama.ProcessModel), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ProcessModel; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ProcessModel.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.g.cs index 9b34db1..7b70155 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ProcessModel.g.cs @@ -13,6 +13,7 @@ public sealed partial class ProcessModel /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] public string? Model { get; set; } @@ -20,6 +21,7 @@ public sealed partial class ProcessModel /// Size of the model on disk.
/// Example: 7323310500L /// + /// 7323310500L [global::System.Text.Json.Serialization.JsonPropertyName("size")] public long? Size { get; set; } @@ -27,6 +29,7 @@ public sealed partial class ProcessModel /// The model's digest.
/// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a /// + /// sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a [global::System.Text.Json.Serialization.JsonPropertyName("digest")] public string? Digest { get; set; } @@ -46,6 +49,7 @@ public sealed partial class ProcessModel /// Size of the model on disk.
/// Example: 7323310500L /// + /// 7323310500L [global::System.Text.Json.Serialization.JsonPropertyName("size_vram")] public long? SizeVram { get; set; } @@ -55,91 +59,52 @@ public sealed partial class ProcessModel [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.ProcessModel? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ProcessModel), - jsonSerializerContext) as global::Ollama.ProcessModel; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.ProcessModel? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Size of the model on disk.
+ /// Example: 7323310500L + /// + /// + /// The model's digest.
+ /// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a + /// + /// + /// Details about a model. + /// + /// + /// + /// Size of the model on disk.
+ /// Example: 7323310500L + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessModel( + string? model, + long? size, + string? digest, + global::Ollama.ModelDetails? details, + global::System.DateTime? expiresAt, + long? sizeVram) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ProcessModel), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ProcessModel; + this.Model = model; + this.Size = size; + this.Digest = digest; + this.Details = details; + this.ExpiresAt = expiresAt; + this.SizeVram = sizeVram; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ProcessModel() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.Json.g.cs new file mode 100644 index 0000000..e93121a --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ProcessResponse + { + /// + /// 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::Ollama.ProcessResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ProcessResponse), + jsonSerializerContext) as global::Ollama.ProcessResponse; + } + + /// + /// 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::Ollama.ProcessResponse? 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::Ollama.ProcessResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ProcessResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ProcessResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.g.cs index 0024c20..f21dbde 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ProcessResponse.g.cs @@ -20,91 +20,24 @@ public sealed partial class ProcessResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.ProcessResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ProcessResponse), - jsonSerializerContext) as global::Ollama.ProcessResponse; - } - - /// - /// 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::Ollama.ProcessResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// List of running models. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ProcessResponse( + global::System.Collections.Generic.IList? models) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ProcessResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ProcessResponse; + this.Models = models; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ProcessResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.Json.g.cs new file mode 100644 index 0000000..36b6850 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class PullModelRequest + { + /// + /// 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::Ollama.PullModelRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.PullModelRequest), + jsonSerializerContext) as global::Ollama.PullModelRequest; + } + + /// + /// 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::Ollama.PullModelRequest? 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::Ollama.PullModelRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.PullModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.g.cs index 909498b..a600546 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelRequest.g.cs @@ -13,6 +13,7 @@ public sealed partial class PullModelRequest /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
/// Example: llama3.2 /// + /// llama3.2 [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -50,91 +51,49 @@ public sealed partial class PullModelRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.PullModelRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.PullModelRequest), - jsonSerializerContext) as global::Ollama.PullModelRequest; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.PullModelRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.2 + /// + /// + /// Allow insecure connections to the library.
+ /// Only use this if you are pulling from your own library during development.
+ /// Default Value: false + /// + /// + /// Ollama username. + /// + /// + /// Ollama password. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PullModelRequest( + string model, + bool? insecure, + string? username, + string? password, + bool? stream) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.PullModelRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Insecure = insecure; + this.Username = username; + this.Password = password; + this.Stream = stream; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public PullModelRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.Json.g.cs new file mode 100644 index 0000000..97c6022 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class PullModelResponse + { + /// + /// 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::Ollama.PullModelResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.PullModelResponse), + jsonSerializerContext) as global::Ollama.PullModelResponse; + } + + /// + /// 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::Ollama.PullModelResponse? 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::Ollama.PullModelResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs index 4d08867..654123f 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs @@ -14,6 +14,7 @@ public sealed partial class PullModelResponse /// Status pulling the model.
/// Example: pulling manifest /// + /// pulling manifest [global::System.Text.Json.Serialization.JsonPropertyName("status")] [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.PullModelStatusJsonConverter))] public global::Ollama.PullModelStatus? Status { get; set; } @@ -22,6 +23,7 @@ public sealed partial class PullModelResponse /// The model's digest.
/// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a /// + /// sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a [global::System.Text.Json.Serialization.JsonPropertyName("digest")] public string? Digest { get; set; } @@ -29,6 +31,7 @@ public sealed partial class PullModelResponse /// Total size of the model.
/// Example: 2142590208L /// + /// 2142590208L [global::System.Text.Json.Serialization.JsonPropertyName("total")] public long? Total { get; set; } @@ -36,6 +39,7 @@ public sealed partial class PullModelResponse /// Total bytes transferred.
/// Example: 2142590208L /// + /// 2142590208L [global::System.Text.Json.Serialization.JsonPropertyName("completed")] public long? Completed { get; set; } @@ -45,91 +49,43 @@ public sealed partial class PullModelResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.PullModelResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.PullModelResponse), - jsonSerializerContext) as global::Ollama.PullModelResponse; - } - - /// - /// 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::Ollama.PullModelResponse? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// Status pulling the model.
+ /// Example: pulling manifest + /// + /// + /// The model's digest.
+ /// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a + /// + /// + /// Total size of the model.
+ /// Example: 2142590208L + /// + /// + /// Total bytes transferred.
+ /// Example: 2142590208L + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PullModelResponse( + global::Ollama.PullModelStatus? status, + string? digest, + long? total, + long? completed) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.PullModelResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelResponse; + this.Status = status; + this.Digest = digest; + this.Total = total; + this.Completed = completed; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public PullModelResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.Json.g.cs new file mode 100644 index 0000000..af259dd --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public readonly partial struct PullModelStatus + { + /// + /// 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::Ollama.PullModelStatus? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.PullModelStatus), + jsonSerializerContext) as global::Ollama.PullModelStatus?; + } + + /// + /// 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::Ollama.PullModelStatus? 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::Ollama.PullModelStatus), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelStatus?; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.PullModelStatus.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.g.cs index 9d98a48..4721cb2 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelStatus.g.cs @@ -1,4 +1,3 @@ -using System.Linq; #pragma warning disable CS0618 // Type or member is obsolete #nullable enable @@ -174,7 +173,8 @@ public override int GetHashCode() static int HashCodeAggregator(int hashCode, object? value) => value == null ? (hashCode ^ 0) * prime : (hashCode ^ value.GetHashCode()) * prime; - return fields.Aggregate(offset, HashCodeAggregator); + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); } /// @@ -211,92 +211,5 @@ public override bool Equals(object? obj) { return obj is PullModelStatus o && Equals(o); } - - - /// - /// 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::Ollama.PullModelStatus? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.PullModelStatus), - jsonSerializerContext) as global::Ollama.PullModelStatus?; - } - - /// - /// 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::Ollama.PullModelStatus? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.PullModelStatus), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PullModelStatus?; - } - - /// - /// 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 FromJsonStream( - 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/Ollama/Generated/Ollama.Models.PushModelRequest.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PushModelRequest.Json.g.cs new file mode 100644 index 0000000..5d0c563 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.PushModelRequest.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class PushModelRequest + { + /// + /// 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::Ollama.PushModelRequest? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.PushModelRequest), + jsonSerializerContext) as global::Ollama.PushModelRequest; + } + + /// + /// 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::Ollama.PushModelRequest? 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::Ollama.PushModelRequest), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PushModelRequest; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.PushModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PushModelRequest.g.cs index bf3209b..c13b161 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PushModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PushModelRequest.g.cs @@ -12,6 +12,7 @@ public sealed partial class PushModelRequest /// The name of the model to push in the form of <namespace>/<model>:<tag>.
/// Example: mattw/pygmalion:latest ///
+ /// mattw/pygmalion:latest [global::System.Text.Json.Serialization.JsonPropertyName("model")] [global::System.Text.Json.Serialization.JsonRequired] public required string Model { get; set; } @@ -49,91 +50,48 @@ public sealed partial class PushModelRequest [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.PushModelRequest? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.PushModelRequest), - jsonSerializerContext) as global::Ollama.PushModelRequest; - } - /// - /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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::Ollama.PushModelRequest? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The name of the model to push in the form of <namespace>/<model>:<tag>.
+ /// Example: mattw/pygmalion:latest + /// + /// + /// Allow insecure connections to the library.
+ /// Only use this if you are pushing to your library during development.
+ /// Default Value: false + /// + /// + /// Ollama username. + /// + /// + /// Ollama password. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PushModelRequest( + string model, + bool? insecure, + string? username, + string? password, + bool? stream) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.PushModelRequest), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PushModelRequest; + this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); + this.Insecure = insecure; + this.Username = username; + this.Password = password; + this.Stream = stream; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public PushModelRequest() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.Json.g.cs new file mode 100644 index 0000000..4b7433b --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class PushModelResponse + { + /// + /// 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::Ollama.PushModelResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.PushModelResponse), + jsonSerializerContext) as global::Ollama.PushModelResponse; + } + + /// + /// 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::Ollama.PushModelResponse? 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::Ollama.PushModelResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PushModelResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs index da5f990..ab0d631 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs @@ -21,6 +21,7 @@ public sealed partial class PushModelResponse /// the model's digest
/// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a /// + /// sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a [global::System.Text.Json.Serialization.JsonPropertyName("digest")] public string? Digest { get; set; } @@ -28,6 +29,7 @@ public sealed partial class PushModelResponse /// total size of the model
/// Example: 2142590208L /// + /// 2142590208L [global::System.Text.Json.Serialization.JsonPropertyName("total")] public long? Total { get; set; } @@ -35,6 +37,7 @@ public sealed partial class PushModelResponse /// Total bytes transferred.
/// Example: 2142590208L /// + /// 2142590208L [global::System.Text.Json.Serialization.JsonPropertyName("completed")] public long? Completed { get; set; } @@ -44,91 +47,42 @@ public sealed partial class PushModelResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.PushModelResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.PushModelResponse), - jsonSerializerContext) as global::Ollama.PushModelResponse; - } - - /// - /// 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::Ollama.PushModelResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// Status pushing the model. + /// + /// + /// the model's digest
+ /// Example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a + /// + /// + /// total size of the model
+ /// Example: 2142590208L + /// + /// + /// Total bytes transferred.
+ /// Example: 2142590208L + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public PushModelResponse( + global::Ollama.AnyOf? status, + string? digest, + long? total, + long? completed) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.PushModelResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.PushModelResponse; + this.Status = status; + this.Digest = digest; + this.Total = total; + this.Completed = completed; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public PushModelResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.Json.g.cs new file mode 100644 index 0000000..8fe30a7 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class RequestOptions + { + /// + /// 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::Ollama.RequestOptions? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.RequestOptions), + jsonSerializerContext) as global::Ollama.RequestOptions; + } + + /// + /// 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::Ollama.RequestOptions? 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::Ollama.RequestOptions), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.RequestOptions; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.RequestOptions.g.cs b/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.g.cs index bdc8588..2aa94cc 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.RequestOptions.g.cs @@ -215,91 +215,190 @@ public sealed partial class RequestOptions [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.RequestOptions? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.RequestOptions), - jsonSerializerContext) as global::Ollama.RequestOptions; - } - - /// - /// 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::Ollama.RequestOptions? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// Number of tokens to keep from the prompt. + /// + /// + /// Sets the random number seed to use for generation. Setting this to a specific number will make the model
+ /// generate the same text for the same prompt. (Default: 0) + /// + /// + /// Maximum number of tokens to predict when generating text.
+ /// (Default: 128, -1 = infinite generation, -2 = fill context) + /// + /// + /// Reduces the probability of generating nonsense. A higher value (e.g. 100) will give more diverse answers,
+ /// while a lower value (e.g. 10) will be more conservative. (Default: 40) + /// + /// + /// Works together with top_k. A higher value (e.g., 0.95) will lead to more diverse text, while a lower value
+ /// (e.g., 0.5) will generate more focused and conservative text. (Default: 0.9) + /// + /// + /// Alternative to the top_p, and aims to ensure a balance of quality and variety. min_p represents the minimum
+ /// probability for a token to be considered, relative to the probability of the most likely token. For
+ /// example, with min_p=0.05 and the most likely token having a probability of 0.9, logits with a value less
+ /// than 0.05*0.9=0.045 are filtered out. (Default: 0.0) + /// + /// + /// Tail free sampling is used to reduce the impact of less probable tokens from the output. A higher value
+ /// (e.g., 2.0) will reduce the impact more, while a value of 1.0 disables this setting. (default: 1) + /// + /// + /// Typical p is used to reduce the impact of less probable tokens from the output. (default: 1) + /// + /// + /// Sets how far back for the model to look back to prevent repetition.
+ /// (Default: 64, 0 = disabled, -1 = num_ctx) + /// + /// + /// The temperature of the model. Increasing the temperature will make the model answer more creatively.
+ /// (Default: 0.8) + /// + /// + /// Sets how strongly to penalize repetitions. A higher value (e.g., 1.5) will penalize repetitions more
+ /// strongly, while a lower value (e.g., 0.9) will be more lenient. (Default: 1.1) + /// + /// + /// Positive values penalize new tokens based on whether they appear in the text so far, increasing the
+ /// model's likelihood to talk about new topics. (Default: 0) + /// + /// + /// Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the
+ /// model's likelihood to repeat the same line verbatim. (Default: 0) + /// + /// + /// Enable Mirostat sampling for controlling perplexity.
+ /// (default: 0, 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0) + /// + /// + /// Controls the balance between coherence and diversity of the output. A lower value will result in more
+ /// focused and coherent text. (Default: 5.0) + /// + /// + /// Influences how quickly the algorithm responds to feedback from the generated text. A lower learning rate
+ /// will result in slower adjustments, while a higher learning rate will make the algorithm more responsive.
+ /// (Default: 0.1) + /// + /// + /// Penalize newlines in the output. (Default: true) + /// + /// + /// Sequences where the API will stop generating further tokens. The returned text will not contain the stop
+ /// sequence. + /// + /// + /// Enable NUMA support. (Default: false) + /// + /// + /// Sets the size of the context window used to generate the next token. (Default: 2048) + /// + /// + /// Sets the number of batches to use for generation. (Default: 512) + /// + /// + /// The number of layers to send to the GPU(s).
+ /// On macOS it defaults to 1 to enable metal support, 0 to disable. + /// + /// + /// The GPU to use for the main model. Default is 0. + /// + /// + /// Enable low VRAM mode. (Default: false) + /// + /// + /// Enable f16 key/value. (Default: true) + /// + /// + /// Enable logits all. (Default: false) + /// + /// + /// Enable vocab only. (Default: false) + /// + /// + /// Enable mmap. (Default: false) + /// + /// + /// Enable mlock. (Default: false) + /// + /// + /// Sets the number of threads to use during computation. By default, Ollama will detect this for optimal
+ /// performance. It is recommended to set this value to the number of physical CPU cores your system has
+ /// (as opposed to the logical number of cores). + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public RequestOptions( + int? numKeep, + int? seed, + int? numPredict, + int? topK, + float? topP, + float? minP, + float? tfsZ, + float? typicalP, + int? repeatLastN, + float? temperature, + float? repeatPenalty, + float? presencePenalty, + float? frequencyPenalty, + int? mirostat, + float? mirostatTau, + float? mirostatEta, + bool? penalizeNewline, + global::System.Collections.Generic.IList? stop, + bool? numa, + int? numCtx, + int? numBatch, + int? numGpu, + int? mainGpu, + bool? lowVram, + bool? f16Kv, + bool? logitsAll, + bool? vocabOnly, + bool? useMmap, + bool? useMlock, + int? numThread) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.RequestOptions), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.RequestOptions; + this.NumKeep = numKeep; + this.Seed = seed; + this.NumPredict = numPredict; + this.TopK = topK; + this.TopP = topP; + this.MinP = minP; + this.TfsZ = tfsZ; + this.TypicalP = typicalP; + this.RepeatLastN = repeatLastN; + this.Temperature = temperature; + this.RepeatPenalty = repeatPenalty; + this.PresencePenalty = presencePenalty; + this.FrequencyPenalty = frequencyPenalty; + this.Mirostat = mirostat; + this.MirostatTau = mirostatTau; + this.MirostatEta = mirostatEta; + this.PenalizeNewline = penalizeNewline; + this.Stop = stop; + this.Numa = numa; + this.NumCtx = numCtx; + this.NumBatch = numBatch; + this.NumGpu = numGpu; + this.MainGpu = mainGpu; + this.LowVram = lowVram; + this.F16Kv = f16Kv; + this.LogitsAll = logitsAll; + this.VocabOnly = vocabOnly; + this.UseMmap = useMmap; + this.UseMlock = useMlock; + this.NumThread = numThread; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public RequestOptions() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.Tool.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Tool.Json.g.cs new file mode 100644 index 0000000..34b3162 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.Tool.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class Tool + { + /// + /// 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::Ollama.Tool? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.Tool), + jsonSerializerContext) as global::Ollama.Tool; + } + + /// + /// 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::Ollama.Tool? 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::Ollama.Tool), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Tool; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.Tool.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs index 16d7581..6cbcd7c 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs @@ -28,91 +28,30 @@ public sealed partial class Tool [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// Initializes a new instance of the class. /// - 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::Ollama.Tool? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.Tool), - jsonSerializerContext) as global::Ollama.Tool; - } - - /// - /// 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::Ollama.Tool? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The type of tool.
+ /// Default Value: function + /// + /// + /// A function that the model may call. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public Tool( + global::Ollama.ToolType? type, + global::Ollama.ToolFunction? function) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.Tool), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.Tool; + this.Type = type; + this.Function = function; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public Tool() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolCall.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCall.Json.g.cs new file mode 100644 index 0000000..0d94dea --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCall.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ToolCall + { + /// + /// 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::Ollama.ToolCall? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ToolCall), + jsonSerializerContext) as global::Ollama.ToolCall; + } + + /// + /// 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::Ollama.ToolCall? 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::Ollama.ToolCall), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCall; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ToolCall.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCall.g.cs index 417d92b..b63413a 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolCall.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCall.g.cs @@ -20,91 +20,24 @@ public sealed partial class ToolCall [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.ToolCall? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ToolCall), - jsonSerializerContext) as global::Ollama.ToolCall; - } - - /// - /// 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::Ollama.ToolCall? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The function the model wants to call. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCall( + global::Ollama.ToolCallFunction? function) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ToolCall), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCall; + this.Function = function; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ToolCall() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.Json.g.cs new file mode 100644 index 0000000..34d7954 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ToolCallFunction + { + /// + /// 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::Ollama.ToolCallFunction? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ToolCallFunction), + jsonSerializerContext) as global::Ollama.ToolCallFunction; + } + + /// + /// 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::Ollama.ToolCallFunction? 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::Ollama.ToolCallFunction), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCallFunction; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs index 70cdce1..ddc18e4 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs @@ -28,91 +28,29 @@ public sealed partial class ToolCallFunction [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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::Ollama.ToolCallFunction? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ToolCallFunction), - jsonSerializerContext) as global::Ollama.ToolCallFunction; - } - - /// - /// 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::Ollama.ToolCallFunction? 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. + /// Initializes a new instance of the class. /// - public static async global::System.Threading.Tasks.ValueTask FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The name of the function to be called. + /// + /// + /// The arguments to pass to the function. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallFunction( + string name, + object arguments) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ToolCallFunction), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCallFunction; + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Arguments = arguments ?? throw new global::System.ArgumentNullException(nameof(arguments)); } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ToolCallFunction() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.Json.g.cs new file mode 100644 index 0000000..db59048 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ToolCallFunctionArgs + { + /// + /// 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::Ollama.ToolCallFunctionArgs? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ToolCallFunctionArgs), + jsonSerializerContext) as global::Ollama.ToolCallFunctionArgs; + } + + /// + /// 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::Ollama.ToolCallFunctionArgs? 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::Ollama.ToolCallFunctionArgs), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCallFunctionArgs; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.g.cs index 26eae40..7cf9639 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunctionArgs.g.cs @@ -15,91 +15,13 @@ public sealed partial class ToolCallFunctionArgs [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// - public static global::Ollama.ToolCallFunctionArgs? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolCallFunctionArgs( + ) { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ToolCallFunctionArgs), - jsonSerializerContext) as global::Ollama.ToolCallFunctionArgs; } - - /// - /// 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::Ollama.ToolCallFunctionArgs? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ToolCallFunctionArgs), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolCallFunctionArgs; - } - - /// - /// 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.Json.g.cs new file mode 100644 index 0000000..ab6256d --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ToolFunction + { + /// + /// 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::Ollama.ToolFunction? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ToolFunction), + jsonSerializerContext) as global::Ollama.ToolFunction; + } + + /// + /// 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::Ollama.ToolFunction? 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::Ollama.ToolFunction), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolFunction; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ToolFunction.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.g.cs index f1d2078..ceec18e 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolFunction.g.cs @@ -35,91 +35,34 @@ public sealed partial class ToolFunction [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - /// - /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// Initializes a new instance of the class. /// - 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::Ollama.ToolFunction? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ToolFunction), - jsonSerializerContext) as global::Ollama.ToolFunction; - } - - /// - /// 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::Ollama.ToolFunction? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The name of the function to be called. + /// + /// + /// A description of what the function does, used by the model to choose when and how to call the function. + /// + /// + /// The parameters the functions accepts, described as a JSON Schema object. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolFunction( + string name, + string description, + object parameters) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ToolFunction), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolFunction; + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Description = description ?? throw new global::System.ArgumentNullException(nameof(description)); + this.Parameters = parameters ?? throw new global::System.ArgumentNullException(nameof(parameters)); } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public ToolFunction() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.Json.g.cs new file mode 100644 index 0000000..837a47a --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class ToolFunctionParams + { + /// + /// 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::Ollama.ToolFunctionParams? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.ToolFunctionParams), + jsonSerializerContext) as global::Ollama.ToolFunctionParams; + } + + /// + /// 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::Ollama.ToolFunctionParams? 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::Ollama.ToolFunctionParams), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolFunctionParams; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.ToolFunctionParams.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.g.cs index eb5d657..dad8499 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolFunctionParams.g.cs @@ -15,91 +15,13 @@ public sealed partial class ToolFunctionParams [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// - public static global::Ollama.ToolFunctionParams? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public ToolFunctionParams( + ) { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.ToolFunctionParams), - jsonSerializerContext) as global::Ollama.ToolFunctionParams; } - - /// - /// 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::Ollama.ToolFunctionParams? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.ToolFunctionParams), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.ToolFunctionParams; - } - - /// - /// 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) - { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); - } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.Json.g.cs new file mode 100644 index 0000000..f66e7b5 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class VersionResponse + { + /// + /// 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::Ollama.VersionResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.VersionResponse), + jsonSerializerContext) as global::Ollama.VersionResponse; + } + + /// + /// 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::Ollama.VersionResponse? 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::Ollama.VersionResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.VersionResponse; + } + + /// + /// 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/Ollama/Generated/Ollama.Models.VersionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.g.cs index d2c1365..df72dee 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.VersionResponse.g.cs @@ -20,91 +20,24 @@ public sealed partial class VersionResponse [global::System.Text.Json.Serialization.JsonExtensionData] public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); - - /// - /// 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. + /// Initializes a new instance of the class. /// -#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::Ollama.VersionResponse? FromJson( - string json, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) - { - return global::System.Text.Json.JsonSerializer.Deserialize( - json, - typeof(global::Ollama.VersionResponse), - jsonSerializerContext) as global::Ollama.VersionResponse; - } - - /// - /// 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::Ollama.VersionResponse? 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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + /// + /// The version of the Ollama server. + /// + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] + public VersionResponse( + string? version) { - return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - typeof(global::Ollama.VersionResponse), - jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.VersionResponse; + this.Version = version; } /// - /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// Initializes a new instance of the class. /// -#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 FromJsonStream( - global::System.IO.Stream jsonStream, - global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + public VersionResponse() { - return global::System.Text.Json.JsonSerializer.DeserializeAsync( - jsonStream, - jsonSerializerOptions); } - } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs index 7adb048..7e8d42c 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs @@ -22,7 +22,7 @@ partial void ProcessCheckBlobResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task CheckBlobAsync( string digest, global::System.Threading.CancellationToken cancellationToken = default) @@ -60,7 +60,23 @@ partial void ProcessCheckBlobResponse( ProcessCheckBlobResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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), + }; + } } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs index cfe9cc7..cd00c49 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs @@ -21,7 +21,7 @@ partial void ProcessCopyModelResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task CopyModelAsync( global::Ollama.CopyModelRequest request, global::System.Threading.CancellationToken cancellationToken = default) @@ -67,7 +67,23 @@ partial void ProcessCopyModelResponse( ProcessCopyModelResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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), + }; + } } /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs index fc8fb46..5560a5b 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs @@ -24,7 +24,7 @@ partial void ProcessCreateBlobResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task CreateBlobAsync( string digest, byte[] request, @@ -73,7 +73,23 @@ partial void ProcessCreateBlobResponse( ProcessCreateBlobResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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), + }; + } } /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs index d792c16..c03ac61 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs @@ -22,7 +22,7 @@ partial void ProcessCreateModelResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( global::Ollama.CreateModelRequest request, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) @@ -68,18 +68,34 @@ partial void ProcessCreateModelResponse( ProcessCreateModelResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - using var reader = new global::System.IO.StreamReader(stream); + using var __stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var __reader = new global::System.IO.StreamReader(__stream); - while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) + while (!__reader.EndOfStream && !cancellationToken.IsCancellationRequested) { - var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::Ollama.CreateModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __content = await __reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; + var __streamedResponse = global::Ollama.CreateModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - yield return streamedResponse; + yield return __streamedResponse; } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs index 4c6af40..dbae5e6 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs @@ -21,7 +21,7 @@ partial void ProcessDeleteModelResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task DeleteModelAsync( global::Ollama.DeleteModelRequest request, global::System.Threading.CancellationToken cancellationToken = default) @@ -67,7 +67,23 @@ partial void ProcessDeleteModelResponse( ProcessDeleteModelResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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), + }; + } } /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs index e3a1b7f..a58c910 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs @@ -23,7 +23,7 @@ partial void ProcessListModelsResponseContent( /// List models that are available locally. /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task ListModelsAsync( global::System.Threading.CancellationToken cancellationToken = default) { @@ -59,29 +59,70 @@ partial void ProcessListModelsResponseContent( httpClient: HttpClient, httpResponseMessage: __response); - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessListModelsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListModelsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); - try - { - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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::Ollama.ModelsResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + else { - throw new global::System.InvalidOperationException(__content, __ex); - } + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - return - global::Ollama.ModelsResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + var __responseValue = await global::Ollama.ModelsResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false); + + return + __responseValue ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs index 10f83d1..8f4e02a 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs @@ -23,7 +23,7 @@ partial void ProcessListRunningModelsResponseContent( /// List models that are running. /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task ListRunningModelsAsync( global::System.Threading.CancellationToken cancellationToken = default) { @@ -59,29 +59,70 @@ partial void ProcessListRunningModelsResponseContent( httpClient: HttpClient, httpResponseMessage: __response); - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessListRunningModelsResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListRunningModelsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); - try - { - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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::Ollama.ProcessResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + else { - throw new global::System.InvalidOperationException(__content, __ex); - } + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - return - global::Ollama.ProcessResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + var __responseValue = await global::Ollama.ProcessResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false); + + return + __responseValue ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs index 67291e1..0b15018 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs @@ -22,7 +22,7 @@ partial void ProcessPullModelResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Collections.Generic.IAsyncEnumerable PullModelAsync( global::Ollama.PullModelRequest request, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) @@ -68,18 +68,34 @@ partial void ProcessPullModelResponse( ProcessPullModelResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - using var reader = new global::System.IO.StreamReader(stream); + using var __stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var __reader = new global::System.IO.StreamReader(__stream); - while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) + while (!__reader.EndOfStream && !cancellationToken.IsCancellationRequested) { - var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::Ollama.PullModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __content = await __reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; + var __streamedResponse = global::Ollama.PullModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - yield return streamedResponse; + yield return __streamedResponse; } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs index 75f45fe..7213260 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs @@ -22,7 +22,7 @@ partial void ProcessPushModelResponse( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Collections.Generic.IAsyncEnumerable PushModelAsync( global::Ollama.PushModelRequest request, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) @@ -68,18 +68,34 @@ partial void ProcessPushModelResponse( ProcessPushModelResponse( httpClient: HttpClient, httpResponseMessage: __response); - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - using var reader = new global::System.IO.StreamReader(stream); + using var __stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var __reader = new global::System.IO.StreamReader(__stream); - while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) + while (!__reader.EndOfStream && !cancellationToken.IsCancellationRequested) { - var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::Ollama.PushModelResponse.FromJson(__content, JsonSerializerContext) ?? + var __content = await __reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; + var __streamedResponse = global::Ollama.PushModelResponse.FromJson(__content, JsonSerializerContext) ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); - yield return streamedResponse; + yield return __streamedResponse; } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs index 993460b..4714e0a 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs @@ -26,7 +26,7 @@ partial void ProcessShowModelInfoResponseContent( /// /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task ShowModelInfoAsync( global::Ollama.ModelInfoRequest request, global::System.Threading.CancellationToken cancellationToken = default) @@ -73,29 +73,70 @@ partial void ProcessShowModelInfoResponseContent( httpClient: HttpClient, httpResponseMessage: __response); - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessShowModelInfoResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessShowModelInfoResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); - try - { - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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::Ollama.ModelInfo.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + else { - throw new global::System.InvalidOperationException(__content, __ex); - } + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - return - global::Ollama.ModelInfo.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + var __responseValue = await global::Ollama.ModelInfo.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false); + + return + __responseValue ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } } /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs index c8b6323..3ebd429 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs @@ -26,6 +26,11 @@ public sealed partial class ModelsClient : global::Ollama.IModelsClient, global: /// public global::System.Collections.Generic.List Authorizations { get; } + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs index 9fe55fb..6387154 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs @@ -24,7 +24,7 @@ partial void ProcessGetVersionResponseContent( /// This endpoint returns the version of the Ollama server. /// /// The token to cancel the operation with - /// + /// public async global::System.Threading.Tasks.Task GetVersionAsync( global::System.Threading.CancellationToken cancellationToken = default) { @@ -60,29 +60,70 @@ partial void ProcessGetVersionResponseContent( httpClient: HttpClient, httpResponseMessage: __response); - var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + if (ReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - ProcessResponseContent( - client: HttpClient, - response: __response, - content: ref __content); - ProcessGetVersionResponseContent( - httpClient: HttpClient, - httpResponseMessage: __response, - content: ref __content); + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetVersionResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); - try - { - __response.EnsureSuccessStatusCode(); + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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::Ollama.VersionResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } - catch (global::System.Net.Http.HttpRequestException __ex) + else { - throw new global::System.InvalidOperationException(__content, __ex); - } + try + { + __response.EnsureSuccessStatusCode(); + } + catch (global::System.Net.Http.HttpRequestException __ex) + { + throw new global::Ollama.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 __responseStream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); - return - global::Ollama.VersionResponse.FromJson(__content, JsonSerializerContext) ?? - throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + var __responseValue = await global::Ollama.VersionResponse.FromJsonStreamAsync(__responseStream, JsonSerializerContext).ConfigureAwait(false); + + return + __responseValue ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + } } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs index 36885a7..625d296 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs @@ -26,6 +26,11 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// public global::System.Collections.Generic.List Authorizations { get; } + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif /// /// /// @@ -37,6 +42,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// public CompletionsClient Completions => new CompletionsClient(HttpClient, authorizations: Authorizations) { + ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, }; @@ -45,6 +51,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// public ChatClient Chat => new ChatClient(HttpClient, authorizations: Authorizations) { + ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, }; @@ -53,6 +60,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// public EmbeddingsClient Embeddings => new EmbeddingsClient(HttpClient, authorizations: Authorizations) { + ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, }; @@ -61,6 +69,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations) { + ReadResponseAsString = ReadResponseAsString, JsonSerializerContext = JsonSerializerContext, }; diff --git a/src/libs/Ollama/Generated/Ollama.PathBuilder.g.cs b/src/libs/Ollama/Generated/Ollama.PathBuilder.g.cs index 6ec508a..fef8aa6 100644 --- a/src/libs/Ollama/Generated/Ollama.PathBuilder.g.cs +++ b/src/libs/Ollama/Generated/Ollama.PathBuilder.g.cs @@ -1,5 +1,3 @@ -using System.Linq; - #nullable enable namespace Ollama @@ -103,7 +101,11 @@ public PathBuilder AddRequiredParameter( string delimiter = ",", bool explode = false) { - AddRequiredParameter(name, value.Select(selector).ToArray(), delimiter, explode); + AddRequiredParameter( + name, + global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(value, selector)), + delimiter, + explode); return this; } @@ -167,7 +169,11 @@ public PathBuilder AddOptionalParameter( { if (value is not null) { - AddRequiredParameter(name, value.Select(selector).ToArray(), delimiter, explode); + AddRequiredParameter( + name, + global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(value, selector)), + delimiter, + explode); } return this; diff --git a/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs b/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs index 1a7c42f..88d9edc 100644 --- a/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs @@ -7,7 +7,7 @@ namespace Ollama /// /// /// - public static partial class AutoSDKPolyfills + public static partial class AutoSdkPolyfills { /// ///