diff --git a/src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.cs b/src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.cs index f04e301..65450b4 100644 --- a/src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.cs +++ b/src/libs/Ollama/Generated/Ollama..JsonSerializerContext.g.cs @@ -13,12 +13,20 @@ namespace Ollama DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Converters = new global::System.Type[] { + typeof(global::Ollama.JsonConverters.GenerateCompletionRequestFormatEnumJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullableJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateCompletionRequestThinkJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateCompletionRequestThinkNullableJsonConverter), typeof(global::Ollama.JsonConverters.ResponseFormatEnumJsonConverter), typeof(global::Ollama.JsonConverters.ResponseFormatEnumNullableJsonConverter), typeof(global::Ollama.JsonConverters.MessageRoleJsonConverter), typeof(global::Ollama.JsonConverters.MessageRoleNullableJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullableJsonConverter), typeof(global::Ollama.JsonConverters.ToolTypeJsonConverter), typeof(global::Ollama.JsonConverters.ToolTypeNullableJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateChatCompletionRequestThinkJsonConverter), + typeof(global::Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullableJsonConverter), typeof(global::Ollama.JsonConverters.DoneReasonEnumJsonConverter), typeof(global::Ollama.JsonConverters.DoneReasonEnumNullableJsonConverter), typeof(global::Ollama.JsonConverters.CreateModelStatusEnumJsonConverter), @@ -33,6 +41,10 @@ namespace Ollama typeof(global::Ollama.JsonConverters.DoneReasonJsonConverter), typeof(global::Ollama.JsonConverters.CreateModelStatusJsonConverter), typeof(global::Ollama.JsonConverters.PullModelStatusJsonConverter), + typeof(global::Ollama.JsonConverters.OneOfJsonConverter), + typeof(global::Ollama.JsonConverters.OneOfJsonConverter), + typeof(global::Ollama.JsonConverters.OneOfJsonConverter), + typeof(global::Ollama.JsonConverters.OneOfJsonConverter), typeof(global::Ollama.JsonConverters.AnyOfJsonConverter), typeof(global::Ollama.JsonConverters.UnixTimestampJsonConverter), })] diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs index 7bc0bae..76c29c3 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs @@ -123,7 +123,11 @@ partial void ProcessGenerateChatCompletionResponse( /// 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 /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -138,10 +142,16 @@ partial void ProcessGenerateChatCompletionResponse( /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the chat history if it exceeds the context length + /// + /// + /// Shifts the oldest messages out of the context window when the context limit is reached /// /// The token to cancel the operation with /// @@ -149,11 +159,13 @@ partial void ProcessGenerateChatCompletionResponse( string model, global::System.Collections.Generic.IList messages, bool? stream = default, - global::Ollama.ResponseFormat? format = default, + global::Ollama.OneOf? format = default, int? keepAlive = default, global::System.Collections.Generic.IList? tools = default, global::Ollama.RequestOptions? options = default, - bool? think = default, + global::Ollama.OneOf? think = default, + bool? truncate = default, + bool? shift = default, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::Ollama.GenerateChatCompletionRequest @@ -166,6 +178,8 @@ partial void ProcessGenerateChatCompletionResponse( Tools = tools, Options = options, Think = think, + Truncate = truncate, + Shift = shift, }; var __enumerable = GenerateChatCompletionAsync( diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs index a853f4f..339753f 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs @@ -137,10 +137,14 @@ partial void ProcessGenerateCompletionResponse( /// Default Value: true /// /// - /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// 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. /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -155,10 +159,16 @@ partial void ProcessGenerateCompletionResponse( /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the prompt if it exceeds the context length + /// + /// + /// Shifts the oldest parts out of the context window when the context limit is reached /// /// The token to cancel the operation with /// @@ -171,11 +181,13 @@ partial void ProcessGenerateCompletionResponse( global::System.Collections.Generic.IList? context = default, bool? stream = default, bool? raw = default, - global::Ollama.ResponseFormat? format = default, + global::Ollama.OneOf? format = default, int? keepAlive = default, global::System.Collections.Generic.IList? images = default, global::Ollama.RequestOptions? options = default, - bool? think = default, + global::Ollama.OneOf? think = default, + bool? truncate = default, + bool? shift = default, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::Ollama.GenerateCompletionRequest @@ -193,6 +205,8 @@ partial void ProcessGenerateCompletionResponse( Images = images, Options = options, Think = think, + Truncate = truncate, + Shift = shift, }; var __enumerable = GenerateCompletionAsync( diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs index b1a6b29..16fb46c 100644 --- a/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs @@ -31,7 +31,11 @@ public partial interface IChatClient /// 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 /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -46,10 +50,16 @@ public partial interface IChatClient /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the chat history if it exceeds the context length + /// + /// + /// Shifts the oldest messages out of the context window when the context limit is reached /// /// The token to cancel the operation with /// @@ -57,11 +67,13 @@ public partial interface IChatClient string model, global::System.Collections.Generic.IList messages, bool? stream = default, - global::Ollama.ResponseFormat? format = default, + global::Ollama.OneOf? format = default, int? keepAlive = default, global::System.Collections.Generic.IList? tools = default, global::Ollama.RequestOptions? options = default, - bool? think = default, + global::Ollama.OneOf? think = default, + bool? truncate = default, + bool? shift = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs index 7bd497c..df8056d 100644 --- a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs @@ -45,10 +45,14 @@ public partial interface ICompletionsClient /// Default Value: true /// /// - /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// 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. /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -63,10 +67,16 @@ public partial interface ICompletionsClient /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the prompt if it exceeds the context length + /// + /// + /// Shifts the oldest parts out of the context window when the context limit is reached /// /// The token to cancel the operation with /// @@ -79,11 +89,13 @@ public partial interface ICompletionsClient global::System.Collections.Generic.IList? context = default, bool? stream = default, bool? raw = default, - global::Ollama.ResponseFormat? format = default, + global::Ollama.OneOf? format = default, int? keepAlive = default, global::System.Collections.Generic.IList? images = default, global::Ollama.RequestOptions? options = default, - bool? think = default, + global::Ollama.OneOf? think = default, + bool? truncate = default, + bool? shift = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs index 9e7d83d..f877e4e 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs @@ -38,14 +38,38 @@ public partial interface IModelsClient /// 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 /// + /// + /// Name of the model or file to use as the source + /// + /// + /// Map of files to include when creating the model + /// + /// + /// Map of LoRA adapters to include when creating the model + /// + /// + /// Template used when constructing a request to the model + /// + /// + /// System prompt for the model + /// + /// + /// Map of hyper-parameters which are applied to the model + /// /// The token to cancel the operation with /// global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( string model, - string modelfile, + string? modelfile = default, string? path = default, string? quantize = default, bool? stream = default, + string? from = default, + global::System.Collections.Generic.Dictionary? files = default, + global::System.Collections.Generic.Dictionary? adapters = default, + string? template = default, + string? system = default, + object? parameters = default, global::System.Threading.CancellationToken cancellationToken = default); } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnum.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnum.g.cs new file mode 100644 index 0000000..60e54fb --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnum.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateChatCompletionRequestFormatEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateChatCompletionRequestFormatEnum Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateChatCompletionRequestFormatEnumExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateChatCompletionRequestFormatEnum)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateChatCompletionRequestFormatEnum); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateChatCompletionRequestFormatEnum value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ollama.GenerateChatCompletionRequestFormatEnumExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullable.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullable.g.cs new file mode 100644 index 0000000..c0f6ce9 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestFormatEnumNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateChatCompletionRequestFormatEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateChatCompletionRequestFormatEnum? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateChatCompletionRequestFormatEnumExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateChatCompletionRequestFormatEnum)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateChatCompletionRequestFormatEnum?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateChatCompletionRequestFormatEnum? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Ollama.GenerateChatCompletionRequestFormatEnumExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThink.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThink.g.cs new file mode 100644 index 0000000..a558f38 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThink.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateChatCompletionRequestThinkJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateChatCompletionRequestThink Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateChatCompletionRequestThinkExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateChatCompletionRequestThink)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateChatCompletionRequestThink); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateChatCompletionRequestThink value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ollama.GenerateChatCompletionRequestThinkExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullable.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullable.g.cs new file mode 100644 index 0000000..576b9d0 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateChatCompletionRequestThinkNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateChatCompletionRequestThinkNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateChatCompletionRequestThink? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateChatCompletionRequestThinkExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateChatCompletionRequestThink)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateChatCompletionRequestThink?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateChatCompletionRequestThink? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Ollama.GenerateChatCompletionRequestThinkExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnum.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnum.g.cs new file mode 100644 index 0000000..09ff745 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnum.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateCompletionRequestFormatEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateCompletionRequestFormatEnum Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateCompletionRequestFormatEnumExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateCompletionRequestFormatEnum)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateCompletionRequestFormatEnum); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateCompletionRequestFormatEnum value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ollama.GenerateCompletionRequestFormatEnumExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullable.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullable.g.cs new file mode 100644 index 0000000..13e7ec6 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestFormatEnumNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateCompletionRequestFormatEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateCompletionRequestFormatEnum? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateCompletionRequestFormatEnumExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateCompletionRequestFormatEnum)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateCompletionRequestFormatEnum?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateCompletionRequestFormatEnum? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Ollama.GenerateCompletionRequestFormatEnumExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThink.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThink.g.cs new file mode 100644 index 0000000..76c0638 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThink.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateCompletionRequestThinkJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateCompletionRequestThink Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateCompletionRequestThinkExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateCompletionRequestThink)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateCompletionRequestThink); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateCompletionRequestThink value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Ollama.GenerateCompletionRequestThinkExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThinkNullable.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThinkNullable.g.cs new file mode 100644 index 0000000..375b1be --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.GenerateCompletionRequestThinkNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public sealed class GenerateCompletionRequestThinkNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Ollama.GenerateCompletionRequestThink? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Ollama.GenerateCompletionRequestThinkExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Ollama.GenerateCompletionRequestThink)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Ollama.GenerateCompletionRequestThink?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.GenerateCompletionRequestThink? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Ollama.GenerateCompletionRequestThinkExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Ollama/Generated/Ollama.JsonConverters.OneOf2.g.cs b/src/libs/Ollama/Generated/Ollama.JsonConverters.OneOf2.g.cs new file mode 100644 index 0000000..8acf4e9 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.JsonConverters.OneOf2.g.cs @@ -0,0 +1,86 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public class OneOfJsonConverter : global::System.Text.Json.Serialization.JsonConverter> + { + /// + public override global::Ollama.OneOf Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + var + readerCopy = reader; + T1? value1 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + value1 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + + readerCopy = reader; + T2? value2 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + value2 = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + + var result = new global::Ollama.OneOf( + value1, + value2 + ); + + if (value1 != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + else if (value2 != null) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + _ = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + return result; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Ollama.OneOf value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsValue1) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T1).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value1, typeInfo); + } + else if (value.IsValue2) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(T2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(T2).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.Value2, typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.cs b/src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.cs index 2c8f65b..cb515e7 100644 --- a/src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.cs +++ b/src/libs/Ollama/Generated/Ollama.JsonSerializerContextTypes.g.cs @@ -46,11 +46,11 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Ollama.ResponseFormat? Type5 { get; set; } + public global::Ollama.OneOf? Type5 { get; set; } /// /// /// - public global::Ollama.ResponseFormatEnum? Type6 { get; set; } + public global::Ollama.GenerateCompletionRequestFormatEnum? Type6 { get; set; } /// /// /// @@ -74,202 +74,238 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Ollama.VersionResponse? Type12 { get; set; } + public global::Ollama.OneOf? Type12 { get; set; } /// /// /// - public global::Ollama.GenerateCompletionResponse? Type13 { get; set; } + public global::Ollama.GenerateCompletionRequestThink? Type13 { get; set; } /// /// /// - public global::System.DateTime? Type14 { get; set; } + public global::Ollama.ResponseFormat? Type14 { get; set; } /// /// /// - public global::Ollama.GenerateChatCompletionRequest? Type15 { get; set; } + public global::Ollama.ResponseFormatEnum? Type15 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type16 { get; set; } + public global::Ollama.VersionResponse? Type16 { get; set; } /// /// /// - public global::Ollama.Message? Type17 { get; set; } + public global::Ollama.GenerateCompletionResponse? Type17 { get; set; } /// /// /// - public global::Ollama.MessageRole? Type18 { get; set; } + public global::System.DateTime? Type18 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type19 { get; set; } + public global::Ollama.GenerateChatCompletionRequest? Type19 { get; set; } /// /// /// - public global::Ollama.ToolCall? Type20 { get; set; } + public global::System.Collections.Generic.IList? Type20 { get; set; } /// /// /// - public global::Ollama.ToolCallFunction? Type21 { get; set; } + public global::Ollama.Message? Type21 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type22 { get; set; } + public global::Ollama.MessageRole? Type22 { get; set; } /// /// /// - public global::Ollama.Tool? Type23 { get; set; } + public global::System.Collections.Generic.IList? Type23 { get; set; } /// /// /// - public global::Ollama.ToolType? Type24 { get; set; } + public global::Ollama.ToolCall? Type24 { get; set; } /// /// /// - public global::Ollama.ToolFunction? Type25 { get; set; } + public global::Ollama.ToolCallFunction? Type25 { get; set; } /// /// /// - public global::Ollama.GenerateChatCompletionResponse? Type26 { get; set; } + public global::Ollama.OneOf? Type26 { get; set; } /// /// /// - public global::Ollama.DoneReason? Type27 { get; set; } + public global::Ollama.GenerateChatCompletionRequestFormatEnum? Type27 { get; set; } /// /// /// - public global::Ollama.DoneReasonEnum? Type28 { get; set; } + public global::System.Collections.Generic.IList? Type28 { get; set; } /// /// /// - public global::Ollama.GenerateEmbeddingRequest? Type29 { get; set; } + public global::Ollama.Tool? Type29 { get; set; } /// /// /// - public global::Ollama.GenerateEmbeddingResponse? Type30 { get; set; } + public global::Ollama.ToolType? Type30 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type31 { get; set; } + public global::Ollama.ToolFunction? Type31 { get; set; } /// /// /// - public double? Type32 { get; set; } + public global::Ollama.OneOf? Type32 { get; set; } /// /// /// - public global::Ollama.CreateModelRequest? Type33 { get; set; } + public global::Ollama.GenerateChatCompletionRequestThink? Type33 { get; set; } /// /// /// - public global::Ollama.CreateModelResponse? Type34 { get; set; } + public global::Ollama.GenerateChatCompletionResponse? Type34 { get; set; } /// /// /// - public global::Ollama.CreateModelStatus? Type35 { get; set; } + public global::Ollama.DoneReason? Type35 { get; set; } /// /// /// - public global::Ollama.CreateModelStatusEnum? Type36 { get; set; } + public global::Ollama.DoneReasonEnum? Type36 { get; set; } /// /// /// - public global::Ollama.ModelsResponse? Type37 { get; set; } + public global::Ollama.GenerateEmbeddingRequest? Type37 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type38 { get; set; } + public global::Ollama.GenerateEmbeddingResponse? Type38 { get; set; } /// /// /// - public global::Ollama.Model? Type39 { get; set; } + public global::System.Collections.Generic.IList? Type39 { get; set; } /// /// /// - public global::Ollama.ModelDetails? Type40 { get; set; } + public double? Type40 { get; set; } /// /// /// - public global::Ollama.ModelInformation? Type41 { get; set; } + public global::Ollama.CreateModelRequest? Type41 { get; set; } /// /// /// - public global::Ollama.Tensor? Type42 { get; set; } + public global::System.Collections.Generic.Dictionary? Type42 { get; set; } /// /// /// - public global::Ollama.Capability? Type43 { get; set; } + public global::Ollama.CreateModelResponse? Type43 { get; set; } /// /// /// - public global::Ollama.ProcessResponse? Type44 { get; set; } + public global::Ollama.CreateModelStatus? Type44 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type45 { get; set; } + public global::Ollama.CreateModelStatusEnum? Type45 { get; set; } /// /// /// - public global::Ollama.ProcessModel? Type46 { get; set; } + public global::Ollama.ModelsResponse? Type46 { get; set; } /// /// /// - public global::Ollama.ModelInfoRequest? Type47 { get; set; } + public global::System.Collections.Generic.IList? Type47 { get; set; } /// /// /// - public global::Ollama.ModelInfo? Type48 { get; set; } + public global::Ollama.Model? Type48 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type49 { get; set; } + public global::Ollama.ModelDetails? Type49 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type50 { get; set; } + public global::Ollama.ModelInformation? Type50 { get; set; } /// /// /// - public global::Ollama.CopyModelRequest? Type51 { get; set; } + public global::Ollama.Tensor? Type51 { get; set; } /// /// /// - public global::Ollama.DeleteModelRequest? Type52 { get; set; } + public global::Ollama.Capability? Type52 { get; set; } /// /// /// - public global::Ollama.PullModelRequest? Type53 { get; set; } + public global::Ollama.ProcessResponse? Type53 { get; set; } /// /// /// - public global::Ollama.PullModelResponse? Type54 { get; set; } + public global::System.Collections.Generic.IList? Type54 { get; set; } /// /// /// - public global::Ollama.PullModelStatus? Type55 { get; set; } + public global::Ollama.ProcessModel? Type55 { get; set; } /// /// /// - public global::Ollama.PullModelStatusEnum? Type56 { get; set; } + public global::Ollama.ModelInfoRequest? Type56 { get; set; } /// /// /// - public global::Ollama.PushModelRequest? Type57 { get; set; } + public global::Ollama.ModelInfo? Type57 { get; set; } /// /// /// - public global::Ollama.PushModelResponse? Type58 { get; set; } + public global::System.Collections.Generic.IList? Type58 { get; set; } /// /// /// - public global::Ollama.AnyOf? Type59 { get; set; } + public global::System.Collections.Generic.IList? Type59 { get; set; } /// /// /// - public global::Ollama.PushModelResponseStatus? Type60 { get; set; } + public global::Ollama.CopyModelRequest? Type60 { get; set; } /// /// /// - public byte[]? Type61 { get; set; } + public global::Ollama.DeleteModelRequest? Type61 { get; set; } + /// + /// + /// + public global::Ollama.PullModelRequest? Type62 { get; set; } + /// + /// + /// + public global::Ollama.PullModelResponse? Type63 { get; set; } + /// + /// + /// + public global::Ollama.PullModelStatus? Type64 { get; set; } + /// + /// + /// + public global::Ollama.PullModelStatusEnum? Type65 { get; set; } + /// + /// + /// + public global::Ollama.PushModelRequest? Type66 { get; set; } + /// + /// + /// + public global::Ollama.PushModelResponse? Type67 { get; set; } + /// + /// + /// + public global::Ollama.AnyOf? Type68 { get; set; } + /// + /// + /// + public global::Ollama.PushModelResponseStatus? Type69 { get; set; } + /// + /// + /// + public byte[]? Type70 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs index 54b6595..de058a4 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequest.g.cs @@ -24,8 +24,7 @@ public sealed partial class CreateModelRequest /// /// 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; } + public string? Modelfile { get; set; } /// /// Path to the Modelfile (optional) @@ -46,6 +45,42 @@ public sealed partial class CreateModelRequest [global::System.Text.Json.Serialization.JsonPropertyName("stream")] public bool? Stream { get; set; } + /// + /// Name of the model or file to use as the source + /// + [global::System.Text.Json.Serialization.JsonPropertyName("from")] + public string? From { get; set; } + + /// + /// Map of files to include when creating the model + /// + [global::System.Text.Json.Serialization.JsonPropertyName("files")] + public global::System.Collections.Generic.Dictionary? Files { get; set; } + + /// + /// Map of LoRA adapters to include when creating the model + /// + [global::System.Text.Json.Serialization.JsonPropertyName("adapters")] + public global::System.Collections.Generic.Dictionary? Adapters { get; set; } + + /// + /// Template used when constructing a request to the model + /// + [global::System.Text.Json.Serialization.JsonPropertyName("template")] + public string? Template { get; set; } + + /// + /// System prompt for the model + /// + [global::System.Text.Json.Serialization.JsonPropertyName("system")] + public string? System { get; set; } + + /// + /// Map of hyper-parameters which are applied to the model + /// + [global::System.Text.Json.Serialization.JsonPropertyName("parameters")] + public object? Parameters { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -74,21 +109,51 @@ public sealed partial class CreateModelRequest /// 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 /// + /// + /// Name of the model or file to use as the source + /// + /// + /// Map of files to include when creating the model + /// + /// + /// Map of LoRA adapters to include when creating the model + /// + /// + /// Template used when constructing a request to the model + /// + /// + /// System prompt for the model + /// + /// + /// Map of hyper-parameters which are applied to the model + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public CreateModelRequest( string model, - string modelfile, + string? modelfile, string? path, string? quantize, - bool? stream) + bool? stream, + string? from, + global::System.Collections.Generic.Dictionary? files, + global::System.Collections.Generic.Dictionary? adapters, + string? template, + string? system, + object? parameters) { this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); - this.Modelfile = modelfile ?? throw new global::System.ArgumentNullException(nameof(modelfile)); + this.Modelfile = modelfile; this.Path = path; this.Quantize = quantize; this.Stream = stream; + this.From = from; + this.Files = files; + this.Adapters = adapters; + this.Template = template; + this.System = system; + this.Parameters = parameters; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.Json.g.cs new file mode 100644 index 0000000..d755f19 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CreateModelRequestAdapters + { + /// + /// 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.CreateModelRequestAdapters? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelRequestAdapters), + jsonSerializerContext) as global::Ollama.CreateModelRequestAdapters; + } + + /// + /// 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.CreateModelRequestAdapters? 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.CreateModelRequestAdapters), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelRequestAdapters; + } + + /// + /// 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.CreateModelRequestAdapters.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.g.cs new file mode 100644 index 0000000..e87e339 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestAdapters.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Map of LoRA adapters to include when creating the model + /// + public sealed partial class CreateModelRequestAdapters + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.Json.g.cs new file mode 100644 index 0000000..cd91dc8 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CreateModelRequestFiles + { + /// + /// 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.CreateModelRequestFiles? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelRequestFiles), + jsonSerializerContext) as global::Ollama.CreateModelRequestFiles; + } + + /// + /// 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.CreateModelRequestFiles? 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.CreateModelRequestFiles), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelRequestFiles; + } + + /// + /// 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.CreateModelRequestFiles.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.g.cs new file mode 100644 index 0000000..3b1a9f3 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestFiles.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Map of files to include when creating the model + /// + public sealed partial class CreateModelRequestFiles + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.Json.g.cs new file mode 100644 index 0000000..8646359 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class CreateModelRequestParameters + { + /// + /// 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.CreateModelRequestParameters? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.CreateModelRequestParameters), + jsonSerializerContext) as global::Ollama.CreateModelRequestParameters; + } + + /// + /// 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.CreateModelRequestParameters? 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.CreateModelRequestParameters), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.CreateModelRequestParameters; + } + + /// + /// 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.CreateModelRequestParameters.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.g.cs new file mode 100644 index 0000000..c64c4e0 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelRequestParameters.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Map of hyper-parameters which are applied to the model + /// + public sealed partial class CreateModelRequestParameters + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs index dca3d45..aea1841 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs @@ -1,4 +1,6 @@ +#pragma warning disable CS0618 // Type or member is obsolete + #nullable enable namespace Ollama @@ -33,11 +35,13 @@ public sealed partial class GenerateChatCompletionRequest public bool? Stream { get; set; } /// - /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation ///
[global::System.Text.Json.Serialization.JsonPropertyName("format")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.ResponseFormatJsonConverter))] - public global::Ollama.ResponseFormat? Format { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.OneOfJsonConverter))] + public global::Ollama.OneOf? Format { get; set; } /// /// How long (in minutes) to keep the model loaded in memory.
@@ -62,13 +66,26 @@ public sealed partial class GenerateChatCompletionRequest public global::Ollama.RequestOptions? Options { get; set; } /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level ///
[global::System.Text.Json.Serialization.JsonPropertyName("think")] - public bool? Think { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.OneOfJsonConverter))] + public global::Ollama.OneOf? Think { get; set; } + + /// + /// Truncates the end of the chat history if it exceeds the context length + /// + [global::System.Text.Json.Serialization.JsonPropertyName("truncate")] + public bool? Truncate { get; set; } + + /// + /// Shifts the oldest messages out of the context window when the context limit is reached + /// + [global::System.Text.Json.Serialization.JsonPropertyName("shift")] + public bool? Shift { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -91,7 +108,11 @@ public sealed partial class GenerateChatCompletionRequest /// 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 /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -106,10 +127,16 @@ public sealed partial class GenerateChatCompletionRequest /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the chat history if it exceeds the context length + /// + /// + /// Shifts the oldest messages out of the context window when the context limit is reached /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] @@ -118,11 +145,13 @@ public GenerateChatCompletionRequest( string model, global::System.Collections.Generic.IList messages, bool? stream, - global::Ollama.ResponseFormat? format, + global::Ollama.OneOf? format, int? keepAlive, global::System.Collections.Generic.IList? tools, global::Ollama.RequestOptions? options, - bool? think) + global::Ollama.OneOf? think, + bool? truncate, + bool? shift) { this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); this.Messages = messages ?? throw new global::System.ArgumentNullException(nameof(messages)); @@ -132,6 +161,8 @@ public GenerateChatCompletionRequest( this.Tools = tools; this.Options = options; this.Think = think; + this.Truncate = truncate; + this.Shift = shift; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum.g.cs new file mode 100644 index 0000000..8ed1af3 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Enable JSON mode
+ /// Default Value: json + ///
+ public enum GenerateChatCompletionRequestFormatEnum + { + /// + /// + /// + Json, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateChatCompletionRequestFormatEnumExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateChatCompletionRequestFormatEnum value) + { + return value switch + { + GenerateChatCompletionRequestFormatEnum.Json => "json", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateChatCompletionRequestFormatEnum? ToEnum(string value) + { + return value switch + { + "json" => GenerateChatCompletionRequestFormatEnum.Json, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.Json.g.cs new file mode 100644 index 0000000..33a66e0 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateChatCompletionRequestFormatEnum2 + { + /// + /// 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.GenerateChatCompletionRequestFormatEnum2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateChatCompletionRequestFormatEnum2), + jsonSerializerContext) as global::Ollama.GenerateChatCompletionRequestFormatEnum2; + } + + /// + /// 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.GenerateChatCompletionRequestFormatEnum2? 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.GenerateChatCompletionRequestFormatEnum2), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateChatCompletionRequestFormatEnum2; + } + + /// + /// 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.GenerateChatCompletionRequestFormatEnum2.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.g.cs new file mode 100644 index 0000000..2db3a8e --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestFormatEnum2.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// JSON schema object for structured output validation + /// + public sealed partial class GenerateChatCompletionRequestFormatEnum2 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestThink.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestThink.g.cs new file mode 100644 index 0000000..e9b29f2 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequestThink.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// + /// + public enum GenerateChatCompletionRequestThink + { + /// + /// + /// + High, + /// + /// + /// + Medium, + /// + /// + /// + Low, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateChatCompletionRequestThinkExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateChatCompletionRequestThink value) + { + return value switch + { + GenerateChatCompletionRequestThink.High => "high", + GenerateChatCompletionRequestThink.Medium => "medium", + GenerateChatCompletionRequestThink.Low => "low", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateChatCompletionRequestThink? ToEnum(string value) + { + return value switch + { + "high" => GenerateChatCompletionRequestThink.High, + "medium" => GenerateChatCompletionRequestThink.Medium, + "low" => GenerateChatCompletionRequestThink.Low, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs index 29a5325..b775c40 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs @@ -96,6 +96,18 @@ public sealed partial class GenerateChatCompletionResponse [global::System.Text.Json.Serialization.JsonPropertyName("eval_duration")] public long? EvalDuration { get; set; } + /// + /// Name of the upstream remote model that generated the response (when using federated models) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_model")] + public string? RemoteModel { get; set; } + + /// + /// URL of the upstream Ollama host that served the request (when proxying to remote instances) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_host")] + public string? RemoteHost { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -147,6 +159,12 @@ public sealed partial class GenerateChatCompletionResponse /// Time in nanoseconds spent generating the response.
/// Example: 1325948000L /// + /// + /// Name of the upstream remote model that generated the response (when using federated models) + /// + /// + /// URL of the upstream Ollama host that served the request (when proxying to remote instances) + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -161,7 +179,9 @@ public GenerateChatCompletionResponse( int? promptEvalCount, long? promptEvalDuration, int? evalCount, - long? evalDuration) + long? evalDuration, + string? remoteModel, + string? remoteHost) { this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); @@ -174,6 +194,8 @@ public GenerateChatCompletionResponse( this.PromptEvalDuration = promptEvalDuration; this.EvalCount = evalCount; this.EvalDuration = evalDuration; + this.RemoteModel = remoteModel; + this.RemoteHost = remoteHost; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs index 8c523e2..13658c2 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs @@ -1,4 +1,6 @@ +#pragma warning disable CS0618 // Type or member is obsolete + #nullable enable namespace Ollama @@ -59,18 +61,20 @@ public sealed partial class GenerateCompletionRequest public bool? Stream { get; set; } /// - /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// 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. ///
[global::System.Text.Json.Serialization.JsonPropertyName("raw")] public bool? Raw { get; set; } /// - /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation ///
[global::System.Text.Json.Serialization.JsonPropertyName("format")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.ResponseFormatJsonConverter))] - public global::Ollama.ResponseFormat? Format { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.OneOfJsonConverter))] + public global::Ollama.OneOf? Format { get; set; } /// /// How long (in minutes) to keep the model loaded in memory.
@@ -95,13 +99,26 @@ public sealed partial class GenerateCompletionRequest public global::Ollama.RequestOptions? Options { get; set; } /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level ///
[global::System.Text.Json.Serialization.JsonPropertyName("think")] - public bool? Think { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.OneOfJsonConverter))] + public global::Ollama.OneOf? Think { get; set; } + + /// + /// Truncates the end of the prompt if it exceeds the context length + /// + [global::System.Text.Json.Serialization.JsonPropertyName("truncate")] + public bool? Truncate { get; set; } + + /// + /// Shifts the oldest parts out of the context window when the context limit is reached + /// + [global::System.Text.Json.Serialization.JsonPropertyName("shift")] + public bool? Shift { get; set; } /// /// Additional properties that are not explicitly defined in the schema @@ -138,10 +155,14 @@ public sealed partial class GenerateCompletionRequest /// Default Value: true /// /// - /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// 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. /// - /// + /// + /// The format to return a response in. Can be:
+ /// - "json" string to enable JSON mode
+ /// - JSON schema object for structured output validation + /// /// /// 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.
@@ -156,10 +177,16 @@ public sealed partial class GenerateCompletionRequest /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. /// /// - /// Think controls whether thinking/reasoning models will think before
- /// responding. Needs to be a pointer so we can distinguish between false
- /// (request that thinking _not_ be used) and unset (use the old behavior
- /// before this option was introduced). + /// Controls whether thinking/reasoning models will think before responding.
+ /// Can be:
+ /// - boolean: true/false to enable/disable thinking
+ /// - string: "high", "medium", "low" to set thinking intensity level + /// + /// + /// Truncates the end of the prompt if it exceeds the context length + /// + /// + /// Shifts the oldest parts out of the context window when the context limit is reached /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] @@ -173,11 +200,13 @@ public GenerateCompletionRequest( global::System.Collections.Generic.IList? context, bool? stream, bool? raw, - global::Ollama.ResponseFormat? format, + global::Ollama.OneOf? format, int? keepAlive, global::System.Collections.Generic.IList? images, global::Ollama.RequestOptions? options, - bool? think) + global::Ollama.OneOf? think, + bool? truncate, + bool? shift) { this.Model = model ?? throw new global::System.ArgumentNullException(nameof(model)); this.Prompt = prompt ?? throw new global::System.ArgumentNullException(nameof(prompt)); @@ -192,6 +221,8 @@ public GenerateCompletionRequest( this.Images = images; this.Options = options; this.Think = think; + this.Truncate = truncate; + this.Shift = shift; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum.g.cs new file mode 100644 index 0000000..e9663af --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Enable JSON mode
+ /// Default Value: json + ///
+ public enum GenerateCompletionRequestFormatEnum + { + /// + /// + /// + Json, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateCompletionRequestFormatEnumExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateCompletionRequestFormatEnum value) + { + return value switch + { + GenerateCompletionRequestFormatEnum.Json => "json", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateCompletionRequestFormatEnum? ToEnum(string value) + { + return value switch + { + "json" => GenerateCompletionRequestFormatEnum.Json, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.Json.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.Json.g.cs new file mode 100644 index 0000000..ea655c7 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public sealed partial class GenerateCompletionRequestFormatEnum2 + { + /// + /// 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.GenerateCompletionRequestFormatEnum2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.GenerateCompletionRequestFormatEnum2), + jsonSerializerContext) as global::Ollama.GenerateCompletionRequestFormatEnum2; + } + + /// + /// 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.GenerateCompletionRequestFormatEnum2? 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.GenerateCompletionRequestFormatEnum2), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.GenerateCompletionRequestFormatEnum2; + } + + /// + /// 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.GenerateCompletionRequestFormatEnum2.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.g.cs new file mode 100644 index 0000000..5a78708 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestFormatEnum2.g.cs @@ -0,0 +1,18 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// JSON schema object for structured output validation + /// + public sealed partial class GenerateCompletionRequestFormatEnum2 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestThink.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestThink.g.cs new file mode 100644 index 0000000..caa6de8 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequestThink.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// + /// + public enum GenerateCompletionRequestThink + { + /// + /// + /// + High, + /// + /// + /// + Medium, + /// + /// + /// + Low, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class GenerateCompletionRequestThinkExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this GenerateCompletionRequestThink value) + { + return value switch + { + GenerateCompletionRequestThink.High => "high", + GenerateCompletionRequestThink.Medium => "medium", + GenerateCompletionRequestThink.Low => "low", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static GenerateCompletionRequestThink? ToEnum(string value) + { + return value switch + { + "high" => GenerateCompletionRequestThink.High, + "medium" => GenerateCompletionRequestThink.Medium, + "low" => GenerateCompletionRequestThink.Low, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs index 0130764..3c7a035 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionResponse.g.cs @@ -101,6 +101,18 @@ public sealed partial class GenerateCompletionResponse [global::System.Text.Json.Serialization.JsonPropertyName("eval_duration")] public long? EvalDuration { get; set; } + /// + /// Name of the upstream remote model that generated the response (when using federated models) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_model")] + public string? RemoteModel { get; set; } + + /// + /// URL of the upstream Ollama host that served the request (when proxying to remote instances) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_host")] + public string? RemoteHost { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -157,6 +169,12 @@ public sealed partial class GenerateCompletionResponse /// Time in nanoseconds spent generating the response.
/// Example: 1325948000L /// + /// + /// Name of the upstream remote model that generated the response (when using federated models) + /// + /// + /// URL of the upstream Ollama host that served the request (when proxying to remote instances) + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -172,7 +190,9 @@ public GenerateCompletionResponse( int? promptEvalCount, long? promptEvalDuration, int? evalCount, - long? evalDuration) + long? evalDuration, + string? remoteModel, + string? remoteHost) { this.Model = model; this.CreatedAt = createdAt; @@ -186,6 +206,8 @@ public GenerateCompletionResponse( this.PromptEvalDuration = promptEvalDuration; this.EvalCount = evalCount; this.EvalDuration = evalDuration; + this.RemoteModel = remoteModel; + this.RemoteHost = remoteHost; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs index d4d546a..5c3f40b 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs @@ -43,6 +43,12 @@ public sealed partial class Message [global::System.Text.Json.Serialization.JsonPropertyName("tool_calls")] public global::System.Collections.Generic.IList? ToolCalls { get; set; } + /// + /// The name of the tool when role is "tool" (used in tool response messages) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("tool_name")] + public string? ToolName { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -68,6 +74,9 @@ public sealed partial class Message /// /// A list of tools the model wants to call. /// + /// + /// The name of the tool when role is "tool" (used in tool response messages) + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -76,13 +85,15 @@ public Message( string content, string? thinking, global::System.Collections.Generic.IList? images, - global::System.Collections.Generic.IList? toolCalls) + global::System.Collections.Generic.IList? toolCalls, + string? toolName) { this.Role = role; this.Content = content ?? throw new global::System.ArgumentNullException(nameof(content)); this.Thinking = thinking; this.Images = images; this.ToolCalls = toolCalls; + this.ToolName = toolName; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs index d3c5e8e..45b0a56 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Model.g.cs @@ -45,6 +45,18 @@ public sealed partial class Model [global::System.Text.Json.Serialization.JsonPropertyName("details")] public global::Ollama.ModelDetails? Details { get; set; } + /// + /// Name of the upstream remote model (when model is federated from another Ollama instance) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_model")] + public string? RemoteModel { get; set; } + + /// + /// URL of the upstream Ollama host (when model is federated from another instance) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_host")] + public string? RemoteHost { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -73,6 +85,12 @@ public sealed partial class Model /// /// Details about a model. /// + /// + /// Name of the upstream remote model (when model is federated from another Ollama instance) + /// + /// + /// URL of the upstream Ollama host (when model is federated from another instance) + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -81,13 +99,17 @@ public Model( global::System.DateTime? modifiedAt, long? size, string? digest, - global::Ollama.ModelDetails? details) + global::Ollama.ModelDetails? details, + string? remoteModel, + string? remoteHost) { this.Model1 = model1; this.ModifiedAt = modifiedAt; this.Size = size; this.Digest = digest; this.Details = details; + this.RemoteModel = remoteModel; + this.RemoteHost = remoteHost; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs index cd13588..ecaef85 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ModelInfo.g.cs @@ -88,6 +88,18 @@ public sealed partial class ModelInfo [global::System.Text.Json.Serialization.JsonPropertyName("modified_at")] public global::System.DateTime? ModifiedAt { get; set; } + /// + /// Name of the upstream remote model (when model is federated from another Ollama instance) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_model")] + public string? RemoteModel { get; set; } + + /// + /// URL of the upstream Ollama host (when model is federated from another instance) + /// + [global::System.Text.Json.Serialization.JsonPropertyName("remote_host")] + public string? RemoteHost { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -137,6 +149,12 @@ public sealed partial class ModelInfo /// /// Date on which a model was created. /// + /// + /// Name of the upstream remote model (when model is federated from another Ollama instance) + /// + /// + /// URL of the upstream Ollama host (when model is federated from another instance) + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif @@ -152,7 +170,9 @@ public ModelInfo( object? projectorInfo, global::System.Collections.Generic.IList? tensors, global::System.Collections.Generic.IList? capabilities, - global::System.DateTime? modifiedAt) + global::System.DateTime? modifiedAt, + string? remoteModel, + string? remoteHost) { this.License = license; this.Modelfile = modelfile; @@ -166,6 +186,8 @@ public ModelInfo( this.Tensors = tensors; this.Capabilities = capabilities; this.ModifiedAt = modifiedAt; + this.RemoteModel = remoteModel; + this.RemoteHost = remoteHost; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs index fbcdb61..68373d8 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.ToolCallFunction.g.cs @@ -22,6 +22,12 @@ public sealed partial class ToolCallFunction [global::System.Text.Json.Serialization.JsonRequired] public required object Arguments { get; set; } + /// + /// The index of the tool call in the list of tool calls + /// + [global::System.Text.Json.Serialization.JsonPropertyName("index")] + public int? Index { get; set; } + /// /// Additional properties that are not explicitly defined in the schema /// @@ -37,15 +43,20 @@ public sealed partial class ToolCallFunction /// /// The arguments to pass to the function. /// + /// + /// The index of the tool call in the list of tool calls + /// #if NET7_0_OR_GREATER [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] #endif public ToolCallFunction( string name, - object arguments) + object arguments, + int? index) { this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); this.Arguments = arguments ?? throw new global::System.ArgumentNullException(nameof(arguments)); + this.Index = index; } /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs index 99fb8bc..68988cf 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs @@ -130,14 +130,38 @@ partial void ProcessCreateModelResponse( /// 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 /// + /// + /// Name of the model or file to use as the source + /// + /// + /// Map of files to include when creating the model + /// + /// + /// Map of LoRA adapters to include when creating the model + /// + /// + /// Template used when constructing a request to the model + /// + /// + /// System prompt for the model + /// + /// + /// Map of hyper-parameters which are applied to the model + /// /// The token to cancel the operation with /// public async global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( string model, - string modelfile, + string? modelfile = default, string? path = default, string? quantize = default, bool? stream = default, + string? from = default, + global::System.Collections.Generic.Dictionary? files = default, + global::System.Collections.Generic.Dictionary? adapters = default, + string? template = default, + string? system = default, + object? parameters = default, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { var __request = new global::Ollama.CreateModelRequest @@ -147,6 +171,12 @@ partial void ProcessCreateModelResponse( Path = path, Quantize = quantize, Stream = stream, + From = from, + Files = files, + Adapters = adapters, + Template = template, + System = system, + Parameters = parameters, }; var __enumerable = CreateModelAsync( diff --git a/src/libs/Ollama/Generated/OneOf.2.Json.g.cs b/src/libs/Ollama/Generated/OneOf.2.Json.g.cs new file mode 100644 index 0000000..73dbad8 --- /dev/null +++ b/src/libs/Ollama/Generated/OneOf.2.Json.g.cs @@ -0,0 +1,92 @@ +#nullable enable + +namespace Ollama +{ + public readonly partial struct OneOf + { + /// + /// 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.OneOf? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Ollama.OneOf), + jsonSerializerContext) as global::Ollama.OneOf?; + } + + /// + /// 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.OneOf? 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.OneOf), + jsonSerializerContext).ConfigureAwait(false)) as global::Ollama.OneOf?; + } + + /// + /// 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/OneOf.2.g.cs b/src/libs/Ollama/Generated/OneOf.2.g.cs new file mode 100644 index 0000000..c881c07 --- /dev/null +++ b/src/libs/Ollama/Generated/OneOf.2.g.cs @@ -0,0 +1,221 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// + /// + public readonly partial struct OneOf : global::System.IEquatable> + { + /// + /// + /// +#if NET6_0_OR_GREATER + public T1? Value1 { get; init; } +#else + public T1? Value1 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value1))] +#endif + public bool IsValue1 => Value1 != null; + + /// + /// + /// + public static implicit operator OneOf(T1 value) => new OneOf((T1?)value); + + /// + /// + /// + public static implicit operator T1?(OneOf @this) => @this.Value1; + + /// + /// + /// + public OneOf(T1? value) + { + Value1 = value; + } + + /// + /// + /// +#if NET6_0_OR_GREATER + public T2? Value2 { get; init; } +#else + public T2? Value2 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Value2))] +#endif + public bool IsValue2 => Value2 != null; + + /// + /// + /// + public static implicit operator OneOf(T2 value) => new OneOf((T2?)value); + + /// + /// + /// + public static implicit operator T2?(OneOf @this) => @this.Value2; + + /// + /// + /// + public OneOf(T2? value) + { + Value2 = value; + } + + /// + /// + /// + public OneOf( + T1? value1, + T2? value2 + ) + { + Value1 = value1; + Value2 = value2; + } + + /// + /// + /// + public object? Object => + Value2 as object ?? + Value1 as object + ; + + /// + /// + /// + public override string? ToString() => + Value1?.ToString() ?? + Value2?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsValue1 && !IsValue2 || !IsValue1 && IsValue2; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? value1 = null, + global::System.Func? value2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1 && value1 != null) + { + return value1(Value1!); + } + else if (IsValue2 && value2 != null) + { + return value2(Value2!); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? value1 = null, + global::System.Action? value2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (IsValue1) + { + value1?.Invoke(Value1!); + } + else if (IsValue2) + { + value2?.Invoke(Value2!); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Value1, + typeof(T1), + Value2, + typeof(T2), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(OneOf other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value1, other.Value1) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Value2, other.Value2) + ; + } + + /// + /// + /// + public static bool operator ==(OneOf obj1, OneOf obj2) + { + return global::System.Collections.Generic.EqualityComparer>.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(OneOf obj1, OneOf obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is OneOf o && Equals(o); + } + } +} diff --git a/src/libs/Ollama/openapi.yaml b/src/libs/Ollama/openapi.yaml index 6f8b007..acf9699 100644 --- a/src/libs/Ollama/openapi.yaml +++ b/src/libs/Ollama/openapi.yaml @@ -284,9 +284,18 @@ components: default: true raw: type: boolean - description: "If `true` no formatting will be applied to the prompt and no context will be returned. \n\nYou 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.\n" + description: "If `true` no formatting will be applied to the prompt and no context will be returned.\n\nYou 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.\n" format: - $ref: '#/components/schemas/ResponseFormat' + oneOf: + - enum: + - json + type: string + description: Enable JSON mode + default: json + - type: object + description: JSON schema object for structured output validation + description: "The format to return a response in. Can be:\n- \"json\" string to enable JSON mode\n- JSON schema object for structured output validation\n" + nullable: true keep_alive: type: integer description: "How long (in minutes) to keep the model loaded in memory.\n\n- If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.\n- If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.\n- If set to 0, the model will be unloaded immediately once finished.\n- If not set, the model will stay loaded for 5 minutes by default\n" @@ -301,8 +310,22 @@ components: options: $ref: '#/components/schemas/RequestOptions' think: + oneOf: + - type: boolean + - enum: + - high + - medium + - low + type: string + description: "Controls whether thinking/reasoning models will think before responding.\nCan be:\n- boolean: true/false to enable/disable thinking\n- string: \"high\", \"medium\", \"low\" to set thinking intensity level\n" + nullable: true + truncate: + type: boolean + description: Truncates the end of the prompt if it exceeds the context length + nullable: true + shift: type: boolean - description: "Think controls whether thinking/reasoning models will think before\nresponding. Needs to be a pointer so we can distinguish between false\n(request that thinking _not_ be used) and unset (use the old behavior\nbefore this option was introduced).\n" + description: Shifts the oldest parts out of the context window when the context limit is reached nullable: true description: Request class for the generate endpoint. RequestOptions: @@ -517,6 +540,14 @@ components: description: Time in nanoseconds spent generating the response. format: int64 example: 1325948000 + remote_model: + type: string + description: Name of the upstream remote model that generated the response (when using federated models) + nullable: true + remote_host: + type: string + description: URL of the upstream Ollama host that served the request (when proxying to remote instances) + nullable: true description: The response class for the generate endpoint. GenerateChatCompletionRequest: required: @@ -538,7 +569,16 @@ components: description: "If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.\n" default: true format: - $ref: '#/components/schemas/ResponseFormat' + oneOf: + - enum: + - json + type: string + description: Enable JSON mode + default: json + - type: object + description: JSON schema object for structured output validation + description: "The format to return a response in. Can be:\n- \"json\" string to enable JSON mode\n- JSON schema object for structured output validation\n" + nullable: true keep_alive: type: integer description: "How long (in minutes) to keep the model loaded in memory.\n\n- If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.\n- If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.\n- If set to 0, the model will be unloaded immediately once finished.\n- If not set, the model will stay loaded for 5 minutes by default\n" @@ -551,8 +591,22 @@ components: options: $ref: '#/components/schemas/RequestOptions' think: + oneOf: + - type: boolean + - enum: + - high + - medium + - low + type: string + description: "Controls whether thinking/reasoning models will think before responding.\nCan be:\n- boolean: true/false to enable/disable thinking\n- string: \"high\", \"medium\", \"low\" to set thinking intensity level\n" + nullable: true + truncate: type: boolean - description: "Think controls whether thinking/reasoning models will think before\nresponding. Needs to be a pointer so we can distinguish between false\n(request that thinking _not_ be used) and unset (use the old behavior\nbefore this option was introduced).\n" + description: Truncates the end of the chat history if it exceeds the context length + nullable: true + shift: + type: boolean + description: Shifts the oldest messages out of the context window when the context limit is reached nullable: true description: Request class for the chat endpoint. GenerateChatCompletionResponse: @@ -608,6 +662,14 @@ components: description: Time in nanoseconds spent generating the response. format: int64 example: 1325948000 + remote_model: + type: string + description: Name of the upstream remote model that generated the response (when using federated models) + nullable: true + remote_host: + type: string + description: URL of the upstream Ollama host that served the request (when proxying to remote instances) + nullable: true description: The response class for the chat endpoint. DoneReason: anyOf: @@ -651,6 +713,10 @@ components: items: $ref: '#/components/schemas/ToolCall' description: A list of tools the model wants to call. + tool_name: + type: string + description: The name of the tool when role is "tool" (used in tool response messages) + nullable: true description: A message in the chat endpoint Tool: type: object @@ -700,6 +766,9 @@ components: description: The name of the function to be called. arguments: $ref: '#/components/schemas/ToolCallFunctionArgs' + index: + type: integer + description: The index of the tool call in the list of tool calls description: The function the model wants to call. ToolCallFunctionArgs: type: object @@ -742,7 +811,6 @@ components: CreateModelRequest: required: - model - - modelfile type: object properties: model: @@ -752,6 +820,7 @@ components: modelfile: type: string description: The contents of the Modelfile. + nullable: true example: FROM llama3\nSYSTEM You are mario from Super Mario Bros. path: type: string @@ -764,6 +833,34 @@ components: type: boolean description: "If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.\n" default: true + from: + type: string + description: Name of the model or file to use as the source + nullable: true + files: + type: object + additionalProperties: + type: string + description: Map of files to include when creating the model + nullable: true + adapters: + type: object + additionalProperties: + type: string + description: Map of LoRA adapters to include when creating the model + nullable: true + template: + type: string + description: Template used when constructing a request to the model + nullable: true + system: + type: string + description: System prompt for the model + nullable: true + parameters: + type: object + description: Map of hyper-parameters which are applied to the model + nullable: true description: Create model request object. CreateModelResponse: type: object @@ -812,6 +909,14 @@ components: example: sha256:bc07c81de745696fdf5afca05e065818a8149fb0c77266fb584d9b2cba3711a details: $ref: '#/components/schemas/ModelDetails' + remote_model: + type: string + description: Name of the upstream remote model (when model is federated from another Ollama instance) + nullable: true + remote_host: + type: string + description: URL of the upstream Ollama host (when model is federated from another instance) + nullable: true description: A model available locally. ModelDetails: type: object @@ -987,6 +1092,14 @@ components: description: Date on which a model was created. format: date-time example: '2023-08-04T19:22:45.4991270+00:00' + remote_model: + type: string + description: Name of the upstream remote model (when model is federated from another Ollama instance) + nullable: true + remote_host: + type: string + description: URL of the upstream Ollama host (when model is federated from another instance) + nullable: true description: 'Details about a model including modelfile, template, parameters, license, and system prompt.' CopyModelRequest: required: