-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
306 changed files
with
10,280 additions
and
9,978 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
212 changes: 212 additions & 0 deletions
212
src/libs/Anthropic/Generated/Anthropic.AnthropicClient.BetaModelsGet.g.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
|
||
#nullable enable | ||
|
||
namespace Anthropic | ||
{ | ||
public partial class AnthropicClient | ||
{ | ||
partial void PrepareBetaModelsGetArguments( | ||
global::System.Net.Http.HttpClient httpClient, | ||
ref string modelId, | ||
ref string? anthropicVersion, | ||
ref string? xApiKey); | ||
partial void PrepareBetaModelsGetRequest( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpRequestMessage httpRequestMessage, | ||
string modelId, | ||
string? anthropicVersion, | ||
string? xApiKey); | ||
partial void ProcessBetaModelsGetResponse( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage); | ||
|
||
partial void ProcessBetaModelsGetResponseContent( | ||
global::System.Net.Http.HttpClient httpClient, | ||
global::System.Net.Http.HttpResponseMessage httpResponseMessage, | ||
ref string content); | ||
|
||
/// <summary> | ||
/// Get a Model<br/> | ||
/// Get a specific model.<br/> | ||
/// The Models API response can be used to determine information about a specific model or resolve a model alias to a model ID. | ||
/// </summary> | ||
/// <param name="modelId"> | ||
/// Model identifier or alias. | ||
/// </param> | ||
/// <param name="anthropicVersion"> | ||
/// The version of the Anthropic API you want to use.<br/> | ||
/// Read more about versioning and our version history [here](https://docs.anthropic.com/en/api/versioning). | ||
/// </param> | ||
/// <param name="xApiKey"> | ||
/// Your unique API key for authentication. <br/> | ||
/// This key is required in the header of all API requests, to authenticate your account and access Anthropic's services. Get your API key through the [Console](https://console.anthropic.com/settings/keys). Each key is scoped to a Workspace. | ||
/// </param> | ||
/// <param name="cancellationToken">The token to cancel the operation with</param> | ||
/// <exception cref="global::Anthropic.ApiException"></exception> | ||
public async global::System.Threading.Tasks.Task<global::Anthropic.BetaModelResponse> BetaModelsGetAsync( | ||
string modelId, | ||
string? anthropicVersion = default, | ||
string? xApiKey = default, | ||
global::System.Threading.CancellationToken cancellationToken = default) | ||
{ | ||
PrepareArguments( | ||
client: HttpClient); | ||
PrepareBetaModelsGetArguments( | ||
httpClient: HttpClient, | ||
modelId: ref modelId, | ||
anthropicVersion: ref anthropicVersion, | ||
xApiKey: ref xApiKey); | ||
|
||
var __pathBuilder = new PathBuilder( | ||
path: $"/v1/models/{modelId}?beta=true", | ||
baseUri: HttpClient.BaseAddress); | ||
var __path = __pathBuilder.ToString(); | ||
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)); | ||
#if NET6_0_OR_GREATER | ||
__httpRequest.Version = global::System.Net.HttpVersion.Version11; | ||
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; | ||
#endif | ||
|
||
foreach (var __authorization in Authorizations) | ||
{ | ||
if (__authorization.Type == "Http" || | ||
__authorization.Type == "OAuth2") | ||
{ | ||
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( | ||
scheme: __authorization.Name, | ||
parameter: __authorization.Value); | ||
} | ||
else if (__authorization.Type == "ApiKey" && | ||
__authorization.Location == "Header") | ||
{ | ||
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value); | ||
} | ||
} | ||
|
||
if (anthropicVersion != default) | ||
{ | ||
__httpRequest.Headers.TryAddWithoutValidation("anthropic-version", anthropicVersion.ToString()); | ||
} | ||
if (xApiKey != default) | ||
{ | ||
__httpRequest.Headers.TryAddWithoutValidation("x-api-key", xApiKey.ToString()); | ||
} | ||
|
||
|
||
PrepareRequest( | ||
client: HttpClient, | ||
request: __httpRequest); | ||
PrepareBetaModelsGetRequest( | ||
httpClient: HttpClient, | ||
httpRequestMessage: __httpRequest, | ||
modelId: modelId, | ||
anthropicVersion: anthropicVersion, | ||
xApiKey: xApiKey); | ||
|
||
using var __response = await HttpClient.SendAsync( | ||
request: __httpRequest, | ||
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, | ||
cancellationToken: cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponse( | ||
client: HttpClient, | ||
response: __response); | ||
ProcessBetaModelsGetResponse( | ||
httpClient: HttpClient, | ||
httpResponseMessage: __response); | ||
// Error response. See our [errors documentation](https://docs.anthropic.com/en/api/errors) for more details. | ||
if ((int)__response.StatusCode >= 400 && (int)__response.StatusCode <= 499) | ||
{ | ||
string? __content_4XX = null; | ||
global::Anthropic.BetaErrorResponse? __value_4XX = null; | ||
if (ReadResponseAsString) | ||
{ | ||
__content_4XX = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
__value_4XX = global::Anthropic.BetaErrorResponse.FromJson(__content_4XX, JsonSerializerContext); | ||
} | ||
else | ||
{ | ||
var __contentStream_4XX = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); | ||
__value_4XX = await global::Anthropic.BetaErrorResponse.FromJsonStreamAsync(__contentStream_4XX, JsonSerializerContext).ConfigureAwait(false); | ||
} | ||
|
||
throw new global::Anthropic.ApiException<global::Anthropic.BetaErrorResponse>( | ||
message: __response.ReasonPhrase ?? string.Empty, | ||
statusCode: __response.StatusCode) | ||
{ | ||
ResponseBody = __content_4XX, | ||
ResponseObject = __value_4XX, | ||
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( | ||
__response.Headers, | ||
h => h.Key, | ||
h => h.Value), | ||
}; | ||
} | ||
|
||
if (ReadResponseAsString) | ||
{ | ||
var __content = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
ProcessResponseContent( | ||
client: HttpClient, | ||
response: __response, | ||
content: ref __content); | ||
ProcessBetaModelsGetResponseContent( | ||
httpClient: HttpClient, | ||
httpResponseMessage: __response, | ||
content: ref __content); | ||
|
||
try | ||
{ | ||
__response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException __ex) | ||
{ | ||
throw new global::Anthropic.ApiException( | ||
message: __content ?? __response.ReasonPhrase ?? string.Empty, | ||
innerException: __ex, | ||
statusCode: __response.StatusCode) | ||
{ | ||
ResponseBody = __content, | ||
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( | ||
__response.Headers, | ||
h => h.Key, | ||
h => h.Value), | ||
}; | ||
} | ||
|
||
return | ||
global::Anthropic.BetaModelResponse.FromJson(__content, JsonSerializerContext) ?? | ||
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
__response.EnsureSuccessStatusCode(); | ||
} | ||
catch (global::System.Net.Http.HttpRequestException __ex) | ||
{ | ||
throw new global::Anthropic.ApiException( | ||
message: __response.ReasonPhrase ?? string.Empty, | ||
innerException: __ex, | ||
statusCode: __response.StatusCode) | ||
{ | ||
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary( | ||
__response.Headers, | ||
h => h.Key, | ||
h => h.Value), | ||
}; | ||
} | ||
|
||
using var __content = await __response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false); | ||
|
||
return | ||
await global::Anthropic.BetaModelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? | ||
throw new global::System.InvalidOperationException("Response deserialization failed."); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.