From f00eb70e9cccbd9605d94961084c0f65d7fe26e9 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Sun, 15 Sep 2024 07:19:28 +0400 Subject: [PATCH] feat: Use AutoSDK. --- src/libs/Ollama/Generated/AnyOf.2.g.cs | 2 +- .../Generated/JsonConverters.AnyOf2.g.cs | 10 +-- .../JsonConverters.AnyOfFactory2.g.cs | 4 +- .../JsonConverters.CreateModelStatus.g.cs | 2 +- .../JsonConverters.CreateModelStatusEnum.g.cs | 2 +- ...verters.CreateModelStatusEnumNullable.g.cs | 2 +- .../Generated/JsonConverters.DoneReason.g.cs | 2 +- .../JsonConverters.DoneReasonEnum.g.cs | 2 +- ...JsonConverters.DoneReasonEnumNullable.g.cs | 2 +- .../Generated/JsonConverters.MessageRole.g.cs | 2 +- .../JsonConverters.MessageRoleNullable.g.cs | 2 +- .../JsonConverters.PullModelStatus.g.cs | 2 +- .../JsonConverters.PullModelStatusEnum.g.cs | 2 +- ...onverters.PullModelStatusEnumNullable.g.cs | 2 +- ...sonConverters.PushModelResponseStatus.g.cs | 2 +- ...rters.PushModelResponseStatusNullable.g.cs | 2 +- .../JsonConverters.ResponseFormat.g.cs | 2 +- ...JsonConverters.ResponseFormatNullable.g.cs | 2 +- .../Generated/JsonConverters.ToolType.g.cs | 2 +- .../JsonConverters.ToolTypeNullable.g.cs | 2 +- .../JsonConverters.UnixTimestamp.g.cs | 39 +++++++++ .../Generated/JsonSerializerContext.g.cs | 36 ++++---- .../Generated/JsonSerializerContextTypes.g.cs | 2 +- ...ama.ChatClient.GenerateChatCompletion.g.cs | 4 +- .../Ollama/Generated/Ollama.ChatClient.g.cs | 10 ++- ....CompletionsClient.GenerateCompletion.g.cs | 4 +- .../Generated/Ollama.CompletionsClient.g.cs | 10 ++- ...ma.EmbeddingsClient.GenerateEmbedding.g.cs | 4 +- .../Generated/Ollama.EmbeddingsClient.g.cs | 10 ++- ...ma.IChatClient.GenerateChatCompletion.g.cs | 64 ++++++++++++++ .../Ollama/Generated/Ollama.IChatClient.g.cs | 20 +++++ ...ICompletionsClient.GenerateCompletion.g.cs | 86 +++++++++++++++++++ .../Generated/Ollama.ICompletionsClient.g.cs | 20 +++++ ...a.IEmbeddingsClient.GenerateEmbedding.g.cs | 48 +++++++++++ .../Generated/Ollama.IEmbeddingsClient.g.cs | 20 +++++ .../Ollama.IModelsClient.CheckBlob.g.cs | 18 ++++ .../Ollama.IModelsClient.CopyModel.g.cs | 35 ++++++++ .../Ollama.IModelsClient.CreateBlob.g.cs | 29 +++++++ .../Ollama.IModelsClient.CreateModel.g.cs | 51 +++++++++++ .../Ollama.IModelsClient.DeleteModel.g.cs | 31 +++++++ .../Ollama.IModelsClient.ListModels.g.cs | 15 ++++ ...llama.IModelsClient.ListRunningModels.g.cs | 15 ++++ .../Ollama.IModelsClient.PullModel.g.cs | 52 +++++++++++ .../Ollama.IModelsClient.PushModel.g.cs | 51 +++++++++++ .../Ollama.IModelsClient.ShowModelInfo.g.cs | 31 +++++++ .../Generated/Ollama.IModelsClient.g.cs | 20 +++++ .../Ollama.IOllamaApiClient.GetVersion.g.cs | 16 ++++ .../Generated/Ollama.IOllamaApiClient.g.cs | 40 +++++++++ .../Ollama.Models.CreateModelResponse.g.cs | 2 +- ....Models.GenerateChatCompletionRequest.g.cs | 2 +- ...Models.GenerateChatCompletionResponse.g.cs | 2 +- ...lama.Models.GenerateCompletionRequest.g.cs | 2 +- .../Generated/Ollama.Models.Message.g.cs | 2 +- .../Ollama.Models.PullModelResponse.g.cs | 2 +- .../Ollama.Models.PushModelResponse.g.cs | 4 +- .../Ollama/Generated/Ollama.Models.Tool.g.cs | 2 +- .../Ollama.ModelsClient.CopyModel.g.cs | 2 +- .../Ollama.ModelsClient.CreateBlob.g.cs | 2 +- .../Ollama.ModelsClient.CreateModel.g.cs | 4 +- .../Ollama.ModelsClient.DeleteModel.g.cs | 2 +- .../Ollama.ModelsClient.ListModels.g.cs | 2 +- ...Ollama.ModelsClient.ListRunningModels.g.cs | 2 +- .../Ollama.ModelsClient.PullModel.g.cs | 4 +- .../Ollama.ModelsClient.PushModel.g.cs | 4 +- .../Ollama.ModelsClient.ShowModelInfo.g.cs | 4 +- .../Ollama/Generated/Ollama.ModelsClient.g.cs | 10 ++- .../Ollama.OllamaApiClient.GetVersion.g.cs | 2 +- .../Generated/Ollama.OllamaApiClient.g.cs | 30 +++++-- .../Ollama/Generated/Ollama.Polyfills.g.cs | 2 +- src/libs/Ollama/generate.sh | 4 +- 70 files changed, 828 insertions(+), 95 deletions(-) create mode 100644 src/libs/Ollama/Generated/JsonConverters.UnixTimestamp.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IChatClient.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs create mode 100644 src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs diff --git a/src/libs/Ollama/Generated/AnyOf.2.g.cs b/src/libs/Ollama/Generated/AnyOf.2.g.cs index 3a951e3..e7ed8f2 100644 --- a/src/libs/Ollama/Generated/AnyOf.2.g.cs +++ b/src/libs/Ollama/Generated/AnyOf.2.g.cs @@ -2,7 +2,7 @@ #nullable enable -namespace System +namespace Ollama { /// /// diff --git a/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs b/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs index 4514e48..392dbcf 100644 --- a/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.AnyOf2.g.cs @@ -1,12 +1,12 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// - public class AnyOfJsonConverter : global::System.Text.Json.Serialization.JsonConverter> + public class AnyOfJsonConverter : global::System.Text.Json.Serialization.JsonConverter> { /// - public override global::System.AnyOf Read( + public override global::Ollama.AnyOf Read( ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options) @@ -39,7 +39,7 @@ public class AnyOfJsonConverter : global::System.Text.Json.Serialization { } - var result = new global::System.AnyOf( + var result = new global::Ollama.AnyOf( value1, value2 ); @@ -63,7 +63,7 @@ public class AnyOfJsonConverter : global::System.Text.Json.Serialization /// public override void Write( global::System.Text.Json.Utf8JsonWriter writer, - global::System.AnyOf value, + global::Ollama.AnyOf value, global::System.Text.Json.JsonSerializerOptions options) { options = options ?? throw new global::System.ArgumentNullException(nameof(options)); diff --git a/src/libs/Ollama/Generated/JsonConverters.AnyOfFactory2.g.cs b/src/libs/Ollama/Generated/JsonConverters.AnyOfFactory2.g.cs index e3a7b3f..99f0043 100644 --- a/src/libs/Ollama/Generated/JsonConverters.AnyOfFactory2.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.AnyOfFactory2.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class AnyOfJsonConverterFactory2 : global::System.Text.Json.Serialization.JsonConverterFactory @@ -8,7 +8,7 @@ public sealed class AnyOfJsonConverterFactory2 : global::System.Text.Json.Serial /// public override bool CanConvert(global::System.Type? typeToConvert) { - return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::System.AnyOf<,>); + return typeToConvert is { IsGenericType: true } && typeToConvert.GetGenericTypeDefinition() == typeof(global::Ollama.AnyOf<,>); } /// diff --git a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs index c331ede..72d1082 100644 --- a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatus.g.cs @@ -1,7 +1,7 @@ #nullable enable #pragma warning disable CS0618 // Type or member is obsolete -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public class CreateModelStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnum.g.cs b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnum.g.cs index 1b80ef8..bdf7187 100644 --- a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnum.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnum.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class CreateModelStatusEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnumNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnumNullable.g.cs index 5d2f41b..32b128a 100644 --- a/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnumNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.CreateModelStatusEnumNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class CreateModelStatusEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs b/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs index a746361..8fc8e37 100644 --- a/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.DoneReason.g.cs @@ -1,7 +1,7 @@ #nullable enable #pragma warning disable CS0618 // Type or member is obsolete -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public class DoneReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnum.g.cs b/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnum.g.cs index 3c225e2..00fe658 100644 --- a/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnum.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnum.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class DoneReasonEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnumNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnumNullable.g.cs index 1f2465a..247d238 100644 --- a/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnumNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.DoneReasonEnumNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class DoneReasonEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.MessageRole.g.cs b/src/libs/Ollama/Generated/JsonConverters.MessageRole.g.cs index 01ffac3..0808be1 100644 --- a/src/libs/Ollama/Generated/JsonConverters.MessageRole.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.MessageRole.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class MessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.MessageRoleNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.MessageRoleNullable.g.cs index 858f09d..2126cbb 100644 --- a/src/libs/Ollama/Generated/JsonConverters.MessageRoleNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.MessageRoleNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class MessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs b/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs index 0e1528c..0ce6a3d 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PullModelStatus.g.cs @@ -1,7 +1,7 @@ #nullable enable #pragma warning disable CS0618 // Type or member is obsolete -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public class PullModelStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnum.g.cs b/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnum.g.cs index b94142a..7b490a1 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnum.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnum.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class PullModelStatusEnumJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnumNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnumNullable.g.cs index 461ae3e..386162c 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnumNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PullModelStatusEnumNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class PullModelStatusEnumNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatus.g.cs b/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatus.g.cs index e013bd0..910fa7c 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatus.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatus.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class PushModelResponseStatusJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatusNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatusNullable.g.cs index e78a306..b8fdc19 100644 --- a/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatusNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.PushModelResponseStatusNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class PushModelResponseStatusNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.ResponseFormat.g.cs b/src/libs/Ollama/Generated/JsonConverters.ResponseFormat.g.cs index 5033db8..18549fb 100644 --- a/src/libs/Ollama/Generated/JsonConverters.ResponseFormat.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.ResponseFormat.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class ResponseFormatJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.ResponseFormatNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.ResponseFormatNullable.g.cs index 7d81e55..600ef89 100644 --- a/src/libs/Ollama/Generated/JsonConverters.ResponseFormatNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.ResponseFormatNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class ResponseFormatNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.ToolType.g.cs b/src/libs/Ollama/Generated/JsonConverters.ToolType.g.cs index 83ad764..b54336f 100644 --- a/src/libs/Ollama/Generated/JsonConverters.ToolType.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.ToolType.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class ToolTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.ToolTypeNullable.g.cs b/src/libs/Ollama/Generated/JsonConverters.ToolTypeNullable.g.cs index 4613d7a..688b4f0 100644 --- a/src/libs/Ollama/Generated/JsonConverters.ToolTypeNullable.g.cs +++ b/src/libs/Ollama/Generated/JsonConverters.ToolTypeNullable.g.cs @@ -1,6 +1,6 @@ #nullable enable -namespace OpenApiGenerator.JsonConverters +namespace Ollama.JsonConverters { /// public sealed class ToolTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter diff --git a/src/libs/Ollama/Generated/JsonConverters.UnixTimestamp.g.cs b/src/libs/Ollama/Generated/JsonConverters.UnixTimestamp.g.cs new file mode 100644 index 0000000..bafc668 --- /dev/null +++ b/src/libs/Ollama/Generated/JsonConverters.UnixTimestamp.g.cs @@ -0,0 +1,39 @@ +#nullable enable + +namespace Ollama.JsonConverters +{ + /// + public class UnixTimestampJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::System.DateTimeOffset Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + if (reader.TokenType == global::System.Text.Json.JsonTokenType.Number) + { + if (reader.TryGetInt64(out long unixTimestamp)) + { + return global::System.DateTimeOffset.FromUnixTimeSeconds(unixTimestamp); + } + if (reader.TryGetInt32(out int unixTimestampInt)) + { + return global::System.DateTimeOffset.FromUnixTimeSeconds(unixTimestampInt); + } + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::System.DateTimeOffset value, + global::System.Text.Json.JsonSerializerOptions options) + { + long unixTimestamp = value.ToUnixTimeSeconds(); + writer.WriteNumberValue(unixTimestamp); + } + } +} diff --git a/src/libs/Ollama/Generated/JsonSerializerContext.g.cs b/src/libs/Ollama/Generated/JsonSerializerContext.g.cs index d1c4d30..0b76f46 100644 --- a/src/libs/Ollama/Generated/JsonSerializerContext.g.cs +++ b/src/libs/Ollama/Generated/JsonSerializerContext.g.cs @@ -13,24 +13,24 @@ namespace Ollama DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, Converters = new global::System.Type[] { - typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.MessageRoleJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.MessageRoleNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.ToolTypeJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.ToolTypeNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.DoneReasonEnumJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.DoneReasonEnumNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.CreateModelStatusEnumJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.CreateModelStatusEnumNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.PullModelStatusEnumJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.PullModelStatusEnumNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.PushModelResponseStatusJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.PushModelResponseStatusNullableJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.DoneReasonJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.CreateModelStatusJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.PullModelStatusJsonConverter), - typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2), + typeof(global::Ollama.JsonConverters.ResponseFormatJsonConverter), + typeof(global::Ollama.JsonConverters.ResponseFormatNullableJsonConverter), + typeof(global::Ollama.JsonConverters.MessageRoleJsonConverter), + typeof(global::Ollama.JsonConverters.MessageRoleNullableJsonConverter), + typeof(global::Ollama.JsonConverters.ToolTypeJsonConverter), + typeof(global::Ollama.JsonConverters.ToolTypeNullableJsonConverter), + typeof(global::Ollama.JsonConverters.DoneReasonEnumJsonConverter), + typeof(global::Ollama.JsonConverters.DoneReasonEnumNullableJsonConverter), + typeof(global::Ollama.JsonConverters.CreateModelStatusEnumJsonConverter), + typeof(global::Ollama.JsonConverters.CreateModelStatusEnumNullableJsonConverter), + typeof(global::Ollama.JsonConverters.PullModelStatusEnumJsonConverter), + typeof(global::Ollama.JsonConverters.PullModelStatusEnumNullableJsonConverter), + typeof(global::Ollama.JsonConverters.PushModelResponseStatusJsonConverter), + typeof(global::Ollama.JsonConverters.PushModelResponseStatusNullableJsonConverter), + typeof(global::Ollama.JsonConverters.DoneReasonJsonConverter), + typeof(global::Ollama.JsonConverters.CreateModelStatusJsonConverter), + typeof(global::Ollama.JsonConverters.PullModelStatusJsonConverter), + typeof(global::Ollama.JsonConverters.AnyOfJsonConverterFactory2), })] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ollama.JsonSerializerContextTypes))] diff --git a/src/libs/Ollama/Generated/JsonSerializerContextTypes.g.cs b/src/libs/Ollama/Generated/JsonSerializerContextTypes.g.cs index acfaf78..d7eda82 100644 --- a/src/libs/Ollama/Generated/JsonSerializerContextTypes.g.cs +++ b/src/libs/Ollama/Generated/JsonSerializerContextTypes.g.cs @@ -233,7 +233,7 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::System.AnyOf? Type55 { get; set; } + public global::Ollama.AnyOf? Type55 { get; set; } /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs index 5403097..19f428b 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs @@ -38,7 +38,7 @@ partial void ProcessGenerateChatCompletionResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/chat", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateChatCompletionRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -72,7 +72,7 @@ partial void ProcessGenerateChatCompletionResponse( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) { var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.GenerateChatCompletionResponse) ?? + var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.GenerateChatCompletionResponse), JsonSerializerContext) as global::Ollama.GenerateChatCompletionResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); yield return streamedResponse; diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs index 42f2d69..7c88096 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs @@ -8,7 +8,7 @@ namespace Ollama /// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
- public sealed partial class ChatClient : global::System.IDisposable + public sealed partial class ChatClient : global::Ollama.IChatClient, global::System.IDisposable { /// /// Ollama server URL @@ -17,6 +17,11 @@ public sealed partial class ChatClient : global::System.IDisposable private readonly global::System.Net.Http.HttpClient _httpClient; + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ollama.SourceGenerationContext.Default; + /// /// Creates a new instance of the ChatClient. @@ -27,8 +32,7 @@ public sealed partial class ChatClient : global::System.IDisposable /// public ChatClient( global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null - ) + global::System.Uri? baseUri = null) { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs index 650e6c8..36763b4 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs @@ -38,7 +38,7 @@ partial void ProcessGenerateCompletionResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/generate", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateCompletionRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -72,7 +72,7 @@ partial void ProcessGenerateCompletionResponse( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) { var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.GenerateCompletionResponse) ?? + var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.GenerateCompletionResponse), JsonSerializerContext) as global::Ollama.GenerateCompletionResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); yield return streamedResponse; diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs index 2d44737..fcb791e 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs @@ -8,7 +8,7 @@ namespace Ollama /// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
- public sealed partial class CompletionsClient : global::System.IDisposable + public sealed partial class CompletionsClient : global::Ollama.ICompletionsClient, global::System.IDisposable { /// /// Ollama server URL @@ -17,6 +17,11 @@ public sealed partial class CompletionsClient : global::System.IDisposable private readonly global::System.Net.Http.HttpClient _httpClient; + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ollama.SourceGenerationContext.Default; + /// /// Creates a new instance of the CompletionsClient. @@ -27,8 +32,7 @@ public sealed partial class CompletionsClient : global::System.IDisposable /// public CompletionsClient( global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null - ) + global::System.Uri? baseUri = null) { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs index 6db6856..fbc867d 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs @@ -42,7 +42,7 @@ partial void ProcessGenerateEmbeddingResponseContent( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/embeddings", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.GenerateEmbeddingRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -90,7 +90,7 @@ partial void ProcessGenerateEmbeddingResponseContent( } return - global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.GenerateEmbeddingResponse) ?? + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.GenerateEmbeddingResponse), JsonSerializerContext) as global::Ollama.GenerateEmbeddingResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs index c80ae06..f12daf7 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs @@ -8,7 +8,7 @@ namespace Ollama /// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
- public sealed partial class EmbeddingsClient : global::System.IDisposable + public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient, global::System.IDisposable { /// /// Ollama server URL @@ -17,6 +17,11 @@ public sealed partial class EmbeddingsClient : global::System.IDisposable private readonly global::System.Net.Http.HttpClient _httpClient; + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ollama.SourceGenerationContext.Default; + /// /// Creates a new instance of the EmbeddingsClient. @@ -27,8 +32,7 @@ public sealed partial class EmbeddingsClient : global::System.IDisposable /// public EmbeddingsClient( global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null - ) + global::System.Uri? baseUri = null) { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs new file mode 100644 index 0000000..9b6fe84 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.GenerateChatCompletion.g.cs @@ -0,0 +1,64 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IChatClient + { + /// + /// Generate the next message in a chat with a provided model.
+ /// This is a streaming endpoint, so there will be a series of responses. The final response object will include statistics and additional data from the request. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable GenerateChatCompletionAsync( + global::Ollama.GenerateChatCompletionRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Generate the next message in a chat with a provided model.
+ /// This is a streaming endpoint, so there will be a series of responses. The final response object will include statistics and additional data from the request. + ///
+ /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.1 + /// + /// + /// The messages of the chat, this can be used to keep a chat memory + /// + /// + /// The format to return a response in. Currently the only accepted value is json.
+ /// Enable JSON mode by setting the format parameter to json. This will structure the response as valid JSON.
+ /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + /// + /// A list of tools the model may call. + /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable GenerateChatCompletionAsync( + string model, + global::System.Collections.Generic.IList messages, + global::Ollama.ResponseFormat? format = default, + global::Ollama.RequestOptions? options = default, + bool stream = true, + int? keepAlive = default, + global::System.Collections.Generic.IList? tools = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs new file mode 100644 index 0000000..454310e --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Given a list of messages comprising a conversation, the model will return a response.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IChatClient : global::System.IDisposable + { + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ 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 new file mode 100644 index 0000000..8905b6f --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.GenerateCompletion.g.cs @@ -0,0 +1,86 @@ +#nullable enable + +namespace Ollama +{ + public partial interface ICompletionsClient + { + /// + /// Generate a response for a given prompt with a provided model.
+ /// The final response object will include statistics and additional data from the request. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable GenerateCompletionAsync( + global::Ollama.GenerateCompletionRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Generate a response for a given prompt with a provided model.
+ /// The final response object will include statistics and additional data from the request. + ///
+ /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.1 + /// + /// + /// The prompt to generate a response.
+ /// Example: Why is the sky blue? + /// + /// + /// The text that comes after the inserted text. + /// + /// + /// (optional) a list of Base64-encoded images to include in the message (for multimodal models such as llava) + /// + /// + /// The system prompt to (overrides what is defined in the Modelfile). + /// + /// + /// The full prompt or prompt template (overrides what is defined in the Modelfile). + /// + /// + /// The context parameter returned from a previous request to [generateCompletion], this can be used to keep a short conversational memory. + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// The format to return a response in. Currently the only accepted value is json.
+ /// Enable JSON mode by setting the format parameter to json. This will structure the response as valid JSON.
+ /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. + /// + /// + /// If `true` no formatting will be applied to the prompt and no context will be returned.
+ /// You may choose to use the `raw` parameter if you are specifying a full templated prompt in your request to the API, and are managing history yourself. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable GenerateCompletionAsync( + string model, + string prompt, + string? suffix = default, + global::System.Collections.Generic.IList? images = default, + string? system = default, + string? template = default, + global::System.Collections.Generic.IList? context = default, + global::Ollama.RequestOptions? options = default, + global::Ollama.ResponseFormat? format = default, + bool raw = default, + bool stream = true, + int? keepAlive = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs new file mode 100644 index 0000000..67173b8 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Given a prompt, the model will generate a completion.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface ICompletionsClient : global::System.IDisposable + { + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs new file mode 100644 index 0000000..58bfc71 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.GenerateEmbedding.g.cs @@ -0,0 +1,48 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IEmbeddingsClient + { + /// + /// Generate embeddings from a model. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GenerateEmbeddingAsync( + global::Ollama.GenerateEmbeddingRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Generate embeddings from a model. + /// + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.1 + /// + /// + /// Text to generate embeddings for.
+ /// Example: Here is an article about llamas... + /// + /// + /// Additional model parameters listed in the documentation for the Modelfile such as `temperature`. + /// + /// + /// How long (in minutes) to keep the model loaded in memory.
+ /// - If set to a positive duration (e.g. 20), the model will stay loaded for the provided duration.
+ /// - If set to a negative duration (e.g. -1), the model will stay loaded indefinitely.
+ /// - If set to 0, the model will be unloaded immediately once finished.
+ /// - If not set, the model will stay loaded for 5 minutes by default + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GenerateEmbeddingAsync( + string model, + string prompt, + global::Ollama.RequestOptions? options = default, + int? keepAlive = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs new file mode 100644 index 0000000..4bd70f9 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// Get a vector representation of a given input.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IEmbeddingsClient : global::System.IDisposable + { + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs new file mode 100644 index 0000000..f6dbc5c --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CheckBlob.g.cs @@ -0,0 +1,18 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Ensures that the file blob used for a FROM or ADAPTER field exists on the server.
+ /// This is checking your Ollama server and not Ollama.ai. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CheckBlobAsync( + string digest, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs new file mode 100644 index 0000000..82c4532 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CopyModel.g.cs @@ -0,0 +1,35 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Creates a model with another name from an existing model. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CopyModelAsync( + global::Ollama.CopyModelRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates a model with another name from an existing model. + /// + /// + /// Name of the model to copy.
+ /// Example: llama3.1 + /// + /// + /// Name of the new model.
+ /// Example: llama3-backup + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CopyModelAsync( + string source, + string destination, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs new file mode 100644 index 0000000..4c63455 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateBlob.g.cs @@ -0,0 +1,29 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Create a blob from a file. Returns the server file path. + /// + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateBlobAsync( + string digest, + byte[] request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a blob from a file. Returns the server file path. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateBlobAsync( + string digest, + 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 new file mode 100644 index 0000000..3cc63b5 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.CreateModel.g.cs @@ -0,0 +1,51 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Create a model from a Modelfile.
+ /// It is recommended to set `modelfile` to the content of the Modelfile rather than just set `path`. This is a requirement for remote create. Remote model creation should also create any file blobs, fields such as `FROM` and `ADAPTER`, explicitly with the server using Create a Blob and the value to the path indicated in the response. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( + global::Ollama.CreateModelRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create a model from a Modelfile.
+ /// It is recommended to set `modelfile` to the content of the Modelfile rather than just set `path`. This is a requirement for remote create. Remote model creation should also create any file blobs, fields such as `FROM` and `ADAPTER`, explicitly with the server using Create a Blob and the value to the path indicated in the response. + ///
+ /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: mario + /// + /// + /// The contents of the Modelfile.
+ /// Example: FROM llama3\nSYSTEM You are mario from Super Mario Bros. + /// + /// + /// Path to the Modelfile (optional) + /// + /// + /// The quantization level of the model. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable CreateModelAsync( + string model, + string modelfile, + string? path = default, + string? quantize = default, + bool stream = true, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs new file mode 100644 index 0000000..dd05c93 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.DeleteModel.g.cs @@ -0,0 +1,31 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Delete a model and its data. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteModelAsync( + global::Ollama.DeleteModelRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete a model and its data. + /// + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3:13b + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteModelAsync( + string model, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs new file mode 100644 index 0000000..ecb5adb --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListModels.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// List models that are available locally. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListModelsAsync( + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs new file mode 100644 index 0000000..9f62a6f --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ListRunningModels.g.cs @@ -0,0 +1,15 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// List models that are running. + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListRunningModelsAsync( + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs new file mode 100644 index 0000000..89c765f --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.PullModel.g.cs @@ -0,0 +1,52 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Download a model from the ollama library.
+ /// Cancelled pulls are resumed from where they left off, and multiple calls will share the same download progress. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable PullModelAsync( + global::Ollama.PullModelRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Download a model from the ollama library.
+ /// Cancelled pulls are resumed from where they left off, and multiple calls will share the same download progress. + ///
+ /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.1 + /// + /// + /// Allow insecure connections to the library.
+ /// Only use this if you are pulling from your own library during development.
+ /// Default Value: false + /// + /// + /// Ollama username. + /// + /// + /// Ollama password. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable PullModelAsync( + string model, + bool insecure = false, + string? username = default, + string? password = default, + bool stream = true, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs new file mode 100644 index 0000000..e9099a5 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.PushModel.g.cs @@ -0,0 +1,51 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Upload a model to a model library.
+ /// Requires registering for ollama.ai and adding a public key first. + ///
+ /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable PushModelAsync( + global::Ollama.PushModelRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Upload a model to a model library.
+ /// Requires registering for ollama.ai and adding a public key first. + ///
+ /// + /// The name of the model to push in the form of <namespace>/<model>:<tag>.
+ /// Example: mattw/pygmalion:latest + /// + /// + /// Allow insecure connections to the library.
+ /// Only use this if you are pushing to your library during development.
+ /// Default Value: false + /// + /// + /// Ollama username. + /// + /// + /// Ollama password. + /// + /// + /// If `false` the response will be returned as a single response object, otherwise the response will be streamed as a series of objects.
+ /// Default Value: true + /// + /// The token to cancel the operation with + /// + global::System.Collections.Generic.IAsyncEnumerable PushModelAsync( + string model, + bool insecure = false, + string? username = default, + string? password = default, + bool stream = true, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs new file mode 100644 index 0000000..a8b6ec2 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.ShowModelInfo.g.cs @@ -0,0 +1,31 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IModelsClient + { + /// + /// Show details about a model including modelfile, template, parameters, license, and system prompt. + /// + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ShowModelInfoAsync( + global::Ollama.ModelInfoRequest request, + global::System.Threading.CancellationToken cancellationToken = default); + + /// + /// Show details about a model including modelfile, template, parameters, license, and system prompt. + /// + /// + /// The model name.
+ /// Model names follow a `model:tag` format. Some examples are `orca-mini:3b-q4_1` and `llama3:70b`. The tag is optional and, if not provided, will default to `latest`. The tag is used to identify a specific version.
+ /// Example: llama3.1 + /// + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ShowModelInfoAsync( + string model, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs new file mode 100644 index 0000000..3cbe86c --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// List and describe the various models available.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IModelsClient : global::System.IDisposable + { + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs new file mode 100644 index 0000000..0f66736 --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.GetVersion.g.cs @@ -0,0 +1,16 @@ +#nullable enable + +namespace Ollama +{ + public partial interface IOllamaApiClient + { + /// + /// Returns the version of the Ollama server.
+ /// This endpoint returns the version of the Ollama server. + ///
+ /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetVersionAsync( + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs new file mode 100644 index 0000000..389077d --- /dev/null +++ b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs @@ -0,0 +1,40 @@ + +#nullable enable + +namespace Ollama +{ + /// + /// API Spec for Ollama API. Please see https://github.com/jmorganca/ollama/blob/main/docs/api.md for more details.
+ /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IOllamaApiClient : global::System.IDisposable + { + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + /// + /// Given a prompt, the model will generate a completion. + /// + public CompletionsClient Completions { get; } + + /// + /// Given a list of messages comprising a conversation, the model will return a response. + /// + public ChatClient Chat { get; } + + /// + /// Get a vector representation of a given input. + /// + public EmbeddingsClient Embeddings { get; } + + /// + /// List and describe the various models available. + /// + public ModelsClient Models { get; } + + } +} \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs index 5a24005..69a379a 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.CreateModelResponse.g.cs @@ -12,7 +12,7 @@ public sealed partial class CreateModelResponse /// Status creating the model ///
[global::System.Text.Json.Serialization.JsonPropertyName("status")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.CreateModelStatusJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.CreateModelStatusJsonConverter))] public global::Ollama.CreateModelStatus? Status { get; set; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs index 015c2a6..cf518d3 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionRequest.g.cs @@ -30,7 +30,7 @@ public sealed partial class GenerateChatCompletionRequest /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. /// [global::System.Text.Json.Serialization.JsonPropertyName("format")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.ResponseFormatJsonConverter))] public global::Ollama.ResponseFormat? Format { get; set; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs index dc32407..54c2524 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateChatCompletionResponse.g.cs @@ -43,7 +43,7 @@ public sealed partial class GenerateChatCompletionResponse /// Reason why the model is done generating a response. /// [global::System.Text.Json.Serialization.JsonPropertyName("done_reason")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.DoneReasonJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.DoneReasonJsonConverter))] public global::Ollama.DoneReason? DoneReason { get; set; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs index 0e190d1..fbbba4a 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.GenerateCompletionRequest.g.cs @@ -67,7 +67,7 @@ public sealed partial class GenerateCompletionRequest /// Note: it's important to instruct the model to use JSON in the prompt. Otherwise, the model may generate large amounts whitespace. /// [global::System.Text.Json.Serialization.JsonPropertyName("format")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ResponseFormatJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.ResponseFormatJsonConverter))] public global::Ollama.ResponseFormat? Format { get; set; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs index 70037ac..0b3f5c1 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Message.g.cs @@ -12,7 +12,7 @@ public sealed partial class Message /// The role of the message /// [global::System.Text.Json.Serialization.JsonPropertyName("role")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.MessageRoleJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.MessageRoleJsonConverter))] [global::System.Text.Json.Serialization.JsonRequired] public required global::Ollama.MessageRole Role { get; set; } diff --git a/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs index 51de3c2..0a7846a 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PullModelResponse.g.cs @@ -15,7 +15,7 @@ public sealed partial class PullModelResponse /// Example: pulling manifest ///
[global::System.Text.Json.Serialization.JsonPropertyName("status")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.PullModelStatusJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.PullModelStatusJsonConverter))] public global::Ollama.PullModelStatus? Status { get; set; } /// diff --git a/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs index 4abefe5..9dd0560 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.PushModelResponse.g.cs @@ -14,8 +14,8 @@ public sealed partial class PushModelResponse /// Status pushing the model. /// [global::System.Text.Json.Serialization.JsonPropertyName("status")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.AnyOfJsonConverterFactory2))] - public global::System.AnyOf? Status { get; set; } + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.AnyOfJsonConverterFactory2))] + public global::Ollama.AnyOf? Status { get; set; } /// /// the model's digest
diff --git a/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs b/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs index 51590b4..3a373a5 100644 --- a/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Models.Tool.g.cs @@ -13,7 +13,7 @@ public sealed partial class Tool /// Default Value: function ///
[global::System.Text.Json.Serialization.JsonPropertyName("type")] - [global::System.Text.Json.Serialization.JsonConverter(typeof(global::OpenApiGenerator.JsonConverters.ToolTypeJsonConverter))] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Ollama.JsonConverters.ToolTypeJsonConverter))] public global::Ollama.ToolType? Type { get; set; } = global::Ollama.ToolType.Function; /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs index c49bc21..c7ce2af 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs @@ -37,7 +37,7 @@ partial void ProcessCopyModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/copy", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CopyModelRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs index 8e1c11c..cacc55a 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs @@ -42,7 +42,7 @@ partial void ProcessCreateBlobResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + $"/blobs/{digest}", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ByteArray); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs index 1019c97..1f1dba6 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs @@ -38,7 +38,7 @@ partial void ProcessCreateModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/create", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.CreateModelRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -72,7 +72,7 @@ partial void ProcessCreateModelResponse( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) { var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.CreateModelResponse) ?? + var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.CreateModelResponse), JsonSerializerContext) as global::Ollama.CreateModelResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); yield return streamedResponse; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs index e3c8584..d154846 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs @@ -37,7 +37,7 @@ partial void ProcessDeleteModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Delete, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/delete", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.DeleteModelRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs index 4fb2032..d3a553c 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs @@ -76,7 +76,7 @@ partial void ProcessListModelsResponseContent( } return - global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.ModelsResponse) ?? + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.ModelsResponse), JsonSerializerContext) as global::Ollama.ModelsResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs index af90b78..fbd3f40 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs @@ -76,7 +76,7 @@ partial void ProcessListRunningModelsResponseContent( } return - global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.ProcessResponse) ?? + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.ProcessResponse), JsonSerializerContext) as global::Ollama.ProcessResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs index 72173eb..ccecc39 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs @@ -38,7 +38,7 @@ partial void ProcessPullModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/pull", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PullModelRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -72,7 +72,7 @@ partial void ProcessPullModelResponse( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) { var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.PullModelResponse) ?? + var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.PullModelResponse), JsonSerializerContext) as global::Ollama.PullModelResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); yield return streamedResponse; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs index e03060d..d8d20e6 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs @@ -38,7 +38,7 @@ partial void ProcessPushModelResponse( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/push", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.PushModelRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -72,7 +72,7 @@ partial void ProcessPushModelResponse( while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) { var __content = await reader.ReadLineAsync().ConfigureAwait(false) ?? string.Empty; - var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.PushModelResponse) ?? + var streamedResponse = global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.PushModelResponse), JsonSerializerContext) as global::Ollama.PushModelResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); yield return streamedResponse; diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs index a20271b..f3e9000 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs @@ -42,7 +42,7 @@ partial void ProcessShowModelInfoResponseContent( using var httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(_httpClient.BaseAddress?.AbsoluteUri.TrimEnd('/') + "/show", global::System.UriKind.RelativeOrAbsolute)); - var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, global::Ollama.SourceGenerationContext.Default.ModelInfoRequest); + var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); var __httpRequestContent = new global::System.Net.Http.StringContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, @@ -90,7 +90,7 @@ partial void ProcessShowModelInfoResponseContent( } return - global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.ModelInfo) ?? + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.ModelInfo), JsonSerializerContext) as global::Ollama.ModelInfo ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs index 443bd48..ec1b184 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs @@ -8,7 +8,7 @@ namespace Ollama /// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
- public sealed partial class ModelsClient : global::System.IDisposable + public sealed partial class ModelsClient : global::Ollama.IModelsClient, global::System.IDisposable { /// /// Ollama server URL @@ -17,6 +17,11 @@ public sealed partial class ModelsClient : global::System.IDisposable private readonly global::System.Net.Http.HttpClient _httpClient; + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ollama.SourceGenerationContext.Default; + /// /// Creates a new instance of the ModelsClient. @@ -27,8 +32,7 @@ public sealed partial class ModelsClient : global::System.IDisposable /// public ModelsClient( global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null - ) + global::System.Uri? baseUri = null) { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs index 0c87693..0e91cd2 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs @@ -77,7 +77,7 @@ partial void ProcessGetVersionResponseContent( } return - global::System.Text.Json.JsonSerializer.Deserialize(__content, global::Ollama.SourceGenerationContext.Default.VersionResponse) ?? + global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(global::Ollama.VersionResponse), JsonSerializerContext) as global::Ollama.VersionResponse ?? throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); } } diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs index ab0c774..88e8a2b 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs @@ -8,7 +8,7 @@ namespace Ollama /// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. ///
- public sealed partial class OllamaApiClient : global::System.IDisposable + public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, global::System.IDisposable { /// /// Ollama server URL @@ -17,26 +17,43 @@ public sealed partial class OllamaApiClient : global::System.IDisposable private readonly global::System.Net.Http.HttpClient _httpClient; + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Ollama.SourceGenerationContext.Default; + /// /// Given a prompt, the model will generate a completion. /// - public CompletionsClient Completions => new CompletionsClient(_httpClient); + public CompletionsClient Completions => new CompletionsClient(_httpClient) + { + JsonSerializerContext = JsonSerializerContext, + }; /// /// Given a list of messages comprising a conversation, the model will return a response. /// - public ChatClient Chat => new ChatClient(_httpClient); + public ChatClient Chat => new ChatClient(_httpClient) + { + JsonSerializerContext = JsonSerializerContext, + }; /// /// Get a vector representation of a given input. /// - public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient); + public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient) + { + JsonSerializerContext = JsonSerializerContext, + }; /// /// List and describe the various models available. /// - public ModelsClient Models => new ModelsClient(_httpClient); + public ModelsClient Models => new ModelsClient(_httpClient) + { + JsonSerializerContext = JsonSerializerContext, + }; /// /// Creates a new instance of the OllamaApiClient. @@ -47,8 +64,7 @@ public sealed partial class OllamaApiClient : global::System.IDisposable /// public OllamaApiClient( global::System.Net.Http.HttpClient? httpClient = null, - global::System.Uri? baseUri = null - ) + global::System.Uri? baseUri = null) { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); diff --git a/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs b/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs index 9075491..1a7c42f 100644 --- a/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs +++ b/src/libs/Ollama/Generated/Ollama.Polyfills.g.cs @@ -7,7 +7,7 @@ namespace Ollama /// /// /// - public static partial class OpenApiGeneratorPolyfills + public static partial class AutoSDKPolyfills { /// /// diff --git a/src/libs/Ollama/generate.sh b/src/libs/Ollama/generate.sh index 9f3bd6f..6a880ba 100755 --- a/src/libs/Ollama/generate.sh +++ b/src/libs/Ollama/generate.sh @@ -1,4 +1,4 @@ -dotnet tool install --global openapigenerator.cli --prerelease +dotnet tool install --global autosdk.cli --prerelease rm -rf Generated curl -o openapi.yaml https://raw.githubusercontent.com/davidmigloz/langchain_dart/main/packages/ollama_dart/oas/ollama-curated.yaml dotnet run --project ../../helpers/FixOpenApiSpec openapi.yaml @@ -6,7 +6,7 @@ if [ $? -ne 0 ]; then echo "Failed, exiting..." exit 1 fi -oag generate openapi.yaml \ +autosdk generate openapi.yaml \ --namespace Ollama \ --clientClassName OllamaApiClient \ --targetFramework net8.0 \