From 79ae695ae882f41d0bc5b7375211bbbc8a568283 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Thu, 29 Aug 2024 15:56:44 +0400 Subject: [PATCH] fix: Fixed missing headers. --- .../Anthropic.AnthropicApi.Constructors..g.cs | 10 ++++++++++ .../Generated/Anthropic.AnthropicApi.g.cs | 4 ++++ .../Anthropic/OpenAiApi.AdditionalConstructors.cs | 15 +-------------- src/libs/Anthropic/generate.sh | 3 ++- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.Constructors..g.cs b/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.Constructors..g.cs index 1cfae17..bd96e89 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.Constructors..g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.Constructors..g.cs @@ -11,7 +11,17 @@ public AnthropicApi( global::System.Net.Http.HttpClient? httpClient = null, global::System.Uri? baseUri = null) : this(httpClient, baseUri) { + Authorizing(_httpClient, ref apiKey); + AuthorizeUsingApiKey(apiKey); + + Authorized(_httpClient); } + + partial void Authorizing( + global::System.Net.Http.HttpClient client, + ref string apiKey); + partial void Authorized( + global::System.Net.Http.HttpClient client); } } \ No newline at end of file diff --git a/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs b/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs index 2a11041..7b54727 100644 --- a/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs +++ b/src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs @@ -32,6 +32,8 @@ public AnthropicApi( { _httpClient = httpClient ?? new global::System.Net.Http.HttpClient(); _httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl); + + Initialized(_httpClient); } /// @@ -40,6 +42,8 @@ public void Dispose() _httpClient.Dispose(); } + partial void Initialized( + global::System.Net.Http.HttpClient client); partial void PrepareArguments( global::System.Net.Http.HttpClient client); partial void PrepareRequest( diff --git a/src/libs/Anthropic/OpenAiApi.AdditionalConstructors.cs b/src/libs/Anthropic/OpenAiApi.AdditionalConstructors.cs index 7f46ff0..a602375 100644 --- a/src/libs/Anthropic/OpenAiApi.AdditionalConstructors.cs +++ b/src/libs/Anthropic/OpenAiApi.AdditionalConstructors.cs @@ -5,20 +5,7 @@ namespace Anthropic; public partial class AnthropicApi { - /// - public AnthropicApi( - string apiKey, - HttpClient? httpClient = null, - Uri? baseUri = null) : this(httpClient, baseUri) - { - AuthorizeUsingApiKey(apiKey); - SetHeaders(); - } - - /// - /// - /// - public void SetHeaders() + partial void Initialized(HttpClient client) { _httpClient.DefaultRequestHeaders.Add("anthropic-version", "2023-06-01"); _httpClient.DefaultRequestHeaders.Add("anthropic-beta", "tools-2024-04-04"); //max-tokens-3-5-sonnet-2024-07-15 diff --git a/src/libs/Anthropic/generate.sh b/src/libs/Anthropic/generate.sh index 4c63ee0..86ce78e 100755 --- a/src/libs/Anthropic/generate.sh +++ b/src/libs/Anthropic/generate.sh @@ -10,4 +10,5 @@ oag generate openapi.yaml \ --namespace Anthropic \ --clientClassName AnthropicApi \ --targetFramework net8.0 \ - --output Generated \ No newline at end of file + --output Generated \ + --exclude-deprecated-operations \ No newline at end of file