Skip to content

Commit

Permalink
fix: Fixed missing headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Aug 29, 2024
1 parent 4dda0bb commit 79ae695
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
4 changes: 4 additions & 0 deletions src/libs/Anthropic/Generated/Anthropic.AnthropicApi.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public AnthropicApi(
{
_httpClient = httpClient ?? new global::System.Net.Http.HttpClient();
_httpClient.BaseAddress ??= baseUri ?? new global::System.Uri(BaseUrl);

Initialized(_httpClient);
}

/// <inheritdoc/>
Expand All @@ -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(
Expand Down
15 changes: 1 addition & 14 deletions src/libs/Anthropic/OpenAiApi.AdditionalConstructors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ namespace Anthropic;

public partial class AnthropicApi
{
/// <inheritdoc cref="AnthropicApi(HttpClient?, Uri?)"/>
public AnthropicApi(
string apiKey,
HttpClient? httpClient = null,
Uri? baseUri = null) : this(httpClient, baseUri)
{
AuthorizeUsingApiKey(apiKey);
SetHeaders();
}

/// <summary>
///
/// </summary>
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
Expand Down
3 changes: 2 additions & 1 deletion src/libs/Anthropic/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ oag generate openapi.yaml \
--namespace Anthropic \
--clientClassName AnthropicApi \
--targetFramework net8.0 \
--output Generated
--output Generated \
--exclude-deprecated-operations

0 comments on commit 79ae695

Please sign in to comment.