From d16e220a449beca157d4030dc6837ca6d5f0a211 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 23 Oct 2024 01:48:09 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- ...ama.ChatClient.GenerateChatCompletion.g.cs | 44 ++++++++-------- .../Ollama/Generated/Ollama.ChatClient.g.cs | 38 +++++++++----- ....CompletionsClient.GenerateCompletion.g.cs | 44 ++++++++-------- .../Generated/Ollama.CompletionsClient.g.cs | 38 +++++++++----- ...ma.EmbeddingsClient.GenerateEmbedding.g.cs | 50 +++++++++---------- .../Generated/Ollama.EmbeddingsClient.g.cs | 38 +++++++++----- .../Ollama/Generated/Ollama.IChatClient.g.cs | 15 ++++++ .../Generated/Ollama.ICompletionsClient.g.cs | 15 ++++++ .../Generated/Ollama.IEmbeddingsClient.g.cs | 15 ++++++ .../Generated/Ollama.IModelsClient.g.cs | 15 ++++++ .../Generated/Ollama.IOllamaApiClient.g.cs | 15 ++++++ .../Ollama.ModelsClient.CheckBlob.g.cs | 30 +++++------ .../Ollama.ModelsClient.CopyModel.g.cs | 36 ++++++------- .../Ollama.ModelsClient.CreateBlob.g.cs | 36 ++++++------- .../Ollama.ModelsClient.CreateModel.g.cs | 44 ++++++++-------- .../Ollama.ModelsClient.DeleteModel.g.cs | 36 ++++++------- .../Ollama.ModelsClient.ListModels.g.cs | 44 ++++++++-------- ...Ollama.ModelsClient.ListRunningModels.g.cs | 44 ++++++++-------- .../Ollama.ModelsClient.PullModel.g.cs | 44 ++++++++-------- .../Ollama.ModelsClient.PushModel.g.cs | 44 ++++++++-------- .../Ollama.ModelsClient.ShowModelInfo.g.cs | 50 +++++++++---------- .../Ollama/Generated/Ollama.ModelsClient.g.cs | 38 +++++++++----- .../Ollama.OllamaApiClient.GetVersion.g.cs | 44 ++++++++-------- .../Generated/Ollama.OllamaApiClient.g.cs | 46 +++++++++++------ 24 files changed, 504 insertions(+), 359 deletions(-) diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs index 8cbed61..d17f96f 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.GenerateChatCompletion.g.cs @@ -30,16 +30,16 @@ partial void ProcessGenerateChatCompletionResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGenerateChatCompletionArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/chat", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -47,30 +47,30 @@ partial void ProcessGenerateChatCompletionResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGenerateChatCompletionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGenerateChatCompletionResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new global::System.IO.StreamReader(stream); while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) @@ -129,7 +129,7 @@ partial void ProcessGenerateChatCompletionResponse( global::System.Collections.Generic.IList? tools = default, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.GenerateChatCompletionRequest + var __request = new global::Ollama.GenerateChatCompletionRequest { Model = model, Messages = messages, @@ -140,13 +140,13 @@ partial void ProcessGenerateChatCompletionResponse( Tools = tools, }; - var enumerable = GenerateChatCompletionAsync( - request: request, + var __enumerable = GenerateChatCompletionAsync( + request: __request, cancellationToken: cancellationToken); - await foreach (var response in enumerable) + await foreach (var __response in __enumerable) { - yield return response; + yield return __response; } } } diff --git a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs index 94f1c9f..3e18ecf 100644 --- a/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ChatClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ChatClient : global::Ollama.IChatClient, global::Sys /// /// Ollama server URL /// - public const string BaseUrl = "http://localhost:11434/api"; + public const string DefaultBaseUrl = "http://localhost:11434/api"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -29,25 +37,31 @@ public sealed partial class ChatClient : global::Ollama.IChatClient, global::Sys /// 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. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public ChatClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs index cbbe9a4..aa3ad9e 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.GenerateCompletion.g.cs @@ -30,16 +30,16 @@ partial void ProcessGenerateCompletionResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGenerateCompletionArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/generate", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -47,30 +47,30 @@ partial void ProcessGenerateCompletionResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGenerateCompletionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGenerateCompletionResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new global::System.IO.StreamReader(stream); while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) @@ -151,7 +151,7 @@ partial void ProcessGenerateCompletionResponse( int? keepAlive = default, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.GenerateCompletionRequest + var __request = new global::Ollama.GenerateCompletionRequest { Model = model, Prompt = prompt, @@ -167,13 +167,13 @@ partial void ProcessGenerateCompletionResponse( KeepAlive = keepAlive, }; - var enumerable = GenerateCompletionAsync( - request: request, + var __enumerable = GenerateCompletionAsync( + request: __request, cancellationToken: cancellationToken); - await foreach (var response in enumerable) + await foreach (var __response in __enumerable) { - yield return response; + yield return __response; } } } diff --git a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs index af9d1d4..6dda616 100644 --- a/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.CompletionsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class CompletionsClient : global::Ollama.ICompletionsClien /// /// Ollama server URL /// - public const string BaseUrl = "http://localhost:11434/api"; + public const string DefaultBaseUrl = "http://localhost:11434/api"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -29,25 +37,31 @@ public sealed partial class CompletionsClient : global::Ollama.ICompletionsClien /// 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. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public CompletionsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs index 4c8246c..6a351fd 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.GenerateEmbedding.g.cs @@ -34,16 +34,16 @@ partial void ProcessGenerateEmbeddingResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGenerateEmbeddingArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/embeddings", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -51,46 +51,46 @@ partial void ProcessGenerateEmbeddingResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGenerateEmbeddingRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGenerateEmbeddingResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGenerateEmbeddingResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -129,7 +129,7 @@ partial void ProcessGenerateEmbeddingResponseContent( int? keepAlive = default, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.GenerateEmbeddingRequest + var __request = new global::Ollama.GenerateEmbeddingRequest { Model = model, Prompt = prompt, @@ -138,7 +138,7 @@ partial void ProcessGenerateEmbeddingResponseContent( }; return await GenerateEmbeddingAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs index 3847caf..5de4574 100644 --- a/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.EmbeddingsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient, /// /// Ollama server URL /// - public const string BaseUrl = "http://localhost:11434/api"; + public const string DefaultBaseUrl = "http://localhost:11434/api"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -29,25 +37,31 @@ public sealed partial class EmbeddingsClient : global::Ollama.IEmbeddingsClient, /// 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. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public EmbeddingsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs index 454310e..a911e26 100644 --- a/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IChatClient.g.cs @@ -10,6 +10,21 @@ namespace Ollama /// public partial interface IChatClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs index 67173b8..1331d2d 100644 --- a/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ICompletionsClient.g.cs @@ -10,6 +10,21 @@ namespace Ollama /// public partial interface ICompletionsClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs index 4bd70f9..bad6d5e 100644 --- a/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IEmbeddingsClient.g.cs @@ -10,6 +10,21 @@ namespace Ollama /// public partial interface IEmbeddingsClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs index 3cbe86c..c1881b3 100644 --- a/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IModelsClient.g.cs @@ -10,6 +10,21 @@ namespace Ollama /// public partial interface IModelsClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs index 389077d..fd7d0ae 100644 --- a/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.IOllamaApiClient.g.cs @@ -10,6 +10,21 @@ namespace Ollama /// public partial interface IOllamaApiClient : global::System.IDisposable { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + /// /// /// diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs index 2eb7e06..7adb048 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CheckBlob.g.cs @@ -28,39 +28,39 @@ partial void ProcessCheckBlobResponse( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCheckBlobArguments( - httpClient: _httpClient, + httpClient: HttpClient, digest: ref digest); var __pathBuilder = new PathBuilder( path: $"/blobs/{digest}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Head, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCheckBlobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, digest: digest); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCheckBlobResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); } } } \ No newline at end of file diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs index 5ee9a61..cfe9cc7 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CopyModel.g.cs @@ -29,16 +29,16 @@ partial void ProcessCopyModelResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCopyModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/copy", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -46,28 +46,28 @@ partial void ProcessCopyModelResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCopyModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCopyModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); } /// @@ -88,14 +88,14 @@ partial void ProcessCopyModelResponse( string destination, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.CopyModelRequest + var __request = new global::Ollama.CopyModelRequest { Source = source, Destination = destination, }; await CopyModelAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs index defca70..fc8fb46 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateBlob.g.cs @@ -33,17 +33,17 @@ partial void ProcessCreateBlobResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateBlobArguments( - httpClient: _httpClient, + httpClient: HttpClient, digest: ref digest, request: request); var __pathBuilder = new PathBuilder( path: $"/blobs/{digest}", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = global::System.Text.Json.JsonSerializer.Serialize(request, request.GetType(), JsonSerializerContext); @@ -51,29 +51,29 @@ partial void ProcessCreateBlobResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/octet-stream"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateBlobRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, digest: digest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateBlobResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); } /// @@ -86,13 +86,13 @@ partial void ProcessCreateBlobResponse( string digest, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new byte[] + var __request = new byte[] { }; await CreateBlobAsync( digest: digest, - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs index df06b9b..ad72436 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.CreateModel.g.cs @@ -30,16 +30,16 @@ partial void ProcessCreateModelResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareCreateModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/create", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -47,30 +47,30 @@ partial void ProcessCreateModelResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareCreateModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessCreateModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new global::System.IO.StreamReader(stream); while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) @@ -116,7 +116,7 @@ partial void ProcessCreateModelResponse( bool? stream = true, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.CreateModelRequest + var __request = new global::Ollama.CreateModelRequest { Model = model, Modelfile = modelfile, @@ -125,13 +125,13 @@ partial void ProcessCreateModelResponse( Stream = stream, }; - var enumerable = CreateModelAsync( - request: request, + var __enumerable = CreateModelAsync( + request: __request, cancellationToken: cancellationToken); - await foreach (var response in enumerable) + await foreach (var __response in __enumerable) { - yield return response; + yield return __response; } } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs index 78b8c7b..4c6af40 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.DeleteModel.g.cs @@ -29,16 +29,16 @@ partial void ProcessDeleteModelResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareDeleteModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/delete", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Delete, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -46,28 +46,28 @@ partial void ProcessDeleteModelResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareDeleteModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessDeleteModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); } /// @@ -84,13 +84,13 @@ partial void ProcessDeleteModelResponse( string model, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.DeleteModelRequest + var __request = new global::Ollama.DeleteModelRequest { Model = model, }; await DeleteModelAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs index dd3cb50..e3a1b7f 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListModels.g.cs @@ -28,55 +28,55 @@ partial void ProcessListModelsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListModelsArguments( - httpClient: _httpClient); + httpClient: HttpClient); var __pathBuilder = new PathBuilder( path: "/tags", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Get, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListModelsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest); + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListModelsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListModelsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs index fe7ea66..10f83d1 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ListRunningModels.g.cs @@ -28,55 +28,55 @@ partial void ProcessListRunningModelsResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareListRunningModelsArguments( - httpClient: _httpClient); + httpClient: HttpClient); var __pathBuilder = new PathBuilder( path: "/ps", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Get, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareListRunningModelsRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest); + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessListRunningModelsResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessListRunningModelsResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs index 0c6351b..12a91f2 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PullModel.g.cs @@ -30,16 +30,16 @@ partial void ProcessPullModelResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PreparePullModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/pull", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -47,30 +47,30 @@ partial void ProcessPullModelResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PreparePullModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessPullModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new global::System.IO.StreamReader(stream); while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) @@ -117,7 +117,7 @@ partial void ProcessPullModelResponse( bool? stream = true, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.PullModelRequest + var __request = new global::Ollama.PullModelRequest { Model = model, Insecure = insecure, @@ -126,13 +126,13 @@ partial void ProcessPullModelResponse( Stream = stream, }; - var enumerable = PullModelAsync( - request: request, + var __enumerable = PullModelAsync( + request: __request, cancellationToken: cancellationToken); - await foreach (var response in enumerable) + await foreach (var __response in __enumerable) { - yield return response; + yield return __response; } } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs index 9ceb48d..ab4d4ce 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.PushModel.g.cs @@ -30,16 +30,16 @@ partial void ProcessPushModelResponse( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PreparePushModelArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/push", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -47,30 +47,30 @@ partial void ProcessPushModelResponse( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PreparePushModelRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessPushModelResponse( - httpClient: _httpClient, - httpResponseMessage: response); - response.EnsureSuccessStatusCode(); + httpClient: HttpClient, + httpResponseMessage: __response); + __response.EnsureSuccessStatusCode(); - using var stream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); + using var stream = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); using var reader = new global::System.IO.StreamReader(stream); while (!reader.EndOfStream && !cancellationToken.IsCancellationRequested) @@ -116,7 +116,7 @@ partial void ProcessPushModelResponse( bool? stream = true, [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.PushModelRequest + var __request = new global::Ollama.PushModelRequest { Model = model, Insecure = insecure, @@ -125,13 +125,13 @@ partial void ProcessPushModelResponse( Stream = stream, }; - var enumerable = PushModelAsync( - request: request, + var __enumerable = PushModelAsync( + request: __request, cancellationToken: cancellationToken); - await foreach (var response in enumerable) + await foreach (var __response in __enumerable) { - yield return response; + yield return __response; } } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs index f37ad2d..993460b 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.ShowModelInfo.g.cs @@ -34,16 +34,16 @@ partial void ProcessShowModelInfoResponseContent( request = request ?? throw new global::System.ArgumentNullException(nameof(request)); PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareShowModelInfoArguments( - httpClient: _httpClient, + httpClient: HttpClient, request: request); var __pathBuilder = new PathBuilder( path: "/show", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Post, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); var __httpRequestContentBody = request.ToJson(JsonSerializerContext); @@ -51,46 +51,46 @@ partial void ProcessShowModelInfoResponseContent( content: __httpRequestContentBody, encoding: global::System.Text.Encoding.UTF8, mediaType: "application/json"); - httpRequest.Content = __httpRequestContent; + __httpRequest.Content = __httpRequestContent; PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareShowModelInfoRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest, + httpClient: HttpClient, + httpRequestMessage: __httpRequest, request: request); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessShowModelInfoResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessShowModelInfoResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return @@ -112,13 +112,13 @@ partial void ProcessShowModelInfoResponseContent( string model, global::System.Threading.CancellationToken cancellationToken = default) { - var request = new global::Ollama.ModelInfoRequest + var __request = new global::Ollama.ModelInfoRequest { Model = model, }; return await ShowModelInfoAsync( - request: request, + request: __request, cancellationToken: cancellationToken).ConfigureAwait(false); } } diff --git a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs index ad64ac4..c8b6323 100644 --- a/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.ModelsClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class ModelsClient : global::Ollama.IModelsClient, global: /// /// Ollama server URL /// - public const string BaseUrl = "http://localhost:11434/api"; + public const string DefaultBaseUrl = "http://localhost:11434/api"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -29,25 +37,31 @@ public sealed partial class ModelsClient : global::Ollama.IModelsClient, global: /// 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. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public ModelsClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized( diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs index d356b44..9fe55fb 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.GetVersion.g.cs @@ -29,55 +29,55 @@ partial void ProcessGetVersionResponseContent( global::System.Threading.CancellationToken cancellationToken = default) { PrepareArguments( - client: _httpClient); + client: HttpClient); PrepareGetVersionArguments( - httpClient: _httpClient); + httpClient: HttpClient); var __pathBuilder = new PathBuilder( path: "/version", - baseUri: _httpClient.BaseAddress); + baseUri: HttpClient.BaseAddress); var __path = __pathBuilder.ToString(); - using var httpRequest = new global::System.Net.Http.HttpRequestMessage( + using var __httpRequest = new global::System.Net.Http.HttpRequestMessage( method: global::System.Net.Http.HttpMethod.Get, requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); PrepareRequest( - client: _httpClient, - request: httpRequest); + client: HttpClient, + request: __httpRequest); PrepareGetVersionRequest( - httpClient: _httpClient, - httpRequestMessage: httpRequest); + httpClient: HttpClient, + httpRequestMessage: __httpRequest); - using var response = await _httpClient.SendAsync( - request: httpRequest, + using var __response = await HttpClient.SendAsync( + request: __httpRequest, completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, cancellationToken: cancellationToken).ConfigureAwait(false); ProcessResponse( - client: _httpClient, - response: response); + client: HttpClient, + response: __response); ProcessGetVersionResponse( - httpClient: _httpClient, - httpResponseMessage: response); + httpClient: HttpClient, + httpResponseMessage: __response); - var __content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); ProcessResponseContent( - client: _httpClient, - response: response, + client: HttpClient, + response: __response, content: ref __content); ProcessGetVersionResponseContent( - httpClient: _httpClient, - httpResponseMessage: response, + httpClient: HttpClient, + httpResponseMessage: __response, content: ref __content); try { - response.EnsureSuccessStatusCode(); + __response.EnsureSuccessStatusCode(); } - catch (global::System.Net.Http.HttpRequestException ex) + catch (global::System.Net.Http.HttpRequestException __ex) { - throw new global::System.InvalidOperationException(__content, ex); + throw new global::System.InvalidOperationException(__content, __ex); } return diff --git a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs index 30ce40f..36885a7 100644 --- a/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs +++ b/src/libs/Ollama/Generated/Ollama.OllamaApiClient.g.cs @@ -13,10 +13,18 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// /// Ollama server URL /// - public const string BaseUrl = "http://localhost:11434/api"; + public const string DefaultBaseUrl = "http://localhost:11434/api"; - private readonly global::System.Net.Http.HttpClient _httpClient; - private global::System.Collections.Generic.List _authorizations; + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } /// /// @@ -27,7 +35,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// /// Given a prompt, the model will generate a completion. /// - public CompletionsClient Completions => new CompletionsClient(_httpClient, authorizations: _authorizations) + public CompletionsClient Completions => new CompletionsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -35,7 +43,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// /// Given a list of messages comprising a conversation, the model will return a response. /// - public ChatClient Chat => new ChatClient(_httpClient, authorizations: _authorizations) + public ChatClient Chat => new ChatClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -43,7 +51,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// /// Get a vector representation of a given input. /// - public EmbeddingsClient Embeddings => new EmbeddingsClient(_httpClient, authorizations: _authorizations) + public EmbeddingsClient Embeddings => new EmbeddingsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -51,7 +59,7 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// /// List and describe the various models available. /// - public ModelsClient Models => new ModelsClient(_httpClient, authorizations: _authorizations) + public ModelsClient Models => new ModelsClient(HttpClient, authorizations: Authorizations) { JsonSerializerContext = JsonSerializerContext, }; @@ -61,25 +69,31 @@ public sealed partial class OllamaApiClient : global::Ollama.IOllamaApiClient, g /// 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. /// - /// - /// - /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. public OllamaApiClient( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null, - global::System.Collections.Generic.List? authorizations = null) + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) { - _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); - _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); - _authorizations = authorizations ?? new global::System.Collections.Generic.List(); + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + _disposeHttpClient = disposeHttpClient; - Initialized(_httpClient); + Initialized(HttpClient); } /// public void Dispose() { - _httpClient.Dispose(); + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } } partial void Initialized(